1package media 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "encoding/json" 12 "github.com/Azure/go-autorest/autorest" 13 "github.com/Azure/go-autorest/autorest/azure" 14 "github.com/Azure/go-autorest/autorest/date" 15 "github.com/Azure/go-autorest/autorest/to" 16 "github.com/Azure/go-autorest/tracing" 17 "github.com/gofrs/uuid" 18 "net/http" 19) 20 21// The package's fully qualified name. 22const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/mediaservices/mgmt/2019-05-01-preview/media" 23 24// AacAudio describes Advanced Audio Codec (AAC) audio encoding settings. 25type AacAudio struct { 26 // Profile - The encoding profile to be used when encoding audio with AAC. Possible values include: 'AacLc', 'HeAacV1', 'HeAacV2' 27 Profile AacAudioProfile `json:"profile,omitempty"` 28 // Channels - The number of channels in the audio. 29 Channels *int32 `json:"channels,omitempty"` 30 // SamplingRate - The sampling rate to use for encoding in hertz. 31 SamplingRate *int32 `json:"samplingRate,omitempty"` 32 // Bitrate - The bitrate, in bits per second, of the output encoded audio. 33 Bitrate *int32 `json:"bitrate,omitempty"` 34 // Label - An optional label for the codec. The label can be used to control muxing behavior. 35 Label *string `json:"label,omitempty"` 36 // OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage' 37 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"` 38} 39 40// MarshalJSON is the custom marshaler for AacAudio. 41func (aa AacAudio) MarshalJSON() ([]byte, error) { 42 aa.OdataType = OdataTypeMicrosoftMediaAacAudio 43 objectMap := make(map[string]interface{}) 44 if aa.Profile != "" { 45 objectMap["profile"] = aa.Profile 46 } 47 if aa.Channels != nil { 48 objectMap["channels"] = aa.Channels 49 } 50 if aa.SamplingRate != nil { 51 objectMap["samplingRate"] = aa.SamplingRate 52 } 53 if aa.Bitrate != nil { 54 objectMap["bitrate"] = aa.Bitrate 55 } 56 if aa.Label != nil { 57 objectMap["label"] = aa.Label 58 } 59 if aa.OdataType != "" { 60 objectMap["@odata.type"] = aa.OdataType 61 } 62 return json.Marshal(objectMap) 63} 64 65// AsAudio is the BasicCodec implementation for AacAudio. 66func (aa AacAudio) AsAudio() (*Audio, bool) { 67 return nil, false 68} 69 70// AsBasicAudio is the BasicCodec implementation for AacAudio. 71func (aa AacAudio) AsBasicAudio() (BasicAudio, bool) { 72 return &aa, true 73} 74 75// AsAacAudio is the BasicCodec implementation for AacAudio. 76func (aa AacAudio) AsAacAudio() (*AacAudio, bool) { 77 return &aa, true 78} 79 80// AsCopyVideo is the BasicCodec implementation for AacAudio. 81func (aa AacAudio) AsCopyVideo() (*CopyVideo, bool) { 82 return nil, false 83} 84 85// AsVideo is the BasicCodec implementation for AacAudio. 86func (aa AacAudio) AsVideo() (*Video, bool) { 87 return nil, false 88} 89 90// AsBasicVideo is the BasicCodec implementation for AacAudio. 91func (aa AacAudio) AsBasicVideo() (BasicVideo, bool) { 92 return nil, false 93} 94 95// AsImage is the BasicCodec implementation for AacAudio. 96func (aa AacAudio) AsImage() (*Image, bool) { 97 return nil, false 98} 99 100// AsBasicImage is the BasicCodec implementation for AacAudio. 101func (aa AacAudio) AsBasicImage() (BasicImage, bool) { 102 return nil, false 103} 104 105// AsCopyAudio is the BasicCodec implementation for AacAudio. 106func (aa AacAudio) AsCopyAudio() (*CopyAudio, bool) { 107 return nil, false 108} 109 110// AsH264Video is the BasicCodec implementation for AacAudio. 111func (aa AacAudio) AsH264Video() (*H264Video, bool) { 112 return nil, false 113} 114 115// AsJpgImage is the BasicCodec implementation for AacAudio. 116func (aa AacAudio) AsJpgImage() (*JpgImage, bool) { 117 return nil, false 118} 119 120// AsPngImage is the BasicCodec implementation for AacAudio. 121func (aa AacAudio) AsPngImage() (*PngImage, bool) { 122 return nil, false 123} 124 125// AsCodec is the BasicCodec implementation for AacAudio. 126func (aa AacAudio) AsCodec() (*Codec, bool) { 127 return nil, false 128} 129 130// AsBasicCodec is the BasicCodec implementation for AacAudio. 131func (aa AacAudio) AsBasicCodec() (BasicCodec, bool) { 132 return &aa, true 133} 134 135// AbsoluteClipTime specifies the clip time as an absolute time position in the media file. The absolute 136// time can point to a different position depending on whether the media file starts from a timestamp of 137// zero or not. 138type AbsoluteClipTime struct { 139 // Time - The time position on the timeline of the input media. It is usually specified as an ISO8601 period. e.g PT30S for 30 seconds. 140 Time *string `json:"time,omitempty"` 141 // OdataType - Possible values include: 'OdataTypeClipTime', 'OdataTypeMicrosoftMediaAbsoluteClipTime' 142 OdataType OdataTypeBasicClipTime `json:"@odata.type,omitempty"` 143} 144 145// MarshalJSON is the custom marshaler for AbsoluteClipTime. 146func (act AbsoluteClipTime) MarshalJSON() ([]byte, error) { 147 act.OdataType = OdataTypeMicrosoftMediaAbsoluteClipTime 148 objectMap := make(map[string]interface{}) 149 if act.Time != nil { 150 objectMap["time"] = act.Time 151 } 152 if act.OdataType != "" { 153 objectMap["@odata.type"] = act.OdataType 154 } 155 return json.Marshal(objectMap) 156} 157 158// AsAbsoluteClipTime is the BasicClipTime implementation for AbsoluteClipTime. 159func (act AbsoluteClipTime) AsAbsoluteClipTime() (*AbsoluteClipTime, bool) { 160 return &act, true 161} 162 163// AsClipTime is the BasicClipTime implementation for AbsoluteClipTime. 164func (act AbsoluteClipTime) AsClipTime() (*ClipTime, bool) { 165 return nil, false 166} 167 168// AsBasicClipTime is the BasicClipTime implementation for AbsoluteClipTime. 169func (act AbsoluteClipTime) AsBasicClipTime() (BasicClipTime, bool) { 170 return &act, true 171} 172 173// AccountFilter an Account Filter. 174type AccountFilter struct { 175 autorest.Response `json:"-"` 176 *FilterProperties `json:"properties,omitempty"` 177 // ID - READ-ONLY; Fully qualified resource ID for the resource. 178 ID *string `json:"id,omitempty"` 179 // Name - READ-ONLY; The name of the resource. 180 Name *string `json:"name,omitempty"` 181 // Type - READ-ONLY; The type of the resource. 182 Type *string `json:"type,omitempty"` 183} 184 185// MarshalJSON is the custom marshaler for AccountFilter. 186func (af AccountFilter) MarshalJSON() ([]byte, error) { 187 objectMap := make(map[string]interface{}) 188 if af.FilterProperties != nil { 189 objectMap["properties"] = af.FilterProperties 190 } 191 return json.Marshal(objectMap) 192} 193 194// UnmarshalJSON is the custom unmarshaler for AccountFilter struct. 195func (af *AccountFilter) UnmarshalJSON(body []byte) error { 196 var m map[string]*json.RawMessage 197 err := json.Unmarshal(body, &m) 198 if err != nil { 199 return err 200 } 201 for k, v := range m { 202 switch k { 203 case "properties": 204 if v != nil { 205 var filterProperties FilterProperties 206 err = json.Unmarshal(*v, &filterProperties) 207 if err != nil { 208 return err 209 } 210 af.FilterProperties = &filterProperties 211 } 212 case "id": 213 if v != nil { 214 var ID string 215 err = json.Unmarshal(*v, &ID) 216 if err != nil { 217 return err 218 } 219 af.ID = &ID 220 } 221 case "name": 222 if v != nil { 223 var name string 224 err = json.Unmarshal(*v, &name) 225 if err != nil { 226 return err 227 } 228 af.Name = &name 229 } 230 case "type": 231 if v != nil { 232 var typeVar string 233 err = json.Unmarshal(*v, &typeVar) 234 if err != nil { 235 return err 236 } 237 af.Type = &typeVar 238 } 239 } 240 } 241 242 return nil 243} 244 245// AccountFilterCollection a collection of AccountFilter items. 246type AccountFilterCollection struct { 247 autorest.Response `json:"-"` 248 // Value - A collection of AccountFilter items. 249 Value *[]AccountFilter `json:"value,omitempty"` 250 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 251 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 252} 253 254// AccountFilterCollectionIterator provides access to a complete listing of AccountFilter values. 255type AccountFilterCollectionIterator struct { 256 i int 257 page AccountFilterCollectionPage 258} 259 260// NextWithContext advances to the next value. If there was an error making 261// the request the iterator does not advance and the error is returned. 262func (iter *AccountFilterCollectionIterator) NextWithContext(ctx context.Context) (err error) { 263 if tracing.IsEnabled() { 264 ctx = tracing.StartSpan(ctx, fqdn+"/AccountFilterCollectionIterator.NextWithContext") 265 defer func() { 266 sc := -1 267 if iter.Response().Response.Response != nil { 268 sc = iter.Response().Response.Response.StatusCode 269 } 270 tracing.EndSpan(ctx, sc, err) 271 }() 272 } 273 iter.i++ 274 if iter.i < len(iter.page.Values()) { 275 return nil 276 } 277 err = iter.page.NextWithContext(ctx) 278 if err != nil { 279 iter.i-- 280 return err 281 } 282 iter.i = 0 283 return nil 284} 285 286// Next advances to the next value. If there was an error making 287// the request the iterator does not advance and the error is returned. 288// Deprecated: Use NextWithContext() instead. 289func (iter *AccountFilterCollectionIterator) Next() error { 290 return iter.NextWithContext(context.Background()) 291} 292 293// NotDone returns true if the enumeration should be started or is not yet complete. 294func (iter AccountFilterCollectionIterator) NotDone() bool { 295 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 296} 297 298// Response returns the raw server response from the last page request. 299func (iter AccountFilterCollectionIterator) Response() AccountFilterCollection { 300 return iter.page.Response() 301} 302 303// Value returns the current value or a zero-initialized value if the 304// iterator has advanced beyond the end of the collection. 305func (iter AccountFilterCollectionIterator) Value() AccountFilter { 306 if !iter.page.NotDone() { 307 return AccountFilter{} 308 } 309 return iter.page.Values()[iter.i] 310} 311 312// Creates a new instance of the AccountFilterCollectionIterator type. 313func NewAccountFilterCollectionIterator(page AccountFilterCollectionPage) AccountFilterCollectionIterator { 314 return AccountFilterCollectionIterator{page: page} 315} 316 317// IsEmpty returns true if the ListResult contains no values. 318func (afc AccountFilterCollection) IsEmpty() bool { 319 return afc.Value == nil || len(*afc.Value) == 0 320} 321 322// hasNextLink returns true if the NextLink is not empty. 323func (afc AccountFilterCollection) hasNextLink() bool { 324 return afc.OdataNextLink != nil && len(*afc.OdataNextLink) != 0 325} 326 327// accountFilterCollectionPreparer prepares a request to retrieve the next set of results. 328// It returns nil if no more results exist. 329func (afc AccountFilterCollection) accountFilterCollectionPreparer(ctx context.Context) (*http.Request, error) { 330 if !afc.hasNextLink() { 331 return nil, nil 332 } 333 return autorest.Prepare((&http.Request{}).WithContext(ctx), 334 autorest.AsJSON(), 335 autorest.AsGet(), 336 autorest.WithBaseURL(to.String(afc.OdataNextLink))) 337} 338 339// AccountFilterCollectionPage contains a page of AccountFilter values. 340type AccountFilterCollectionPage struct { 341 fn func(context.Context, AccountFilterCollection) (AccountFilterCollection, error) 342 afc AccountFilterCollection 343} 344 345// NextWithContext advances to the next page of values. If there was an error making 346// the request the page does not advance and the error is returned. 347func (page *AccountFilterCollectionPage) NextWithContext(ctx context.Context) (err error) { 348 if tracing.IsEnabled() { 349 ctx = tracing.StartSpan(ctx, fqdn+"/AccountFilterCollectionPage.NextWithContext") 350 defer func() { 351 sc := -1 352 if page.Response().Response.Response != nil { 353 sc = page.Response().Response.Response.StatusCode 354 } 355 tracing.EndSpan(ctx, sc, err) 356 }() 357 } 358 for { 359 next, err := page.fn(ctx, page.afc) 360 if err != nil { 361 return err 362 } 363 page.afc = next 364 if !next.hasNextLink() || !next.IsEmpty() { 365 break 366 } 367 } 368 return nil 369} 370 371// Next advances to the next page of values. If there was an error making 372// the request the page does not advance and the error is returned. 373// Deprecated: Use NextWithContext() instead. 374func (page *AccountFilterCollectionPage) Next() error { 375 return page.NextWithContext(context.Background()) 376} 377 378// NotDone returns true if the page enumeration should be started or is not yet complete. 379func (page AccountFilterCollectionPage) NotDone() bool { 380 return !page.afc.IsEmpty() 381} 382 383// Response returns the raw server response from the last page request. 384func (page AccountFilterCollectionPage) Response() AccountFilterCollection { 385 return page.afc 386} 387 388// Values returns the slice of values for the current page or nil if there are no values. 389func (page AccountFilterCollectionPage) Values() []AccountFilter { 390 if page.afc.IsEmpty() { 391 return nil 392 } 393 return *page.afc.Value 394} 395 396// Creates a new instance of the AccountFilterCollectionPage type. 397func NewAccountFilterCollectionPage(cur AccountFilterCollection, getNextPage func(context.Context, AccountFilterCollection) (AccountFilterCollection, error)) AccountFilterCollectionPage { 398 return AccountFilterCollectionPage{ 399 fn: getNextPage, 400 afc: cur, 401 } 402} 403 404// AkamaiAccessControl akamai access control 405type AkamaiAccessControl struct { 406 // AkamaiSignatureHeaderAuthenticationKeyList - authentication key list 407 AkamaiSignatureHeaderAuthenticationKeyList *[]AkamaiSignatureHeaderAuthenticationKey `json:"akamaiSignatureHeaderAuthenticationKeyList,omitempty"` 408} 409 410// AkamaiSignatureHeaderAuthenticationKey akamai Signature Header authentication key. 411type AkamaiSignatureHeaderAuthenticationKey struct { 412 // Identifier - identifier of the key 413 Identifier *string `json:"identifier,omitempty"` 414 // Base64Key - authentication key 415 Base64Key *string `json:"base64Key,omitempty"` 416 // Expiration - The expiration time of the authentication key. 417 Expiration *date.Time `json:"expiration,omitempty"` 418} 419 420// APIError the API error. 421type APIError struct { 422 // Error - The error properties. 423 Error *ODataError `json:"error,omitempty"` 424} 425 426// Asset an Asset. 427type Asset struct { 428 autorest.Response `json:"-"` 429 // AssetProperties - The resource properties. 430 *AssetProperties `json:"properties,omitempty"` 431 // ID - READ-ONLY; Fully qualified resource ID for the resource. 432 ID *string `json:"id,omitempty"` 433 // Name - READ-ONLY; The name of the resource. 434 Name *string `json:"name,omitempty"` 435 // Type - READ-ONLY; The type of the resource. 436 Type *string `json:"type,omitempty"` 437} 438 439// MarshalJSON is the custom marshaler for Asset. 440func (a Asset) MarshalJSON() ([]byte, error) { 441 objectMap := make(map[string]interface{}) 442 if a.AssetProperties != nil { 443 objectMap["properties"] = a.AssetProperties 444 } 445 return json.Marshal(objectMap) 446} 447 448// UnmarshalJSON is the custom unmarshaler for Asset struct. 449func (a *Asset) UnmarshalJSON(body []byte) error { 450 var m map[string]*json.RawMessage 451 err := json.Unmarshal(body, &m) 452 if err != nil { 453 return err 454 } 455 for k, v := range m { 456 switch k { 457 case "properties": 458 if v != nil { 459 var assetProperties AssetProperties 460 err = json.Unmarshal(*v, &assetProperties) 461 if err != nil { 462 return err 463 } 464 a.AssetProperties = &assetProperties 465 } 466 case "id": 467 if v != nil { 468 var ID string 469 err = json.Unmarshal(*v, &ID) 470 if err != nil { 471 return err 472 } 473 a.ID = &ID 474 } 475 case "name": 476 if v != nil { 477 var name string 478 err = json.Unmarshal(*v, &name) 479 if err != nil { 480 return err 481 } 482 a.Name = &name 483 } 484 case "type": 485 if v != nil { 486 var typeVar string 487 err = json.Unmarshal(*v, &typeVar) 488 if err != nil { 489 return err 490 } 491 a.Type = &typeVar 492 } 493 } 494 } 495 496 return nil 497} 498 499// AssetCollection a collection of Asset items. 500type AssetCollection struct { 501 autorest.Response `json:"-"` 502 // Value - A collection of Asset items. 503 Value *[]Asset `json:"value,omitempty"` 504 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 505 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 506} 507 508// AssetCollectionIterator provides access to a complete listing of Asset values. 509type AssetCollectionIterator struct { 510 i int 511 page AssetCollectionPage 512} 513 514// NextWithContext advances to the next value. If there was an error making 515// the request the iterator does not advance and the error is returned. 516func (iter *AssetCollectionIterator) NextWithContext(ctx context.Context) (err error) { 517 if tracing.IsEnabled() { 518 ctx = tracing.StartSpan(ctx, fqdn+"/AssetCollectionIterator.NextWithContext") 519 defer func() { 520 sc := -1 521 if iter.Response().Response.Response != nil { 522 sc = iter.Response().Response.Response.StatusCode 523 } 524 tracing.EndSpan(ctx, sc, err) 525 }() 526 } 527 iter.i++ 528 if iter.i < len(iter.page.Values()) { 529 return nil 530 } 531 err = iter.page.NextWithContext(ctx) 532 if err != nil { 533 iter.i-- 534 return err 535 } 536 iter.i = 0 537 return nil 538} 539 540// Next advances to the next value. If there was an error making 541// the request the iterator does not advance and the error is returned. 542// Deprecated: Use NextWithContext() instead. 543func (iter *AssetCollectionIterator) Next() error { 544 return iter.NextWithContext(context.Background()) 545} 546 547// NotDone returns true if the enumeration should be started or is not yet complete. 548func (iter AssetCollectionIterator) NotDone() bool { 549 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 550} 551 552// Response returns the raw server response from the last page request. 553func (iter AssetCollectionIterator) Response() AssetCollection { 554 return iter.page.Response() 555} 556 557// Value returns the current value or a zero-initialized value if the 558// iterator has advanced beyond the end of the collection. 559func (iter AssetCollectionIterator) Value() Asset { 560 if !iter.page.NotDone() { 561 return Asset{} 562 } 563 return iter.page.Values()[iter.i] 564} 565 566// Creates a new instance of the AssetCollectionIterator type. 567func NewAssetCollectionIterator(page AssetCollectionPage) AssetCollectionIterator { 568 return AssetCollectionIterator{page: page} 569} 570 571// IsEmpty returns true if the ListResult contains no values. 572func (ac AssetCollection) IsEmpty() bool { 573 return ac.Value == nil || len(*ac.Value) == 0 574} 575 576// hasNextLink returns true if the NextLink is not empty. 577func (ac AssetCollection) hasNextLink() bool { 578 return ac.OdataNextLink != nil && len(*ac.OdataNextLink) != 0 579} 580 581// assetCollectionPreparer prepares a request to retrieve the next set of results. 582// It returns nil if no more results exist. 583func (ac AssetCollection) assetCollectionPreparer(ctx context.Context) (*http.Request, error) { 584 if !ac.hasNextLink() { 585 return nil, nil 586 } 587 return autorest.Prepare((&http.Request{}).WithContext(ctx), 588 autorest.AsJSON(), 589 autorest.AsGet(), 590 autorest.WithBaseURL(to.String(ac.OdataNextLink))) 591} 592 593// AssetCollectionPage contains a page of Asset values. 594type AssetCollectionPage struct { 595 fn func(context.Context, AssetCollection) (AssetCollection, error) 596 ac AssetCollection 597} 598 599// NextWithContext advances to the next page of values. If there was an error making 600// the request the page does not advance and the error is returned. 601func (page *AssetCollectionPage) NextWithContext(ctx context.Context) (err error) { 602 if tracing.IsEnabled() { 603 ctx = tracing.StartSpan(ctx, fqdn+"/AssetCollectionPage.NextWithContext") 604 defer func() { 605 sc := -1 606 if page.Response().Response.Response != nil { 607 sc = page.Response().Response.Response.StatusCode 608 } 609 tracing.EndSpan(ctx, sc, err) 610 }() 611 } 612 for { 613 next, err := page.fn(ctx, page.ac) 614 if err != nil { 615 return err 616 } 617 page.ac = next 618 if !next.hasNextLink() || !next.IsEmpty() { 619 break 620 } 621 } 622 return nil 623} 624 625// Next advances to the next page of values. If there was an error making 626// the request the page does not advance and the error is returned. 627// Deprecated: Use NextWithContext() instead. 628func (page *AssetCollectionPage) Next() error { 629 return page.NextWithContext(context.Background()) 630} 631 632// NotDone returns true if the page enumeration should be started or is not yet complete. 633func (page AssetCollectionPage) NotDone() bool { 634 return !page.ac.IsEmpty() 635} 636 637// Response returns the raw server response from the last page request. 638func (page AssetCollectionPage) Response() AssetCollection { 639 return page.ac 640} 641 642// Values returns the slice of values for the current page or nil if there are no values. 643func (page AssetCollectionPage) Values() []Asset { 644 if page.ac.IsEmpty() { 645 return nil 646 } 647 return *page.ac.Value 648} 649 650// Creates a new instance of the AssetCollectionPage type. 651func NewAssetCollectionPage(cur AssetCollection, getNextPage func(context.Context, AssetCollection) (AssetCollection, error)) AssetCollectionPage { 652 return AssetCollectionPage{ 653 fn: getNextPage, 654 ac: cur, 655 } 656} 657 658// AssetContainerSas the Asset Storage container SAS URLs. 659type AssetContainerSas struct { 660 autorest.Response `json:"-"` 661 // AssetContainerSasUrls - The list of Asset container SAS URLs. 662 AssetContainerSasUrls *[]string `json:"assetContainerSasUrls,omitempty"` 663} 664 665// AssetFileEncryptionMetadata the Asset File Storage encryption metadata. 666type AssetFileEncryptionMetadata struct { 667 // InitializationVector - The Asset File initialization vector. 668 InitializationVector *string `json:"initializationVector,omitempty"` 669 // AssetFileName - The Asset File name. 670 AssetFileName *string `json:"assetFileName,omitempty"` 671 // AssetFileID - The Asset File Id. 672 AssetFileID *uuid.UUID `json:"assetFileId,omitempty"` 673} 674 675// AssetFilter an Asset Filter. 676type AssetFilter struct { 677 autorest.Response `json:"-"` 678 *FilterProperties `json:"properties,omitempty"` 679 // ID - READ-ONLY; Fully qualified resource ID for the resource. 680 ID *string `json:"id,omitempty"` 681 // Name - READ-ONLY; The name of the resource. 682 Name *string `json:"name,omitempty"` 683 // Type - READ-ONLY; The type of the resource. 684 Type *string `json:"type,omitempty"` 685} 686 687// MarshalJSON is the custom marshaler for AssetFilter. 688func (af AssetFilter) MarshalJSON() ([]byte, error) { 689 objectMap := make(map[string]interface{}) 690 if af.FilterProperties != nil { 691 objectMap["properties"] = af.FilterProperties 692 } 693 return json.Marshal(objectMap) 694} 695 696// UnmarshalJSON is the custom unmarshaler for AssetFilter struct. 697func (af *AssetFilter) UnmarshalJSON(body []byte) error { 698 var m map[string]*json.RawMessage 699 err := json.Unmarshal(body, &m) 700 if err != nil { 701 return err 702 } 703 for k, v := range m { 704 switch k { 705 case "properties": 706 if v != nil { 707 var filterProperties FilterProperties 708 err = json.Unmarshal(*v, &filterProperties) 709 if err != nil { 710 return err 711 } 712 af.FilterProperties = &filterProperties 713 } 714 case "id": 715 if v != nil { 716 var ID string 717 err = json.Unmarshal(*v, &ID) 718 if err != nil { 719 return err 720 } 721 af.ID = &ID 722 } 723 case "name": 724 if v != nil { 725 var name string 726 err = json.Unmarshal(*v, &name) 727 if err != nil { 728 return err 729 } 730 af.Name = &name 731 } 732 case "type": 733 if v != nil { 734 var typeVar string 735 err = json.Unmarshal(*v, &typeVar) 736 if err != nil { 737 return err 738 } 739 af.Type = &typeVar 740 } 741 } 742 } 743 744 return nil 745} 746 747// AssetFilterCollection a collection of AssetFilter items. 748type AssetFilterCollection struct { 749 autorest.Response `json:"-"` 750 // Value - A collection of AssetFilter items. 751 Value *[]AssetFilter `json:"value,omitempty"` 752 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 753 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 754} 755 756// AssetFilterCollectionIterator provides access to a complete listing of AssetFilter values. 757type AssetFilterCollectionIterator struct { 758 i int 759 page AssetFilterCollectionPage 760} 761 762// NextWithContext advances to the next value. If there was an error making 763// the request the iterator does not advance and the error is returned. 764func (iter *AssetFilterCollectionIterator) NextWithContext(ctx context.Context) (err error) { 765 if tracing.IsEnabled() { 766 ctx = tracing.StartSpan(ctx, fqdn+"/AssetFilterCollectionIterator.NextWithContext") 767 defer func() { 768 sc := -1 769 if iter.Response().Response.Response != nil { 770 sc = iter.Response().Response.Response.StatusCode 771 } 772 tracing.EndSpan(ctx, sc, err) 773 }() 774 } 775 iter.i++ 776 if iter.i < len(iter.page.Values()) { 777 return nil 778 } 779 err = iter.page.NextWithContext(ctx) 780 if err != nil { 781 iter.i-- 782 return err 783 } 784 iter.i = 0 785 return nil 786} 787 788// Next advances to the next value. If there was an error making 789// the request the iterator does not advance and the error is returned. 790// Deprecated: Use NextWithContext() instead. 791func (iter *AssetFilterCollectionIterator) Next() error { 792 return iter.NextWithContext(context.Background()) 793} 794 795// NotDone returns true if the enumeration should be started or is not yet complete. 796func (iter AssetFilterCollectionIterator) NotDone() bool { 797 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 798} 799 800// Response returns the raw server response from the last page request. 801func (iter AssetFilterCollectionIterator) Response() AssetFilterCollection { 802 return iter.page.Response() 803} 804 805// Value returns the current value or a zero-initialized value if the 806// iterator has advanced beyond the end of the collection. 807func (iter AssetFilterCollectionIterator) Value() AssetFilter { 808 if !iter.page.NotDone() { 809 return AssetFilter{} 810 } 811 return iter.page.Values()[iter.i] 812} 813 814// Creates a new instance of the AssetFilterCollectionIterator type. 815func NewAssetFilterCollectionIterator(page AssetFilterCollectionPage) AssetFilterCollectionIterator { 816 return AssetFilterCollectionIterator{page: page} 817} 818 819// IsEmpty returns true if the ListResult contains no values. 820func (afc AssetFilterCollection) IsEmpty() bool { 821 return afc.Value == nil || len(*afc.Value) == 0 822} 823 824// hasNextLink returns true if the NextLink is not empty. 825func (afc AssetFilterCollection) hasNextLink() bool { 826 return afc.OdataNextLink != nil && len(*afc.OdataNextLink) != 0 827} 828 829// assetFilterCollectionPreparer prepares a request to retrieve the next set of results. 830// It returns nil if no more results exist. 831func (afc AssetFilterCollection) assetFilterCollectionPreparer(ctx context.Context) (*http.Request, error) { 832 if !afc.hasNextLink() { 833 return nil, nil 834 } 835 return autorest.Prepare((&http.Request{}).WithContext(ctx), 836 autorest.AsJSON(), 837 autorest.AsGet(), 838 autorest.WithBaseURL(to.String(afc.OdataNextLink))) 839} 840 841// AssetFilterCollectionPage contains a page of AssetFilter values. 842type AssetFilterCollectionPage struct { 843 fn func(context.Context, AssetFilterCollection) (AssetFilterCollection, error) 844 afc AssetFilterCollection 845} 846 847// NextWithContext advances to the next page of values. If there was an error making 848// the request the page does not advance and the error is returned. 849func (page *AssetFilterCollectionPage) NextWithContext(ctx context.Context) (err error) { 850 if tracing.IsEnabled() { 851 ctx = tracing.StartSpan(ctx, fqdn+"/AssetFilterCollectionPage.NextWithContext") 852 defer func() { 853 sc := -1 854 if page.Response().Response.Response != nil { 855 sc = page.Response().Response.Response.StatusCode 856 } 857 tracing.EndSpan(ctx, sc, err) 858 }() 859 } 860 for { 861 next, err := page.fn(ctx, page.afc) 862 if err != nil { 863 return err 864 } 865 page.afc = next 866 if !next.hasNextLink() || !next.IsEmpty() { 867 break 868 } 869 } 870 return nil 871} 872 873// Next advances to the next page of values. If there was an error making 874// the request the page does not advance and the error is returned. 875// Deprecated: Use NextWithContext() instead. 876func (page *AssetFilterCollectionPage) Next() error { 877 return page.NextWithContext(context.Background()) 878} 879 880// NotDone returns true if the page enumeration should be started or is not yet complete. 881func (page AssetFilterCollectionPage) NotDone() bool { 882 return !page.afc.IsEmpty() 883} 884 885// Response returns the raw server response from the last page request. 886func (page AssetFilterCollectionPage) Response() AssetFilterCollection { 887 return page.afc 888} 889 890// Values returns the slice of values for the current page or nil if there are no values. 891func (page AssetFilterCollectionPage) Values() []AssetFilter { 892 if page.afc.IsEmpty() { 893 return nil 894 } 895 return *page.afc.Value 896} 897 898// Creates a new instance of the AssetFilterCollectionPage type. 899func NewAssetFilterCollectionPage(cur AssetFilterCollection, getNextPage func(context.Context, AssetFilterCollection) (AssetFilterCollection, error)) AssetFilterCollectionPage { 900 return AssetFilterCollectionPage{ 901 fn: getNextPage, 902 afc: cur, 903 } 904} 905 906// AssetProperties the Asset properties. 907type AssetProperties struct { 908 // AssetID - READ-ONLY; The Asset ID. 909 AssetID *uuid.UUID `json:"assetId,omitempty"` 910 // Created - READ-ONLY; The creation date of the Asset. 911 Created *date.Time `json:"created,omitempty"` 912 // LastModified - READ-ONLY; The last modified date of the Asset. 913 LastModified *date.Time `json:"lastModified,omitempty"` 914 // AlternateID - The alternate ID of the Asset. 915 AlternateID *string `json:"alternateId,omitempty"` 916 // Description - The Asset description. 917 Description *string `json:"description,omitempty"` 918 // Container - The name of the asset blob container. 919 Container *string `json:"container,omitempty"` 920 // StorageAccountName - The name of the storage account. 921 StorageAccountName *string `json:"storageAccountName,omitempty"` 922 // StorageEncryptionFormat - READ-ONLY; The Asset encryption format. One of None or MediaStorageEncryption. Possible values include: 'None', 'MediaStorageClientEncryption' 923 StorageEncryptionFormat AssetStorageEncryptionFormat `json:"storageEncryptionFormat,omitempty"` 924} 925 926// MarshalJSON is the custom marshaler for AssetProperties. 927func (ap AssetProperties) MarshalJSON() ([]byte, error) { 928 objectMap := make(map[string]interface{}) 929 if ap.AlternateID != nil { 930 objectMap["alternateId"] = ap.AlternateID 931 } 932 if ap.Description != nil { 933 objectMap["description"] = ap.Description 934 } 935 if ap.Container != nil { 936 objectMap["container"] = ap.Container 937 } 938 if ap.StorageAccountName != nil { 939 objectMap["storageAccountName"] = ap.StorageAccountName 940 } 941 return json.Marshal(objectMap) 942} 943 944// AssetStreamingLocator properties of the Streaming Locator. 945type AssetStreamingLocator struct { 946 // Name - READ-ONLY; Streaming Locator name. 947 Name *string `json:"name,omitempty"` 948 // AssetName - READ-ONLY; Asset Name. 949 AssetName *string `json:"assetName,omitempty"` 950 // Created - READ-ONLY; The creation time of the Streaming Locator. 951 Created *date.Time `json:"created,omitempty"` 952 // StartTime - READ-ONLY; The start time of the Streaming Locator. 953 StartTime *date.Time `json:"startTime,omitempty"` 954 // EndTime - READ-ONLY; The end time of the Streaming Locator. 955 EndTime *date.Time `json:"endTime,omitempty"` 956 // StreamingLocatorID - READ-ONLY; StreamingLocatorId of the Streaming Locator. 957 StreamingLocatorID *uuid.UUID `json:"streamingLocatorId,omitempty"` 958 // StreamingPolicyName - READ-ONLY; Name of the Streaming Policy used by this Streaming Locator. 959 StreamingPolicyName *string `json:"streamingPolicyName,omitempty"` 960 // DefaultContentKeyPolicyName - READ-ONLY; Name of the default ContentKeyPolicy used by this Streaming Locator. 961 DefaultContentKeyPolicyName *string `json:"defaultContentKeyPolicyName,omitempty"` 962} 963 964// MarshalJSON is the custom marshaler for AssetStreamingLocator. 965func (asl AssetStreamingLocator) MarshalJSON() ([]byte, error) { 966 objectMap := make(map[string]interface{}) 967 return json.Marshal(objectMap) 968} 969 970// BasicAudio defines the common properties for all audio codecs. 971type BasicAudio interface { 972 AsAacAudio() (*AacAudio, bool) 973 AsAudio() (*Audio, bool) 974} 975 976// Audio defines the common properties for all audio codecs. 977type Audio struct { 978 // Channels - The number of channels in the audio. 979 Channels *int32 `json:"channels,omitempty"` 980 // SamplingRate - The sampling rate to use for encoding in hertz. 981 SamplingRate *int32 `json:"samplingRate,omitempty"` 982 // Bitrate - The bitrate, in bits per second, of the output encoded audio. 983 Bitrate *int32 `json:"bitrate,omitempty"` 984 // Label - An optional label for the codec. The label can be used to control muxing behavior. 985 Label *string `json:"label,omitempty"` 986 // OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage' 987 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"` 988} 989 990func unmarshalBasicAudio(body []byte) (BasicAudio, error) { 991 var m map[string]interface{} 992 err := json.Unmarshal(body, &m) 993 if err != nil { 994 return nil, err 995 } 996 997 switch m["@odata.type"] { 998 case string(OdataTypeMicrosoftMediaAacAudio): 999 var aa AacAudio 1000 err := json.Unmarshal(body, &aa) 1001 return aa, err 1002 default: 1003 var a Audio 1004 err := json.Unmarshal(body, &a) 1005 return a, err 1006 } 1007} 1008func unmarshalBasicAudioArray(body []byte) ([]BasicAudio, error) { 1009 var rawMessages []*json.RawMessage 1010 err := json.Unmarshal(body, &rawMessages) 1011 if err != nil { 1012 return nil, err 1013 } 1014 1015 aArray := make([]BasicAudio, len(rawMessages)) 1016 1017 for index, rawMessage := range rawMessages { 1018 a, err := unmarshalBasicAudio(*rawMessage) 1019 if err != nil { 1020 return nil, err 1021 } 1022 aArray[index] = a 1023 } 1024 return aArray, nil 1025} 1026 1027// MarshalJSON is the custom marshaler for Audio. 1028func (a Audio) MarshalJSON() ([]byte, error) { 1029 a.OdataType = OdataTypeMicrosoftMediaAudio 1030 objectMap := make(map[string]interface{}) 1031 if a.Channels != nil { 1032 objectMap["channels"] = a.Channels 1033 } 1034 if a.SamplingRate != nil { 1035 objectMap["samplingRate"] = a.SamplingRate 1036 } 1037 if a.Bitrate != nil { 1038 objectMap["bitrate"] = a.Bitrate 1039 } 1040 if a.Label != nil { 1041 objectMap["label"] = a.Label 1042 } 1043 if a.OdataType != "" { 1044 objectMap["@odata.type"] = a.OdataType 1045 } 1046 return json.Marshal(objectMap) 1047} 1048 1049// AsAudio is the BasicCodec implementation for Audio. 1050func (a Audio) AsAudio() (*Audio, bool) { 1051 return &a, true 1052} 1053 1054// AsBasicAudio is the BasicCodec implementation for Audio. 1055func (a Audio) AsBasicAudio() (BasicAudio, bool) { 1056 return &a, true 1057} 1058 1059// AsAacAudio is the BasicCodec implementation for Audio. 1060func (a Audio) AsAacAudio() (*AacAudio, bool) { 1061 return nil, false 1062} 1063 1064// AsCopyVideo is the BasicCodec implementation for Audio. 1065func (a Audio) AsCopyVideo() (*CopyVideo, bool) { 1066 return nil, false 1067} 1068 1069// AsVideo is the BasicCodec implementation for Audio. 1070func (a Audio) AsVideo() (*Video, bool) { 1071 return nil, false 1072} 1073 1074// AsBasicVideo is the BasicCodec implementation for Audio. 1075func (a Audio) AsBasicVideo() (BasicVideo, bool) { 1076 return nil, false 1077} 1078 1079// AsImage is the BasicCodec implementation for Audio. 1080func (a Audio) AsImage() (*Image, bool) { 1081 return nil, false 1082} 1083 1084// AsBasicImage is the BasicCodec implementation for Audio. 1085func (a Audio) AsBasicImage() (BasicImage, bool) { 1086 return nil, false 1087} 1088 1089// AsCopyAudio is the BasicCodec implementation for Audio. 1090func (a Audio) AsCopyAudio() (*CopyAudio, bool) { 1091 return nil, false 1092} 1093 1094// AsH264Video is the BasicCodec implementation for Audio. 1095func (a Audio) AsH264Video() (*H264Video, bool) { 1096 return nil, false 1097} 1098 1099// AsJpgImage is the BasicCodec implementation for Audio. 1100func (a Audio) AsJpgImage() (*JpgImage, bool) { 1101 return nil, false 1102} 1103 1104// AsPngImage is the BasicCodec implementation for Audio. 1105func (a Audio) AsPngImage() (*PngImage, bool) { 1106 return nil, false 1107} 1108 1109// AsCodec is the BasicCodec implementation for Audio. 1110func (a Audio) AsCodec() (*Codec, bool) { 1111 return nil, false 1112} 1113 1114// AsBasicCodec is the BasicCodec implementation for Audio. 1115func (a Audio) AsBasicCodec() (BasicCodec, bool) { 1116 return &a, true 1117} 1118 1119// BasicAudioAnalyzerPreset the Audio Analyzer preset applies a pre-defined set of AI-based analysis operations, 1120// including speech transcription. Currently, the preset supports processing of content with a single audio track. 1121type BasicAudioAnalyzerPreset interface { 1122 AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) 1123 AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) 1124} 1125 1126// AudioAnalyzerPreset the Audio Analyzer preset applies a pre-defined set of AI-based analysis operations, 1127// including speech transcription. Currently, the preset supports processing of content with a single audio 1128// track. 1129type AudioAnalyzerPreset struct { 1130 // AudioLanguage - The language for the audio payload in the input using the BCP-47 format of 'language tag-region' (e.g: 'en-US'). The list of supported languages are English ('en-US' and 'en-GB'), Spanish ('es-ES' and 'es-MX'), French ('fr-FR'), Italian ('it-IT'), Japanese ('ja-JP'), Portuguese ('pt-BR'), Chinese ('zh-CN'), German ('de-DE'), Arabic ('ar-EG' and 'ar-SY'), Russian ('ru-RU'), Hindi ('hi-IN'), and Korean ('ko-KR'). If you know the language of your content, it is recommended that you specify it. If the language isn't specified or set to null, automatic language detection will choose the first language detected and process with the selected language for the duration of the file. This language detection feature currently supports English, Chinese, French, German, Italian, Japanese, Spanish, Russian, and Portuguese. It does not currently support dynamically switching between languages after the first language is detected. The automatic detection works best with audio recordings with clearly discernable speech. If automatic detection fails to find the language, transcription would fallback to 'en-US'." 1131 AudioLanguage *string `json:"audioLanguage,omitempty"` 1132 // OdataType - Possible values include: 'OdataTypePreset', 'OdataTypeMicrosoftMediaFaceDetectorPreset', 'OdataTypeMicrosoftMediaAudioAnalyzerPreset', 'OdataTypeMicrosoftMediaBuiltInStandardEncoderPreset', 'OdataTypeMicrosoftMediaStandardEncoderPreset', 'OdataTypeMicrosoftMediaVideoAnalyzerPreset' 1133 OdataType OdataTypeBasicPreset `json:"@odata.type,omitempty"` 1134} 1135 1136func unmarshalBasicAudioAnalyzerPreset(body []byte) (BasicAudioAnalyzerPreset, error) { 1137 var m map[string]interface{} 1138 err := json.Unmarshal(body, &m) 1139 if err != nil { 1140 return nil, err 1141 } 1142 1143 switch m["@odata.type"] { 1144 case string(OdataTypeMicrosoftMediaVideoAnalyzerPreset): 1145 var vap VideoAnalyzerPreset 1146 err := json.Unmarshal(body, &vap) 1147 return vap, err 1148 default: 1149 var aap AudioAnalyzerPreset 1150 err := json.Unmarshal(body, &aap) 1151 return aap, err 1152 } 1153} 1154func unmarshalBasicAudioAnalyzerPresetArray(body []byte) ([]BasicAudioAnalyzerPreset, error) { 1155 var rawMessages []*json.RawMessage 1156 err := json.Unmarshal(body, &rawMessages) 1157 if err != nil { 1158 return nil, err 1159 } 1160 1161 aapArray := make([]BasicAudioAnalyzerPreset, len(rawMessages)) 1162 1163 for index, rawMessage := range rawMessages { 1164 aap, err := unmarshalBasicAudioAnalyzerPreset(*rawMessage) 1165 if err != nil { 1166 return nil, err 1167 } 1168 aapArray[index] = aap 1169 } 1170 return aapArray, nil 1171} 1172 1173// MarshalJSON is the custom marshaler for AudioAnalyzerPreset. 1174func (aap AudioAnalyzerPreset) MarshalJSON() ([]byte, error) { 1175 aap.OdataType = OdataTypeMicrosoftMediaAudioAnalyzerPreset 1176 objectMap := make(map[string]interface{}) 1177 if aap.AudioLanguage != nil { 1178 objectMap["audioLanguage"] = aap.AudioLanguage 1179 } 1180 if aap.OdataType != "" { 1181 objectMap["@odata.type"] = aap.OdataType 1182 } 1183 return json.Marshal(objectMap) 1184} 1185 1186// AsFaceDetectorPreset is the BasicPreset implementation for AudioAnalyzerPreset. 1187func (aap AudioAnalyzerPreset) AsFaceDetectorPreset() (*FaceDetectorPreset, bool) { 1188 return nil, false 1189} 1190 1191// AsAudioAnalyzerPreset is the BasicPreset implementation for AudioAnalyzerPreset. 1192func (aap AudioAnalyzerPreset) AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) { 1193 return &aap, true 1194} 1195 1196// AsBasicAudioAnalyzerPreset is the BasicPreset implementation for AudioAnalyzerPreset. 1197func (aap AudioAnalyzerPreset) AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) { 1198 return &aap, true 1199} 1200 1201// AsBuiltInStandardEncoderPreset is the BasicPreset implementation for AudioAnalyzerPreset. 1202func (aap AudioAnalyzerPreset) AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) { 1203 return nil, false 1204} 1205 1206// AsStandardEncoderPreset is the BasicPreset implementation for AudioAnalyzerPreset. 1207func (aap AudioAnalyzerPreset) AsStandardEncoderPreset() (*StandardEncoderPreset, bool) { 1208 return nil, false 1209} 1210 1211// AsVideoAnalyzerPreset is the BasicPreset implementation for AudioAnalyzerPreset. 1212func (aap AudioAnalyzerPreset) AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) { 1213 return nil, false 1214} 1215 1216// AsPreset is the BasicPreset implementation for AudioAnalyzerPreset. 1217func (aap AudioAnalyzerPreset) AsPreset() (*Preset, bool) { 1218 return nil, false 1219} 1220 1221// AsBasicPreset is the BasicPreset implementation for AudioAnalyzerPreset. 1222func (aap AudioAnalyzerPreset) AsBasicPreset() (BasicPreset, bool) { 1223 return &aap, true 1224} 1225 1226// AudioOverlay describes the properties of an audio overlay. 1227type AudioOverlay struct { 1228 // InputLabel - The label of the job input which is to be used as an overlay. The Input must specify exactly one file. You can specify an image file in JPG or PNG formats, or an audio file (such as a WAV, MP3, WMA or M4A file), or a video file. See https://aka.ms/mesformats for the complete list of supported audio and video file formats. 1229 InputLabel *string `json:"inputLabel,omitempty"` 1230 // Start - The start position, with reference to the input video, at which the overlay starts. The value should be in ISO 8601 format. For example, PT05S to start the overlay at 5 seconds in to the input video. If not specified the overlay starts from the beginning of the input video. 1231 Start *string `json:"start,omitempty"` 1232 // End - The position in the input video at which the overlay ends. The value should be in ISO 8601 duration format. For example, PT30S to end the overlay at 30 seconds in to the input video. If not specified the overlay will be applied until the end of the input video if inputLoop is true. Else, if inputLoop is false, then overlay will last as long as the duration of the overlay media. 1233 End *string `json:"end,omitempty"` 1234 // FadeInDuration - The duration over which the overlay fades in onto the input video. The value should be in ISO 8601 duration format. If not specified the default behavior is to have no fade in (same as PT0S). 1235 FadeInDuration *string `json:"fadeInDuration,omitempty"` 1236 // FadeOutDuration - The duration over which the overlay fades out of the input video. The value should be in ISO 8601 duration format. If not specified the default behavior is to have no fade out (same as PT0S). 1237 FadeOutDuration *string `json:"fadeOutDuration,omitempty"` 1238 // AudioGainLevel - The gain level of audio in the overlay. The value should be in the range [0, 1.0]. The default is 1.0. 1239 AudioGainLevel *float64 `json:"audioGainLevel,omitempty"` 1240 // OdataType - Possible values include: 'OdataTypeOverlay', 'OdataTypeMicrosoftMediaAudioOverlay', 'OdataTypeMicrosoftMediaVideoOverlay' 1241 OdataType OdataTypeBasicOverlay `json:"@odata.type,omitempty"` 1242} 1243 1244// MarshalJSON is the custom marshaler for AudioOverlay. 1245func (ao AudioOverlay) MarshalJSON() ([]byte, error) { 1246 ao.OdataType = OdataTypeMicrosoftMediaAudioOverlay 1247 objectMap := make(map[string]interface{}) 1248 if ao.InputLabel != nil { 1249 objectMap["inputLabel"] = ao.InputLabel 1250 } 1251 if ao.Start != nil { 1252 objectMap["start"] = ao.Start 1253 } 1254 if ao.End != nil { 1255 objectMap["end"] = ao.End 1256 } 1257 if ao.FadeInDuration != nil { 1258 objectMap["fadeInDuration"] = ao.FadeInDuration 1259 } 1260 if ao.FadeOutDuration != nil { 1261 objectMap["fadeOutDuration"] = ao.FadeOutDuration 1262 } 1263 if ao.AudioGainLevel != nil { 1264 objectMap["audioGainLevel"] = ao.AudioGainLevel 1265 } 1266 if ao.OdataType != "" { 1267 objectMap["@odata.type"] = ao.OdataType 1268 } 1269 return json.Marshal(objectMap) 1270} 1271 1272// AsAudioOverlay is the BasicOverlay implementation for AudioOverlay. 1273func (ao AudioOverlay) AsAudioOverlay() (*AudioOverlay, bool) { 1274 return &ao, true 1275} 1276 1277// AsVideoOverlay is the BasicOverlay implementation for AudioOverlay. 1278func (ao AudioOverlay) AsVideoOverlay() (*VideoOverlay, bool) { 1279 return nil, false 1280} 1281 1282// AsOverlay is the BasicOverlay implementation for AudioOverlay. 1283func (ao AudioOverlay) AsOverlay() (*Overlay, bool) { 1284 return nil, false 1285} 1286 1287// AsBasicOverlay is the BasicOverlay implementation for AudioOverlay. 1288func (ao AudioOverlay) AsBasicOverlay() (BasicOverlay, bool) { 1289 return &ao, true 1290} 1291 1292// BuiltInStandardEncoderPreset describes a built-in preset for encoding the input video with the Standard 1293// Encoder. 1294type BuiltInStandardEncoderPreset struct { 1295 // PresetName - The built-in preset to be used for encoding videos. Possible values include: 'H264SingleBitrateSD', 'H264SingleBitrate720p', 'H264SingleBitrate1080p', 'AdaptiveStreaming', 'AACGoodQualityAudio', 'ContentAwareEncodingExperimental', 'H264MultipleBitrate1080p', 'H264MultipleBitrate720p', 'H264MultipleBitrateSD' 1296 PresetName EncoderNamedPreset `json:"presetName,omitempty"` 1297 // OdataType - Possible values include: 'OdataTypePreset', 'OdataTypeMicrosoftMediaFaceDetectorPreset', 'OdataTypeMicrosoftMediaAudioAnalyzerPreset', 'OdataTypeMicrosoftMediaBuiltInStandardEncoderPreset', 'OdataTypeMicrosoftMediaStandardEncoderPreset', 'OdataTypeMicrosoftMediaVideoAnalyzerPreset' 1298 OdataType OdataTypeBasicPreset `json:"@odata.type,omitempty"` 1299} 1300 1301// MarshalJSON is the custom marshaler for BuiltInStandardEncoderPreset. 1302func (bisep BuiltInStandardEncoderPreset) MarshalJSON() ([]byte, error) { 1303 bisep.OdataType = OdataTypeMicrosoftMediaBuiltInStandardEncoderPreset 1304 objectMap := make(map[string]interface{}) 1305 if bisep.PresetName != "" { 1306 objectMap["presetName"] = bisep.PresetName 1307 } 1308 if bisep.OdataType != "" { 1309 objectMap["@odata.type"] = bisep.OdataType 1310 } 1311 return json.Marshal(objectMap) 1312} 1313 1314// AsFaceDetectorPreset is the BasicPreset implementation for BuiltInStandardEncoderPreset. 1315func (bisep BuiltInStandardEncoderPreset) AsFaceDetectorPreset() (*FaceDetectorPreset, bool) { 1316 return nil, false 1317} 1318 1319// AsAudioAnalyzerPreset is the BasicPreset implementation for BuiltInStandardEncoderPreset. 1320func (bisep BuiltInStandardEncoderPreset) AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) { 1321 return nil, false 1322} 1323 1324// AsBasicAudioAnalyzerPreset is the BasicPreset implementation for BuiltInStandardEncoderPreset. 1325func (bisep BuiltInStandardEncoderPreset) AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) { 1326 return nil, false 1327} 1328 1329// AsBuiltInStandardEncoderPreset is the BasicPreset implementation for BuiltInStandardEncoderPreset. 1330func (bisep BuiltInStandardEncoderPreset) AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) { 1331 return &bisep, true 1332} 1333 1334// AsStandardEncoderPreset is the BasicPreset implementation for BuiltInStandardEncoderPreset. 1335func (bisep BuiltInStandardEncoderPreset) AsStandardEncoderPreset() (*StandardEncoderPreset, bool) { 1336 return nil, false 1337} 1338 1339// AsVideoAnalyzerPreset is the BasicPreset implementation for BuiltInStandardEncoderPreset. 1340func (bisep BuiltInStandardEncoderPreset) AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) { 1341 return nil, false 1342} 1343 1344// AsPreset is the BasicPreset implementation for BuiltInStandardEncoderPreset. 1345func (bisep BuiltInStandardEncoderPreset) AsPreset() (*Preset, bool) { 1346 return nil, false 1347} 1348 1349// AsBasicPreset is the BasicPreset implementation for BuiltInStandardEncoderPreset. 1350func (bisep BuiltInStandardEncoderPreset) AsBasicPreset() (BasicPreset, bool) { 1351 return &bisep, true 1352} 1353 1354// CbcsDrmConfiguration class to specify DRM configurations of CommonEncryptionCbcs scheme in Streaming 1355// Policy 1356type CbcsDrmConfiguration struct { 1357 // FairPlay - FairPlay configurations 1358 FairPlay *StreamingPolicyFairPlayConfiguration `json:"fairPlay,omitempty"` 1359 // PlayReady - PlayReady configurations 1360 PlayReady *StreamingPolicyPlayReadyConfiguration `json:"playReady,omitempty"` 1361 // Widevine - Widevine configurations 1362 Widevine *StreamingPolicyWidevineConfiguration `json:"widevine,omitempty"` 1363} 1364 1365// CencDrmConfiguration class to specify DRM configurations of CommonEncryptionCenc scheme in Streaming 1366// Policy 1367type CencDrmConfiguration struct { 1368 // PlayReady - PlayReady configurations 1369 PlayReady *StreamingPolicyPlayReadyConfiguration `json:"playReady,omitempty"` 1370 // Widevine - Widevine configurations 1371 Widevine *StreamingPolicyWidevineConfiguration `json:"widevine,omitempty"` 1372} 1373 1374// CheckNameAvailabilityInput the input to the check name availability request. 1375type CheckNameAvailabilityInput struct { 1376 // Name - The account name. 1377 Name *string `json:"name,omitempty"` 1378 // Type - The account type. For a Media Services account, this should be 'MediaServices'. 1379 Type *string `json:"type,omitempty"` 1380} 1381 1382// BasicClipTime base class for specifying a clip time. Use sub classes of this class to specify the time position in 1383// the media. 1384type BasicClipTime interface { 1385 AsAbsoluteClipTime() (*AbsoluteClipTime, bool) 1386 AsClipTime() (*ClipTime, bool) 1387} 1388 1389// ClipTime base class for specifying a clip time. Use sub classes of this class to specify the time position 1390// in the media. 1391type ClipTime struct { 1392 // OdataType - Possible values include: 'OdataTypeClipTime', 'OdataTypeMicrosoftMediaAbsoluteClipTime' 1393 OdataType OdataTypeBasicClipTime `json:"@odata.type,omitempty"` 1394} 1395 1396func unmarshalBasicClipTime(body []byte) (BasicClipTime, error) { 1397 var m map[string]interface{} 1398 err := json.Unmarshal(body, &m) 1399 if err != nil { 1400 return nil, err 1401 } 1402 1403 switch m["@odata.type"] { 1404 case string(OdataTypeMicrosoftMediaAbsoluteClipTime): 1405 var act AbsoluteClipTime 1406 err := json.Unmarshal(body, &act) 1407 return act, err 1408 default: 1409 var ct ClipTime 1410 err := json.Unmarshal(body, &ct) 1411 return ct, err 1412 } 1413} 1414func unmarshalBasicClipTimeArray(body []byte) ([]BasicClipTime, error) { 1415 var rawMessages []*json.RawMessage 1416 err := json.Unmarshal(body, &rawMessages) 1417 if err != nil { 1418 return nil, err 1419 } 1420 1421 ctArray := make([]BasicClipTime, len(rawMessages)) 1422 1423 for index, rawMessage := range rawMessages { 1424 ct, err := unmarshalBasicClipTime(*rawMessage) 1425 if err != nil { 1426 return nil, err 1427 } 1428 ctArray[index] = ct 1429 } 1430 return ctArray, nil 1431} 1432 1433// MarshalJSON is the custom marshaler for ClipTime. 1434func (ct ClipTime) MarshalJSON() ([]byte, error) { 1435 ct.OdataType = OdataTypeClipTime 1436 objectMap := make(map[string]interface{}) 1437 if ct.OdataType != "" { 1438 objectMap["@odata.type"] = ct.OdataType 1439 } 1440 return json.Marshal(objectMap) 1441} 1442 1443// AsAbsoluteClipTime is the BasicClipTime implementation for ClipTime. 1444func (ct ClipTime) AsAbsoluteClipTime() (*AbsoluteClipTime, bool) { 1445 return nil, false 1446} 1447 1448// AsClipTime is the BasicClipTime implementation for ClipTime. 1449func (ct ClipTime) AsClipTime() (*ClipTime, bool) { 1450 return &ct, true 1451} 1452 1453// AsBasicClipTime is the BasicClipTime implementation for ClipTime. 1454func (ct ClipTime) AsBasicClipTime() (BasicClipTime, bool) { 1455 return &ct, true 1456} 1457 1458// BasicCodec describes the basic properties of all codecs. 1459type BasicCodec interface { 1460 AsAudio() (*Audio, bool) 1461 AsBasicAudio() (BasicAudio, bool) 1462 AsAacAudio() (*AacAudio, bool) 1463 AsCopyVideo() (*CopyVideo, bool) 1464 AsVideo() (*Video, bool) 1465 AsBasicVideo() (BasicVideo, bool) 1466 AsImage() (*Image, bool) 1467 AsBasicImage() (BasicImage, bool) 1468 AsCopyAudio() (*CopyAudio, bool) 1469 AsH264Video() (*H264Video, bool) 1470 AsJpgImage() (*JpgImage, bool) 1471 AsPngImage() (*PngImage, bool) 1472 AsCodec() (*Codec, bool) 1473} 1474 1475// Codec describes the basic properties of all codecs. 1476type Codec struct { 1477 // Label - An optional label for the codec. The label can be used to control muxing behavior. 1478 Label *string `json:"label,omitempty"` 1479 // OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage' 1480 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"` 1481} 1482 1483func unmarshalBasicCodec(body []byte) (BasicCodec, error) { 1484 var m map[string]interface{} 1485 err := json.Unmarshal(body, &m) 1486 if err != nil { 1487 return nil, err 1488 } 1489 1490 switch m["@odata.type"] { 1491 case string(OdataTypeMicrosoftMediaAudio): 1492 var a Audio 1493 err := json.Unmarshal(body, &a) 1494 return a, err 1495 case string(OdataTypeMicrosoftMediaAacAudio): 1496 var aa AacAudio 1497 err := json.Unmarshal(body, &aa) 1498 return aa, err 1499 case string(OdataTypeMicrosoftMediaCopyVideo): 1500 var cv CopyVideo 1501 err := json.Unmarshal(body, &cv) 1502 return cv, err 1503 case string(OdataTypeMicrosoftMediaVideo): 1504 var vVar Video 1505 err := json.Unmarshal(body, &vVar) 1506 return vVar, err 1507 case string(OdataTypeMicrosoftMediaImage): 1508 var i Image 1509 err := json.Unmarshal(body, &i) 1510 return i, err 1511 case string(OdataTypeMicrosoftMediaCopyAudio): 1512 var ca CopyAudio 1513 err := json.Unmarshal(body, &ca) 1514 return ca, err 1515 case string(OdataTypeMicrosoftMediaH264Video): 1516 var hv H264Video 1517 err := json.Unmarshal(body, &hv) 1518 return hv, err 1519 case string(OdataTypeMicrosoftMediaJpgImage): 1520 var ji JpgImage 1521 err := json.Unmarshal(body, &ji) 1522 return ji, err 1523 case string(OdataTypeMicrosoftMediaPngImage): 1524 var pi PngImage 1525 err := json.Unmarshal(body, &pi) 1526 return pi, err 1527 default: 1528 var c Codec 1529 err := json.Unmarshal(body, &c) 1530 return c, err 1531 } 1532} 1533func unmarshalBasicCodecArray(body []byte) ([]BasicCodec, error) { 1534 var rawMessages []*json.RawMessage 1535 err := json.Unmarshal(body, &rawMessages) 1536 if err != nil { 1537 return nil, err 1538 } 1539 1540 cArray := make([]BasicCodec, len(rawMessages)) 1541 1542 for index, rawMessage := range rawMessages { 1543 c, err := unmarshalBasicCodec(*rawMessage) 1544 if err != nil { 1545 return nil, err 1546 } 1547 cArray[index] = c 1548 } 1549 return cArray, nil 1550} 1551 1552// MarshalJSON is the custom marshaler for Codec. 1553func (c Codec) MarshalJSON() ([]byte, error) { 1554 c.OdataType = OdataTypeCodec 1555 objectMap := make(map[string]interface{}) 1556 if c.Label != nil { 1557 objectMap["label"] = c.Label 1558 } 1559 if c.OdataType != "" { 1560 objectMap["@odata.type"] = c.OdataType 1561 } 1562 return json.Marshal(objectMap) 1563} 1564 1565// AsAudio is the BasicCodec implementation for Codec. 1566func (c Codec) AsAudio() (*Audio, bool) { 1567 return nil, false 1568} 1569 1570// AsBasicAudio is the BasicCodec implementation for Codec. 1571func (c Codec) AsBasicAudio() (BasicAudio, bool) { 1572 return nil, false 1573} 1574 1575// AsAacAudio is the BasicCodec implementation for Codec. 1576func (c Codec) AsAacAudio() (*AacAudio, bool) { 1577 return nil, false 1578} 1579 1580// AsCopyVideo is the BasicCodec implementation for Codec. 1581func (c Codec) AsCopyVideo() (*CopyVideo, bool) { 1582 return nil, false 1583} 1584 1585// AsVideo is the BasicCodec implementation for Codec. 1586func (c Codec) AsVideo() (*Video, bool) { 1587 return nil, false 1588} 1589 1590// AsBasicVideo is the BasicCodec implementation for Codec. 1591func (c Codec) AsBasicVideo() (BasicVideo, bool) { 1592 return nil, false 1593} 1594 1595// AsImage is the BasicCodec implementation for Codec. 1596func (c Codec) AsImage() (*Image, bool) { 1597 return nil, false 1598} 1599 1600// AsBasicImage is the BasicCodec implementation for Codec. 1601func (c Codec) AsBasicImage() (BasicImage, bool) { 1602 return nil, false 1603} 1604 1605// AsCopyAudio is the BasicCodec implementation for Codec. 1606func (c Codec) AsCopyAudio() (*CopyAudio, bool) { 1607 return nil, false 1608} 1609 1610// AsH264Video is the BasicCodec implementation for Codec. 1611func (c Codec) AsH264Video() (*H264Video, bool) { 1612 return nil, false 1613} 1614 1615// AsJpgImage is the BasicCodec implementation for Codec. 1616func (c Codec) AsJpgImage() (*JpgImage, bool) { 1617 return nil, false 1618} 1619 1620// AsPngImage is the BasicCodec implementation for Codec. 1621func (c Codec) AsPngImage() (*PngImage, bool) { 1622 return nil, false 1623} 1624 1625// AsCodec is the BasicCodec implementation for Codec. 1626func (c Codec) AsCodec() (*Codec, bool) { 1627 return &c, true 1628} 1629 1630// AsBasicCodec is the BasicCodec implementation for Codec. 1631func (c Codec) AsBasicCodec() (BasicCodec, bool) { 1632 return &c, true 1633} 1634 1635// CommonEncryptionCbcs class for CommonEncryptionCbcs encryption scheme 1636type CommonEncryptionCbcs struct { 1637 // EnabledProtocols - Representing supported protocols 1638 EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"` 1639 // ClearTracks - Representing which tracks should not be encrypted 1640 ClearTracks *[]TrackSelection `json:"clearTracks,omitempty"` 1641 // ContentKeys - Representing default content key for each encryption scheme and separate content keys for specific tracks 1642 ContentKeys *StreamingPolicyContentKeys `json:"contentKeys,omitempty"` 1643 // Drm - Configuration of DRMs for current encryption scheme 1644 Drm *CbcsDrmConfiguration `json:"drm,omitempty"` 1645} 1646 1647// CommonEncryptionCenc class for envelope encryption scheme 1648type CommonEncryptionCenc struct { 1649 // EnabledProtocols - Representing supported protocols 1650 EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"` 1651 // ClearTracks - Representing which tracks should not be encrypted 1652 ClearTracks *[]TrackSelection `json:"clearTracks,omitempty"` 1653 // ContentKeys - Representing default content key for each encryption scheme and separate content keys for specific tracks 1654 ContentKeys *StreamingPolicyContentKeys `json:"contentKeys,omitempty"` 1655 // Drm - Configuration of DRMs for CommonEncryptionCenc encryption scheme 1656 Drm *CencDrmConfiguration `json:"drm,omitempty"` 1657} 1658 1659// ContentKeyPolicy a Content Key Policy resource. 1660type ContentKeyPolicy struct { 1661 autorest.Response `json:"-"` 1662 *ContentKeyPolicyProperties `json:"properties,omitempty"` 1663 // ID - READ-ONLY; Fully qualified resource ID for the resource. 1664 ID *string `json:"id,omitempty"` 1665 // Name - READ-ONLY; The name of the resource. 1666 Name *string `json:"name,omitempty"` 1667 // Type - READ-ONLY; The type of the resource. 1668 Type *string `json:"type,omitempty"` 1669} 1670 1671// MarshalJSON is the custom marshaler for ContentKeyPolicy. 1672func (ckp ContentKeyPolicy) MarshalJSON() ([]byte, error) { 1673 objectMap := make(map[string]interface{}) 1674 if ckp.ContentKeyPolicyProperties != nil { 1675 objectMap["properties"] = ckp.ContentKeyPolicyProperties 1676 } 1677 return json.Marshal(objectMap) 1678} 1679 1680// UnmarshalJSON is the custom unmarshaler for ContentKeyPolicy struct. 1681func (ckp *ContentKeyPolicy) UnmarshalJSON(body []byte) error { 1682 var m map[string]*json.RawMessage 1683 err := json.Unmarshal(body, &m) 1684 if err != nil { 1685 return err 1686 } 1687 for k, v := range m { 1688 switch k { 1689 case "properties": 1690 if v != nil { 1691 var contentKeyPolicyProperties ContentKeyPolicyProperties 1692 err = json.Unmarshal(*v, &contentKeyPolicyProperties) 1693 if err != nil { 1694 return err 1695 } 1696 ckp.ContentKeyPolicyProperties = &contentKeyPolicyProperties 1697 } 1698 case "id": 1699 if v != nil { 1700 var ID string 1701 err = json.Unmarshal(*v, &ID) 1702 if err != nil { 1703 return err 1704 } 1705 ckp.ID = &ID 1706 } 1707 case "name": 1708 if v != nil { 1709 var name string 1710 err = json.Unmarshal(*v, &name) 1711 if err != nil { 1712 return err 1713 } 1714 ckp.Name = &name 1715 } 1716 case "type": 1717 if v != nil { 1718 var typeVar string 1719 err = json.Unmarshal(*v, &typeVar) 1720 if err != nil { 1721 return err 1722 } 1723 ckp.Type = &typeVar 1724 } 1725 } 1726 } 1727 1728 return nil 1729} 1730 1731// ContentKeyPolicyClearKeyConfiguration represents a configuration for non-DRM keys. 1732type ContentKeyPolicyClearKeyConfiguration struct { 1733 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyClearKeyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyUnknownConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyWidevineConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyFairPlayConfiguration' 1734 OdataType OdataTypeBasicContentKeyPolicyConfiguration `json:"@odata.type,omitempty"` 1735} 1736 1737// MarshalJSON is the custom marshaler for ContentKeyPolicyClearKeyConfiguration. 1738func (ckpckc ContentKeyPolicyClearKeyConfiguration) MarshalJSON() ([]byte, error) { 1739 ckpckc.OdataType = OdataTypeMicrosoftMediaContentKeyPolicyClearKeyConfiguration 1740 objectMap := make(map[string]interface{}) 1741 if ckpckc.OdataType != "" { 1742 objectMap["@odata.type"] = ckpckc.OdataType 1743 } 1744 return json.Marshal(objectMap) 1745} 1746 1747// AsContentKeyPolicyClearKeyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyClearKeyConfiguration. 1748func (ckpckc ContentKeyPolicyClearKeyConfiguration) AsContentKeyPolicyClearKeyConfiguration() (*ContentKeyPolicyClearKeyConfiguration, bool) { 1749 return &ckpckc, true 1750} 1751 1752// AsContentKeyPolicyUnknownConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyClearKeyConfiguration. 1753func (ckpckc ContentKeyPolicyClearKeyConfiguration) AsContentKeyPolicyUnknownConfiguration() (*ContentKeyPolicyUnknownConfiguration, bool) { 1754 return nil, false 1755} 1756 1757// AsContentKeyPolicyWidevineConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyClearKeyConfiguration. 1758func (ckpckc ContentKeyPolicyClearKeyConfiguration) AsContentKeyPolicyWidevineConfiguration() (*ContentKeyPolicyWidevineConfiguration, bool) { 1759 return nil, false 1760} 1761 1762// AsContentKeyPolicyPlayReadyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyClearKeyConfiguration. 1763func (ckpckc ContentKeyPolicyClearKeyConfiguration) AsContentKeyPolicyPlayReadyConfiguration() (*ContentKeyPolicyPlayReadyConfiguration, bool) { 1764 return nil, false 1765} 1766 1767// AsContentKeyPolicyFairPlayConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyClearKeyConfiguration. 1768func (ckpckc ContentKeyPolicyClearKeyConfiguration) AsContentKeyPolicyFairPlayConfiguration() (*ContentKeyPolicyFairPlayConfiguration, bool) { 1769 return nil, false 1770} 1771 1772// AsContentKeyPolicyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyClearKeyConfiguration. 1773func (ckpckc ContentKeyPolicyClearKeyConfiguration) AsContentKeyPolicyConfiguration() (*ContentKeyPolicyConfiguration, bool) { 1774 return nil, false 1775} 1776 1777// AsBasicContentKeyPolicyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyClearKeyConfiguration. 1778func (ckpckc ContentKeyPolicyClearKeyConfiguration) AsBasicContentKeyPolicyConfiguration() (BasicContentKeyPolicyConfiguration, bool) { 1779 return &ckpckc, true 1780} 1781 1782// ContentKeyPolicyCollection a collection of ContentKeyPolicy items. 1783type ContentKeyPolicyCollection struct { 1784 autorest.Response `json:"-"` 1785 // Value - A collection of ContentKeyPolicy items. 1786 Value *[]ContentKeyPolicy `json:"value,omitempty"` 1787 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 1788 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 1789} 1790 1791// ContentKeyPolicyCollectionIterator provides access to a complete listing of ContentKeyPolicy values. 1792type ContentKeyPolicyCollectionIterator struct { 1793 i int 1794 page ContentKeyPolicyCollectionPage 1795} 1796 1797// NextWithContext advances to the next value. If there was an error making 1798// the request the iterator does not advance and the error is returned. 1799func (iter *ContentKeyPolicyCollectionIterator) NextWithContext(ctx context.Context) (err error) { 1800 if tracing.IsEnabled() { 1801 ctx = tracing.StartSpan(ctx, fqdn+"/ContentKeyPolicyCollectionIterator.NextWithContext") 1802 defer func() { 1803 sc := -1 1804 if iter.Response().Response.Response != nil { 1805 sc = iter.Response().Response.Response.StatusCode 1806 } 1807 tracing.EndSpan(ctx, sc, err) 1808 }() 1809 } 1810 iter.i++ 1811 if iter.i < len(iter.page.Values()) { 1812 return nil 1813 } 1814 err = iter.page.NextWithContext(ctx) 1815 if err != nil { 1816 iter.i-- 1817 return err 1818 } 1819 iter.i = 0 1820 return nil 1821} 1822 1823// Next advances to the next value. If there was an error making 1824// the request the iterator does not advance and the error is returned. 1825// Deprecated: Use NextWithContext() instead. 1826func (iter *ContentKeyPolicyCollectionIterator) Next() error { 1827 return iter.NextWithContext(context.Background()) 1828} 1829 1830// NotDone returns true if the enumeration should be started or is not yet complete. 1831func (iter ContentKeyPolicyCollectionIterator) NotDone() bool { 1832 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1833} 1834 1835// Response returns the raw server response from the last page request. 1836func (iter ContentKeyPolicyCollectionIterator) Response() ContentKeyPolicyCollection { 1837 return iter.page.Response() 1838} 1839 1840// Value returns the current value or a zero-initialized value if the 1841// iterator has advanced beyond the end of the collection. 1842func (iter ContentKeyPolicyCollectionIterator) Value() ContentKeyPolicy { 1843 if !iter.page.NotDone() { 1844 return ContentKeyPolicy{} 1845 } 1846 return iter.page.Values()[iter.i] 1847} 1848 1849// Creates a new instance of the ContentKeyPolicyCollectionIterator type. 1850func NewContentKeyPolicyCollectionIterator(page ContentKeyPolicyCollectionPage) ContentKeyPolicyCollectionIterator { 1851 return ContentKeyPolicyCollectionIterator{page: page} 1852} 1853 1854// IsEmpty returns true if the ListResult contains no values. 1855func (ckpc ContentKeyPolicyCollection) IsEmpty() bool { 1856 return ckpc.Value == nil || len(*ckpc.Value) == 0 1857} 1858 1859// hasNextLink returns true if the NextLink is not empty. 1860func (ckpc ContentKeyPolicyCollection) hasNextLink() bool { 1861 return ckpc.OdataNextLink != nil && len(*ckpc.OdataNextLink) != 0 1862} 1863 1864// contentKeyPolicyCollectionPreparer prepares a request to retrieve the next set of results. 1865// It returns nil if no more results exist. 1866func (ckpc ContentKeyPolicyCollection) contentKeyPolicyCollectionPreparer(ctx context.Context) (*http.Request, error) { 1867 if !ckpc.hasNextLink() { 1868 return nil, nil 1869 } 1870 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1871 autorest.AsJSON(), 1872 autorest.AsGet(), 1873 autorest.WithBaseURL(to.String(ckpc.OdataNextLink))) 1874} 1875 1876// ContentKeyPolicyCollectionPage contains a page of ContentKeyPolicy values. 1877type ContentKeyPolicyCollectionPage struct { 1878 fn func(context.Context, ContentKeyPolicyCollection) (ContentKeyPolicyCollection, error) 1879 ckpc ContentKeyPolicyCollection 1880} 1881 1882// NextWithContext advances to the next page of values. If there was an error making 1883// the request the page does not advance and the error is returned. 1884func (page *ContentKeyPolicyCollectionPage) NextWithContext(ctx context.Context) (err error) { 1885 if tracing.IsEnabled() { 1886 ctx = tracing.StartSpan(ctx, fqdn+"/ContentKeyPolicyCollectionPage.NextWithContext") 1887 defer func() { 1888 sc := -1 1889 if page.Response().Response.Response != nil { 1890 sc = page.Response().Response.Response.StatusCode 1891 } 1892 tracing.EndSpan(ctx, sc, err) 1893 }() 1894 } 1895 for { 1896 next, err := page.fn(ctx, page.ckpc) 1897 if err != nil { 1898 return err 1899 } 1900 page.ckpc = next 1901 if !next.hasNextLink() || !next.IsEmpty() { 1902 break 1903 } 1904 } 1905 return nil 1906} 1907 1908// Next advances to the next page of values. If there was an error making 1909// the request the page does not advance and the error is returned. 1910// Deprecated: Use NextWithContext() instead. 1911func (page *ContentKeyPolicyCollectionPage) Next() error { 1912 return page.NextWithContext(context.Background()) 1913} 1914 1915// NotDone returns true if the page enumeration should be started or is not yet complete. 1916func (page ContentKeyPolicyCollectionPage) NotDone() bool { 1917 return !page.ckpc.IsEmpty() 1918} 1919 1920// Response returns the raw server response from the last page request. 1921func (page ContentKeyPolicyCollectionPage) Response() ContentKeyPolicyCollection { 1922 return page.ckpc 1923} 1924 1925// Values returns the slice of values for the current page or nil if there are no values. 1926func (page ContentKeyPolicyCollectionPage) Values() []ContentKeyPolicy { 1927 if page.ckpc.IsEmpty() { 1928 return nil 1929 } 1930 return *page.ckpc.Value 1931} 1932 1933// Creates a new instance of the ContentKeyPolicyCollectionPage type. 1934func NewContentKeyPolicyCollectionPage(cur ContentKeyPolicyCollection, getNextPage func(context.Context, ContentKeyPolicyCollection) (ContentKeyPolicyCollection, error)) ContentKeyPolicyCollectionPage { 1935 return ContentKeyPolicyCollectionPage{ 1936 fn: getNextPage, 1937 ckpc: cur, 1938 } 1939} 1940 1941// BasicContentKeyPolicyConfiguration base class for Content Key Policy configuration. A derived class must be used to 1942// create a configuration. 1943type BasicContentKeyPolicyConfiguration interface { 1944 AsContentKeyPolicyClearKeyConfiguration() (*ContentKeyPolicyClearKeyConfiguration, bool) 1945 AsContentKeyPolicyUnknownConfiguration() (*ContentKeyPolicyUnknownConfiguration, bool) 1946 AsContentKeyPolicyWidevineConfiguration() (*ContentKeyPolicyWidevineConfiguration, bool) 1947 AsContentKeyPolicyPlayReadyConfiguration() (*ContentKeyPolicyPlayReadyConfiguration, bool) 1948 AsContentKeyPolicyFairPlayConfiguration() (*ContentKeyPolicyFairPlayConfiguration, bool) 1949 AsContentKeyPolicyConfiguration() (*ContentKeyPolicyConfiguration, bool) 1950} 1951 1952// ContentKeyPolicyConfiguration base class for Content Key Policy configuration. A derived class must be used 1953// to create a configuration. 1954type ContentKeyPolicyConfiguration struct { 1955 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyClearKeyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyUnknownConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyWidevineConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyFairPlayConfiguration' 1956 OdataType OdataTypeBasicContentKeyPolicyConfiguration `json:"@odata.type,omitempty"` 1957} 1958 1959func unmarshalBasicContentKeyPolicyConfiguration(body []byte) (BasicContentKeyPolicyConfiguration, error) { 1960 var m map[string]interface{} 1961 err := json.Unmarshal(body, &m) 1962 if err != nil { 1963 return nil, err 1964 } 1965 1966 switch m["@odata.type"] { 1967 case string(OdataTypeMicrosoftMediaContentKeyPolicyClearKeyConfiguration): 1968 var ckpckc ContentKeyPolicyClearKeyConfiguration 1969 err := json.Unmarshal(body, &ckpckc) 1970 return ckpckc, err 1971 case string(OdataTypeMicrosoftMediaContentKeyPolicyUnknownConfiguration): 1972 var ckpuc ContentKeyPolicyUnknownConfiguration 1973 err := json.Unmarshal(body, &ckpuc) 1974 return ckpuc, err 1975 case string(OdataTypeMicrosoftMediaContentKeyPolicyWidevineConfiguration): 1976 var ckpwc ContentKeyPolicyWidevineConfiguration 1977 err := json.Unmarshal(body, &ckpwc) 1978 return ckpwc, err 1979 case string(OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyConfiguration): 1980 var ckpprc ContentKeyPolicyPlayReadyConfiguration 1981 err := json.Unmarshal(body, &ckpprc) 1982 return ckpprc, err 1983 case string(OdataTypeMicrosoftMediaContentKeyPolicyFairPlayConfiguration): 1984 var ckpfpc ContentKeyPolicyFairPlayConfiguration 1985 err := json.Unmarshal(body, &ckpfpc) 1986 return ckpfpc, err 1987 default: 1988 var ckpc ContentKeyPolicyConfiguration 1989 err := json.Unmarshal(body, &ckpc) 1990 return ckpc, err 1991 } 1992} 1993func unmarshalBasicContentKeyPolicyConfigurationArray(body []byte) ([]BasicContentKeyPolicyConfiguration, error) { 1994 var rawMessages []*json.RawMessage 1995 err := json.Unmarshal(body, &rawMessages) 1996 if err != nil { 1997 return nil, err 1998 } 1999 2000 ckpcArray := make([]BasicContentKeyPolicyConfiguration, len(rawMessages)) 2001 2002 for index, rawMessage := range rawMessages { 2003 ckpc, err := unmarshalBasicContentKeyPolicyConfiguration(*rawMessage) 2004 if err != nil { 2005 return nil, err 2006 } 2007 ckpcArray[index] = ckpc 2008 } 2009 return ckpcArray, nil 2010} 2011 2012// MarshalJSON is the custom marshaler for ContentKeyPolicyConfiguration. 2013func (ckpc ContentKeyPolicyConfiguration) MarshalJSON() ([]byte, error) { 2014 ckpc.OdataType = OdataTypeContentKeyPolicyConfiguration 2015 objectMap := make(map[string]interface{}) 2016 if ckpc.OdataType != "" { 2017 objectMap["@odata.type"] = ckpc.OdataType 2018 } 2019 return json.Marshal(objectMap) 2020} 2021 2022// AsContentKeyPolicyClearKeyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyConfiguration. 2023func (ckpc ContentKeyPolicyConfiguration) AsContentKeyPolicyClearKeyConfiguration() (*ContentKeyPolicyClearKeyConfiguration, bool) { 2024 return nil, false 2025} 2026 2027// AsContentKeyPolicyUnknownConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyConfiguration. 2028func (ckpc ContentKeyPolicyConfiguration) AsContentKeyPolicyUnknownConfiguration() (*ContentKeyPolicyUnknownConfiguration, bool) { 2029 return nil, false 2030} 2031 2032// AsContentKeyPolicyWidevineConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyConfiguration. 2033func (ckpc ContentKeyPolicyConfiguration) AsContentKeyPolicyWidevineConfiguration() (*ContentKeyPolicyWidevineConfiguration, bool) { 2034 return nil, false 2035} 2036 2037// AsContentKeyPolicyPlayReadyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyConfiguration. 2038func (ckpc ContentKeyPolicyConfiguration) AsContentKeyPolicyPlayReadyConfiguration() (*ContentKeyPolicyPlayReadyConfiguration, bool) { 2039 return nil, false 2040} 2041 2042// AsContentKeyPolicyFairPlayConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyConfiguration. 2043func (ckpc ContentKeyPolicyConfiguration) AsContentKeyPolicyFairPlayConfiguration() (*ContentKeyPolicyFairPlayConfiguration, bool) { 2044 return nil, false 2045} 2046 2047// AsContentKeyPolicyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyConfiguration. 2048func (ckpc ContentKeyPolicyConfiguration) AsContentKeyPolicyConfiguration() (*ContentKeyPolicyConfiguration, bool) { 2049 return &ckpc, true 2050} 2051 2052// AsBasicContentKeyPolicyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyConfiguration. 2053func (ckpc ContentKeyPolicyConfiguration) AsBasicContentKeyPolicyConfiguration() (BasicContentKeyPolicyConfiguration, bool) { 2054 return &ckpc, true 2055} 2056 2057// ContentKeyPolicyFairPlayConfiguration specifies a configuration for FairPlay licenses. 2058type ContentKeyPolicyFairPlayConfiguration struct { 2059 // Ask - The key that must be used as FairPlay Application Secret key. 2060 Ask *[]byte `json:"ask,omitempty"` 2061 // FairPlayPfxPassword - The password encrypting FairPlay certificate in PKCS 12 (pfx) format. 2062 FairPlayPfxPassword *string `json:"fairPlayPfxPassword,omitempty"` 2063 // FairPlayPfx - The Base64 representation of FairPlay certificate in PKCS 12 (pfx) format (including private key). 2064 FairPlayPfx *string `json:"fairPlayPfx,omitempty"` 2065 // RentalAndLeaseKeyType - The rental and lease key type. Possible values include: 'Unknown', 'Undefined', 'PersistentUnlimited', 'PersistentLimited' 2066 RentalAndLeaseKeyType ContentKeyPolicyFairPlayRentalAndLeaseKeyType `json:"rentalAndLeaseKeyType,omitempty"` 2067 // RentalDuration - The rental duration. Must be greater than or equal to 0. 2068 RentalDuration *int64 `json:"rentalDuration,omitempty"` 2069 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyClearKeyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyUnknownConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyWidevineConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyFairPlayConfiguration' 2070 OdataType OdataTypeBasicContentKeyPolicyConfiguration `json:"@odata.type,omitempty"` 2071} 2072 2073// MarshalJSON is the custom marshaler for ContentKeyPolicyFairPlayConfiguration. 2074func (ckpfpc ContentKeyPolicyFairPlayConfiguration) MarshalJSON() ([]byte, error) { 2075 ckpfpc.OdataType = OdataTypeMicrosoftMediaContentKeyPolicyFairPlayConfiguration 2076 objectMap := make(map[string]interface{}) 2077 if ckpfpc.Ask != nil { 2078 objectMap["ask"] = ckpfpc.Ask 2079 } 2080 if ckpfpc.FairPlayPfxPassword != nil { 2081 objectMap["fairPlayPfxPassword"] = ckpfpc.FairPlayPfxPassword 2082 } 2083 if ckpfpc.FairPlayPfx != nil { 2084 objectMap["fairPlayPfx"] = ckpfpc.FairPlayPfx 2085 } 2086 if ckpfpc.RentalAndLeaseKeyType != "" { 2087 objectMap["rentalAndLeaseKeyType"] = ckpfpc.RentalAndLeaseKeyType 2088 } 2089 if ckpfpc.RentalDuration != nil { 2090 objectMap["rentalDuration"] = ckpfpc.RentalDuration 2091 } 2092 if ckpfpc.OdataType != "" { 2093 objectMap["@odata.type"] = ckpfpc.OdataType 2094 } 2095 return json.Marshal(objectMap) 2096} 2097 2098// AsContentKeyPolicyClearKeyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyFairPlayConfiguration. 2099func (ckpfpc ContentKeyPolicyFairPlayConfiguration) AsContentKeyPolicyClearKeyConfiguration() (*ContentKeyPolicyClearKeyConfiguration, bool) { 2100 return nil, false 2101} 2102 2103// AsContentKeyPolicyUnknownConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyFairPlayConfiguration. 2104func (ckpfpc ContentKeyPolicyFairPlayConfiguration) AsContentKeyPolicyUnknownConfiguration() (*ContentKeyPolicyUnknownConfiguration, bool) { 2105 return nil, false 2106} 2107 2108// AsContentKeyPolicyWidevineConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyFairPlayConfiguration. 2109func (ckpfpc ContentKeyPolicyFairPlayConfiguration) AsContentKeyPolicyWidevineConfiguration() (*ContentKeyPolicyWidevineConfiguration, bool) { 2110 return nil, false 2111} 2112 2113// AsContentKeyPolicyPlayReadyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyFairPlayConfiguration. 2114func (ckpfpc ContentKeyPolicyFairPlayConfiguration) AsContentKeyPolicyPlayReadyConfiguration() (*ContentKeyPolicyPlayReadyConfiguration, bool) { 2115 return nil, false 2116} 2117 2118// AsContentKeyPolicyFairPlayConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyFairPlayConfiguration. 2119func (ckpfpc ContentKeyPolicyFairPlayConfiguration) AsContentKeyPolicyFairPlayConfiguration() (*ContentKeyPolicyFairPlayConfiguration, bool) { 2120 return &ckpfpc, true 2121} 2122 2123// AsContentKeyPolicyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyFairPlayConfiguration. 2124func (ckpfpc ContentKeyPolicyFairPlayConfiguration) AsContentKeyPolicyConfiguration() (*ContentKeyPolicyConfiguration, bool) { 2125 return nil, false 2126} 2127 2128// AsBasicContentKeyPolicyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyFairPlayConfiguration. 2129func (ckpfpc ContentKeyPolicyFairPlayConfiguration) AsBasicContentKeyPolicyConfiguration() (BasicContentKeyPolicyConfiguration, bool) { 2130 return &ckpfpc, true 2131} 2132 2133// ContentKeyPolicyOpenRestriction represents an open restriction. License or key will be delivered on 2134// every request. 2135type ContentKeyPolicyOpenRestriction struct { 2136 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyRestriction', 'OdataTypeMicrosoftMediaContentKeyPolicyOpenRestriction', 'OdataTypeMicrosoftMediaContentKeyPolicyUnknownRestriction', 'OdataTypeMicrosoftMediaContentKeyPolicyTokenRestriction' 2137 OdataType OdataTypeBasicContentKeyPolicyRestriction `json:"@odata.type,omitempty"` 2138} 2139 2140// MarshalJSON is the custom marshaler for ContentKeyPolicyOpenRestriction. 2141func (ckpor ContentKeyPolicyOpenRestriction) MarshalJSON() ([]byte, error) { 2142 ckpor.OdataType = OdataTypeMicrosoftMediaContentKeyPolicyOpenRestriction 2143 objectMap := make(map[string]interface{}) 2144 if ckpor.OdataType != "" { 2145 objectMap["@odata.type"] = ckpor.OdataType 2146 } 2147 return json.Marshal(objectMap) 2148} 2149 2150// AsContentKeyPolicyOpenRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyOpenRestriction. 2151func (ckpor ContentKeyPolicyOpenRestriction) AsContentKeyPolicyOpenRestriction() (*ContentKeyPolicyOpenRestriction, bool) { 2152 return &ckpor, true 2153} 2154 2155// AsContentKeyPolicyUnknownRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyOpenRestriction. 2156func (ckpor ContentKeyPolicyOpenRestriction) AsContentKeyPolicyUnknownRestriction() (*ContentKeyPolicyUnknownRestriction, bool) { 2157 return nil, false 2158} 2159 2160// AsContentKeyPolicyTokenRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyOpenRestriction. 2161func (ckpor ContentKeyPolicyOpenRestriction) AsContentKeyPolicyTokenRestriction() (*ContentKeyPolicyTokenRestriction, bool) { 2162 return nil, false 2163} 2164 2165// AsContentKeyPolicyRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyOpenRestriction. 2166func (ckpor ContentKeyPolicyOpenRestriction) AsContentKeyPolicyRestriction() (*ContentKeyPolicyRestriction, bool) { 2167 return nil, false 2168} 2169 2170// AsBasicContentKeyPolicyRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyOpenRestriction. 2171func (ckpor ContentKeyPolicyOpenRestriction) AsBasicContentKeyPolicyRestriction() (BasicContentKeyPolicyRestriction, bool) { 2172 return &ckpor, true 2173} 2174 2175// ContentKeyPolicyOption represents a policy option. 2176type ContentKeyPolicyOption struct { 2177 // PolicyOptionID - READ-ONLY; The legacy Policy Option ID. 2178 PolicyOptionID *uuid.UUID `json:"policyOptionId,omitempty"` 2179 // Name - The Policy Option description. 2180 Name *string `json:"name,omitempty"` 2181 // Configuration - The key delivery configuration. 2182 Configuration BasicContentKeyPolicyConfiguration `json:"configuration,omitempty"` 2183 // Restriction - The requirements that must be met to deliver keys with this configuration 2184 Restriction BasicContentKeyPolicyRestriction `json:"restriction,omitempty"` 2185} 2186 2187// MarshalJSON is the custom marshaler for ContentKeyPolicyOption. 2188func (ckpo ContentKeyPolicyOption) MarshalJSON() ([]byte, error) { 2189 objectMap := make(map[string]interface{}) 2190 if ckpo.Name != nil { 2191 objectMap["name"] = ckpo.Name 2192 } 2193 objectMap["configuration"] = ckpo.Configuration 2194 objectMap["restriction"] = ckpo.Restriction 2195 return json.Marshal(objectMap) 2196} 2197 2198// UnmarshalJSON is the custom unmarshaler for ContentKeyPolicyOption struct. 2199func (ckpo *ContentKeyPolicyOption) UnmarshalJSON(body []byte) error { 2200 var m map[string]*json.RawMessage 2201 err := json.Unmarshal(body, &m) 2202 if err != nil { 2203 return err 2204 } 2205 for k, v := range m { 2206 switch k { 2207 case "policyOptionId": 2208 if v != nil { 2209 var policyOptionID uuid.UUID 2210 err = json.Unmarshal(*v, &policyOptionID) 2211 if err != nil { 2212 return err 2213 } 2214 ckpo.PolicyOptionID = &policyOptionID 2215 } 2216 case "name": 2217 if v != nil { 2218 var name string 2219 err = json.Unmarshal(*v, &name) 2220 if err != nil { 2221 return err 2222 } 2223 ckpo.Name = &name 2224 } 2225 case "configuration": 2226 if v != nil { 2227 configuration, err := unmarshalBasicContentKeyPolicyConfiguration(*v) 2228 if err != nil { 2229 return err 2230 } 2231 ckpo.Configuration = configuration 2232 } 2233 case "restriction": 2234 if v != nil { 2235 restriction, err := unmarshalBasicContentKeyPolicyRestriction(*v) 2236 if err != nil { 2237 return err 2238 } 2239 ckpo.Restriction = restriction 2240 } 2241 } 2242 } 2243 2244 return nil 2245} 2246 2247// ContentKeyPolicyPlayReadyConfiguration specifies a configuration for PlayReady licenses. 2248type ContentKeyPolicyPlayReadyConfiguration struct { 2249 // Licenses - The PlayReady licenses. 2250 Licenses *[]ContentKeyPolicyPlayReadyLicense `json:"licenses,omitempty"` 2251 // ResponseCustomData - The custom response data. 2252 ResponseCustomData *string `json:"responseCustomData,omitempty"` 2253 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyClearKeyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyUnknownConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyWidevineConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyFairPlayConfiguration' 2254 OdataType OdataTypeBasicContentKeyPolicyConfiguration `json:"@odata.type,omitempty"` 2255} 2256 2257// MarshalJSON is the custom marshaler for ContentKeyPolicyPlayReadyConfiguration. 2258func (ckpprc ContentKeyPolicyPlayReadyConfiguration) MarshalJSON() ([]byte, error) { 2259 ckpprc.OdataType = OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyConfiguration 2260 objectMap := make(map[string]interface{}) 2261 if ckpprc.Licenses != nil { 2262 objectMap["licenses"] = ckpprc.Licenses 2263 } 2264 if ckpprc.ResponseCustomData != nil { 2265 objectMap["responseCustomData"] = ckpprc.ResponseCustomData 2266 } 2267 if ckpprc.OdataType != "" { 2268 objectMap["@odata.type"] = ckpprc.OdataType 2269 } 2270 return json.Marshal(objectMap) 2271} 2272 2273// AsContentKeyPolicyClearKeyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyPlayReadyConfiguration. 2274func (ckpprc ContentKeyPolicyPlayReadyConfiguration) AsContentKeyPolicyClearKeyConfiguration() (*ContentKeyPolicyClearKeyConfiguration, bool) { 2275 return nil, false 2276} 2277 2278// AsContentKeyPolicyUnknownConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyPlayReadyConfiguration. 2279func (ckpprc ContentKeyPolicyPlayReadyConfiguration) AsContentKeyPolicyUnknownConfiguration() (*ContentKeyPolicyUnknownConfiguration, bool) { 2280 return nil, false 2281} 2282 2283// AsContentKeyPolicyWidevineConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyPlayReadyConfiguration. 2284func (ckpprc ContentKeyPolicyPlayReadyConfiguration) AsContentKeyPolicyWidevineConfiguration() (*ContentKeyPolicyWidevineConfiguration, bool) { 2285 return nil, false 2286} 2287 2288// AsContentKeyPolicyPlayReadyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyPlayReadyConfiguration. 2289func (ckpprc ContentKeyPolicyPlayReadyConfiguration) AsContentKeyPolicyPlayReadyConfiguration() (*ContentKeyPolicyPlayReadyConfiguration, bool) { 2290 return &ckpprc, true 2291} 2292 2293// AsContentKeyPolicyFairPlayConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyPlayReadyConfiguration. 2294func (ckpprc ContentKeyPolicyPlayReadyConfiguration) AsContentKeyPolicyFairPlayConfiguration() (*ContentKeyPolicyFairPlayConfiguration, bool) { 2295 return nil, false 2296} 2297 2298// AsContentKeyPolicyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyPlayReadyConfiguration. 2299func (ckpprc ContentKeyPolicyPlayReadyConfiguration) AsContentKeyPolicyConfiguration() (*ContentKeyPolicyConfiguration, bool) { 2300 return nil, false 2301} 2302 2303// AsBasicContentKeyPolicyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyPlayReadyConfiguration. 2304func (ckpprc ContentKeyPolicyPlayReadyConfiguration) AsBasicContentKeyPolicyConfiguration() (BasicContentKeyPolicyConfiguration, bool) { 2305 return &ckpprc, true 2306} 2307 2308// ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader specifies that the content key ID is in the 2309// PlayReady header. 2310type ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader struct { 2311 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyPlayReadyContentKeyLocation', 'OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader', 'OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier' 2312 OdataType OdataType `json:"@odata.type,omitempty"` 2313} 2314 2315// MarshalJSON is the custom marshaler for ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader. 2316func (ckpprcekfh ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) MarshalJSON() ([]byte, error) { 2317 ckpprcekfh.OdataType = OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader 2318 objectMap := make(map[string]interface{}) 2319 if ckpprcekfh.OdataType != "" { 2320 objectMap["@odata.type"] = ckpprcekfh.OdataType 2321 } 2322 return json.Marshal(objectMap) 2323} 2324 2325// AsContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader is the BasicContentKeyPolicyPlayReadyContentKeyLocation implementation for ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader. 2326func (ckpprcekfh ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) AsContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader() (*ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, bool) { 2327 return &ckpprcekfh, true 2328} 2329 2330// AsContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier is the BasicContentKeyPolicyPlayReadyContentKeyLocation implementation for ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader. 2331func (ckpprcekfh ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) AsContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier() (*ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier, bool) { 2332 return nil, false 2333} 2334 2335// AsContentKeyPolicyPlayReadyContentKeyLocation is the BasicContentKeyPolicyPlayReadyContentKeyLocation implementation for ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader. 2336func (ckpprcekfh ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) AsContentKeyPolicyPlayReadyContentKeyLocation() (*ContentKeyPolicyPlayReadyContentKeyLocation, bool) { 2337 return nil, false 2338} 2339 2340// AsBasicContentKeyPolicyPlayReadyContentKeyLocation is the BasicContentKeyPolicyPlayReadyContentKeyLocation implementation for ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader. 2341func (ckpprcekfh ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) AsBasicContentKeyPolicyPlayReadyContentKeyLocation() (BasicContentKeyPolicyPlayReadyContentKeyLocation, bool) { 2342 return &ckpprcekfh, true 2343} 2344 2345// ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier specifies that the content key ID is 2346// specified in the PlayReady configuration. 2347type ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier struct { 2348 // KeyID - The content key ID. 2349 KeyID *uuid.UUID `json:"keyId,omitempty"` 2350 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyPlayReadyContentKeyLocation', 'OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader', 'OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier' 2351 OdataType OdataType `json:"@odata.type,omitempty"` 2352} 2353 2354// MarshalJSON is the custom marshaler for ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier. 2355func (ckpprcekfki ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) MarshalJSON() ([]byte, error) { 2356 ckpprcekfki.OdataType = OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier 2357 objectMap := make(map[string]interface{}) 2358 if ckpprcekfki.KeyID != nil { 2359 objectMap["keyId"] = ckpprcekfki.KeyID 2360 } 2361 if ckpprcekfki.OdataType != "" { 2362 objectMap["@odata.type"] = ckpprcekfki.OdataType 2363 } 2364 return json.Marshal(objectMap) 2365} 2366 2367// AsContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader is the BasicContentKeyPolicyPlayReadyContentKeyLocation implementation for ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier. 2368func (ckpprcekfki ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) AsContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader() (*ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, bool) { 2369 return nil, false 2370} 2371 2372// AsContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier is the BasicContentKeyPolicyPlayReadyContentKeyLocation implementation for ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier. 2373func (ckpprcekfki ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) AsContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier() (*ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier, bool) { 2374 return &ckpprcekfki, true 2375} 2376 2377// AsContentKeyPolicyPlayReadyContentKeyLocation is the BasicContentKeyPolicyPlayReadyContentKeyLocation implementation for ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier. 2378func (ckpprcekfki ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) AsContentKeyPolicyPlayReadyContentKeyLocation() (*ContentKeyPolicyPlayReadyContentKeyLocation, bool) { 2379 return nil, false 2380} 2381 2382// AsBasicContentKeyPolicyPlayReadyContentKeyLocation is the BasicContentKeyPolicyPlayReadyContentKeyLocation implementation for ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier. 2383func (ckpprcekfki ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) AsBasicContentKeyPolicyPlayReadyContentKeyLocation() (BasicContentKeyPolicyPlayReadyContentKeyLocation, bool) { 2384 return &ckpprcekfki, true 2385} 2386 2387// BasicContentKeyPolicyPlayReadyContentKeyLocation base class for content key ID location. A derived class must be 2388// used to represent the location. 2389type BasicContentKeyPolicyPlayReadyContentKeyLocation interface { 2390 AsContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader() (*ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, bool) 2391 AsContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier() (*ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier, bool) 2392 AsContentKeyPolicyPlayReadyContentKeyLocation() (*ContentKeyPolicyPlayReadyContentKeyLocation, bool) 2393} 2394 2395// ContentKeyPolicyPlayReadyContentKeyLocation base class for content key ID location. A derived class must be 2396// used to represent the location. 2397type ContentKeyPolicyPlayReadyContentKeyLocation struct { 2398 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyPlayReadyContentKeyLocation', 'OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader', 'OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier' 2399 OdataType OdataType `json:"@odata.type,omitempty"` 2400} 2401 2402func unmarshalBasicContentKeyPolicyPlayReadyContentKeyLocation(body []byte) (BasicContentKeyPolicyPlayReadyContentKeyLocation, error) { 2403 var m map[string]interface{} 2404 err := json.Unmarshal(body, &m) 2405 if err != nil { 2406 return nil, err 2407 } 2408 2409 switch m["@odata.type"] { 2410 case string(OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader): 2411 var ckpprcekfh ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader 2412 err := json.Unmarshal(body, &ckpprcekfh) 2413 return ckpprcekfh, err 2414 case string(OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier): 2415 var ckpprcekfki ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier 2416 err := json.Unmarshal(body, &ckpprcekfki) 2417 return ckpprcekfki, err 2418 default: 2419 var ckpprckl ContentKeyPolicyPlayReadyContentKeyLocation 2420 err := json.Unmarshal(body, &ckpprckl) 2421 return ckpprckl, err 2422 } 2423} 2424func unmarshalBasicContentKeyPolicyPlayReadyContentKeyLocationArray(body []byte) ([]BasicContentKeyPolicyPlayReadyContentKeyLocation, error) { 2425 var rawMessages []*json.RawMessage 2426 err := json.Unmarshal(body, &rawMessages) 2427 if err != nil { 2428 return nil, err 2429 } 2430 2431 ckpprcklArray := make([]BasicContentKeyPolicyPlayReadyContentKeyLocation, len(rawMessages)) 2432 2433 for index, rawMessage := range rawMessages { 2434 ckpprckl, err := unmarshalBasicContentKeyPolicyPlayReadyContentKeyLocation(*rawMessage) 2435 if err != nil { 2436 return nil, err 2437 } 2438 ckpprcklArray[index] = ckpprckl 2439 } 2440 return ckpprcklArray, nil 2441} 2442 2443// MarshalJSON is the custom marshaler for ContentKeyPolicyPlayReadyContentKeyLocation. 2444func (ckpprckl ContentKeyPolicyPlayReadyContentKeyLocation) MarshalJSON() ([]byte, error) { 2445 ckpprckl.OdataType = OdataTypeContentKeyPolicyPlayReadyContentKeyLocation 2446 objectMap := make(map[string]interface{}) 2447 if ckpprckl.OdataType != "" { 2448 objectMap["@odata.type"] = ckpprckl.OdataType 2449 } 2450 return json.Marshal(objectMap) 2451} 2452 2453// AsContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader is the BasicContentKeyPolicyPlayReadyContentKeyLocation implementation for ContentKeyPolicyPlayReadyContentKeyLocation. 2454func (ckpprckl ContentKeyPolicyPlayReadyContentKeyLocation) AsContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader() (*ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, bool) { 2455 return nil, false 2456} 2457 2458// AsContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier is the BasicContentKeyPolicyPlayReadyContentKeyLocation implementation for ContentKeyPolicyPlayReadyContentKeyLocation. 2459func (ckpprckl ContentKeyPolicyPlayReadyContentKeyLocation) AsContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier() (*ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier, bool) { 2460 return nil, false 2461} 2462 2463// AsContentKeyPolicyPlayReadyContentKeyLocation is the BasicContentKeyPolicyPlayReadyContentKeyLocation implementation for ContentKeyPolicyPlayReadyContentKeyLocation. 2464func (ckpprckl ContentKeyPolicyPlayReadyContentKeyLocation) AsContentKeyPolicyPlayReadyContentKeyLocation() (*ContentKeyPolicyPlayReadyContentKeyLocation, bool) { 2465 return &ckpprckl, true 2466} 2467 2468// AsBasicContentKeyPolicyPlayReadyContentKeyLocation is the BasicContentKeyPolicyPlayReadyContentKeyLocation implementation for ContentKeyPolicyPlayReadyContentKeyLocation. 2469func (ckpprckl ContentKeyPolicyPlayReadyContentKeyLocation) AsBasicContentKeyPolicyPlayReadyContentKeyLocation() (BasicContentKeyPolicyPlayReadyContentKeyLocation, bool) { 2470 return &ckpprckl, true 2471} 2472 2473// ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction configures the Explicit Analog Television 2474// Output Restriction control bits. For further details see the PlayReady Compliance Rules. 2475type ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction struct { 2476 // BestEffort - Indicates whether this restriction is enforced on a Best Effort basis. 2477 BestEffort *bool `json:"bestEffort,omitempty"` 2478 // ConfigurationData - Configures the restriction control bits. Must be between 0 and 3 inclusive. 2479 ConfigurationData *int32 `json:"configurationData,omitempty"` 2480} 2481 2482// ContentKeyPolicyPlayReadyLicense the PlayReady license 2483type ContentKeyPolicyPlayReadyLicense struct { 2484 // AllowTestDevices - A flag indicating whether test devices can use the license. 2485 AllowTestDevices *bool `json:"allowTestDevices,omitempty"` 2486 // BeginDate - The begin date of license 2487 BeginDate *date.Time `json:"beginDate,omitempty"` 2488 // ExpirationDate - The expiration date of license. 2489 ExpirationDate *date.Time `json:"expirationDate,omitempty"` 2490 // RelativeBeginDate - The relative begin date of license. 2491 RelativeBeginDate *string `json:"relativeBeginDate,omitempty"` 2492 // RelativeExpirationDate - The relative expiration date of license. 2493 RelativeExpirationDate *string `json:"relativeExpirationDate,omitempty"` 2494 // GracePeriod - The grace period of license. 2495 GracePeriod *string `json:"gracePeriod,omitempty"` 2496 // PlayRight - The license PlayRight 2497 PlayRight *ContentKeyPolicyPlayReadyPlayRight `json:"playRight,omitempty"` 2498 // LicenseType - The license type. Possible values include: 'ContentKeyPolicyPlayReadyLicenseTypeUnknown', 'ContentKeyPolicyPlayReadyLicenseTypeNonPersistent', 'ContentKeyPolicyPlayReadyLicenseTypePersistent' 2499 LicenseType ContentKeyPolicyPlayReadyLicenseType `json:"licenseType,omitempty"` 2500 // ContentKeyLocation - The content key location. 2501 ContentKeyLocation BasicContentKeyPolicyPlayReadyContentKeyLocation `json:"contentKeyLocation,omitempty"` 2502 // ContentType - The PlayReady content type. Possible values include: 'ContentKeyPolicyPlayReadyContentTypeUnknown', 'ContentKeyPolicyPlayReadyContentTypeUnspecified', 'ContentKeyPolicyPlayReadyContentTypeUltraVioletDownload', 'ContentKeyPolicyPlayReadyContentTypeUltraVioletStreaming' 2503 ContentType ContentKeyPolicyPlayReadyContentType `json:"contentType,omitempty"` 2504} 2505 2506// UnmarshalJSON is the custom unmarshaler for ContentKeyPolicyPlayReadyLicense struct. 2507func (ckpprl *ContentKeyPolicyPlayReadyLicense) UnmarshalJSON(body []byte) error { 2508 var m map[string]*json.RawMessage 2509 err := json.Unmarshal(body, &m) 2510 if err != nil { 2511 return err 2512 } 2513 for k, v := range m { 2514 switch k { 2515 case "allowTestDevices": 2516 if v != nil { 2517 var allowTestDevices bool 2518 err = json.Unmarshal(*v, &allowTestDevices) 2519 if err != nil { 2520 return err 2521 } 2522 ckpprl.AllowTestDevices = &allowTestDevices 2523 } 2524 case "beginDate": 2525 if v != nil { 2526 var beginDate date.Time 2527 err = json.Unmarshal(*v, &beginDate) 2528 if err != nil { 2529 return err 2530 } 2531 ckpprl.BeginDate = &beginDate 2532 } 2533 case "expirationDate": 2534 if v != nil { 2535 var expirationDate date.Time 2536 err = json.Unmarshal(*v, &expirationDate) 2537 if err != nil { 2538 return err 2539 } 2540 ckpprl.ExpirationDate = &expirationDate 2541 } 2542 case "relativeBeginDate": 2543 if v != nil { 2544 var relativeBeginDate string 2545 err = json.Unmarshal(*v, &relativeBeginDate) 2546 if err != nil { 2547 return err 2548 } 2549 ckpprl.RelativeBeginDate = &relativeBeginDate 2550 } 2551 case "relativeExpirationDate": 2552 if v != nil { 2553 var relativeExpirationDate string 2554 err = json.Unmarshal(*v, &relativeExpirationDate) 2555 if err != nil { 2556 return err 2557 } 2558 ckpprl.RelativeExpirationDate = &relativeExpirationDate 2559 } 2560 case "gracePeriod": 2561 if v != nil { 2562 var gracePeriod string 2563 err = json.Unmarshal(*v, &gracePeriod) 2564 if err != nil { 2565 return err 2566 } 2567 ckpprl.GracePeriod = &gracePeriod 2568 } 2569 case "playRight": 2570 if v != nil { 2571 var playRight ContentKeyPolicyPlayReadyPlayRight 2572 err = json.Unmarshal(*v, &playRight) 2573 if err != nil { 2574 return err 2575 } 2576 ckpprl.PlayRight = &playRight 2577 } 2578 case "licenseType": 2579 if v != nil { 2580 var licenseType ContentKeyPolicyPlayReadyLicenseType 2581 err = json.Unmarshal(*v, &licenseType) 2582 if err != nil { 2583 return err 2584 } 2585 ckpprl.LicenseType = licenseType 2586 } 2587 case "contentKeyLocation": 2588 if v != nil { 2589 contentKeyLocation, err := unmarshalBasicContentKeyPolicyPlayReadyContentKeyLocation(*v) 2590 if err != nil { 2591 return err 2592 } 2593 ckpprl.ContentKeyLocation = contentKeyLocation 2594 } 2595 case "contentType": 2596 if v != nil { 2597 var contentType ContentKeyPolicyPlayReadyContentType 2598 err = json.Unmarshal(*v, &contentType) 2599 if err != nil { 2600 return err 2601 } 2602 ckpprl.ContentType = contentType 2603 } 2604 } 2605 } 2606 2607 return nil 2608} 2609 2610// ContentKeyPolicyPlayReadyPlayRight configures the Play Right in the PlayReady license. 2611type ContentKeyPolicyPlayReadyPlayRight struct { 2612 // FirstPlayExpiration - The amount of time that the license is valid after the license is first used to play content. 2613 FirstPlayExpiration *string `json:"firstPlayExpiration,omitempty"` 2614 // ScmsRestriction - Configures the Serial Copy Management System (SCMS) in the license. Must be between 0 and 3 inclusive. 2615 ScmsRestriction *int32 `json:"scmsRestriction,omitempty"` 2616 // AgcAndColorStripeRestriction - Configures Automatic Gain Control (AGC) and Color Stripe in the license. Must be between 0 and 3 inclusive. 2617 AgcAndColorStripeRestriction *int32 `json:"agcAndColorStripeRestriction,omitempty"` 2618 // ExplicitAnalogTelevisionOutputRestriction - Configures the Explicit Analog Television Output Restriction in the license. Configuration data must be between 0 and 3 inclusive. 2619 ExplicitAnalogTelevisionOutputRestriction *ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction `json:"explicitAnalogTelevisionOutputRestriction,omitempty"` 2620 // DigitalVideoOnlyContentRestriction - Enables the Image Constraint For Analog Component Video Restriction in the license. 2621 DigitalVideoOnlyContentRestriction *bool `json:"digitalVideoOnlyContentRestriction,omitempty"` 2622 // ImageConstraintForAnalogComponentVideoRestriction - Enables the Image Constraint For Analog Component Video Restriction in the license. 2623 ImageConstraintForAnalogComponentVideoRestriction *bool `json:"imageConstraintForAnalogComponentVideoRestriction,omitempty"` 2624 // ImageConstraintForAnalogComputerMonitorRestriction - Enables the Image Constraint For Analog Component Video Restriction in the license. 2625 ImageConstraintForAnalogComputerMonitorRestriction *bool `json:"imageConstraintForAnalogComputerMonitorRestriction,omitempty"` 2626 // AllowPassingVideoContentToUnknownOutput - Configures Unknown output handling settings of the license. Possible values include: 'ContentKeyPolicyPlayReadyUnknownOutputPassingOptionUnknown', 'ContentKeyPolicyPlayReadyUnknownOutputPassingOptionNotAllowed', 'ContentKeyPolicyPlayReadyUnknownOutputPassingOptionAllowed', 'ContentKeyPolicyPlayReadyUnknownOutputPassingOptionAllowedWithVideoConstriction' 2627 AllowPassingVideoContentToUnknownOutput ContentKeyPolicyPlayReadyUnknownOutputPassingOption `json:"allowPassingVideoContentToUnknownOutput,omitempty"` 2628 // UncompressedDigitalVideoOpl - Specifies the output protection level for uncompressed digital video. 2629 UncompressedDigitalVideoOpl *int32 `json:"uncompressedDigitalVideoOpl,omitempty"` 2630 // CompressedDigitalVideoOpl - Specifies the output protection level for compressed digital video. 2631 CompressedDigitalVideoOpl *int32 `json:"compressedDigitalVideoOpl,omitempty"` 2632 // AnalogVideoOpl - Specifies the output protection level for compressed digital audio. 2633 AnalogVideoOpl *int32 `json:"analogVideoOpl,omitempty"` 2634 // CompressedDigitalAudioOpl - Specifies the output protection level for compressed digital audio. 2635 CompressedDigitalAudioOpl *int32 `json:"compressedDigitalAudioOpl,omitempty"` 2636 // UncompressedDigitalAudioOpl - Specifies the output protection level for uncompressed digital audio. 2637 UncompressedDigitalAudioOpl *int32 `json:"uncompressedDigitalAudioOpl,omitempty"` 2638} 2639 2640// ContentKeyPolicyProperties the properties of the Content Key Policy. 2641type ContentKeyPolicyProperties struct { 2642 autorest.Response `json:"-"` 2643 // PolicyID - READ-ONLY; The legacy Policy ID. 2644 PolicyID *uuid.UUID `json:"policyId,omitempty"` 2645 // Created - READ-ONLY; The creation date of the Policy 2646 Created *date.Time `json:"created,omitempty"` 2647 // LastModified - READ-ONLY; The last modified date of the Policy 2648 LastModified *date.Time `json:"lastModified,omitempty"` 2649 // Description - A description for the Policy. 2650 Description *string `json:"description,omitempty"` 2651 // Options - The Key Policy options. 2652 Options *[]ContentKeyPolicyOption `json:"options,omitempty"` 2653} 2654 2655// MarshalJSON is the custom marshaler for ContentKeyPolicyProperties. 2656func (ckpp ContentKeyPolicyProperties) MarshalJSON() ([]byte, error) { 2657 objectMap := make(map[string]interface{}) 2658 if ckpp.Description != nil { 2659 objectMap["description"] = ckpp.Description 2660 } 2661 if ckpp.Options != nil { 2662 objectMap["options"] = ckpp.Options 2663 } 2664 return json.Marshal(objectMap) 2665} 2666 2667// BasicContentKeyPolicyRestriction base class for Content Key Policy restrictions. A derived class must be used to 2668// create a restriction. 2669type BasicContentKeyPolicyRestriction interface { 2670 AsContentKeyPolicyOpenRestriction() (*ContentKeyPolicyOpenRestriction, bool) 2671 AsContentKeyPolicyUnknownRestriction() (*ContentKeyPolicyUnknownRestriction, bool) 2672 AsContentKeyPolicyTokenRestriction() (*ContentKeyPolicyTokenRestriction, bool) 2673 AsContentKeyPolicyRestriction() (*ContentKeyPolicyRestriction, bool) 2674} 2675 2676// ContentKeyPolicyRestriction base class for Content Key Policy restrictions. A derived class must be used to 2677// create a restriction. 2678type ContentKeyPolicyRestriction struct { 2679 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyRestriction', 'OdataTypeMicrosoftMediaContentKeyPolicyOpenRestriction', 'OdataTypeMicrosoftMediaContentKeyPolicyUnknownRestriction', 'OdataTypeMicrosoftMediaContentKeyPolicyTokenRestriction' 2680 OdataType OdataTypeBasicContentKeyPolicyRestriction `json:"@odata.type,omitempty"` 2681} 2682 2683func unmarshalBasicContentKeyPolicyRestriction(body []byte) (BasicContentKeyPolicyRestriction, error) { 2684 var m map[string]interface{} 2685 err := json.Unmarshal(body, &m) 2686 if err != nil { 2687 return nil, err 2688 } 2689 2690 switch m["@odata.type"] { 2691 case string(OdataTypeMicrosoftMediaContentKeyPolicyOpenRestriction): 2692 var ckpor ContentKeyPolicyOpenRestriction 2693 err := json.Unmarshal(body, &ckpor) 2694 return ckpor, err 2695 case string(OdataTypeMicrosoftMediaContentKeyPolicyUnknownRestriction): 2696 var ckpur ContentKeyPolicyUnknownRestriction 2697 err := json.Unmarshal(body, &ckpur) 2698 return ckpur, err 2699 case string(OdataTypeMicrosoftMediaContentKeyPolicyTokenRestriction): 2700 var ckptr ContentKeyPolicyTokenRestriction 2701 err := json.Unmarshal(body, &ckptr) 2702 return ckptr, err 2703 default: 2704 var ckpr ContentKeyPolicyRestriction 2705 err := json.Unmarshal(body, &ckpr) 2706 return ckpr, err 2707 } 2708} 2709func unmarshalBasicContentKeyPolicyRestrictionArray(body []byte) ([]BasicContentKeyPolicyRestriction, error) { 2710 var rawMessages []*json.RawMessage 2711 err := json.Unmarshal(body, &rawMessages) 2712 if err != nil { 2713 return nil, err 2714 } 2715 2716 ckprArray := make([]BasicContentKeyPolicyRestriction, len(rawMessages)) 2717 2718 for index, rawMessage := range rawMessages { 2719 ckpr, err := unmarshalBasicContentKeyPolicyRestriction(*rawMessage) 2720 if err != nil { 2721 return nil, err 2722 } 2723 ckprArray[index] = ckpr 2724 } 2725 return ckprArray, nil 2726} 2727 2728// MarshalJSON is the custom marshaler for ContentKeyPolicyRestriction. 2729func (ckpr ContentKeyPolicyRestriction) MarshalJSON() ([]byte, error) { 2730 ckpr.OdataType = OdataTypeContentKeyPolicyRestriction 2731 objectMap := make(map[string]interface{}) 2732 if ckpr.OdataType != "" { 2733 objectMap["@odata.type"] = ckpr.OdataType 2734 } 2735 return json.Marshal(objectMap) 2736} 2737 2738// AsContentKeyPolicyOpenRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyRestriction. 2739func (ckpr ContentKeyPolicyRestriction) AsContentKeyPolicyOpenRestriction() (*ContentKeyPolicyOpenRestriction, bool) { 2740 return nil, false 2741} 2742 2743// AsContentKeyPolicyUnknownRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyRestriction. 2744func (ckpr ContentKeyPolicyRestriction) AsContentKeyPolicyUnknownRestriction() (*ContentKeyPolicyUnknownRestriction, bool) { 2745 return nil, false 2746} 2747 2748// AsContentKeyPolicyTokenRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyRestriction. 2749func (ckpr ContentKeyPolicyRestriction) AsContentKeyPolicyTokenRestriction() (*ContentKeyPolicyTokenRestriction, bool) { 2750 return nil, false 2751} 2752 2753// AsContentKeyPolicyRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyRestriction. 2754func (ckpr ContentKeyPolicyRestriction) AsContentKeyPolicyRestriction() (*ContentKeyPolicyRestriction, bool) { 2755 return &ckpr, true 2756} 2757 2758// AsBasicContentKeyPolicyRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyRestriction. 2759func (ckpr ContentKeyPolicyRestriction) AsBasicContentKeyPolicyRestriction() (BasicContentKeyPolicyRestriction, bool) { 2760 return &ckpr, true 2761} 2762 2763// BasicContentKeyPolicyRestrictionTokenKey base class for Content Key Policy key for token validation. A derived class 2764// must be used to create a token key. 2765type BasicContentKeyPolicyRestrictionTokenKey interface { 2766 AsContentKeyPolicySymmetricTokenKey() (*ContentKeyPolicySymmetricTokenKey, bool) 2767 AsContentKeyPolicyRsaTokenKey() (*ContentKeyPolicyRsaTokenKey, bool) 2768 AsContentKeyPolicyX509CertificateTokenKey() (*ContentKeyPolicyX509CertificateTokenKey, bool) 2769 AsContentKeyPolicyRestrictionTokenKey() (*ContentKeyPolicyRestrictionTokenKey, bool) 2770} 2771 2772// ContentKeyPolicyRestrictionTokenKey base class for Content Key Policy key for token validation. A derived 2773// class must be used to create a token key. 2774type ContentKeyPolicyRestrictionTokenKey struct { 2775 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyRestrictionTokenKey', 'OdataTypeMicrosoftMediaContentKeyPolicySymmetricTokenKey', 'OdataTypeMicrosoftMediaContentKeyPolicyRsaTokenKey', 'OdataTypeMicrosoftMediaContentKeyPolicyX509CertificateTokenKey' 2776 OdataType OdataTypeBasicContentKeyPolicyRestrictionTokenKey `json:"@odata.type,omitempty"` 2777} 2778 2779func unmarshalBasicContentKeyPolicyRestrictionTokenKey(body []byte) (BasicContentKeyPolicyRestrictionTokenKey, error) { 2780 var m map[string]interface{} 2781 err := json.Unmarshal(body, &m) 2782 if err != nil { 2783 return nil, err 2784 } 2785 2786 switch m["@odata.type"] { 2787 case string(OdataTypeMicrosoftMediaContentKeyPolicySymmetricTokenKey): 2788 var ckpstk ContentKeyPolicySymmetricTokenKey 2789 err := json.Unmarshal(body, &ckpstk) 2790 return ckpstk, err 2791 case string(OdataTypeMicrosoftMediaContentKeyPolicyRsaTokenKey): 2792 var ckprtk ContentKeyPolicyRsaTokenKey 2793 err := json.Unmarshal(body, &ckprtk) 2794 return ckprtk, err 2795 case string(OdataTypeMicrosoftMediaContentKeyPolicyX509CertificateTokenKey): 2796 var ckpxctk ContentKeyPolicyX509CertificateTokenKey 2797 err := json.Unmarshal(body, &ckpxctk) 2798 return ckpxctk, err 2799 default: 2800 var ckprtk ContentKeyPolicyRestrictionTokenKey 2801 err := json.Unmarshal(body, &ckprtk) 2802 return ckprtk, err 2803 } 2804} 2805func unmarshalBasicContentKeyPolicyRestrictionTokenKeyArray(body []byte) ([]BasicContentKeyPolicyRestrictionTokenKey, error) { 2806 var rawMessages []*json.RawMessage 2807 err := json.Unmarshal(body, &rawMessages) 2808 if err != nil { 2809 return nil, err 2810 } 2811 2812 ckprtkArray := make([]BasicContentKeyPolicyRestrictionTokenKey, len(rawMessages)) 2813 2814 for index, rawMessage := range rawMessages { 2815 ckprtk, err := unmarshalBasicContentKeyPolicyRestrictionTokenKey(*rawMessage) 2816 if err != nil { 2817 return nil, err 2818 } 2819 ckprtkArray[index] = ckprtk 2820 } 2821 return ckprtkArray, nil 2822} 2823 2824// MarshalJSON is the custom marshaler for ContentKeyPolicyRestrictionTokenKey. 2825func (ckprtk ContentKeyPolicyRestrictionTokenKey) MarshalJSON() ([]byte, error) { 2826 ckprtk.OdataType = OdataTypeContentKeyPolicyRestrictionTokenKey 2827 objectMap := make(map[string]interface{}) 2828 if ckprtk.OdataType != "" { 2829 objectMap["@odata.type"] = ckprtk.OdataType 2830 } 2831 return json.Marshal(objectMap) 2832} 2833 2834// AsContentKeyPolicySymmetricTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicyRestrictionTokenKey. 2835func (ckprtk ContentKeyPolicyRestrictionTokenKey) AsContentKeyPolicySymmetricTokenKey() (*ContentKeyPolicySymmetricTokenKey, bool) { 2836 return nil, false 2837} 2838 2839// AsContentKeyPolicyRsaTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicyRestrictionTokenKey. 2840func (ckprtk ContentKeyPolicyRestrictionTokenKey) AsContentKeyPolicyRsaTokenKey() (*ContentKeyPolicyRsaTokenKey, bool) { 2841 return nil, false 2842} 2843 2844// AsContentKeyPolicyX509CertificateTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicyRestrictionTokenKey. 2845func (ckprtk ContentKeyPolicyRestrictionTokenKey) AsContentKeyPolicyX509CertificateTokenKey() (*ContentKeyPolicyX509CertificateTokenKey, bool) { 2846 return nil, false 2847} 2848 2849// AsContentKeyPolicyRestrictionTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicyRestrictionTokenKey. 2850func (ckprtk ContentKeyPolicyRestrictionTokenKey) AsContentKeyPolicyRestrictionTokenKey() (*ContentKeyPolicyRestrictionTokenKey, bool) { 2851 return &ckprtk, true 2852} 2853 2854// AsBasicContentKeyPolicyRestrictionTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicyRestrictionTokenKey. 2855func (ckprtk ContentKeyPolicyRestrictionTokenKey) AsBasicContentKeyPolicyRestrictionTokenKey() (BasicContentKeyPolicyRestrictionTokenKey, bool) { 2856 return &ckprtk, true 2857} 2858 2859// ContentKeyPolicyRsaTokenKey specifies a RSA key for token validation 2860type ContentKeyPolicyRsaTokenKey struct { 2861 // Exponent - The RSA Parameter exponent 2862 Exponent *[]byte `json:"exponent,omitempty"` 2863 // Modulus - The RSA Parameter modulus 2864 Modulus *[]byte `json:"modulus,omitempty"` 2865 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyRestrictionTokenKey', 'OdataTypeMicrosoftMediaContentKeyPolicySymmetricTokenKey', 'OdataTypeMicrosoftMediaContentKeyPolicyRsaTokenKey', 'OdataTypeMicrosoftMediaContentKeyPolicyX509CertificateTokenKey' 2866 OdataType OdataTypeBasicContentKeyPolicyRestrictionTokenKey `json:"@odata.type,omitempty"` 2867} 2868 2869// MarshalJSON is the custom marshaler for ContentKeyPolicyRsaTokenKey. 2870func (ckprtk ContentKeyPolicyRsaTokenKey) MarshalJSON() ([]byte, error) { 2871 ckprtk.OdataType = OdataTypeMicrosoftMediaContentKeyPolicyRsaTokenKey 2872 objectMap := make(map[string]interface{}) 2873 if ckprtk.Exponent != nil { 2874 objectMap["exponent"] = ckprtk.Exponent 2875 } 2876 if ckprtk.Modulus != nil { 2877 objectMap["modulus"] = ckprtk.Modulus 2878 } 2879 if ckprtk.OdataType != "" { 2880 objectMap["@odata.type"] = ckprtk.OdataType 2881 } 2882 return json.Marshal(objectMap) 2883} 2884 2885// AsContentKeyPolicySymmetricTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicyRsaTokenKey. 2886func (ckprtk ContentKeyPolicyRsaTokenKey) AsContentKeyPolicySymmetricTokenKey() (*ContentKeyPolicySymmetricTokenKey, bool) { 2887 return nil, false 2888} 2889 2890// AsContentKeyPolicyRsaTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicyRsaTokenKey. 2891func (ckprtk ContentKeyPolicyRsaTokenKey) AsContentKeyPolicyRsaTokenKey() (*ContentKeyPolicyRsaTokenKey, bool) { 2892 return &ckprtk, true 2893} 2894 2895// AsContentKeyPolicyX509CertificateTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicyRsaTokenKey. 2896func (ckprtk ContentKeyPolicyRsaTokenKey) AsContentKeyPolicyX509CertificateTokenKey() (*ContentKeyPolicyX509CertificateTokenKey, bool) { 2897 return nil, false 2898} 2899 2900// AsContentKeyPolicyRestrictionTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicyRsaTokenKey. 2901func (ckprtk ContentKeyPolicyRsaTokenKey) AsContentKeyPolicyRestrictionTokenKey() (*ContentKeyPolicyRestrictionTokenKey, bool) { 2902 return nil, false 2903} 2904 2905// AsBasicContentKeyPolicyRestrictionTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicyRsaTokenKey. 2906func (ckprtk ContentKeyPolicyRsaTokenKey) AsBasicContentKeyPolicyRestrictionTokenKey() (BasicContentKeyPolicyRestrictionTokenKey, bool) { 2907 return &ckprtk, true 2908} 2909 2910// ContentKeyPolicySymmetricTokenKey specifies a symmetric key for token validation. 2911type ContentKeyPolicySymmetricTokenKey struct { 2912 // KeyValue - The key value of the key 2913 KeyValue *[]byte `json:"keyValue,omitempty"` 2914 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyRestrictionTokenKey', 'OdataTypeMicrosoftMediaContentKeyPolicySymmetricTokenKey', 'OdataTypeMicrosoftMediaContentKeyPolicyRsaTokenKey', 'OdataTypeMicrosoftMediaContentKeyPolicyX509CertificateTokenKey' 2915 OdataType OdataTypeBasicContentKeyPolicyRestrictionTokenKey `json:"@odata.type,omitempty"` 2916} 2917 2918// MarshalJSON is the custom marshaler for ContentKeyPolicySymmetricTokenKey. 2919func (ckpstk ContentKeyPolicySymmetricTokenKey) MarshalJSON() ([]byte, error) { 2920 ckpstk.OdataType = OdataTypeMicrosoftMediaContentKeyPolicySymmetricTokenKey 2921 objectMap := make(map[string]interface{}) 2922 if ckpstk.KeyValue != nil { 2923 objectMap["keyValue"] = ckpstk.KeyValue 2924 } 2925 if ckpstk.OdataType != "" { 2926 objectMap["@odata.type"] = ckpstk.OdataType 2927 } 2928 return json.Marshal(objectMap) 2929} 2930 2931// AsContentKeyPolicySymmetricTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicySymmetricTokenKey. 2932func (ckpstk ContentKeyPolicySymmetricTokenKey) AsContentKeyPolicySymmetricTokenKey() (*ContentKeyPolicySymmetricTokenKey, bool) { 2933 return &ckpstk, true 2934} 2935 2936// AsContentKeyPolicyRsaTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicySymmetricTokenKey. 2937func (ckpstk ContentKeyPolicySymmetricTokenKey) AsContentKeyPolicyRsaTokenKey() (*ContentKeyPolicyRsaTokenKey, bool) { 2938 return nil, false 2939} 2940 2941// AsContentKeyPolicyX509CertificateTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicySymmetricTokenKey. 2942func (ckpstk ContentKeyPolicySymmetricTokenKey) AsContentKeyPolicyX509CertificateTokenKey() (*ContentKeyPolicyX509CertificateTokenKey, bool) { 2943 return nil, false 2944} 2945 2946// AsContentKeyPolicyRestrictionTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicySymmetricTokenKey. 2947func (ckpstk ContentKeyPolicySymmetricTokenKey) AsContentKeyPolicyRestrictionTokenKey() (*ContentKeyPolicyRestrictionTokenKey, bool) { 2948 return nil, false 2949} 2950 2951// AsBasicContentKeyPolicyRestrictionTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicySymmetricTokenKey. 2952func (ckpstk ContentKeyPolicySymmetricTokenKey) AsBasicContentKeyPolicyRestrictionTokenKey() (BasicContentKeyPolicyRestrictionTokenKey, bool) { 2953 return &ckpstk, true 2954} 2955 2956// ContentKeyPolicyTokenClaim represents a token claim. 2957type ContentKeyPolicyTokenClaim struct { 2958 // ClaimType - Token claim type. 2959 ClaimType *string `json:"claimType,omitempty"` 2960 // ClaimValue - Token claim value. 2961 ClaimValue *string `json:"claimValue,omitempty"` 2962} 2963 2964// ContentKeyPolicyTokenRestriction represents a token restriction. Provided token must match these 2965// requirements for successful license or key delivery. 2966type ContentKeyPolicyTokenRestriction struct { 2967 // Issuer - The token issuer. 2968 Issuer *string `json:"issuer,omitempty"` 2969 // Audience - The audience for the token. 2970 Audience *string `json:"audience,omitempty"` 2971 // PrimaryVerificationKey - The primary verification key. 2972 PrimaryVerificationKey BasicContentKeyPolicyRestrictionTokenKey `json:"primaryVerificationKey,omitempty"` 2973 // AlternateVerificationKeys - A list of alternative verification keys. 2974 AlternateVerificationKeys *[]BasicContentKeyPolicyRestrictionTokenKey `json:"alternateVerificationKeys,omitempty"` 2975 // RequiredClaims - A list of required token claims. 2976 RequiredClaims *[]ContentKeyPolicyTokenClaim `json:"requiredClaims,omitempty"` 2977 // RestrictionTokenType - The type of token. Possible values include: 'ContentKeyPolicyRestrictionTokenTypeUnknown', 'ContentKeyPolicyRestrictionTokenTypeSwt', 'ContentKeyPolicyRestrictionTokenTypeJwt' 2978 RestrictionTokenType ContentKeyPolicyRestrictionTokenType `json:"restrictionTokenType,omitempty"` 2979 // OpenIDConnectDiscoveryDocument - The OpenID connect discovery document. 2980 OpenIDConnectDiscoveryDocument *string `json:"openIdConnectDiscoveryDocument,omitempty"` 2981 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyRestriction', 'OdataTypeMicrosoftMediaContentKeyPolicyOpenRestriction', 'OdataTypeMicrosoftMediaContentKeyPolicyUnknownRestriction', 'OdataTypeMicrosoftMediaContentKeyPolicyTokenRestriction' 2982 OdataType OdataTypeBasicContentKeyPolicyRestriction `json:"@odata.type,omitempty"` 2983} 2984 2985// MarshalJSON is the custom marshaler for ContentKeyPolicyTokenRestriction. 2986func (ckptr ContentKeyPolicyTokenRestriction) MarshalJSON() ([]byte, error) { 2987 ckptr.OdataType = OdataTypeMicrosoftMediaContentKeyPolicyTokenRestriction 2988 objectMap := make(map[string]interface{}) 2989 if ckptr.Issuer != nil { 2990 objectMap["issuer"] = ckptr.Issuer 2991 } 2992 if ckptr.Audience != nil { 2993 objectMap["audience"] = ckptr.Audience 2994 } 2995 objectMap["primaryVerificationKey"] = ckptr.PrimaryVerificationKey 2996 if ckptr.AlternateVerificationKeys != nil { 2997 objectMap["alternateVerificationKeys"] = ckptr.AlternateVerificationKeys 2998 } 2999 if ckptr.RequiredClaims != nil { 3000 objectMap["requiredClaims"] = ckptr.RequiredClaims 3001 } 3002 if ckptr.RestrictionTokenType != "" { 3003 objectMap["restrictionTokenType"] = ckptr.RestrictionTokenType 3004 } 3005 if ckptr.OpenIDConnectDiscoveryDocument != nil { 3006 objectMap["openIdConnectDiscoveryDocument"] = ckptr.OpenIDConnectDiscoveryDocument 3007 } 3008 if ckptr.OdataType != "" { 3009 objectMap["@odata.type"] = ckptr.OdataType 3010 } 3011 return json.Marshal(objectMap) 3012} 3013 3014// AsContentKeyPolicyOpenRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyTokenRestriction. 3015func (ckptr ContentKeyPolicyTokenRestriction) AsContentKeyPolicyOpenRestriction() (*ContentKeyPolicyOpenRestriction, bool) { 3016 return nil, false 3017} 3018 3019// AsContentKeyPolicyUnknownRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyTokenRestriction. 3020func (ckptr ContentKeyPolicyTokenRestriction) AsContentKeyPolicyUnknownRestriction() (*ContentKeyPolicyUnknownRestriction, bool) { 3021 return nil, false 3022} 3023 3024// AsContentKeyPolicyTokenRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyTokenRestriction. 3025func (ckptr ContentKeyPolicyTokenRestriction) AsContentKeyPolicyTokenRestriction() (*ContentKeyPolicyTokenRestriction, bool) { 3026 return &ckptr, true 3027} 3028 3029// AsContentKeyPolicyRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyTokenRestriction. 3030func (ckptr ContentKeyPolicyTokenRestriction) AsContentKeyPolicyRestriction() (*ContentKeyPolicyRestriction, bool) { 3031 return nil, false 3032} 3033 3034// AsBasicContentKeyPolicyRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyTokenRestriction. 3035func (ckptr ContentKeyPolicyTokenRestriction) AsBasicContentKeyPolicyRestriction() (BasicContentKeyPolicyRestriction, bool) { 3036 return &ckptr, true 3037} 3038 3039// UnmarshalJSON is the custom unmarshaler for ContentKeyPolicyTokenRestriction struct. 3040func (ckptr *ContentKeyPolicyTokenRestriction) UnmarshalJSON(body []byte) error { 3041 var m map[string]*json.RawMessage 3042 err := json.Unmarshal(body, &m) 3043 if err != nil { 3044 return err 3045 } 3046 for k, v := range m { 3047 switch k { 3048 case "issuer": 3049 if v != nil { 3050 var issuer string 3051 err = json.Unmarshal(*v, &issuer) 3052 if err != nil { 3053 return err 3054 } 3055 ckptr.Issuer = &issuer 3056 } 3057 case "audience": 3058 if v != nil { 3059 var audience string 3060 err = json.Unmarshal(*v, &audience) 3061 if err != nil { 3062 return err 3063 } 3064 ckptr.Audience = &audience 3065 } 3066 case "primaryVerificationKey": 3067 if v != nil { 3068 primaryVerificationKey, err := unmarshalBasicContentKeyPolicyRestrictionTokenKey(*v) 3069 if err != nil { 3070 return err 3071 } 3072 ckptr.PrimaryVerificationKey = primaryVerificationKey 3073 } 3074 case "alternateVerificationKeys": 3075 if v != nil { 3076 alternateVerificationKeys, err := unmarshalBasicContentKeyPolicyRestrictionTokenKeyArray(*v) 3077 if err != nil { 3078 return err 3079 } 3080 ckptr.AlternateVerificationKeys = &alternateVerificationKeys 3081 } 3082 case "requiredClaims": 3083 if v != nil { 3084 var requiredClaims []ContentKeyPolicyTokenClaim 3085 err = json.Unmarshal(*v, &requiredClaims) 3086 if err != nil { 3087 return err 3088 } 3089 ckptr.RequiredClaims = &requiredClaims 3090 } 3091 case "restrictionTokenType": 3092 if v != nil { 3093 var restrictionTokenType ContentKeyPolicyRestrictionTokenType 3094 err = json.Unmarshal(*v, &restrictionTokenType) 3095 if err != nil { 3096 return err 3097 } 3098 ckptr.RestrictionTokenType = restrictionTokenType 3099 } 3100 case "openIdConnectDiscoveryDocument": 3101 if v != nil { 3102 var openIDConnectDiscoveryDocument string 3103 err = json.Unmarshal(*v, &openIDConnectDiscoveryDocument) 3104 if err != nil { 3105 return err 3106 } 3107 ckptr.OpenIDConnectDiscoveryDocument = &openIDConnectDiscoveryDocument 3108 } 3109 case "@odata.type": 3110 if v != nil { 3111 var odataType OdataTypeBasicContentKeyPolicyRestriction 3112 err = json.Unmarshal(*v, &odataType) 3113 if err != nil { 3114 return err 3115 } 3116 ckptr.OdataType = odataType 3117 } 3118 } 3119 } 3120 3121 return nil 3122} 3123 3124// ContentKeyPolicyUnknownConfiguration represents a ContentKeyPolicyConfiguration that is unavailable in 3125// the current API version. 3126type ContentKeyPolicyUnknownConfiguration struct { 3127 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyClearKeyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyUnknownConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyWidevineConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyFairPlayConfiguration' 3128 OdataType OdataTypeBasicContentKeyPolicyConfiguration `json:"@odata.type,omitempty"` 3129} 3130 3131// MarshalJSON is the custom marshaler for ContentKeyPolicyUnknownConfiguration. 3132func (ckpuc ContentKeyPolicyUnknownConfiguration) MarshalJSON() ([]byte, error) { 3133 ckpuc.OdataType = OdataTypeMicrosoftMediaContentKeyPolicyUnknownConfiguration 3134 objectMap := make(map[string]interface{}) 3135 if ckpuc.OdataType != "" { 3136 objectMap["@odata.type"] = ckpuc.OdataType 3137 } 3138 return json.Marshal(objectMap) 3139} 3140 3141// AsContentKeyPolicyClearKeyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyUnknownConfiguration. 3142func (ckpuc ContentKeyPolicyUnknownConfiguration) AsContentKeyPolicyClearKeyConfiguration() (*ContentKeyPolicyClearKeyConfiguration, bool) { 3143 return nil, false 3144} 3145 3146// AsContentKeyPolicyUnknownConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyUnknownConfiguration. 3147func (ckpuc ContentKeyPolicyUnknownConfiguration) AsContentKeyPolicyUnknownConfiguration() (*ContentKeyPolicyUnknownConfiguration, bool) { 3148 return &ckpuc, true 3149} 3150 3151// AsContentKeyPolicyWidevineConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyUnknownConfiguration. 3152func (ckpuc ContentKeyPolicyUnknownConfiguration) AsContentKeyPolicyWidevineConfiguration() (*ContentKeyPolicyWidevineConfiguration, bool) { 3153 return nil, false 3154} 3155 3156// AsContentKeyPolicyPlayReadyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyUnknownConfiguration. 3157func (ckpuc ContentKeyPolicyUnknownConfiguration) AsContentKeyPolicyPlayReadyConfiguration() (*ContentKeyPolicyPlayReadyConfiguration, bool) { 3158 return nil, false 3159} 3160 3161// AsContentKeyPolicyFairPlayConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyUnknownConfiguration. 3162func (ckpuc ContentKeyPolicyUnknownConfiguration) AsContentKeyPolicyFairPlayConfiguration() (*ContentKeyPolicyFairPlayConfiguration, bool) { 3163 return nil, false 3164} 3165 3166// AsContentKeyPolicyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyUnknownConfiguration. 3167func (ckpuc ContentKeyPolicyUnknownConfiguration) AsContentKeyPolicyConfiguration() (*ContentKeyPolicyConfiguration, bool) { 3168 return nil, false 3169} 3170 3171// AsBasicContentKeyPolicyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyUnknownConfiguration. 3172func (ckpuc ContentKeyPolicyUnknownConfiguration) AsBasicContentKeyPolicyConfiguration() (BasicContentKeyPolicyConfiguration, bool) { 3173 return &ckpuc, true 3174} 3175 3176// ContentKeyPolicyUnknownRestriction represents a ContentKeyPolicyRestriction that is unavailable in the 3177// current API version. 3178type ContentKeyPolicyUnknownRestriction struct { 3179 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyRestriction', 'OdataTypeMicrosoftMediaContentKeyPolicyOpenRestriction', 'OdataTypeMicrosoftMediaContentKeyPolicyUnknownRestriction', 'OdataTypeMicrosoftMediaContentKeyPolicyTokenRestriction' 3180 OdataType OdataTypeBasicContentKeyPolicyRestriction `json:"@odata.type,omitempty"` 3181} 3182 3183// MarshalJSON is the custom marshaler for ContentKeyPolicyUnknownRestriction. 3184func (ckpur ContentKeyPolicyUnknownRestriction) MarshalJSON() ([]byte, error) { 3185 ckpur.OdataType = OdataTypeMicrosoftMediaContentKeyPolicyUnknownRestriction 3186 objectMap := make(map[string]interface{}) 3187 if ckpur.OdataType != "" { 3188 objectMap["@odata.type"] = ckpur.OdataType 3189 } 3190 return json.Marshal(objectMap) 3191} 3192 3193// AsContentKeyPolicyOpenRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyUnknownRestriction. 3194func (ckpur ContentKeyPolicyUnknownRestriction) AsContentKeyPolicyOpenRestriction() (*ContentKeyPolicyOpenRestriction, bool) { 3195 return nil, false 3196} 3197 3198// AsContentKeyPolicyUnknownRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyUnknownRestriction. 3199func (ckpur ContentKeyPolicyUnknownRestriction) AsContentKeyPolicyUnknownRestriction() (*ContentKeyPolicyUnknownRestriction, bool) { 3200 return &ckpur, true 3201} 3202 3203// AsContentKeyPolicyTokenRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyUnknownRestriction. 3204func (ckpur ContentKeyPolicyUnknownRestriction) AsContentKeyPolicyTokenRestriction() (*ContentKeyPolicyTokenRestriction, bool) { 3205 return nil, false 3206} 3207 3208// AsContentKeyPolicyRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyUnknownRestriction. 3209func (ckpur ContentKeyPolicyUnknownRestriction) AsContentKeyPolicyRestriction() (*ContentKeyPolicyRestriction, bool) { 3210 return nil, false 3211} 3212 3213// AsBasicContentKeyPolicyRestriction is the BasicContentKeyPolicyRestriction implementation for ContentKeyPolicyUnknownRestriction. 3214func (ckpur ContentKeyPolicyUnknownRestriction) AsBasicContentKeyPolicyRestriction() (BasicContentKeyPolicyRestriction, bool) { 3215 return &ckpur, true 3216} 3217 3218// ContentKeyPolicyWidevineConfiguration specifies a configuration for Widevine licenses. 3219type ContentKeyPolicyWidevineConfiguration struct { 3220 // WidevineTemplate - The Widevine template. 3221 WidevineTemplate *string `json:"widevineTemplate,omitempty"` 3222 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyClearKeyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyUnknownConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyWidevineConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyConfiguration', 'OdataTypeMicrosoftMediaContentKeyPolicyFairPlayConfiguration' 3223 OdataType OdataTypeBasicContentKeyPolicyConfiguration `json:"@odata.type,omitempty"` 3224} 3225 3226// MarshalJSON is the custom marshaler for ContentKeyPolicyWidevineConfiguration. 3227func (ckpwc ContentKeyPolicyWidevineConfiguration) MarshalJSON() ([]byte, error) { 3228 ckpwc.OdataType = OdataTypeMicrosoftMediaContentKeyPolicyWidevineConfiguration 3229 objectMap := make(map[string]interface{}) 3230 if ckpwc.WidevineTemplate != nil { 3231 objectMap["widevineTemplate"] = ckpwc.WidevineTemplate 3232 } 3233 if ckpwc.OdataType != "" { 3234 objectMap["@odata.type"] = ckpwc.OdataType 3235 } 3236 return json.Marshal(objectMap) 3237} 3238 3239// AsContentKeyPolicyClearKeyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyWidevineConfiguration. 3240func (ckpwc ContentKeyPolicyWidevineConfiguration) AsContentKeyPolicyClearKeyConfiguration() (*ContentKeyPolicyClearKeyConfiguration, bool) { 3241 return nil, false 3242} 3243 3244// AsContentKeyPolicyUnknownConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyWidevineConfiguration. 3245func (ckpwc ContentKeyPolicyWidevineConfiguration) AsContentKeyPolicyUnknownConfiguration() (*ContentKeyPolicyUnknownConfiguration, bool) { 3246 return nil, false 3247} 3248 3249// AsContentKeyPolicyWidevineConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyWidevineConfiguration. 3250func (ckpwc ContentKeyPolicyWidevineConfiguration) AsContentKeyPolicyWidevineConfiguration() (*ContentKeyPolicyWidevineConfiguration, bool) { 3251 return &ckpwc, true 3252} 3253 3254// AsContentKeyPolicyPlayReadyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyWidevineConfiguration. 3255func (ckpwc ContentKeyPolicyWidevineConfiguration) AsContentKeyPolicyPlayReadyConfiguration() (*ContentKeyPolicyPlayReadyConfiguration, bool) { 3256 return nil, false 3257} 3258 3259// AsContentKeyPolicyFairPlayConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyWidevineConfiguration. 3260func (ckpwc ContentKeyPolicyWidevineConfiguration) AsContentKeyPolicyFairPlayConfiguration() (*ContentKeyPolicyFairPlayConfiguration, bool) { 3261 return nil, false 3262} 3263 3264// AsContentKeyPolicyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyWidevineConfiguration. 3265func (ckpwc ContentKeyPolicyWidevineConfiguration) AsContentKeyPolicyConfiguration() (*ContentKeyPolicyConfiguration, bool) { 3266 return nil, false 3267} 3268 3269// AsBasicContentKeyPolicyConfiguration is the BasicContentKeyPolicyConfiguration implementation for ContentKeyPolicyWidevineConfiguration. 3270func (ckpwc ContentKeyPolicyWidevineConfiguration) AsBasicContentKeyPolicyConfiguration() (BasicContentKeyPolicyConfiguration, bool) { 3271 return &ckpwc, true 3272} 3273 3274// ContentKeyPolicyX509CertificateTokenKey specifies a certificate for token validation. 3275type ContentKeyPolicyX509CertificateTokenKey struct { 3276 // RawBody - The raw data field of a certificate in PKCS 12 format (X509Certificate2 in .NET) 3277 RawBody *[]byte `json:"rawBody,omitempty"` 3278 // OdataType - Possible values include: 'OdataTypeContentKeyPolicyRestrictionTokenKey', 'OdataTypeMicrosoftMediaContentKeyPolicySymmetricTokenKey', 'OdataTypeMicrosoftMediaContentKeyPolicyRsaTokenKey', 'OdataTypeMicrosoftMediaContentKeyPolicyX509CertificateTokenKey' 3279 OdataType OdataTypeBasicContentKeyPolicyRestrictionTokenKey `json:"@odata.type,omitempty"` 3280} 3281 3282// MarshalJSON is the custom marshaler for ContentKeyPolicyX509CertificateTokenKey. 3283func (ckpxctk ContentKeyPolicyX509CertificateTokenKey) MarshalJSON() ([]byte, error) { 3284 ckpxctk.OdataType = OdataTypeMicrosoftMediaContentKeyPolicyX509CertificateTokenKey 3285 objectMap := make(map[string]interface{}) 3286 if ckpxctk.RawBody != nil { 3287 objectMap["rawBody"] = ckpxctk.RawBody 3288 } 3289 if ckpxctk.OdataType != "" { 3290 objectMap["@odata.type"] = ckpxctk.OdataType 3291 } 3292 return json.Marshal(objectMap) 3293} 3294 3295// AsContentKeyPolicySymmetricTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicyX509CertificateTokenKey. 3296func (ckpxctk ContentKeyPolicyX509CertificateTokenKey) AsContentKeyPolicySymmetricTokenKey() (*ContentKeyPolicySymmetricTokenKey, bool) { 3297 return nil, false 3298} 3299 3300// AsContentKeyPolicyRsaTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicyX509CertificateTokenKey. 3301func (ckpxctk ContentKeyPolicyX509CertificateTokenKey) AsContentKeyPolicyRsaTokenKey() (*ContentKeyPolicyRsaTokenKey, bool) { 3302 return nil, false 3303} 3304 3305// AsContentKeyPolicyX509CertificateTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicyX509CertificateTokenKey. 3306func (ckpxctk ContentKeyPolicyX509CertificateTokenKey) AsContentKeyPolicyX509CertificateTokenKey() (*ContentKeyPolicyX509CertificateTokenKey, bool) { 3307 return &ckpxctk, true 3308} 3309 3310// AsContentKeyPolicyRestrictionTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicyX509CertificateTokenKey. 3311func (ckpxctk ContentKeyPolicyX509CertificateTokenKey) AsContentKeyPolicyRestrictionTokenKey() (*ContentKeyPolicyRestrictionTokenKey, bool) { 3312 return nil, false 3313} 3314 3315// AsBasicContentKeyPolicyRestrictionTokenKey is the BasicContentKeyPolicyRestrictionTokenKey implementation for ContentKeyPolicyX509CertificateTokenKey. 3316func (ckpxctk ContentKeyPolicyX509CertificateTokenKey) AsBasicContentKeyPolicyRestrictionTokenKey() (BasicContentKeyPolicyRestrictionTokenKey, bool) { 3317 return &ckpxctk, true 3318} 3319 3320// CopyAudio a codec flag, which tells the encoder to copy the input audio bitstream. 3321type CopyAudio struct { 3322 // Label - An optional label for the codec. The label can be used to control muxing behavior. 3323 Label *string `json:"label,omitempty"` 3324 // OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage' 3325 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"` 3326} 3327 3328// MarshalJSON is the custom marshaler for CopyAudio. 3329func (ca CopyAudio) MarshalJSON() ([]byte, error) { 3330 ca.OdataType = OdataTypeMicrosoftMediaCopyAudio 3331 objectMap := make(map[string]interface{}) 3332 if ca.Label != nil { 3333 objectMap["label"] = ca.Label 3334 } 3335 if ca.OdataType != "" { 3336 objectMap["@odata.type"] = ca.OdataType 3337 } 3338 return json.Marshal(objectMap) 3339} 3340 3341// AsAudio is the BasicCodec implementation for CopyAudio. 3342func (ca CopyAudio) AsAudio() (*Audio, bool) { 3343 return nil, false 3344} 3345 3346// AsBasicAudio is the BasicCodec implementation for CopyAudio. 3347func (ca CopyAudio) AsBasicAudio() (BasicAudio, bool) { 3348 return nil, false 3349} 3350 3351// AsAacAudio is the BasicCodec implementation for CopyAudio. 3352func (ca CopyAudio) AsAacAudio() (*AacAudio, bool) { 3353 return nil, false 3354} 3355 3356// AsCopyVideo is the BasicCodec implementation for CopyAudio. 3357func (ca CopyAudio) AsCopyVideo() (*CopyVideo, bool) { 3358 return nil, false 3359} 3360 3361// AsVideo is the BasicCodec implementation for CopyAudio. 3362func (ca CopyAudio) AsVideo() (*Video, bool) { 3363 return nil, false 3364} 3365 3366// AsBasicVideo is the BasicCodec implementation for CopyAudio. 3367func (ca CopyAudio) AsBasicVideo() (BasicVideo, bool) { 3368 return nil, false 3369} 3370 3371// AsImage is the BasicCodec implementation for CopyAudio. 3372func (ca CopyAudio) AsImage() (*Image, bool) { 3373 return nil, false 3374} 3375 3376// AsBasicImage is the BasicCodec implementation for CopyAudio. 3377func (ca CopyAudio) AsBasicImage() (BasicImage, bool) { 3378 return nil, false 3379} 3380 3381// AsCopyAudio is the BasicCodec implementation for CopyAudio. 3382func (ca CopyAudio) AsCopyAudio() (*CopyAudio, bool) { 3383 return &ca, true 3384} 3385 3386// AsH264Video is the BasicCodec implementation for CopyAudio. 3387func (ca CopyAudio) AsH264Video() (*H264Video, bool) { 3388 return nil, false 3389} 3390 3391// AsJpgImage is the BasicCodec implementation for CopyAudio. 3392func (ca CopyAudio) AsJpgImage() (*JpgImage, bool) { 3393 return nil, false 3394} 3395 3396// AsPngImage is the BasicCodec implementation for CopyAudio. 3397func (ca CopyAudio) AsPngImage() (*PngImage, bool) { 3398 return nil, false 3399} 3400 3401// AsCodec is the BasicCodec implementation for CopyAudio. 3402func (ca CopyAudio) AsCodec() (*Codec, bool) { 3403 return nil, false 3404} 3405 3406// AsBasicCodec is the BasicCodec implementation for CopyAudio. 3407func (ca CopyAudio) AsBasicCodec() (BasicCodec, bool) { 3408 return &ca, true 3409} 3410 3411// CopyVideo a codec flag, which tells the encoder to copy the input video bitstream without re-encoding. 3412type CopyVideo struct { 3413 // Label - An optional label for the codec. The label can be used to control muxing behavior. 3414 Label *string `json:"label,omitempty"` 3415 // OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage' 3416 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"` 3417} 3418 3419// MarshalJSON is the custom marshaler for CopyVideo. 3420func (cv CopyVideo) MarshalJSON() ([]byte, error) { 3421 cv.OdataType = OdataTypeMicrosoftMediaCopyVideo 3422 objectMap := make(map[string]interface{}) 3423 if cv.Label != nil { 3424 objectMap["label"] = cv.Label 3425 } 3426 if cv.OdataType != "" { 3427 objectMap["@odata.type"] = cv.OdataType 3428 } 3429 return json.Marshal(objectMap) 3430} 3431 3432// AsAudio is the BasicCodec implementation for CopyVideo. 3433func (cv CopyVideo) AsAudio() (*Audio, bool) { 3434 return nil, false 3435} 3436 3437// AsBasicAudio is the BasicCodec implementation for CopyVideo. 3438func (cv CopyVideo) AsBasicAudio() (BasicAudio, bool) { 3439 return nil, false 3440} 3441 3442// AsAacAudio is the BasicCodec implementation for CopyVideo. 3443func (cv CopyVideo) AsAacAudio() (*AacAudio, bool) { 3444 return nil, false 3445} 3446 3447// AsCopyVideo is the BasicCodec implementation for CopyVideo. 3448func (cv CopyVideo) AsCopyVideo() (*CopyVideo, bool) { 3449 return &cv, true 3450} 3451 3452// AsVideo is the BasicCodec implementation for CopyVideo. 3453func (cv CopyVideo) AsVideo() (*Video, bool) { 3454 return nil, false 3455} 3456 3457// AsBasicVideo is the BasicCodec implementation for CopyVideo. 3458func (cv CopyVideo) AsBasicVideo() (BasicVideo, bool) { 3459 return nil, false 3460} 3461 3462// AsImage is the BasicCodec implementation for CopyVideo. 3463func (cv CopyVideo) AsImage() (*Image, bool) { 3464 return nil, false 3465} 3466 3467// AsBasicImage is the BasicCodec implementation for CopyVideo. 3468func (cv CopyVideo) AsBasicImage() (BasicImage, bool) { 3469 return nil, false 3470} 3471 3472// AsCopyAudio is the BasicCodec implementation for CopyVideo. 3473func (cv CopyVideo) AsCopyAudio() (*CopyAudio, bool) { 3474 return nil, false 3475} 3476 3477// AsH264Video is the BasicCodec implementation for CopyVideo. 3478func (cv CopyVideo) AsH264Video() (*H264Video, bool) { 3479 return nil, false 3480} 3481 3482// AsJpgImage is the BasicCodec implementation for CopyVideo. 3483func (cv CopyVideo) AsJpgImage() (*JpgImage, bool) { 3484 return nil, false 3485} 3486 3487// AsPngImage is the BasicCodec implementation for CopyVideo. 3488func (cv CopyVideo) AsPngImage() (*PngImage, bool) { 3489 return nil, false 3490} 3491 3492// AsCodec is the BasicCodec implementation for CopyVideo. 3493func (cv CopyVideo) AsCodec() (*Codec, bool) { 3494 return nil, false 3495} 3496 3497// AsBasicCodec is the BasicCodec implementation for CopyVideo. 3498func (cv CopyVideo) AsBasicCodec() (BasicCodec, bool) { 3499 return &cv, true 3500} 3501 3502// CrossSiteAccessPolicies the client access policy. 3503type CrossSiteAccessPolicies struct { 3504 // ClientAccessPolicy - The content of clientaccesspolicy.xml used by Silverlight. 3505 ClientAccessPolicy *string `json:"clientAccessPolicy,omitempty"` 3506 // CrossDomainPolicy - The content of crossdomain.xml used by Silverlight. 3507 CrossDomainPolicy *string `json:"crossDomainPolicy,omitempty"` 3508} 3509 3510// DefaultKey class to specify properties of default content key for each encryption scheme 3511type DefaultKey struct { 3512 // Label - Label can be used to specify Content Key when creating a Streaming Locator 3513 Label *string `json:"label,omitempty"` 3514 // PolicyName - Policy used by Default Key 3515 PolicyName *string `json:"policyName,omitempty"` 3516} 3517 3518// Deinterlace describes the de-interlacing settings. 3519type Deinterlace struct { 3520 // Parity - The field parity for de-interlacing, defaults to Auto. Possible values include: 'Auto', 'TopFieldFirst', 'BottomFieldFirst' 3521 Parity DeinterlaceParity `json:"parity,omitempty"` 3522 // Mode - The deinterlacing mode. Defaults to AutoPixelAdaptive. Possible values include: 'Off', 'AutoPixelAdaptive' 3523 Mode DeinterlaceMode `json:"mode,omitempty"` 3524} 3525 3526// EnabledProtocols class to specify which protocols are enabled 3527type EnabledProtocols struct { 3528 // Download - Enable Download protocol or not 3529 Download *bool `json:"download,omitempty"` 3530 // Dash - Enable DASH protocol or not 3531 Dash *bool `json:"dash,omitempty"` 3532 // Hls - Enable HLS protocol or not 3533 Hls *bool `json:"hls,omitempty"` 3534 // SmoothStreaming - Enable SmoothStreaming protocol or not 3535 SmoothStreaming *bool `json:"smoothStreaming,omitempty"` 3536} 3537 3538// EntityNameAvailabilityCheckOutput the response from the check name availability request. 3539type EntityNameAvailabilityCheckOutput struct { 3540 autorest.Response `json:"-"` 3541 // NameAvailable - Specifies if the name is available. 3542 NameAvailable *bool `json:"nameAvailable,omitempty"` 3543 // Reason - Specifies the reason if the name is not available. 3544 Reason *string `json:"reason,omitempty"` 3545 // Message - Specifies the detailed reason if the name is not available. 3546 Message *string `json:"message,omitempty"` 3547} 3548 3549// EnvelopeEncryption class for EnvelopeEncryption encryption scheme 3550type EnvelopeEncryption struct { 3551 // EnabledProtocols - Representing supported protocols 3552 EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"` 3553 // ClearTracks - Representing which tracks should not be encrypted 3554 ClearTracks *[]TrackSelection `json:"clearTracks,omitempty"` 3555 // ContentKeys - Representing default content key for each encryption scheme and separate content keys for specific tracks 3556 ContentKeys *StreamingPolicyContentKeys `json:"contentKeys,omitempty"` 3557 // CustomKeyAcquisitionURLTemplate - Template for the URL of the custom service delivering keys to end user players. Not required when using Azure Media Services for issuing keys. The template supports replaceable tokens that the service will update at runtime with the value specific to the request. The currently supported token values are {AlternativeMediaId}, which is replaced with the value of StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of identifier of the key being requested. 3558 CustomKeyAcquisitionURLTemplate *string `json:"customKeyAcquisitionUrlTemplate,omitempty"` 3559} 3560 3561// FaceDetectorPreset describes all the settings to be used when analyzing a video in order to detect all 3562// the faces present. 3563type FaceDetectorPreset struct { 3564 // Resolution - Specifies the maximum resolution at which your video is analyzed. The default behavior is "SourceResolution," which will keep the input video at its original resolution when analyzed. Using "StandardDefinition" will resize input videos to standard definition while preserving the appropriate aspect ratio. It will only resize if the video is of higher resolution. For example, a 1920x1080 input would be scaled to 640x360 before processing. Switching to "StandardDefinition" will reduce the time it takes to process high resolution video. It may also reduce the cost of using this component (see https://azure.microsoft.com/en-us/pricing/details/media-services/#analytics for details). However, faces that end up being too small in the resized video may not be detected. Possible values include: 'SourceResolution', 'StandardDefinition' 3565 Resolution AnalysisResolution `json:"resolution,omitempty"` 3566 // OdataType - Possible values include: 'OdataTypePreset', 'OdataTypeMicrosoftMediaFaceDetectorPreset', 'OdataTypeMicrosoftMediaAudioAnalyzerPreset', 'OdataTypeMicrosoftMediaBuiltInStandardEncoderPreset', 'OdataTypeMicrosoftMediaStandardEncoderPreset', 'OdataTypeMicrosoftMediaVideoAnalyzerPreset' 3567 OdataType OdataTypeBasicPreset `json:"@odata.type,omitempty"` 3568} 3569 3570// MarshalJSON is the custom marshaler for FaceDetectorPreset. 3571func (fdp FaceDetectorPreset) MarshalJSON() ([]byte, error) { 3572 fdp.OdataType = OdataTypeMicrosoftMediaFaceDetectorPreset 3573 objectMap := make(map[string]interface{}) 3574 if fdp.Resolution != "" { 3575 objectMap["resolution"] = fdp.Resolution 3576 } 3577 if fdp.OdataType != "" { 3578 objectMap["@odata.type"] = fdp.OdataType 3579 } 3580 return json.Marshal(objectMap) 3581} 3582 3583// AsFaceDetectorPreset is the BasicPreset implementation for FaceDetectorPreset. 3584func (fdp FaceDetectorPreset) AsFaceDetectorPreset() (*FaceDetectorPreset, bool) { 3585 return &fdp, true 3586} 3587 3588// AsAudioAnalyzerPreset is the BasicPreset implementation for FaceDetectorPreset. 3589func (fdp FaceDetectorPreset) AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) { 3590 return nil, false 3591} 3592 3593// AsBasicAudioAnalyzerPreset is the BasicPreset implementation for FaceDetectorPreset. 3594func (fdp FaceDetectorPreset) AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) { 3595 return nil, false 3596} 3597 3598// AsBuiltInStandardEncoderPreset is the BasicPreset implementation for FaceDetectorPreset. 3599func (fdp FaceDetectorPreset) AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) { 3600 return nil, false 3601} 3602 3603// AsStandardEncoderPreset is the BasicPreset implementation for FaceDetectorPreset. 3604func (fdp FaceDetectorPreset) AsStandardEncoderPreset() (*StandardEncoderPreset, bool) { 3605 return nil, false 3606} 3607 3608// AsVideoAnalyzerPreset is the BasicPreset implementation for FaceDetectorPreset. 3609func (fdp FaceDetectorPreset) AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) { 3610 return nil, false 3611} 3612 3613// AsPreset is the BasicPreset implementation for FaceDetectorPreset. 3614func (fdp FaceDetectorPreset) AsPreset() (*Preset, bool) { 3615 return nil, false 3616} 3617 3618// AsBasicPreset is the BasicPreset implementation for FaceDetectorPreset. 3619func (fdp FaceDetectorPreset) AsBasicPreset() (BasicPreset, bool) { 3620 return &fdp, true 3621} 3622 3623// FilterProperties the Media Filter properties. 3624type FilterProperties struct { 3625 // PresentationTimeRange - The presentation time range. 3626 PresentationTimeRange *PresentationTimeRange `json:"presentationTimeRange,omitempty"` 3627 // FirstQuality - The first quality. 3628 FirstQuality *FirstQuality `json:"firstQuality,omitempty"` 3629 // Tracks - The tracks selection conditions. 3630 Tracks *[]FilterTrackSelection `json:"tracks,omitempty"` 3631} 3632 3633// Filters describes all the filtering operations, such as de-interlacing, rotation etc. that are to be 3634// applied to the input media before encoding. 3635type Filters struct { 3636 // Deinterlace - The de-interlacing settings. 3637 Deinterlace *Deinterlace `json:"deinterlace,omitempty"` 3638 // Rotation - The rotation, if any, to be applied to the input video, before it is encoded. Default is Auto. Possible values include: 'RotationAuto', 'RotationNone', 'RotationRotate0', 'RotationRotate90', 'RotationRotate180', 'RotationRotate270' 3639 Rotation Rotation `json:"rotation,omitempty"` 3640 // Crop - The parameters for the rectangular window with which to crop the input video. 3641 Crop *Rectangle `json:"crop,omitempty"` 3642 // Overlays - The properties of overlays to be applied to the input video. These could be audio, image or video overlays. 3643 Overlays *[]BasicOverlay `json:"overlays,omitempty"` 3644} 3645 3646// UnmarshalJSON is the custom unmarshaler for Filters struct. 3647func (f *Filters) UnmarshalJSON(body []byte) error { 3648 var m map[string]*json.RawMessage 3649 err := json.Unmarshal(body, &m) 3650 if err != nil { 3651 return err 3652 } 3653 for k, v := range m { 3654 switch k { 3655 case "deinterlace": 3656 if v != nil { 3657 var deinterlace Deinterlace 3658 err = json.Unmarshal(*v, &deinterlace) 3659 if err != nil { 3660 return err 3661 } 3662 f.Deinterlace = &deinterlace 3663 } 3664 case "rotation": 3665 if v != nil { 3666 var rotation Rotation 3667 err = json.Unmarshal(*v, &rotation) 3668 if err != nil { 3669 return err 3670 } 3671 f.Rotation = rotation 3672 } 3673 case "crop": 3674 if v != nil { 3675 var crop Rectangle 3676 err = json.Unmarshal(*v, &crop) 3677 if err != nil { 3678 return err 3679 } 3680 f.Crop = &crop 3681 } 3682 case "overlays": 3683 if v != nil { 3684 overlays, err := unmarshalBasicOverlayArray(*v) 3685 if err != nil { 3686 return err 3687 } 3688 f.Overlays = &overlays 3689 } 3690 } 3691 } 3692 3693 return nil 3694} 3695 3696// FilterTrackPropertyCondition the class to specify one track property condition. 3697type FilterTrackPropertyCondition struct { 3698 // Property - The track property type. Possible values include: 'FilterTrackPropertyTypeUnknown', 'FilterTrackPropertyTypeType', 'FilterTrackPropertyTypeName', 'FilterTrackPropertyTypeLanguage', 'FilterTrackPropertyTypeFourCC', 'FilterTrackPropertyTypeBitrate' 3699 Property FilterTrackPropertyType `json:"property,omitempty"` 3700 // Value - The track property value. 3701 Value *string `json:"value,omitempty"` 3702 // Operation - The track property condition operation. Possible values include: 'Equal', 'NotEqual' 3703 Operation FilterTrackPropertyCompareOperation `json:"operation,omitempty"` 3704} 3705 3706// FilterTrackSelection representing a list of FilterTrackPropertyConditions to select a track. The 3707// filters are combined using a logical AND operation. 3708type FilterTrackSelection struct { 3709 // TrackSelections - The track selections. 3710 TrackSelections *[]FilterTrackPropertyCondition `json:"trackSelections,omitempty"` 3711} 3712 3713// FirstQuality filter First Quality 3714type FirstQuality struct { 3715 // Bitrate - The first quality bitrate. 3716 Bitrate *int32 `json:"bitrate,omitempty"` 3717} 3718 3719// BasicFormat base class for output. 3720type BasicFormat interface { 3721 AsImageFormat() (*ImageFormat, bool) 3722 AsBasicImageFormat() (BasicImageFormat, bool) 3723 AsJpgFormat() (*JpgFormat, bool) 3724 AsPngFormat() (*PngFormat, bool) 3725 AsMultiBitrateFormat() (*MultiBitrateFormat, bool) 3726 AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) 3727 AsMp4Format() (*Mp4Format, bool) 3728 AsTransportStreamFormat() (*TransportStreamFormat, bool) 3729 AsFormat() (*Format, bool) 3730} 3731 3732// Format base class for output. 3733type Format struct { 3734 // FilenamePattern - The pattern of the file names for the generated output files. The following macros are supported in the file name: {Basename} - The base name of the input video {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. Any unsubstituted macros will be collapsed and removed from the filename. 3735 FilenamePattern *string `json:"filenamePattern,omitempty"` 3736 // OdataType - Possible values include: 'OdataTypeFormat', 'OdataTypeMicrosoftMediaImageFormat', 'OdataTypeMicrosoftMediaJpgFormat', 'OdataTypeMicrosoftMediaPngFormat', 'OdataTypeMicrosoftMediaMultiBitrateFormat', 'OdataTypeMicrosoftMediaMp4Format', 'OdataTypeMicrosoftMediaTransportStreamFormat' 3737 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"` 3738} 3739 3740func unmarshalBasicFormat(body []byte) (BasicFormat, error) { 3741 var m map[string]interface{} 3742 err := json.Unmarshal(body, &m) 3743 if err != nil { 3744 return nil, err 3745 } 3746 3747 switch m["@odata.type"] { 3748 case string(OdataTypeMicrosoftMediaImageFormat): 3749 var ifVar ImageFormat 3750 err := json.Unmarshal(body, &ifVar) 3751 return ifVar, err 3752 case string(OdataTypeMicrosoftMediaJpgFormat): 3753 var jf JpgFormat 3754 err := json.Unmarshal(body, &jf) 3755 return jf, err 3756 case string(OdataTypeMicrosoftMediaPngFormat): 3757 var pf PngFormat 3758 err := json.Unmarshal(body, &pf) 3759 return pf, err 3760 case string(OdataTypeMicrosoftMediaMultiBitrateFormat): 3761 var mbf MultiBitrateFormat 3762 err := json.Unmarshal(body, &mbf) 3763 return mbf, err 3764 case string(OdataTypeMicrosoftMediaMp4Format): 3765 var m4f Mp4Format 3766 err := json.Unmarshal(body, &m4f) 3767 return m4f, err 3768 case string(OdataTypeMicrosoftMediaTransportStreamFormat): 3769 var tsf TransportStreamFormat 3770 err := json.Unmarshal(body, &tsf) 3771 return tsf, err 3772 default: 3773 var f Format 3774 err := json.Unmarshal(body, &f) 3775 return f, err 3776 } 3777} 3778func unmarshalBasicFormatArray(body []byte) ([]BasicFormat, error) { 3779 var rawMessages []*json.RawMessage 3780 err := json.Unmarshal(body, &rawMessages) 3781 if err != nil { 3782 return nil, err 3783 } 3784 3785 fArray := make([]BasicFormat, len(rawMessages)) 3786 3787 for index, rawMessage := range rawMessages { 3788 f, err := unmarshalBasicFormat(*rawMessage) 3789 if err != nil { 3790 return nil, err 3791 } 3792 fArray[index] = f 3793 } 3794 return fArray, nil 3795} 3796 3797// MarshalJSON is the custom marshaler for Format. 3798func (f Format) MarshalJSON() ([]byte, error) { 3799 f.OdataType = OdataTypeFormat 3800 objectMap := make(map[string]interface{}) 3801 if f.FilenamePattern != nil { 3802 objectMap["filenamePattern"] = f.FilenamePattern 3803 } 3804 if f.OdataType != "" { 3805 objectMap["@odata.type"] = f.OdataType 3806 } 3807 return json.Marshal(objectMap) 3808} 3809 3810// AsImageFormat is the BasicFormat implementation for Format. 3811func (f Format) AsImageFormat() (*ImageFormat, bool) { 3812 return nil, false 3813} 3814 3815// AsBasicImageFormat is the BasicFormat implementation for Format. 3816func (f Format) AsBasicImageFormat() (BasicImageFormat, bool) { 3817 return nil, false 3818} 3819 3820// AsJpgFormat is the BasicFormat implementation for Format. 3821func (f Format) AsJpgFormat() (*JpgFormat, bool) { 3822 return nil, false 3823} 3824 3825// AsPngFormat is the BasicFormat implementation for Format. 3826func (f Format) AsPngFormat() (*PngFormat, bool) { 3827 return nil, false 3828} 3829 3830// AsMultiBitrateFormat is the BasicFormat implementation for Format. 3831func (f Format) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) { 3832 return nil, false 3833} 3834 3835// AsBasicMultiBitrateFormat is the BasicFormat implementation for Format. 3836func (f Format) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) { 3837 return nil, false 3838} 3839 3840// AsMp4Format is the BasicFormat implementation for Format. 3841func (f Format) AsMp4Format() (*Mp4Format, bool) { 3842 return nil, false 3843} 3844 3845// AsTransportStreamFormat is the BasicFormat implementation for Format. 3846func (f Format) AsTransportStreamFormat() (*TransportStreamFormat, bool) { 3847 return nil, false 3848} 3849 3850// AsFormat is the BasicFormat implementation for Format. 3851func (f Format) AsFormat() (*Format, bool) { 3852 return &f, true 3853} 3854 3855// AsBasicFormat is the BasicFormat implementation for Format. 3856func (f Format) AsBasicFormat() (BasicFormat, bool) { 3857 return &f, true 3858} 3859 3860// H264Layer describes the settings to be used when encoding the input video into a desired output bitrate 3861// layer with the H.264 video codec. 3862type H264Layer struct { 3863 // Profile - We currently support Baseline, Main, High, High422, High444. Default is Auto. Possible values include: 'H264VideoProfileAuto', 'H264VideoProfileBaseline', 'H264VideoProfileMain', 'H264VideoProfileHigh', 'H264VideoProfileHigh422', 'H264VideoProfileHigh444' 3864 Profile H264VideoProfile `json:"profile,omitempty"` 3865 // Level - We currently support Level up to 6.2. The value can be Auto, or a number that matches the H.264 profile. If not specified, the default is Auto, which lets the encoder choose the Level that is appropriate for this layer. 3866 Level *string `json:"level,omitempty"` 3867 // BufferWindow - The VBV buffer window length. The value should be in ISO 8601 format. The value should be in the range [0.1-100] seconds. The default is 5 seconds (for example, PT5S). 3868 BufferWindow *string `json:"bufferWindow,omitempty"` 3869 // ReferenceFrames - The number of reference frames to be used when encoding this layer. If not specified, the encoder determines an appropriate number based on the encoder complexity setting. 3870 ReferenceFrames *int32 `json:"referenceFrames,omitempty"` 3871 // EntropyMode - The entropy mode to be used for this layer. If not specified, the encoder chooses the mode that is appropriate for the profile and level. Possible values include: 'Cabac', 'Cavlc' 3872 EntropyMode EntropyMode `json:"entropyMode,omitempty"` 3873 // Bitrate - The average bitrate in bits per second at which to encode the input video when generating this layer. This is a required field. 3874 Bitrate *int32 `json:"bitrate,omitempty"` 3875 // MaxBitrate - The maximum bitrate (in bits per second), at which the VBV buffer should be assumed to refill. If not specified, defaults to the same value as bitrate. 3876 MaxBitrate *int32 `json:"maxBitrate,omitempty"` 3877 // BFrames - The number of B-frames to be used when encoding this layer. If not specified, the encoder chooses an appropriate number based on the video profile and level. 3878 BFrames *int32 `json:"bFrames,omitempty"` 3879 // FrameRate - The frame rate (in frames per second) at which to encode this layer. The value can be in the form of M/N where M and N are integers (For example, 30000/1001), or in the form of a number (For example, 30, or 29.97). The encoder enforces constraints on allowed frame rates based on the profile and level. If it is not specified, the encoder will use the same frame rate as the input video. 3880 FrameRate *string `json:"frameRate,omitempty"` 3881 // Slices - The number of slices to be used when encoding this layer. If not specified, default is zero, which means that encoder will use a single slice for each frame. 3882 Slices *int32 `json:"slices,omitempty"` 3883 // AdaptiveBFrame - Whether or not adaptive B-frames are to be used when encoding this layer. If not specified, the encoder will turn it on whenever the video profile permits its use. 3884 AdaptiveBFrame *bool `json:"adaptiveBFrame,omitempty"` 3885 // Width - The width of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in width as the input. 3886 Width *string `json:"width,omitempty"` 3887 // Height - The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in height as the input. 3888 Height *string `json:"height,omitempty"` 3889 // Label - The alphanumeric label for this layer, which can be used in multiplexing different video and audio layers, or in naming the output file. 3890 Label *string `json:"label,omitempty"` 3891 // OdataType - Possible values include: 'OdataTypeLayer', 'OdataTypeMicrosoftMediaVideoLayer', 'OdataTypeMicrosoftMediaH264Layer', 'OdataTypeMicrosoftMediaJpgLayer', 'OdataTypeMicrosoftMediaPngLayer' 3892 OdataType OdataTypeBasicLayer `json:"@odata.type,omitempty"` 3893} 3894 3895// MarshalJSON is the custom marshaler for H264Layer. 3896func (hl H264Layer) MarshalJSON() ([]byte, error) { 3897 hl.OdataType = OdataTypeMicrosoftMediaH264Layer 3898 objectMap := make(map[string]interface{}) 3899 if hl.Profile != "" { 3900 objectMap["profile"] = hl.Profile 3901 } 3902 if hl.Level != nil { 3903 objectMap["level"] = hl.Level 3904 } 3905 if hl.BufferWindow != nil { 3906 objectMap["bufferWindow"] = hl.BufferWindow 3907 } 3908 if hl.ReferenceFrames != nil { 3909 objectMap["referenceFrames"] = hl.ReferenceFrames 3910 } 3911 if hl.EntropyMode != "" { 3912 objectMap["entropyMode"] = hl.EntropyMode 3913 } 3914 if hl.Bitrate != nil { 3915 objectMap["bitrate"] = hl.Bitrate 3916 } 3917 if hl.MaxBitrate != nil { 3918 objectMap["maxBitrate"] = hl.MaxBitrate 3919 } 3920 if hl.BFrames != nil { 3921 objectMap["bFrames"] = hl.BFrames 3922 } 3923 if hl.FrameRate != nil { 3924 objectMap["frameRate"] = hl.FrameRate 3925 } 3926 if hl.Slices != nil { 3927 objectMap["slices"] = hl.Slices 3928 } 3929 if hl.AdaptiveBFrame != nil { 3930 objectMap["adaptiveBFrame"] = hl.AdaptiveBFrame 3931 } 3932 if hl.Width != nil { 3933 objectMap["width"] = hl.Width 3934 } 3935 if hl.Height != nil { 3936 objectMap["height"] = hl.Height 3937 } 3938 if hl.Label != nil { 3939 objectMap["label"] = hl.Label 3940 } 3941 if hl.OdataType != "" { 3942 objectMap["@odata.type"] = hl.OdataType 3943 } 3944 return json.Marshal(objectMap) 3945} 3946 3947// AsVideoLayer is the BasicLayer implementation for H264Layer. 3948func (hl H264Layer) AsVideoLayer() (*VideoLayer, bool) { 3949 return nil, false 3950} 3951 3952// AsBasicVideoLayer is the BasicLayer implementation for H264Layer. 3953func (hl H264Layer) AsBasicVideoLayer() (BasicVideoLayer, bool) { 3954 return &hl, true 3955} 3956 3957// AsH264Layer is the BasicLayer implementation for H264Layer. 3958func (hl H264Layer) AsH264Layer() (*H264Layer, bool) { 3959 return &hl, true 3960} 3961 3962// AsJpgLayer is the BasicLayer implementation for H264Layer. 3963func (hl H264Layer) AsJpgLayer() (*JpgLayer, bool) { 3964 return nil, false 3965} 3966 3967// AsPngLayer is the BasicLayer implementation for H264Layer. 3968func (hl H264Layer) AsPngLayer() (*PngLayer, bool) { 3969 return nil, false 3970} 3971 3972// AsLayer is the BasicLayer implementation for H264Layer. 3973func (hl H264Layer) AsLayer() (*Layer, bool) { 3974 return nil, false 3975} 3976 3977// AsBasicLayer is the BasicLayer implementation for H264Layer. 3978func (hl H264Layer) AsBasicLayer() (BasicLayer, bool) { 3979 return &hl, true 3980} 3981 3982// H264Video describes all the properties for encoding a video with the H.264 codec. 3983type H264Video struct { 3984 // SceneChangeDetection - Whether or not the encoder should insert key frames at scene changes. If not specified, the default is false. This flag should be set to true only when the encoder is being configured to produce a single output video. 3985 SceneChangeDetection *bool `json:"sceneChangeDetection,omitempty"` 3986 // Complexity - Tells the encoder how to choose its encoding settings. The default value is Balanced. Possible values include: 'Speed', 'Balanced', 'Quality' 3987 Complexity H264Complexity `json:"complexity,omitempty"` 3988 // Layers - The collection of output H.264 layers to be produced by the encoder. 3989 Layers *[]H264Layer `json:"layers,omitempty"` 3990 // KeyFrameInterval - The distance between two key frames, thereby defining a group of pictures (GOP). The value should be a non-zero integer in the range [1, 30] seconds, specified in ISO 8601 format. The default is 2 seconds (PT2S). 3991 KeyFrameInterval *string `json:"keyFrameInterval,omitempty"` 3992 // StretchMode - The resizing mode - how the input video will be resized to fit the desired output resolution(s). Default is AutoSize. Possible values include: 'StretchModeNone', 'StretchModeAutoSize', 'StretchModeAutoFit' 3993 StretchMode StretchMode `json:"stretchMode,omitempty"` 3994 // Label - An optional label for the codec. The label can be used to control muxing behavior. 3995 Label *string `json:"label,omitempty"` 3996 // OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage' 3997 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"` 3998} 3999 4000// MarshalJSON is the custom marshaler for H264Video. 4001func (hv H264Video) MarshalJSON() ([]byte, error) { 4002 hv.OdataType = OdataTypeMicrosoftMediaH264Video 4003 objectMap := make(map[string]interface{}) 4004 if hv.SceneChangeDetection != nil { 4005 objectMap["sceneChangeDetection"] = hv.SceneChangeDetection 4006 } 4007 if hv.Complexity != "" { 4008 objectMap["complexity"] = hv.Complexity 4009 } 4010 if hv.Layers != nil { 4011 objectMap["layers"] = hv.Layers 4012 } 4013 if hv.KeyFrameInterval != nil { 4014 objectMap["keyFrameInterval"] = hv.KeyFrameInterval 4015 } 4016 if hv.StretchMode != "" { 4017 objectMap["stretchMode"] = hv.StretchMode 4018 } 4019 if hv.Label != nil { 4020 objectMap["label"] = hv.Label 4021 } 4022 if hv.OdataType != "" { 4023 objectMap["@odata.type"] = hv.OdataType 4024 } 4025 return json.Marshal(objectMap) 4026} 4027 4028// AsAudio is the BasicCodec implementation for H264Video. 4029func (hv H264Video) AsAudio() (*Audio, bool) { 4030 return nil, false 4031} 4032 4033// AsBasicAudio is the BasicCodec implementation for H264Video. 4034func (hv H264Video) AsBasicAudio() (BasicAudio, bool) { 4035 return nil, false 4036} 4037 4038// AsAacAudio is the BasicCodec implementation for H264Video. 4039func (hv H264Video) AsAacAudio() (*AacAudio, bool) { 4040 return nil, false 4041} 4042 4043// AsCopyVideo is the BasicCodec implementation for H264Video. 4044func (hv H264Video) AsCopyVideo() (*CopyVideo, bool) { 4045 return nil, false 4046} 4047 4048// AsVideo is the BasicCodec implementation for H264Video. 4049func (hv H264Video) AsVideo() (*Video, bool) { 4050 return nil, false 4051} 4052 4053// AsBasicVideo is the BasicCodec implementation for H264Video. 4054func (hv H264Video) AsBasicVideo() (BasicVideo, bool) { 4055 return &hv, true 4056} 4057 4058// AsImage is the BasicCodec implementation for H264Video. 4059func (hv H264Video) AsImage() (*Image, bool) { 4060 return nil, false 4061} 4062 4063// AsBasicImage is the BasicCodec implementation for H264Video. 4064func (hv H264Video) AsBasicImage() (BasicImage, bool) { 4065 return nil, false 4066} 4067 4068// AsCopyAudio is the BasicCodec implementation for H264Video. 4069func (hv H264Video) AsCopyAudio() (*CopyAudio, bool) { 4070 return nil, false 4071} 4072 4073// AsH264Video is the BasicCodec implementation for H264Video. 4074func (hv H264Video) AsH264Video() (*H264Video, bool) { 4075 return &hv, true 4076} 4077 4078// AsJpgImage is the BasicCodec implementation for H264Video. 4079func (hv H264Video) AsJpgImage() (*JpgImage, bool) { 4080 return nil, false 4081} 4082 4083// AsPngImage is the BasicCodec implementation for H264Video. 4084func (hv H264Video) AsPngImage() (*PngImage, bool) { 4085 return nil, false 4086} 4087 4088// AsCodec is the BasicCodec implementation for H264Video. 4089func (hv H264Video) AsCodec() (*Codec, bool) { 4090 return nil, false 4091} 4092 4093// AsBasicCodec is the BasicCodec implementation for H264Video. 4094func (hv H264Video) AsBasicCodec() (BasicCodec, bool) { 4095 return &hv, true 4096} 4097 4098// Hls the HLS configuration. 4099type Hls struct { 4100 // FragmentsPerTsSegment - The amount of fragments per HTTP Live Streaming (HLS) segment. 4101 FragmentsPerTsSegment *int32 `json:"fragmentsPerTsSegment,omitempty"` 4102} 4103 4104// BasicImage describes the basic properties for generating thumbnails from the input video 4105type BasicImage interface { 4106 AsJpgImage() (*JpgImage, bool) 4107 AsPngImage() (*PngImage, bool) 4108 AsImage() (*Image, bool) 4109} 4110 4111// Image describes the basic properties for generating thumbnails from the input video 4112type Image struct { 4113 // Start - The position in the input video from where to start generating thumbnails. The value can be in absolute timestamp (ISO 8601, e.g: PT05S), or a frame count (For example, 10 for the 10th frame), or a relative value (For example, 1%). Also supports a macro {Best}, which tells the encoder to select the best thumbnail from the first few seconds of the video. 4114 Start *string `json:"start,omitempty"` 4115 // Step - The intervals at which thumbnails are generated. The value can be in absolute timestamp (ISO 8601, e.g: PT05S for one image every 5 seconds), or a frame count (For example, 30 for every 30 frames), or a relative value (For example, 1%). 4116 Step *string `json:"step,omitempty"` 4117 // Range - The position in the input video at which to stop generating thumbnails. The value can be in absolute timestamp (ISO 8601, e.g: PT5M30S to stop at 5 minutes and 30 seconds), or a frame count (For example, 300 to stop at the 300th frame), or a relative value (For example, 100%). 4118 Range *string `json:"range,omitempty"` 4119 // KeyFrameInterval - The distance between two key frames, thereby defining a group of pictures (GOP). The value should be a non-zero integer in the range [1, 30] seconds, specified in ISO 8601 format. The default is 2 seconds (PT2S). 4120 KeyFrameInterval *string `json:"keyFrameInterval,omitempty"` 4121 // StretchMode - The resizing mode - how the input video will be resized to fit the desired output resolution(s). Default is AutoSize. Possible values include: 'StretchModeNone', 'StretchModeAutoSize', 'StretchModeAutoFit' 4122 StretchMode StretchMode `json:"stretchMode,omitempty"` 4123 // Label - An optional label for the codec. The label can be used to control muxing behavior. 4124 Label *string `json:"label,omitempty"` 4125 // OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage' 4126 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"` 4127} 4128 4129func unmarshalBasicImage(body []byte) (BasicImage, error) { 4130 var m map[string]interface{} 4131 err := json.Unmarshal(body, &m) 4132 if err != nil { 4133 return nil, err 4134 } 4135 4136 switch m["@odata.type"] { 4137 case string(OdataTypeMicrosoftMediaJpgImage): 4138 var ji JpgImage 4139 err := json.Unmarshal(body, &ji) 4140 return ji, err 4141 case string(OdataTypeMicrosoftMediaPngImage): 4142 var pi PngImage 4143 err := json.Unmarshal(body, &pi) 4144 return pi, err 4145 default: 4146 var i Image 4147 err := json.Unmarshal(body, &i) 4148 return i, err 4149 } 4150} 4151func unmarshalBasicImageArray(body []byte) ([]BasicImage, error) { 4152 var rawMessages []*json.RawMessage 4153 err := json.Unmarshal(body, &rawMessages) 4154 if err != nil { 4155 return nil, err 4156 } 4157 4158 iArray := make([]BasicImage, len(rawMessages)) 4159 4160 for index, rawMessage := range rawMessages { 4161 i, err := unmarshalBasicImage(*rawMessage) 4162 if err != nil { 4163 return nil, err 4164 } 4165 iArray[index] = i 4166 } 4167 return iArray, nil 4168} 4169 4170// MarshalJSON is the custom marshaler for Image. 4171func (i Image) MarshalJSON() ([]byte, error) { 4172 i.OdataType = OdataTypeMicrosoftMediaImage 4173 objectMap := make(map[string]interface{}) 4174 if i.Start != nil { 4175 objectMap["start"] = i.Start 4176 } 4177 if i.Step != nil { 4178 objectMap["step"] = i.Step 4179 } 4180 if i.Range != nil { 4181 objectMap["range"] = i.Range 4182 } 4183 if i.KeyFrameInterval != nil { 4184 objectMap["keyFrameInterval"] = i.KeyFrameInterval 4185 } 4186 if i.StretchMode != "" { 4187 objectMap["stretchMode"] = i.StretchMode 4188 } 4189 if i.Label != nil { 4190 objectMap["label"] = i.Label 4191 } 4192 if i.OdataType != "" { 4193 objectMap["@odata.type"] = i.OdataType 4194 } 4195 return json.Marshal(objectMap) 4196} 4197 4198// AsAudio is the BasicCodec implementation for Image. 4199func (i Image) AsAudio() (*Audio, bool) { 4200 return nil, false 4201} 4202 4203// AsBasicAudio is the BasicCodec implementation for Image. 4204func (i Image) AsBasicAudio() (BasicAudio, bool) { 4205 return nil, false 4206} 4207 4208// AsAacAudio is the BasicCodec implementation for Image. 4209func (i Image) AsAacAudio() (*AacAudio, bool) { 4210 return nil, false 4211} 4212 4213// AsCopyVideo is the BasicCodec implementation for Image. 4214func (i Image) AsCopyVideo() (*CopyVideo, bool) { 4215 return nil, false 4216} 4217 4218// AsVideo is the BasicCodec implementation for Image. 4219func (i Image) AsVideo() (*Video, bool) { 4220 return nil, false 4221} 4222 4223// AsBasicVideo is the BasicCodec implementation for Image. 4224func (i Image) AsBasicVideo() (BasicVideo, bool) { 4225 return &i, true 4226} 4227 4228// AsImage is the BasicCodec implementation for Image. 4229func (i Image) AsImage() (*Image, bool) { 4230 return &i, true 4231} 4232 4233// AsBasicImage is the BasicCodec implementation for Image. 4234func (i Image) AsBasicImage() (BasicImage, bool) { 4235 return &i, true 4236} 4237 4238// AsCopyAudio is the BasicCodec implementation for Image. 4239func (i Image) AsCopyAudio() (*CopyAudio, bool) { 4240 return nil, false 4241} 4242 4243// AsH264Video is the BasicCodec implementation for Image. 4244func (i Image) AsH264Video() (*H264Video, bool) { 4245 return nil, false 4246} 4247 4248// AsJpgImage is the BasicCodec implementation for Image. 4249func (i Image) AsJpgImage() (*JpgImage, bool) { 4250 return nil, false 4251} 4252 4253// AsPngImage is the BasicCodec implementation for Image. 4254func (i Image) AsPngImage() (*PngImage, bool) { 4255 return nil, false 4256} 4257 4258// AsCodec is the BasicCodec implementation for Image. 4259func (i Image) AsCodec() (*Codec, bool) { 4260 return nil, false 4261} 4262 4263// AsBasicCodec is the BasicCodec implementation for Image. 4264func (i Image) AsBasicCodec() (BasicCodec, bool) { 4265 return &i, true 4266} 4267 4268// BasicImageFormat describes the properties for an output image file. 4269type BasicImageFormat interface { 4270 AsJpgFormat() (*JpgFormat, bool) 4271 AsPngFormat() (*PngFormat, bool) 4272 AsImageFormat() (*ImageFormat, bool) 4273} 4274 4275// ImageFormat describes the properties for an output image file. 4276type ImageFormat struct { 4277 // FilenamePattern - The pattern of the file names for the generated output files. The following macros are supported in the file name: {Basename} - The base name of the input video {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. Any unsubstituted macros will be collapsed and removed from the filename. 4278 FilenamePattern *string `json:"filenamePattern,omitempty"` 4279 // OdataType - Possible values include: 'OdataTypeFormat', 'OdataTypeMicrosoftMediaImageFormat', 'OdataTypeMicrosoftMediaJpgFormat', 'OdataTypeMicrosoftMediaPngFormat', 'OdataTypeMicrosoftMediaMultiBitrateFormat', 'OdataTypeMicrosoftMediaMp4Format', 'OdataTypeMicrosoftMediaTransportStreamFormat' 4280 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"` 4281} 4282 4283func unmarshalBasicImageFormat(body []byte) (BasicImageFormat, error) { 4284 var m map[string]interface{} 4285 err := json.Unmarshal(body, &m) 4286 if err != nil { 4287 return nil, err 4288 } 4289 4290 switch m["@odata.type"] { 4291 case string(OdataTypeMicrosoftMediaJpgFormat): 4292 var jf JpgFormat 4293 err := json.Unmarshal(body, &jf) 4294 return jf, err 4295 case string(OdataTypeMicrosoftMediaPngFormat): 4296 var pf PngFormat 4297 err := json.Unmarshal(body, &pf) 4298 return pf, err 4299 default: 4300 var ifVar ImageFormat 4301 err := json.Unmarshal(body, &ifVar) 4302 return ifVar, err 4303 } 4304} 4305func unmarshalBasicImageFormatArray(body []byte) ([]BasicImageFormat, error) { 4306 var rawMessages []*json.RawMessage 4307 err := json.Unmarshal(body, &rawMessages) 4308 if err != nil { 4309 return nil, err 4310 } 4311 4312 ifVarArray := make([]BasicImageFormat, len(rawMessages)) 4313 4314 for index, rawMessage := range rawMessages { 4315 ifVar, err := unmarshalBasicImageFormat(*rawMessage) 4316 if err != nil { 4317 return nil, err 4318 } 4319 ifVarArray[index] = ifVar 4320 } 4321 return ifVarArray, nil 4322} 4323 4324// MarshalJSON is the custom marshaler for ImageFormat. 4325func (ifVar ImageFormat) MarshalJSON() ([]byte, error) { 4326 ifVar.OdataType = OdataTypeMicrosoftMediaImageFormat 4327 objectMap := make(map[string]interface{}) 4328 if ifVar.FilenamePattern != nil { 4329 objectMap["filenamePattern"] = ifVar.FilenamePattern 4330 } 4331 if ifVar.OdataType != "" { 4332 objectMap["@odata.type"] = ifVar.OdataType 4333 } 4334 return json.Marshal(objectMap) 4335} 4336 4337// AsImageFormat is the BasicFormat implementation for ImageFormat. 4338func (ifVar ImageFormat) AsImageFormat() (*ImageFormat, bool) { 4339 return &ifVar, true 4340} 4341 4342// AsBasicImageFormat is the BasicFormat implementation for ImageFormat. 4343func (ifVar ImageFormat) AsBasicImageFormat() (BasicImageFormat, bool) { 4344 return &ifVar, true 4345} 4346 4347// AsJpgFormat is the BasicFormat implementation for ImageFormat. 4348func (ifVar ImageFormat) AsJpgFormat() (*JpgFormat, bool) { 4349 return nil, false 4350} 4351 4352// AsPngFormat is the BasicFormat implementation for ImageFormat. 4353func (ifVar ImageFormat) AsPngFormat() (*PngFormat, bool) { 4354 return nil, false 4355} 4356 4357// AsMultiBitrateFormat is the BasicFormat implementation for ImageFormat. 4358func (ifVar ImageFormat) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) { 4359 return nil, false 4360} 4361 4362// AsBasicMultiBitrateFormat is the BasicFormat implementation for ImageFormat. 4363func (ifVar ImageFormat) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) { 4364 return nil, false 4365} 4366 4367// AsMp4Format is the BasicFormat implementation for ImageFormat. 4368func (ifVar ImageFormat) AsMp4Format() (*Mp4Format, bool) { 4369 return nil, false 4370} 4371 4372// AsTransportStreamFormat is the BasicFormat implementation for ImageFormat. 4373func (ifVar ImageFormat) AsTransportStreamFormat() (*TransportStreamFormat, bool) { 4374 return nil, false 4375} 4376 4377// AsFormat is the BasicFormat implementation for ImageFormat. 4378func (ifVar ImageFormat) AsFormat() (*Format, bool) { 4379 return nil, false 4380} 4381 4382// AsBasicFormat is the BasicFormat implementation for ImageFormat. 4383func (ifVar ImageFormat) AsBasicFormat() (BasicFormat, bool) { 4384 return &ifVar, true 4385} 4386 4387// IPAccessControl the IP access control. 4388type IPAccessControl struct { 4389 // Allow - The IP allow list. 4390 Allow *[]IPRange `json:"allow,omitempty"` 4391} 4392 4393// IPRange the IP address range in the CIDR scheme. 4394type IPRange struct { 4395 // Name - The friendly name for the IP address range. 4396 Name *string `json:"name,omitempty"` 4397 // Address - The IP address. 4398 Address *string `json:"address,omitempty"` 4399 // SubnetPrefixLength - The subnet mask prefix length (see CIDR notation). 4400 SubnetPrefixLength *int32 `json:"subnetPrefixLength,omitempty"` 4401} 4402 4403// Job a Job resource type. The progress and state can be obtained by polling a Job or subscribing to 4404// events using EventGrid. 4405type Job struct { 4406 autorest.Response `json:"-"` 4407 // JobProperties - The resource properties. 4408 *JobProperties `json:"properties,omitempty"` 4409 // ID - READ-ONLY; Fully qualified resource ID for the resource. 4410 ID *string `json:"id,omitempty"` 4411 // Name - READ-ONLY; The name of the resource. 4412 Name *string `json:"name,omitempty"` 4413 // Type - READ-ONLY; The type of the resource. 4414 Type *string `json:"type,omitempty"` 4415} 4416 4417// MarshalJSON is the custom marshaler for Job. 4418func (j Job) MarshalJSON() ([]byte, error) { 4419 objectMap := make(map[string]interface{}) 4420 if j.JobProperties != nil { 4421 objectMap["properties"] = j.JobProperties 4422 } 4423 return json.Marshal(objectMap) 4424} 4425 4426// UnmarshalJSON is the custom unmarshaler for Job struct. 4427func (j *Job) UnmarshalJSON(body []byte) error { 4428 var m map[string]*json.RawMessage 4429 err := json.Unmarshal(body, &m) 4430 if err != nil { 4431 return err 4432 } 4433 for k, v := range m { 4434 switch k { 4435 case "properties": 4436 if v != nil { 4437 var jobProperties JobProperties 4438 err = json.Unmarshal(*v, &jobProperties) 4439 if err != nil { 4440 return err 4441 } 4442 j.JobProperties = &jobProperties 4443 } 4444 case "id": 4445 if v != nil { 4446 var ID string 4447 err = json.Unmarshal(*v, &ID) 4448 if err != nil { 4449 return err 4450 } 4451 j.ID = &ID 4452 } 4453 case "name": 4454 if v != nil { 4455 var name string 4456 err = json.Unmarshal(*v, &name) 4457 if err != nil { 4458 return err 4459 } 4460 j.Name = &name 4461 } 4462 case "type": 4463 if v != nil { 4464 var typeVar string 4465 err = json.Unmarshal(*v, &typeVar) 4466 if err != nil { 4467 return err 4468 } 4469 j.Type = &typeVar 4470 } 4471 } 4472 } 4473 4474 return nil 4475} 4476 4477// JobCollection a collection of Job items. 4478type JobCollection struct { 4479 autorest.Response `json:"-"` 4480 // Value - A collection of Job items. 4481 Value *[]Job `json:"value,omitempty"` 4482 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 4483 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 4484} 4485 4486// JobCollectionIterator provides access to a complete listing of Job values. 4487type JobCollectionIterator struct { 4488 i int 4489 page JobCollectionPage 4490} 4491 4492// NextWithContext advances to the next value. If there was an error making 4493// the request the iterator does not advance and the error is returned. 4494func (iter *JobCollectionIterator) NextWithContext(ctx context.Context) (err error) { 4495 if tracing.IsEnabled() { 4496 ctx = tracing.StartSpan(ctx, fqdn+"/JobCollectionIterator.NextWithContext") 4497 defer func() { 4498 sc := -1 4499 if iter.Response().Response.Response != nil { 4500 sc = iter.Response().Response.Response.StatusCode 4501 } 4502 tracing.EndSpan(ctx, sc, err) 4503 }() 4504 } 4505 iter.i++ 4506 if iter.i < len(iter.page.Values()) { 4507 return nil 4508 } 4509 err = iter.page.NextWithContext(ctx) 4510 if err != nil { 4511 iter.i-- 4512 return err 4513 } 4514 iter.i = 0 4515 return nil 4516} 4517 4518// Next advances to the next value. If there was an error making 4519// the request the iterator does not advance and the error is returned. 4520// Deprecated: Use NextWithContext() instead. 4521func (iter *JobCollectionIterator) Next() error { 4522 return iter.NextWithContext(context.Background()) 4523} 4524 4525// NotDone returns true if the enumeration should be started or is not yet complete. 4526func (iter JobCollectionIterator) NotDone() bool { 4527 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4528} 4529 4530// Response returns the raw server response from the last page request. 4531func (iter JobCollectionIterator) Response() JobCollection { 4532 return iter.page.Response() 4533} 4534 4535// Value returns the current value or a zero-initialized value if the 4536// iterator has advanced beyond the end of the collection. 4537func (iter JobCollectionIterator) Value() Job { 4538 if !iter.page.NotDone() { 4539 return Job{} 4540 } 4541 return iter.page.Values()[iter.i] 4542} 4543 4544// Creates a new instance of the JobCollectionIterator type. 4545func NewJobCollectionIterator(page JobCollectionPage) JobCollectionIterator { 4546 return JobCollectionIterator{page: page} 4547} 4548 4549// IsEmpty returns true if the ListResult contains no values. 4550func (jc JobCollection) IsEmpty() bool { 4551 return jc.Value == nil || len(*jc.Value) == 0 4552} 4553 4554// hasNextLink returns true if the NextLink is not empty. 4555func (jc JobCollection) hasNextLink() bool { 4556 return jc.OdataNextLink != nil && len(*jc.OdataNextLink) != 0 4557} 4558 4559// jobCollectionPreparer prepares a request to retrieve the next set of results. 4560// It returns nil if no more results exist. 4561func (jc JobCollection) jobCollectionPreparer(ctx context.Context) (*http.Request, error) { 4562 if !jc.hasNextLink() { 4563 return nil, nil 4564 } 4565 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4566 autorest.AsJSON(), 4567 autorest.AsGet(), 4568 autorest.WithBaseURL(to.String(jc.OdataNextLink))) 4569} 4570 4571// JobCollectionPage contains a page of Job values. 4572type JobCollectionPage struct { 4573 fn func(context.Context, JobCollection) (JobCollection, error) 4574 jc JobCollection 4575} 4576 4577// NextWithContext advances to the next page of values. If there was an error making 4578// the request the page does not advance and the error is returned. 4579func (page *JobCollectionPage) NextWithContext(ctx context.Context) (err error) { 4580 if tracing.IsEnabled() { 4581 ctx = tracing.StartSpan(ctx, fqdn+"/JobCollectionPage.NextWithContext") 4582 defer func() { 4583 sc := -1 4584 if page.Response().Response.Response != nil { 4585 sc = page.Response().Response.Response.StatusCode 4586 } 4587 tracing.EndSpan(ctx, sc, err) 4588 }() 4589 } 4590 for { 4591 next, err := page.fn(ctx, page.jc) 4592 if err != nil { 4593 return err 4594 } 4595 page.jc = next 4596 if !next.hasNextLink() || !next.IsEmpty() { 4597 break 4598 } 4599 } 4600 return nil 4601} 4602 4603// Next advances to the next page of values. If there was an error making 4604// the request the page does not advance and the error is returned. 4605// Deprecated: Use NextWithContext() instead. 4606func (page *JobCollectionPage) Next() error { 4607 return page.NextWithContext(context.Background()) 4608} 4609 4610// NotDone returns true if the page enumeration should be started or is not yet complete. 4611func (page JobCollectionPage) NotDone() bool { 4612 return !page.jc.IsEmpty() 4613} 4614 4615// Response returns the raw server response from the last page request. 4616func (page JobCollectionPage) Response() JobCollection { 4617 return page.jc 4618} 4619 4620// Values returns the slice of values for the current page or nil if there are no values. 4621func (page JobCollectionPage) Values() []Job { 4622 if page.jc.IsEmpty() { 4623 return nil 4624 } 4625 return *page.jc.Value 4626} 4627 4628// Creates a new instance of the JobCollectionPage type. 4629func NewJobCollectionPage(cur JobCollection, getNextPage func(context.Context, JobCollection) (JobCollection, error)) JobCollectionPage { 4630 return JobCollectionPage{ 4631 fn: getNextPage, 4632 jc: cur, 4633 } 4634} 4635 4636// JobError details of JobOutput errors. 4637type JobError struct { 4638 // Code - READ-ONLY; Error code describing the error. Possible values include: 'ServiceError', 'ServiceTransientError', 'DownloadNotAccessible', 'DownloadTransientError', 'UploadNotAccessible', 'UploadTransientError', 'ConfigurationUnsupported', 'ContentMalformed', 'ContentUnsupported' 4639 Code JobErrorCode `json:"code,omitempty"` 4640 // Message - READ-ONLY; A human-readable language-dependent representation of the error. 4641 Message *string `json:"message,omitempty"` 4642 // Category - READ-ONLY; Helps with categorization of errors. Possible values include: 'JobErrorCategoryService', 'JobErrorCategoryDownload', 'JobErrorCategoryUpload', 'JobErrorCategoryConfiguration', 'JobErrorCategoryContent' 4643 Category JobErrorCategory `json:"category,omitempty"` 4644 // Retry - READ-ONLY; Indicates that it may be possible to retry the Job. If retry is unsuccessful, please contact Azure support via Azure Portal. Possible values include: 'DoNotRetry', 'MayRetry' 4645 Retry JobRetry `json:"retry,omitempty"` 4646 // Details - READ-ONLY; An array of details about specific errors that led to this reported error. 4647 Details *[]JobErrorDetail `json:"details,omitempty"` 4648} 4649 4650// MarshalJSON is the custom marshaler for JobError. 4651func (je JobError) MarshalJSON() ([]byte, error) { 4652 objectMap := make(map[string]interface{}) 4653 return json.Marshal(objectMap) 4654} 4655 4656// JobErrorDetail details of JobOutput errors. 4657type JobErrorDetail struct { 4658 // Code - READ-ONLY; Code describing the error detail. 4659 Code *string `json:"code,omitempty"` 4660 // Message - READ-ONLY; A human-readable representation of the error. 4661 Message *string `json:"message,omitempty"` 4662} 4663 4664// MarshalJSON is the custom marshaler for JobErrorDetail. 4665func (jed JobErrorDetail) MarshalJSON() ([]byte, error) { 4666 objectMap := make(map[string]interface{}) 4667 return json.Marshal(objectMap) 4668} 4669 4670// BasicJobInput base class for inputs to a Job. 4671type BasicJobInput interface { 4672 AsJobInputClip() (*JobInputClip, bool) 4673 AsBasicJobInputClip() (BasicJobInputClip, bool) 4674 AsJobInputs() (*JobInputs, bool) 4675 AsJobInputAsset() (*JobInputAsset, bool) 4676 AsJobInputHTTP() (*JobInputHTTP, bool) 4677 AsJobInput() (*JobInput, bool) 4678} 4679 4680// JobInput base class for inputs to a Job. 4681type JobInput struct { 4682 // OdataType - Possible values include: 'OdataTypeJobInput', 'OdataTypeMicrosoftMediaJobInputClip', 'OdataTypeMicrosoftMediaJobInputs', 'OdataTypeMicrosoftMediaJobInputAsset', 'OdataTypeMicrosoftMediaJobInputHTTP' 4683 OdataType OdataTypeBasicJobInput `json:"@odata.type,omitempty"` 4684} 4685 4686func unmarshalBasicJobInput(body []byte) (BasicJobInput, error) { 4687 var m map[string]interface{} 4688 err := json.Unmarshal(body, &m) 4689 if err != nil { 4690 return nil, err 4691 } 4692 4693 switch m["@odata.type"] { 4694 case string(OdataTypeMicrosoftMediaJobInputClip): 4695 var jic JobInputClip 4696 err := json.Unmarshal(body, &jic) 4697 return jic, err 4698 case string(OdataTypeMicrosoftMediaJobInputs): 4699 var ji JobInputs 4700 err := json.Unmarshal(body, &ji) 4701 return ji, err 4702 case string(OdataTypeMicrosoftMediaJobInputAsset): 4703 var jia JobInputAsset 4704 err := json.Unmarshal(body, &jia) 4705 return jia, err 4706 case string(OdataTypeMicrosoftMediaJobInputHTTP): 4707 var jih JobInputHTTP 4708 err := json.Unmarshal(body, &jih) 4709 return jih, err 4710 default: 4711 var ji JobInput 4712 err := json.Unmarshal(body, &ji) 4713 return ji, err 4714 } 4715} 4716func unmarshalBasicJobInputArray(body []byte) ([]BasicJobInput, error) { 4717 var rawMessages []*json.RawMessage 4718 err := json.Unmarshal(body, &rawMessages) 4719 if err != nil { 4720 return nil, err 4721 } 4722 4723 jiArray := make([]BasicJobInput, len(rawMessages)) 4724 4725 for index, rawMessage := range rawMessages { 4726 ji, err := unmarshalBasicJobInput(*rawMessage) 4727 if err != nil { 4728 return nil, err 4729 } 4730 jiArray[index] = ji 4731 } 4732 return jiArray, nil 4733} 4734 4735// MarshalJSON is the custom marshaler for JobInput. 4736func (ji JobInput) MarshalJSON() ([]byte, error) { 4737 ji.OdataType = OdataTypeJobInput 4738 objectMap := make(map[string]interface{}) 4739 if ji.OdataType != "" { 4740 objectMap["@odata.type"] = ji.OdataType 4741 } 4742 return json.Marshal(objectMap) 4743} 4744 4745// AsJobInputClip is the BasicJobInput implementation for JobInput. 4746func (ji JobInput) AsJobInputClip() (*JobInputClip, bool) { 4747 return nil, false 4748} 4749 4750// AsBasicJobInputClip is the BasicJobInput implementation for JobInput. 4751func (ji JobInput) AsBasicJobInputClip() (BasicJobInputClip, bool) { 4752 return nil, false 4753} 4754 4755// AsJobInputs is the BasicJobInput implementation for JobInput. 4756func (ji JobInput) AsJobInputs() (*JobInputs, bool) { 4757 return nil, false 4758} 4759 4760// AsJobInputAsset is the BasicJobInput implementation for JobInput. 4761func (ji JobInput) AsJobInputAsset() (*JobInputAsset, bool) { 4762 return nil, false 4763} 4764 4765// AsJobInputHTTP is the BasicJobInput implementation for JobInput. 4766func (ji JobInput) AsJobInputHTTP() (*JobInputHTTP, bool) { 4767 return nil, false 4768} 4769 4770// AsJobInput is the BasicJobInput implementation for JobInput. 4771func (ji JobInput) AsJobInput() (*JobInput, bool) { 4772 return &ji, true 4773} 4774 4775// AsBasicJobInput is the BasicJobInput implementation for JobInput. 4776func (ji JobInput) AsBasicJobInput() (BasicJobInput, bool) { 4777 return &ji, true 4778} 4779 4780// JobInputAsset represents an Asset for input into a Job. 4781type JobInputAsset struct { 4782 // AssetName - The name of the input Asset. 4783 AssetName *string `json:"assetName,omitempty"` 4784 // Files - List of files. Required for JobInputHttp. Maximum of 4000 characters each. 4785 Files *[]string `json:"files,omitempty"` 4786 // Start - Defines a point on the timeline of the input media at which processing will start. Defaults to the beginning of the input media. 4787 Start BasicClipTime `json:"start,omitempty"` 4788 // End - Defines a point on the timeline of the input media at which processing will end. Defaults to the end of the input media. 4789 End BasicClipTime `json:"end,omitempty"` 4790 // Label - A label that is assigned to a JobInputClip, that is used to satisfy a reference used in the Transform. For example, a Transform can be authored so as to take an image file with the label 'xyz' and apply it as an overlay onto the input video before it is encoded. When submitting a Job, exactly one of the JobInputs should be the image file, and it should have the label 'xyz'. 4791 Label *string `json:"label,omitempty"` 4792 // OdataType - Possible values include: 'OdataTypeJobInput', 'OdataTypeMicrosoftMediaJobInputClip', 'OdataTypeMicrosoftMediaJobInputs', 'OdataTypeMicrosoftMediaJobInputAsset', 'OdataTypeMicrosoftMediaJobInputHTTP' 4793 OdataType OdataTypeBasicJobInput `json:"@odata.type,omitempty"` 4794} 4795 4796// MarshalJSON is the custom marshaler for JobInputAsset. 4797func (jia JobInputAsset) MarshalJSON() ([]byte, error) { 4798 jia.OdataType = OdataTypeMicrosoftMediaJobInputAsset 4799 objectMap := make(map[string]interface{}) 4800 if jia.AssetName != nil { 4801 objectMap["assetName"] = jia.AssetName 4802 } 4803 if jia.Files != nil { 4804 objectMap["files"] = jia.Files 4805 } 4806 objectMap["start"] = jia.Start 4807 objectMap["end"] = jia.End 4808 if jia.Label != nil { 4809 objectMap["label"] = jia.Label 4810 } 4811 if jia.OdataType != "" { 4812 objectMap["@odata.type"] = jia.OdataType 4813 } 4814 return json.Marshal(objectMap) 4815} 4816 4817// AsJobInputClip is the BasicJobInput implementation for JobInputAsset. 4818func (jia JobInputAsset) AsJobInputClip() (*JobInputClip, bool) { 4819 return nil, false 4820} 4821 4822// AsBasicJobInputClip is the BasicJobInput implementation for JobInputAsset. 4823func (jia JobInputAsset) AsBasicJobInputClip() (BasicJobInputClip, bool) { 4824 return &jia, true 4825} 4826 4827// AsJobInputs is the BasicJobInput implementation for JobInputAsset. 4828func (jia JobInputAsset) AsJobInputs() (*JobInputs, bool) { 4829 return nil, false 4830} 4831 4832// AsJobInputAsset is the BasicJobInput implementation for JobInputAsset. 4833func (jia JobInputAsset) AsJobInputAsset() (*JobInputAsset, bool) { 4834 return &jia, true 4835} 4836 4837// AsJobInputHTTP is the BasicJobInput implementation for JobInputAsset. 4838func (jia JobInputAsset) AsJobInputHTTP() (*JobInputHTTP, bool) { 4839 return nil, false 4840} 4841 4842// AsJobInput is the BasicJobInput implementation for JobInputAsset. 4843func (jia JobInputAsset) AsJobInput() (*JobInput, bool) { 4844 return nil, false 4845} 4846 4847// AsBasicJobInput is the BasicJobInput implementation for JobInputAsset. 4848func (jia JobInputAsset) AsBasicJobInput() (BasicJobInput, bool) { 4849 return &jia, true 4850} 4851 4852// UnmarshalJSON is the custom unmarshaler for JobInputAsset struct. 4853func (jia *JobInputAsset) UnmarshalJSON(body []byte) error { 4854 var m map[string]*json.RawMessage 4855 err := json.Unmarshal(body, &m) 4856 if err != nil { 4857 return err 4858 } 4859 for k, v := range m { 4860 switch k { 4861 case "assetName": 4862 if v != nil { 4863 var assetName string 4864 err = json.Unmarshal(*v, &assetName) 4865 if err != nil { 4866 return err 4867 } 4868 jia.AssetName = &assetName 4869 } 4870 case "files": 4871 if v != nil { 4872 var files []string 4873 err = json.Unmarshal(*v, &files) 4874 if err != nil { 4875 return err 4876 } 4877 jia.Files = &files 4878 } 4879 case "start": 4880 if v != nil { 4881 start, err := unmarshalBasicClipTime(*v) 4882 if err != nil { 4883 return err 4884 } 4885 jia.Start = start 4886 } 4887 case "end": 4888 if v != nil { 4889 end, err := unmarshalBasicClipTime(*v) 4890 if err != nil { 4891 return err 4892 } 4893 jia.End = end 4894 } 4895 case "label": 4896 if v != nil { 4897 var label string 4898 err = json.Unmarshal(*v, &label) 4899 if err != nil { 4900 return err 4901 } 4902 jia.Label = &label 4903 } 4904 case "@odata.type": 4905 if v != nil { 4906 var odataType OdataTypeBasicJobInput 4907 err = json.Unmarshal(*v, &odataType) 4908 if err != nil { 4909 return err 4910 } 4911 jia.OdataType = odataType 4912 } 4913 } 4914 } 4915 4916 return nil 4917} 4918 4919// BasicJobInputClip represents input files for a Job. 4920type BasicJobInputClip interface { 4921 AsJobInputAsset() (*JobInputAsset, bool) 4922 AsJobInputHTTP() (*JobInputHTTP, bool) 4923 AsJobInputClip() (*JobInputClip, bool) 4924} 4925 4926// JobInputClip represents input files for a Job. 4927type JobInputClip struct { 4928 // Files - List of files. Required for JobInputHttp. Maximum of 4000 characters each. 4929 Files *[]string `json:"files,omitempty"` 4930 // Start - Defines a point on the timeline of the input media at which processing will start. Defaults to the beginning of the input media. 4931 Start BasicClipTime `json:"start,omitempty"` 4932 // End - Defines a point on the timeline of the input media at which processing will end. Defaults to the end of the input media. 4933 End BasicClipTime `json:"end,omitempty"` 4934 // Label - A label that is assigned to a JobInputClip, that is used to satisfy a reference used in the Transform. For example, a Transform can be authored so as to take an image file with the label 'xyz' and apply it as an overlay onto the input video before it is encoded. When submitting a Job, exactly one of the JobInputs should be the image file, and it should have the label 'xyz'. 4935 Label *string `json:"label,omitempty"` 4936 // OdataType - Possible values include: 'OdataTypeJobInput', 'OdataTypeMicrosoftMediaJobInputClip', 'OdataTypeMicrosoftMediaJobInputs', 'OdataTypeMicrosoftMediaJobInputAsset', 'OdataTypeMicrosoftMediaJobInputHTTP' 4937 OdataType OdataTypeBasicJobInput `json:"@odata.type,omitempty"` 4938} 4939 4940func unmarshalBasicJobInputClip(body []byte) (BasicJobInputClip, error) { 4941 var m map[string]interface{} 4942 err := json.Unmarshal(body, &m) 4943 if err != nil { 4944 return nil, err 4945 } 4946 4947 switch m["@odata.type"] { 4948 case string(OdataTypeMicrosoftMediaJobInputAsset): 4949 var jia JobInputAsset 4950 err := json.Unmarshal(body, &jia) 4951 return jia, err 4952 case string(OdataTypeMicrosoftMediaJobInputHTTP): 4953 var jih JobInputHTTP 4954 err := json.Unmarshal(body, &jih) 4955 return jih, err 4956 default: 4957 var jic JobInputClip 4958 err := json.Unmarshal(body, &jic) 4959 return jic, err 4960 } 4961} 4962func unmarshalBasicJobInputClipArray(body []byte) ([]BasicJobInputClip, error) { 4963 var rawMessages []*json.RawMessage 4964 err := json.Unmarshal(body, &rawMessages) 4965 if err != nil { 4966 return nil, err 4967 } 4968 4969 jicArray := make([]BasicJobInputClip, len(rawMessages)) 4970 4971 for index, rawMessage := range rawMessages { 4972 jic, err := unmarshalBasicJobInputClip(*rawMessage) 4973 if err != nil { 4974 return nil, err 4975 } 4976 jicArray[index] = jic 4977 } 4978 return jicArray, nil 4979} 4980 4981// MarshalJSON is the custom marshaler for JobInputClip. 4982func (jic JobInputClip) MarshalJSON() ([]byte, error) { 4983 jic.OdataType = OdataTypeMicrosoftMediaJobInputClip 4984 objectMap := make(map[string]interface{}) 4985 if jic.Files != nil { 4986 objectMap["files"] = jic.Files 4987 } 4988 objectMap["start"] = jic.Start 4989 objectMap["end"] = jic.End 4990 if jic.Label != nil { 4991 objectMap["label"] = jic.Label 4992 } 4993 if jic.OdataType != "" { 4994 objectMap["@odata.type"] = jic.OdataType 4995 } 4996 return json.Marshal(objectMap) 4997} 4998 4999// AsJobInputClip is the BasicJobInput implementation for JobInputClip. 5000func (jic JobInputClip) AsJobInputClip() (*JobInputClip, bool) { 5001 return &jic, true 5002} 5003 5004// AsBasicJobInputClip is the BasicJobInput implementation for JobInputClip. 5005func (jic JobInputClip) AsBasicJobInputClip() (BasicJobInputClip, bool) { 5006 return &jic, true 5007} 5008 5009// AsJobInputs is the BasicJobInput implementation for JobInputClip. 5010func (jic JobInputClip) AsJobInputs() (*JobInputs, bool) { 5011 return nil, false 5012} 5013 5014// AsJobInputAsset is the BasicJobInput implementation for JobInputClip. 5015func (jic JobInputClip) AsJobInputAsset() (*JobInputAsset, bool) { 5016 return nil, false 5017} 5018 5019// AsJobInputHTTP is the BasicJobInput implementation for JobInputClip. 5020func (jic JobInputClip) AsJobInputHTTP() (*JobInputHTTP, bool) { 5021 return nil, false 5022} 5023 5024// AsJobInput is the BasicJobInput implementation for JobInputClip. 5025func (jic JobInputClip) AsJobInput() (*JobInput, bool) { 5026 return nil, false 5027} 5028 5029// AsBasicJobInput is the BasicJobInput implementation for JobInputClip. 5030func (jic JobInputClip) AsBasicJobInput() (BasicJobInput, bool) { 5031 return &jic, true 5032} 5033 5034// UnmarshalJSON is the custom unmarshaler for JobInputClip struct. 5035func (jic *JobInputClip) UnmarshalJSON(body []byte) error { 5036 var m map[string]*json.RawMessage 5037 err := json.Unmarshal(body, &m) 5038 if err != nil { 5039 return err 5040 } 5041 for k, v := range m { 5042 switch k { 5043 case "files": 5044 if v != nil { 5045 var files []string 5046 err = json.Unmarshal(*v, &files) 5047 if err != nil { 5048 return err 5049 } 5050 jic.Files = &files 5051 } 5052 case "start": 5053 if v != nil { 5054 start, err := unmarshalBasicClipTime(*v) 5055 if err != nil { 5056 return err 5057 } 5058 jic.Start = start 5059 } 5060 case "end": 5061 if v != nil { 5062 end, err := unmarshalBasicClipTime(*v) 5063 if err != nil { 5064 return err 5065 } 5066 jic.End = end 5067 } 5068 case "label": 5069 if v != nil { 5070 var label string 5071 err = json.Unmarshal(*v, &label) 5072 if err != nil { 5073 return err 5074 } 5075 jic.Label = &label 5076 } 5077 case "@odata.type": 5078 if v != nil { 5079 var odataType OdataTypeBasicJobInput 5080 err = json.Unmarshal(*v, &odataType) 5081 if err != nil { 5082 return err 5083 } 5084 jic.OdataType = odataType 5085 } 5086 } 5087 } 5088 5089 return nil 5090} 5091 5092// JobInputHTTP represents HTTPS job input. 5093type JobInputHTTP struct { 5094 // BaseURI - Base URI for HTTPS job input. It will be concatenated with provided file names. If no base uri is given, then the provided file list is assumed to be fully qualified uris. Maximum length of 4000 characters. 5095 BaseURI *string `json:"baseUri,omitempty"` 5096 // Files - List of files. Required for JobInputHttp. Maximum of 4000 characters each. 5097 Files *[]string `json:"files,omitempty"` 5098 // Start - Defines a point on the timeline of the input media at which processing will start. Defaults to the beginning of the input media. 5099 Start BasicClipTime `json:"start,omitempty"` 5100 // End - Defines a point on the timeline of the input media at which processing will end. Defaults to the end of the input media. 5101 End BasicClipTime `json:"end,omitempty"` 5102 // Label - A label that is assigned to a JobInputClip, that is used to satisfy a reference used in the Transform. For example, a Transform can be authored so as to take an image file with the label 'xyz' and apply it as an overlay onto the input video before it is encoded. When submitting a Job, exactly one of the JobInputs should be the image file, and it should have the label 'xyz'. 5103 Label *string `json:"label,omitempty"` 5104 // OdataType - Possible values include: 'OdataTypeJobInput', 'OdataTypeMicrosoftMediaJobInputClip', 'OdataTypeMicrosoftMediaJobInputs', 'OdataTypeMicrosoftMediaJobInputAsset', 'OdataTypeMicrosoftMediaJobInputHTTP' 5105 OdataType OdataTypeBasicJobInput `json:"@odata.type,omitempty"` 5106} 5107 5108// MarshalJSON is the custom marshaler for JobInputHTTP. 5109func (jih JobInputHTTP) MarshalJSON() ([]byte, error) { 5110 jih.OdataType = OdataTypeMicrosoftMediaJobInputHTTP 5111 objectMap := make(map[string]interface{}) 5112 if jih.BaseURI != nil { 5113 objectMap["baseUri"] = jih.BaseURI 5114 } 5115 if jih.Files != nil { 5116 objectMap["files"] = jih.Files 5117 } 5118 objectMap["start"] = jih.Start 5119 objectMap["end"] = jih.End 5120 if jih.Label != nil { 5121 objectMap["label"] = jih.Label 5122 } 5123 if jih.OdataType != "" { 5124 objectMap["@odata.type"] = jih.OdataType 5125 } 5126 return json.Marshal(objectMap) 5127} 5128 5129// AsJobInputClip is the BasicJobInput implementation for JobInputHTTP. 5130func (jih JobInputHTTP) AsJobInputClip() (*JobInputClip, bool) { 5131 return nil, false 5132} 5133 5134// AsBasicJobInputClip is the BasicJobInput implementation for JobInputHTTP. 5135func (jih JobInputHTTP) AsBasicJobInputClip() (BasicJobInputClip, bool) { 5136 return &jih, true 5137} 5138 5139// AsJobInputs is the BasicJobInput implementation for JobInputHTTP. 5140func (jih JobInputHTTP) AsJobInputs() (*JobInputs, bool) { 5141 return nil, false 5142} 5143 5144// AsJobInputAsset is the BasicJobInput implementation for JobInputHTTP. 5145func (jih JobInputHTTP) AsJobInputAsset() (*JobInputAsset, bool) { 5146 return nil, false 5147} 5148 5149// AsJobInputHTTP is the BasicJobInput implementation for JobInputHTTP. 5150func (jih JobInputHTTP) AsJobInputHTTP() (*JobInputHTTP, bool) { 5151 return &jih, true 5152} 5153 5154// AsJobInput is the BasicJobInput implementation for JobInputHTTP. 5155func (jih JobInputHTTP) AsJobInput() (*JobInput, bool) { 5156 return nil, false 5157} 5158 5159// AsBasicJobInput is the BasicJobInput implementation for JobInputHTTP. 5160func (jih JobInputHTTP) AsBasicJobInput() (BasicJobInput, bool) { 5161 return &jih, true 5162} 5163 5164// UnmarshalJSON is the custom unmarshaler for JobInputHTTP struct. 5165func (jih *JobInputHTTP) UnmarshalJSON(body []byte) error { 5166 var m map[string]*json.RawMessage 5167 err := json.Unmarshal(body, &m) 5168 if err != nil { 5169 return err 5170 } 5171 for k, v := range m { 5172 switch k { 5173 case "baseUri": 5174 if v != nil { 5175 var baseURI string 5176 err = json.Unmarshal(*v, &baseURI) 5177 if err != nil { 5178 return err 5179 } 5180 jih.BaseURI = &baseURI 5181 } 5182 case "files": 5183 if v != nil { 5184 var files []string 5185 err = json.Unmarshal(*v, &files) 5186 if err != nil { 5187 return err 5188 } 5189 jih.Files = &files 5190 } 5191 case "start": 5192 if v != nil { 5193 start, err := unmarshalBasicClipTime(*v) 5194 if err != nil { 5195 return err 5196 } 5197 jih.Start = start 5198 } 5199 case "end": 5200 if v != nil { 5201 end, err := unmarshalBasicClipTime(*v) 5202 if err != nil { 5203 return err 5204 } 5205 jih.End = end 5206 } 5207 case "label": 5208 if v != nil { 5209 var label string 5210 err = json.Unmarshal(*v, &label) 5211 if err != nil { 5212 return err 5213 } 5214 jih.Label = &label 5215 } 5216 case "@odata.type": 5217 if v != nil { 5218 var odataType OdataTypeBasicJobInput 5219 err = json.Unmarshal(*v, &odataType) 5220 if err != nil { 5221 return err 5222 } 5223 jih.OdataType = odataType 5224 } 5225 } 5226 } 5227 5228 return nil 5229} 5230 5231// JobInputs describes a list of inputs to a Job. 5232type JobInputs struct { 5233 // Inputs - List of inputs to a Job. 5234 Inputs *[]BasicJobInput `json:"inputs,omitempty"` 5235 // OdataType - Possible values include: 'OdataTypeJobInput', 'OdataTypeMicrosoftMediaJobInputClip', 'OdataTypeMicrosoftMediaJobInputs', 'OdataTypeMicrosoftMediaJobInputAsset', 'OdataTypeMicrosoftMediaJobInputHTTP' 5236 OdataType OdataTypeBasicJobInput `json:"@odata.type,omitempty"` 5237} 5238 5239// MarshalJSON is the custom marshaler for JobInputs. 5240func (ji JobInputs) MarshalJSON() ([]byte, error) { 5241 ji.OdataType = OdataTypeMicrosoftMediaJobInputs 5242 objectMap := make(map[string]interface{}) 5243 if ji.Inputs != nil { 5244 objectMap["inputs"] = ji.Inputs 5245 } 5246 if ji.OdataType != "" { 5247 objectMap["@odata.type"] = ji.OdataType 5248 } 5249 return json.Marshal(objectMap) 5250} 5251 5252// AsJobInputClip is the BasicJobInput implementation for JobInputs. 5253func (ji JobInputs) AsJobInputClip() (*JobInputClip, bool) { 5254 return nil, false 5255} 5256 5257// AsBasicJobInputClip is the BasicJobInput implementation for JobInputs. 5258func (ji JobInputs) AsBasicJobInputClip() (BasicJobInputClip, bool) { 5259 return nil, false 5260} 5261 5262// AsJobInputs is the BasicJobInput implementation for JobInputs. 5263func (ji JobInputs) AsJobInputs() (*JobInputs, bool) { 5264 return &ji, true 5265} 5266 5267// AsJobInputAsset is the BasicJobInput implementation for JobInputs. 5268func (ji JobInputs) AsJobInputAsset() (*JobInputAsset, bool) { 5269 return nil, false 5270} 5271 5272// AsJobInputHTTP is the BasicJobInput implementation for JobInputs. 5273func (ji JobInputs) AsJobInputHTTP() (*JobInputHTTP, bool) { 5274 return nil, false 5275} 5276 5277// AsJobInput is the BasicJobInput implementation for JobInputs. 5278func (ji JobInputs) AsJobInput() (*JobInput, bool) { 5279 return nil, false 5280} 5281 5282// AsBasicJobInput is the BasicJobInput implementation for JobInputs. 5283func (ji JobInputs) AsBasicJobInput() (BasicJobInput, bool) { 5284 return &ji, true 5285} 5286 5287// UnmarshalJSON is the custom unmarshaler for JobInputs struct. 5288func (ji *JobInputs) UnmarshalJSON(body []byte) error { 5289 var m map[string]*json.RawMessage 5290 err := json.Unmarshal(body, &m) 5291 if err != nil { 5292 return err 5293 } 5294 for k, v := range m { 5295 switch k { 5296 case "inputs": 5297 if v != nil { 5298 inputs, err := unmarshalBasicJobInputArray(*v) 5299 if err != nil { 5300 return err 5301 } 5302 ji.Inputs = &inputs 5303 } 5304 case "@odata.type": 5305 if v != nil { 5306 var odataType OdataTypeBasicJobInput 5307 err = json.Unmarshal(*v, &odataType) 5308 if err != nil { 5309 return err 5310 } 5311 ji.OdataType = odataType 5312 } 5313 } 5314 } 5315 5316 return nil 5317} 5318 5319// BasicJobOutput describes all the properties of a JobOutput. 5320type BasicJobOutput interface { 5321 AsJobOutputAsset() (*JobOutputAsset, bool) 5322 AsJobOutput() (*JobOutput, bool) 5323} 5324 5325// JobOutput describes all the properties of a JobOutput. 5326type JobOutput struct { 5327 // Error - READ-ONLY; If the JobOutput is in the Error state, it contains the details of the error. 5328 Error *JobError `json:"error,omitempty"` 5329 // State - READ-ONLY; Describes the state of the JobOutput. Possible values include: 'Canceled', 'Canceling', 'Error', 'Finished', 'Processing', 'Queued', 'Scheduled' 5330 State JobState `json:"state,omitempty"` 5331 // Progress - READ-ONLY; If the JobOutput is in a Processing state, this contains the Job completion percentage. The value is an estimate and not intended to be used to predict Job completion times. To determine if the JobOutput is complete, use the State property. 5332 Progress *int32 `json:"progress,omitempty"` 5333 // Label - A label that is assigned to a JobOutput in order to help uniquely identify it. This is useful when your Transform has more than one TransformOutput, whereby your Job has more than one JobOutput. In such cases, when you submit the Job, you will add two or more JobOutputs, in the same order as TransformOutputs in the Transform. Subsequently, when you retrieve the Job, either through events or on a GET request, you can use the label to easily identify the JobOutput. If a label is not provided, a default value of '{presetName}_{outputIndex}' will be used, where the preset name is the name of the preset in the corresponding TransformOutput and the output index is the relative index of the this JobOutput within the Job. Note that this index is the same as the relative index of the corresponding TransformOutput within its Transform. 5334 Label *string `json:"label,omitempty"` 5335 // OdataType - Possible values include: 'OdataTypeJobOutput', 'OdataTypeMicrosoftMediaJobOutputAsset' 5336 OdataType OdataTypeBasicJobOutput `json:"@odata.type,omitempty"` 5337} 5338 5339func unmarshalBasicJobOutput(body []byte) (BasicJobOutput, error) { 5340 var m map[string]interface{} 5341 err := json.Unmarshal(body, &m) 5342 if err != nil { 5343 return nil, err 5344 } 5345 5346 switch m["@odata.type"] { 5347 case string(OdataTypeMicrosoftMediaJobOutputAsset): 5348 var joa JobOutputAsset 5349 err := json.Unmarshal(body, &joa) 5350 return joa, err 5351 default: 5352 var jo JobOutput 5353 err := json.Unmarshal(body, &jo) 5354 return jo, err 5355 } 5356} 5357func unmarshalBasicJobOutputArray(body []byte) ([]BasicJobOutput, error) { 5358 var rawMessages []*json.RawMessage 5359 err := json.Unmarshal(body, &rawMessages) 5360 if err != nil { 5361 return nil, err 5362 } 5363 5364 joArray := make([]BasicJobOutput, len(rawMessages)) 5365 5366 for index, rawMessage := range rawMessages { 5367 jo, err := unmarshalBasicJobOutput(*rawMessage) 5368 if err != nil { 5369 return nil, err 5370 } 5371 joArray[index] = jo 5372 } 5373 return joArray, nil 5374} 5375 5376// MarshalJSON is the custom marshaler for JobOutput. 5377func (jo JobOutput) MarshalJSON() ([]byte, error) { 5378 jo.OdataType = OdataTypeJobOutput 5379 objectMap := make(map[string]interface{}) 5380 if jo.Label != nil { 5381 objectMap["label"] = jo.Label 5382 } 5383 if jo.OdataType != "" { 5384 objectMap["@odata.type"] = jo.OdataType 5385 } 5386 return json.Marshal(objectMap) 5387} 5388 5389// AsJobOutputAsset is the BasicJobOutput implementation for JobOutput. 5390func (jo JobOutput) AsJobOutputAsset() (*JobOutputAsset, bool) { 5391 return nil, false 5392} 5393 5394// AsJobOutput is the BasicJobOutput implementation for JobOutput. 5395func (jo JobOutput) AsJobOutput() (*JobOutput, bool) { 5396 return &jo, true 5397} 5398 5399// AsBasicJobOutput is the BasicJobOutput implementation for JobOutput. 5400func (jo JobOutput) AsBasicJobOutput() (BasicJobOutput, bool) { 5401 return &jo, true 5402} 5403 5404// JobOutputAsset represents an Asset used as a JobOutput. 5405type JobOutputAsset struct { 5406 // AssetName - The name of the output Asset. 5407 AssetName *string `json:"assetName,omitempty"` 5408 // Error - READ-ONLY; If the JobOutput is in the Error state, it contains the details of the error. 5409 Error *JobError `json:"error,omitempty"` 5410 // State - READ-ONLY; Describes the state of the JobOutput. Possible values include: 'Canceled', 'Canceling', 'Error', 'Finished', 'Processing', 'Queued', 'Scheduled' 5411 State JobState `json:"state,omitempty"` 5412 // Progress - READ-ONLY; If the JobOutput is in a Processing state, this contains the Job completion percentage. The value is an estimate and not intended to be used to predict Job completion times. To determine if the JobOutput is complete, use the State property. 5413 Progress *int32 `json:"progress,omitempty"` 5414 // Label - A label that is assigned to a JobOutput in order to help uniquely identify it. This is useful when your Transform has more than one TransformOutput, whereby your Job has more than one JobOutput. In such cases, when you submit the Job, you will add two or more JobOutputs, in the same order as TransformOutputs in the Transform. Subsequently, when you retrieve the Job, either through events or on a GET request, you can use the label to easily identify the JobOutput. If a label is not provided, a default value of '{presetName}_{outputIndex}' will be used, where the preset name is the name of the preset in the corresponding TransformOutput and the output index is the relative index of the this JobOutput within the Job. Note that this index is the same as the relative index of the corresponding TransformOutput within its Transform. 5415 Label *string `json:"label,omitempty"` 5416 // OdataType - Possible values include: 'OdataTypeJobOutput', 'OdataTypeMicrosoftMediaJobOutputAsset' 5417 OdataType OdataTypeBasicJobOutput `json:"@odata.type,omitempty"` 5418} 5419 5420// MarshalJSON is the custom marshaler for JobOutputAsset. 5421func (joa JobOutputAsset) MarshalJSON() ([]byte, error) { 5422 joa.OdataType = OdataTypeMicrosoftMediaJobOutputAsset 5423 objectMap := make(map[string]interface{}) 5424 if joa.AssetName != nil { 5425 objectMap["assetName"] = joa.AssetName 5426 } 5427 if joa.Label != nil { 5428 objectMap["label"] = joa.Label 5429 } 5430 if joa.OdataType != "" { 5431 objectMap["@odata.type"] = joa.OdataType 5432 } 5433 return json.Marshal(objectMap) 5434} 5435 5436// AsJobOutputAsset is the BasicJobOutput implementation for JobOutputAsset. 5437func (joa JobOutputAsset) AsJobOutputAsset() (*JobOutputAsset, bool) { 5438 return &joa, true 5439} 5440 5441// AsJobOutput is the BasicJobOutput implementation for JobOutputAsset. 5442func (joa JobOutputAsset) AsJobOutput() (*JobOutput, bool) { 5443 return nil, false 5444} 5445 5446// AsBasicJobOutput is the BasicJobOutput implementation for JobOutputAsset. 5447func (joa JobOutputAsset) AsBasicJobOutput() (BasicJobOutput, bool) { 5448 return &joa, true 5449} 5450 5451// JobProperties properties of the Job. 5452type JobProperties struct { 5453 // Created - READ-ONLY; The UTC date and time when the Job was created, in 'YYYY-MM-DDThh:mm:ssZ' format. 5454 Created *date.Time `json:"created,omitempty"` 5455 // State - READ-ONLY; The current state of the job. Possible values include: 'Canceled', 'Canceling', 'Error', 'Finished', 'Processing', 'Queued', 'Scheduled' 5456 State JobState `json:"state,omitempty"` 5457 // Description - Optional customer supplied description of the Job. 5458 Description *string `json:"description,omitempty"` 5459 // Input - The inputs for the Job. 5460 Input BasicJobInput `json:"input,omitempty"` 5461 // LastModified - READ-ONLY; The UTC date and time when the Job was last updated, in 'YYYY-MM-DDThh:mm:ssZ' format. 5462 LastModified *date.Time `json:"lastModified,omitempty"` 5463 // Outputs - The outputs for the Job. 5464 Outputs *[]BasicJobOutput `json:"outputs,omitempty"` 5465 // Priority - Priority with which the job should be processed. Higher priority jobs are processed before lower priority jobs. If not set, the default is normal. Possible values include: 'Low', 'Normal', 'High' 5466 Priority Priority `json:"priority,omitempty"` 5467 // CorrelationData - Customer provided key, value pairs that will be returned in Job and JobOutput state events. 5468 CorrelationData map[string]*string `json:"correlationData"` 5469} 5470 5471// MarshalJSON is the custom marshaler for JobProperties. 5472func (jp JobProperties) MarshalJSON() ([]byte, error) { 5473 objectMap := make(map[string]interface{}) 5474 if jp.Description != nil { 5475 objectMap["description"] = jp.Description 5476 } 5477 objectMap["input"] = jp.Input 5478 if jp.Outputs != nil { 5479 objectMap["outputs"] = jp.Outputs 5480 } 5481 if jp.Priority != "" { 5482 objectMap["priority"] = jp.Priority 5483 } 5484 if jp.CorrelationData != nil { 5485 objectMap["correlationData"] = jp.CorrelationData 5486 } 5487 return json.Marshal(objectMap) 5488} 5489 5490// UnmarshalJSON is the custom unmarshaler for JobProperties struct. 5491func (jp *JobProperties) UnmarshalJSON(body []byte) error { 5492 var m map[string]*json.RawMessage 5493 err := json.Unmarshal(body, &m) 5494 if err != nil { 5495 return err 5496 } 5497 for k, v := range m { 5498 switch k { 5499 case "created": 5500 if v != nil { 5501 var created date.Time 5502 err = json.Unmarshal(*v, &created) 5503 if err != nil { 5504 return err 5505 } 5506 jp.Created = &created 5507 } 5508 case "state": 5509 if v != nil { 5510 var state JobState 5511 err = json.Unmarshal(*v, &state) 5512 if err != nil { 5513 return err 5514 } 5515 jp.State = state 5516 } 5517 case "description": 5518 if v != nil { 5519 var description string 5520 err = json.Unmarshal(*v, &description) 5521 if err != nil { 5522 return err 5523 } 5524 jp.Description = &description 5525 } 5526 case "input": 5527 if v != nil { 5528 input, err := unmarshalBasicJobInput(*v) 5529 if err != nil { 5530 return err 5531 } 5532 jp.Input = input 5533 } 5534 case "lastModified": 5535 if v != nil { 5536 var lastModified date.Time 5537 err = json.Unmarshal(*v, &lastModified) 5538 if err != nil { 5539 return err 5540 } 5541 jp.LastModified = &lastModified 5542 } 5543 case "outputs": 5544 if v != nil { 5545 outputs, err := unmarshalBasicJobOutputArray(*v) 5546 if err != nil { 5547 return err 5548 } 5549 jp.Outputs = &outputs 5550 } 5551 case "priority": 5552 if v != nil { 5553 var priority Priority 5554 err = json.Unmarshal(*v, &priority) 5555 if err != nil { 5556 return err 5557 } 5558 jp.Priority = priority 5559 } 5560 case "correlationData": 5561 if v != nil { 5562 var correlationData map[string]*string 5563 err = json.Unmarshal(*v, &correlationData) 5564 if err != nil { 5565 return err 5566 } 5567 jp.CorrelationData = correlationData 5568 } 5569 } 5570 } 5571 5572 return nil 5573} 5574 5575// JpgFormat describes the settings for producing JPEG thumbnails. 5576type JpgFormat struct { 5577 // FilenamePattern - The pattern of the file names for the generated output files. The following macros are supported in the file name: {Basename} - The base name of the input video {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. Any unsubstituted macros will be collapsed and removed from the filename. 5578 FilenamePattern *string `json:"filenamePattern,omitempty"` 5579 // OdataType - Possible values include: 'OdataTypeFormat', 'OdataTypeMicrosoftMediaImageFormat', 'OdataTypeMicrosoftMediaJpgFormat', 'OdataTypeMicrosoftMediaPngFormat', 'OdataTypeMicrosoftMediaMultiBitrateFormat', 'OdataTypeMicrosoftMediaMp4Format', 'OdataTypeMicrosoftMediaTransportStreamFormat' 5580 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"` 5581} 5582 5583// MarshalJSON is the custom marshaler for JpgFormat. 5584func (jf JpgFormat) MarshalJSON() ([]byte, error) { 5585 jf.OdataType = OdataTypeMicrosoftMediaJpgFormat 5586 objectMap := make(map[string]interface{}) 5587 if jf.FilenamePattern != nil { 5588 objectMap["filenamePattern"] = jf.FilenamePattern 5589 } 5590 if jf.OdataType != "" { 5591 objectMap["@odata.type"] = jf.OdataType 5592 } 5593 return json.Marshal(objectMap) 5594} 5595 5596// AsImageFormat is the BasicFormat implementation for JpgFormat. 5597func (jf JpgFormat) AsImageFormat() (*ImageFormat, bool) { 5598 return nil, false 5599} 5600 5601// AsBasicImageFormat is the BasicFormat implementation for JpgFormat. 5602func (jf JpgFormat) AsBasicImageFormat() (BasicImageFormat, bool) { 5603 return &jf, true 5604} 5605 5606// AsJpgFormat is the BasicFormat implementation for JpgFormat. 5607func (jf JpgFormat) AsJpgFormat() (*JpgFormat, bool) { 5608 return &jf, true 5609} 5610 5611// AsPngFormat is the BasicFormat implementation for JpgFormat. 5612func (jf JpgFormat) AsPngFormat() (*PngFormat, bool) { 5613 return nil, false 5614} 5615 5616// AsMultiBitrateFormat is the BasicFormat implementation for JpgFormat. 5617func (jf JpgFormat) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) { 5618 return nil, false 5619} 5620 5621// AsBasicMultiBitrateFormat is the BasicFormat implementation for JpgFormat. 5622func (jf JpgFormat) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) { 5623 return nil, false 5624} 5625 5626// AsMp4Format is the BasicFormat implementation for JpgFormat. 5627func (jf JpgFormat) AsMp4Format() (*Mp4Format, bool) { 5628 return nil, false 5629} 5630 5631// AsTransportStreamFormat is the BasicFormat implementation for JpgFormat. 5632func (jf JpgFormat) AsTransportStreamFormat() (*TransportStreamFormat, bool) { 5633 return nil, false 5634} 5635 5636// AsFormat is the BasicFormat implementation for JpgFormat. 5637func (jf JpgFormat) AsFormat() (*Format, bool) { 5638 return nil, false 5639} 5640 5641// AsBasicFormat is the BasicFormat implementation for JpgFormat. 5642func (jf JpgFormat) AsBasicFormat() (BasicFormat, bool) { 5643 return &jf, true 5644} 5645 5646// JpgImage describes the properties for producing a series of JPEG images from the input video. 5647type JpgImage struct { 5648 // Layers - A collection of output JPEG image layers to be produced by the encoder. 5649 Layers *[]JpgLayer `json:"layers,omitempty"` 5650 // Start - The position in the input video from where to start generating thumbnails. The value can be in absolute timestamp (ISO 8601, e.g: PT05S), or a frame count (For example, 10 for the 10th frame), or a relative value (For example, 1%). Also supports a macro {Best}, which tells the encoder to select the best thumbnail from the first few seconds of the video. 5651 Start *string `json:"start,omitempty"` 5652 // Step - The intervals at which thumbnails are generated. The value can be in absolute timestamp (ISO 8601, e.g: PT05S for one image every 5 seconds), or a frame count (For example, 30 for every 30 frames), or a relative value (For example, 1%). 5653 Step *string `json:"step,omitempty"` 5654 // Range - The position in the input video at which to stop generating thumbnails. The value can be in absolute timestamp (ISO 8601, e.g: PT5M30S to stop at 5 minutes and 30 seconds), or a frame count (For example, 300 to stop at the 300th frame), or a relative value (For example, 100%). 5655 Range *string `json:"range,omitempty"` 5656 // KeyFrameInterval - The distance between two key frames, thereby defining a group of pictures (GOP). The value should be a non-zero integer in the range [1, 30] seconds, specified in ISO 8601 format. The default is 2 seconds (PT2S). 5657 KeyFrameInterval *string `json:"keyFrameInterval,omitempty"` 5658 // StretchMode - The resizing mode - how the input video will be resized to fit the desired output resolution(s). Default is AutoSize. Possible values include: 'StretchModeNone', 'StretchModeAutoSize', 'StretchModeAutoFit' 5659 StretchMode StretchMode `json:"stretchMode,omitempty"` 5660 // Label - An optional label for the codec. The label can be used to control muxing behavior. 5661 Label *string `json:"label,omitempty"` 5662 // OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage' 5663 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"` 5664} 5665 5666// MarshalJSON is the custom marshaler for JpgImage. 5667func (ji JpgImage) MarshalJSON() ([]byte, error) { 5668 ji.OdataType = OdataTypeMicrosoftMediaJpgImage 5669 objectMap := make(map[string]interface{}) 5670 if ji.Layers != nil { 5671 objectMap["layers"] = ji.Layers 5672 } 5673 if ji.Start != nil { 5674 objectMap["start"] = ji.Start 5675 } 5676 if ji.Step != nil { 5677 objectMap["step"] = ji.Step 5678 } 5679 if ji.Range != nil { 5680 objectMap["range"] = ji.Range 5681 } 5682 if ji.KeyFrameInterval != nil { 5683 objectMap["keyFrameInterval"] = ji.KeyFrameInterval 5684 } 5685 if ji.StretchMode != "" { 5686 objectMap["stretchMode"] = ji.StretchMode 5687 } 5688 if ji.Label != nil { 5689 objectMap["label"] = ji.Label 5690 } 5691 if ji.OdataType != "" { 5692 objectMap["@odata.type"] = ji.OdataType 5693 } 5694 return json.Marshal(objectMap) 5695} 5696 5697// AsAudio is the BasicCodec implementation for JpgImage. 5698func (ji JpgImage) AsAudio() (*Audio, bool) { 5699 return nil, false 5700} 5701 5702// AsBasicAudio is the BasicCodec implementation for JpgImage. 5703func (ji JpgImage) AsBasicAudio() (BasicAudio, bool) { 5704 return nil, false 5705} 5706 5707// AsAacAudio is the BasicCodec implementation for JpgImage. 5708func (ji JpgImage) AsAacAudio() (*AacAudio, bool) { 5709 return nil, false 5710} 5711 5712// AsCopyVideo is the BasicCodec implementation for JpgImage. 5713func (ji JpgImage) AsCopyVideo() (*CopyVideo, bool) { 5714 return nil, false 5715} 5716 5717// AsVideo is the BasicCodec implementation for JpgImage. 5718func (ji JpgImage) AsVideo() (*Video, bool) { 5719 return nil, false 5720} 5721 5722// AsBasicVideo is the BasicCodec implementation for JpgImage. 5723func (ji JpgImage) AsBasicVideo() (BasicVideo, bool) { 5724 return &ji, true 5725} 5726 5727// AsImage is the BasicCodec implementation for JpgImage. 5728func (ji JpgImage) AsImage() (*Image, bool) { 5729 return nil, false 5730} 5731 5732// AsBasicImage is the BasicCodec implementation for JpgImage. 5733func (ji JpgImage) AsBasicImage() (BasicImage, bool) { 5734 return &ji, true 5735} 5736 5737// AsCopyAudio is the BasicCodec implementation for JpgImage. 5738func (ji JpgImage) AsCopyAudio() (*CopyAudio, bool) { 5739 return nil, false 5740} 5741 5742// AsH264Video is the BasicCodec implementation for JpgImage. 5743func (ji JpgImage) AsH264Video() (*H264Video, bool) { 5744 return nil, false 5745} 5746 5747// AsJpgImage is the BasicCodec implementation for JpgImage. 5748func (ji JpgImage) AsJpgImage() (*JpgImage, bool) { 5749 return &ji, true 5750} 5751 5752// AsPngImage is the BasicCodec implementation for JpgImage. 5753func (ji JpgImage) AsPngImage() (*PngImage, bool) { 5754 return nil, false 5755} 5756 5757// AsCodec is the BasicCodec implementation for JpgImage. 5758func (ji JpgImage) AsCodec() (*Codec, bool) { 5759 return nil, false 5760} 5761 5762// AsBasicCodec is the BasicCodec implementation for JpgImage. 5763func (ji JpgImage) AsBasicCodec() (BasicCodec, bool) { 5764 return &ji, true 5765} 5766 5767// JpgLayer describes the settings to produce a JPEG image from the input video. 5768type JpgLayer struct { 5769 // Quality - The compression quality of the JPEG output. Range is from 0-100 and the default is 70. 5770 Quality *int32 `json:"quality,omitempty"` 5771 // Width - The width of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in width as the input. 5772 Width *string `json:"width,omitempty"` 5773 // Height - The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in height as the input. 5774 Height *string `json:"height,omitempty"` 5775 // Label - The alphanumeric label for this layer, which can be used in multiplexing different video and audio layers, or in naming the output file. 5776 Label *string `json:"label,omitempty"` 5777 // OdataType - Possible values include: 'OdataTypeLayer', 'OdataTypeMicrosoftMediaVideoLayer', 'OdataTypeMicrosoftMediaH264Layer', 'OdataTypeMicrosoftMediaJpgLayer', 'OdataTypeMicrosoftMediaPngLayer' 5778 OdataType OdataTypeBasicLayer `json:"@odata.type,omitempty"` 5779} 5780 5781// MarshalJSON is the custom marshaler for JpgLayer. 5782func (jl JpgLayer) MarshalJSON() ([]byte, error) { 5783 jl.OdataType = OdataTypeMicrosoftMediaJpgLayer 5784 objectMap := make(map[string]interface{}) 5785 if jl.Quality != nil { 5786 objectMap["quality"] = jl.Quality 5787 } 5788 if jl.Width != nil { 5789 objectMap["width"] = jl.Width 5790 } 5791 if jl.Height != nil { 5792 objectMap["height"] = jl.Height 5793 } 5794 if jl.Label != nil { 5795 objectMap["label"] = jl.Label 5796 } 5797 if jl.OdataType != "" { 5798 objectMap["@odata.type"] = jl.OdataType 5799 } 5800 return json.Marshal(objectMap) 5801} 5802 5803// AsVideoLayer is the BasicLayer implementation for JpgLayer. 5804func (jl JpgLayer) AsVideoLayer() (*VideoLayer, bool) { 5805 return nil, false 5806} 5807 5808// AsBasicVideoLayer is the BasicLayer implementation for JpgLayer. 5809func (jl JpgLayer) AsBasicVideoLayer() (BasicVideoLayer, bool) { 5810 return nil, false 5811} 5812 5813// AsH264Layer is the BasicLayer implementation for JpgLayer. 5814func (jl JpgLayer) AsH264Layer() (*H264Layer, bool) { 5815 return nil, false 5816} 5817 5818// AsJpgLayer is the BasicLayer implementation for JpgLayer. 5819func (jl JpgLayer) AsJpgLayer() (*JpgLayer, bool) { 5820 return &jl, true 5821} 5822 5823// AsPngLayer is the BasicLayer implementation for JpgLayer. 5824func (jl JpgLayer) AsPngLayer() (*PngLayer, bool) { 5825 return nil, false 5826} 5827 5828// AsLayer is the BasicLayer implementation for JpgLayer. 5829func (jl JpgLayer) AsLayer() (*Layer, bool) { 5830 return nil, false 5831} 5832 5833// AsBasicLayer is the BasicLayer implementation for JpgLayer. 5834func (jl JpgLayer) AsBasicLayer() (BasicLayer, bool) { 5835 return &jl, true 5836} 5837 5838// BasicLayer the encoder can be configured to produce video and/or images (thumbnails) at different resolutions, by 5839// specifying a layer for each desired resolution. A layer represents the properties for the video or image at a 5840// resolution. 5841type BasicLayer interface { 5842 AsVideoLayer() (*VideoLayer, bool) 5843 AsBasicVideoLayer() (BasicVideoLayer, bool) 5844 AsH264Layer() (*H264Layer, bool) 5845 AsJpgLayer() (*JpgLayer, bool) 5846 AsPngLayer() (*PngLayer, bool) 5847 AsLayer() (*Layer, bool) 5848} 5849 5850// Layer the encoder can be configured to produce video and/or images (thumbnails) at different resolutions, by 5851// specifying a layer for each desired resolution. A layer represents the properties for the video or image at 5852// a resolution. 5853type Layer struct { 5854 // Width - The width of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in width as the input. 5855 Width *string `json:"width,omitempty"` 5856 // Height - The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in height as the input. 5857 Height *string `json:"height,omitempty"` 5858 // Label - The alphanumeric label for this layer, which can be used in multiplexing different video and audio layers, or in naming the output file. 5859 Label *string `json:"label,omitempty"` 5860 // OdataType - Possible values include: 'OdataTypeLayer', 'OdataTypeMicrosoftMediaVideoLayer', 'OdataTypeMicrosoftMediaH264Layer', 'OdataTypeMicrosoftMediaJpgLayer', 'OdataTypeMicrosoftMediaPngLayer' 5861 OdataType OdataTypeBasicLayer `json:"@odata.type,omitempty"` 5862} 5863 5864func unmarshalBasicLayer(body []byte) (BasicLayer, error) { 5865 var m map[string]interface{} 5866 err := json.Unmarshal(body, &m) 5867 if err != nil { 5868 return nil, err 5869 } 5870 5871 switch m["@odata.type"] { 5872 case string(OdataTypeMicrosoftMediaVideoLayer): 5873 var vl VideoLayer 5874 err := json.Unmarshal(body, &vl) 5875 return vl, err 5876 case string(OdataTypeMicrosoftMediaH264Layer): 5877 var hl H264Layer 5878 err := json.Unmarshal(body, &hl) 5879 return hl, err 5880 case string(OdataTypeMicrosoftMediaJpgLayer): 5881 var jl JpgLayer 5882 err := json.Unmarshal(body, &jl) 5883 return jl, err 5884 case string(OdataTypeMicrosoftMediaPngLayer): 5885 var pl PngLayer 5886 err := json.Unmarshal(body, &pl) 5887 return pl, err 5888 default: 5889 var l Layer 5890 err := json.Unmarshal(body, &l) 5891 return l, err 5892 } 5893} 5894func unmarshalBasicLayerArray(body []byte) ([]BasicLayer, error) { 5895 var rawMessages []*json.RawMessage 5896 err := json.Unmarshal(body, &rawMessages) 5897 if err != nil { 5898 return nil, err 5899 } 5900 5901 lArray := make([]BasicLayer, len(rawMessages)) 5902 5903 for index, rawMessage := range rawMessages { 5904 l, err := unmarshalBasicLayer(*rawMessage) 5905 if err != nil { 5906 return nil, err 5907 } 5908 lArray[index] = l 5909 } 5910 return lArray, nil 5911} 5912 5913// MarshalJSON is the custom marshaler for Layer. 5914func (l Layer) MarshalJSON() ([]byte, error) { 5915 l.OdataType = OdataTypeLayer 5916 objectMap := make(map[string]interface{}) 5917 if l.Width != nil { 5918 objectMap["width"] = l.Width 5919 } 5920 if l.Height != nil { 5921 objectMap["height"] = l.Height 5922 } 5923 if l.Label != nil { 5924 objectMap["label"] = l.Label 5925 } 5926 if l.OdataType != "" { 5927 objectMap["@odata.type"] = l.OdataType 5928 } 5929 return json.Marshal(objectMap) 5930} 5931 5932// AsVideoLayer is the BasicLayer implementation for Layer. 5933func (l Layer) AsVideoLayer() (*VideoLayer, bool) { 5934 return nil, false 5935} 5936 5937// AsBasicVideoLayer is the BasicLayer implementation for Layer. 5938func (l Layer) AsBasicVideoLayer() (BasicVideoLayer, bool) { 5939 return nil, false 5940} 5941 5942// AsH264Layer is the BasicLayer implementation for Layer. 5943func (l Layer) AsH264Layer() (*H264Layer, bool) { 5944 return nil, false 5945} 5946 5947// AsJpgLayer is the BasicLayer implementation for Layer. 5948func (l Layer) AsJpgLayer() (*JpgLayer, bool) { 5949 return nil, false 5950} 5951 5952// AsPngLayer is the BasicLayer implementation for Layer. 5953func (l Layer) AsPngLayer() (*PngLayer, bool) { 5954 return nil, false 5955} 5956 5957// AsLayer is the BasicLayer implementation for Layer. 5958func (l Layer) AsLayer() (*Layer, bool) { 5959 return &l, true 5960} 5961 5962// AsBasicLayer is the BasicLayer implementation for Layer. 5963func (l Layer) AsBasicLayer() (BasicLayer, bool) { 5964 return &l, true 5965} 5966 5967// ListContainerSasInput the parameters to the list SAS request. 5968type ListContainerSasInput struct { 5969 // Permissions - The permissions to set on the SAS URL. Possible values include: 'Read', 'ReadWrite', 'ReadWriteDelete' 5970 Permissions AssetContainerPermission `json:"permissions,omitempty"` 5971 // ExpiryTime - The SAS URL expiration time. This must be less than 24 hours from the current time. 5972 ExpiryTime *date.Time `json:"expiryTime,omitempty"` 5973} 5974 5975// ListContentKeysResponse class of response for listContentKeys action 5976type ListContentKeysResponse struct { 5977 autorest.Response `json:"-"` 5978 // ContentKeys - ContentKeys used by current Streaming Locator 5979 ContentKeys *[]StreamingLocatorContentKey `json:"contentKeys,omitempty"` 5980} 5981 5982// ListPathsResponse class of response for listPaths action 5983type ListPathsResponse struct { 5984 autorest.Response `json:"-"` 5985 // StreamingPaths - Streaming Paths supported by current Streaming Locator 5986 StreamingPaths *[]StreamingPath `json:"streamingPaths,omitempty"` 5987 // DownloadPaths - Download Paths supported by current Streaming Locator 5988 DownloadPaths *[]string `json:"downloadPaths,omitempty"` 5989} 5990 5991// ListStreamingLocatorsResponse the Streaming Locators associated with this Asset. 5992type ListStreamingLocatorsResponse struct { 5993 autorest.Response `json:"-"` 5994 // StreamingLocators - READ-ONLY; The list of Streaming Locators. 5995 StreamingLocators *[]AssetStreamingLocator `json:"streamingLocators,omitempty"` 5996} 5997 5998// MarshalJSON is the custom marshaler for ListStreamingLocatorsResponse. 5999func (lslr ListStreamingLocatorsResponse) MarshalJSON() ([]byte, error) { 6000 objectMap := make(map[string]interface{}) 6001 return json.Marshal(objectMap) 6002} 6003 6004// LiveEvent the Live Event. 6005type LiveEvent struct { 6006 autorest.Response `json:"-"` 6007 // LiveEventProperties - The Live Event properties. 6008 *LiveEventProperties `json:"properties,omitempty"` 6009 // Tags - Resource tags. 6010 Tags map[string]*string `json:"tags"` 6011 // Location - The Azure Region of the resource. 6012 Location *string `json:"location,omitempty"` 6013 // ID - READ-ONLY; Fully qualified resource ID for the resource. 6014 ID *string `json:"id,omitempty"` 6015 // Name - READ-ONLY; The name of the resource. 6016 Name *string `json:"name,omitempty"` 6017 // Type - READ-ONLY; The type of the resource. 6018 Type *string `json:"type,omitempty"` 6019} 6020 6021// MarshalJSON is the custom marshaler for LiveEvent. 6022func (le LiveEvent) MarshalJSON() ([]byte, error) { 6023 objectMap := make(map[string]interface{}) 6024 if le.LiveEventProperties != nil { 6025 objectMap["properties"] = le.LiveEventProperties 6026 } 6027 if le.Tags != nil { 6028 objectMap["tags"] = le.Tags 6029 } 6030 if le.Location != nil { 6031 objectMap["location"] = le.Location 6032 } 6033 return json.Marshal(objectMap) 6034} 6035 6036// UnmarshalJSON is the custom unmarshaler for LiveEvent struct. 6037func (le *LiveEvent) UnmarshalJSON(body []byte) error { 6038 var m map[string]*json.RawMessage 6039 err := json.Unmarshal(body, &m) 6040 if err != nil { 6041 return err 6042 } 6043 for k, v := range m { 6044 switch k { 6045 case "properties": 6046 if v != nil { 6047 var liveEventProperties LiveEventProperties 6048 err = json.Unmarshal(*v, &liveEventProperties) 6049 if err != nil { 6050 return err 6051 } 6052 le.LiveEventProperties = &liveEventProperties 6053 } 6054 case "tags": 6055 if v != nil { 6056 var tags map[string]*string 6057 err = json.Unmarshal(*v, &tags) 6058 if err != nil { 6059 return err 6060 } 6061 le.Tags = tags 6062 } 6063 case "location": 6064 if v != nil { 6065 var location string 6066 err = json.Unmarshal(*v, &location) 6067 if err != nil { 6068 return err 6069 } 6070 le.Location = &location 6071 } 6072 case "id": 6073 if v != nil { 6074 var ID string 6075 err = json.Unmarshal(*v, &ID) 6076 if err != nil { 6077 return err 6078 } 6079 le.ID = &ID 6080 } 6081 case "name": 6082 if v != nil { 6083 var name string 6084 err = json.Unmarshal(*v, &name) 6085 if err != nil { 6086 return err 6087 } 6088 le.Name = &name 6089 } 6090 case "type": 6091 if v != nil { 6092 var typeVar string 6093 err = json.Unmarshal(*v, &typeVar) 6094 if err != nil { 6095 return err 6096 } 6097 le.Type = &typeVar 6098 } 6099 } 6100 } 6101 6102 return nil 6103} 6104 6105// LiveEventActionInput the LiveEvent action input parameter definition. 6106type LiveEventActionInput struct { 6107 // RemoveOutputsOnStop - The flag indicates if remove LiveOutputs on Stop. 6108 RemoveOutputsOnStop *bool `json:"removeOutputsOnStop,omitempty"` 6109} 6110 6111// LiveEventEncoding the Live Event encoding. 6112type LiveEventEncoding struct { 6113 // EncodingType - The encoding type for Live Event. This value is specified at creation time and cannot be updated. Possible values include: 'LiveEventEncodingTypeNone', 'LiveEventEncodingTypeBasic', 'LiveEventEncodingTypeStandard', 'LiveEventEncodingTypePremium1080p' 6114 EncodingType LiveEventEncodingType `json:"encodingType,omitempty"` 6115 // PresetName - The encoding preset name. This value is specified at creation time and cannot be updated. 6116 PresetName *string `json:"presetName,omitempty"` 6117} 6118 6119// LiveEventEndpoint the Live Event endpoint. 6120type LiveEventEndpoint struct { 6121 // Protocol - The endpoint protocol. 6122 Protocol *string `json:"protocol,omitempty"` 6123 // URL - The endpoint URL. 6124 URL *string `json:"url,omitempty"` 6125} 6126 6127// LiveEventInput the Live Event input. 6128type LiveEventInput struct { 6129 // StreamingProtocol - The streaming protocol for the Live Event. This is specified at creation time and cannot be updated. Possible values include: 'FragmentedMP4', 'RTMP' 6130 StreamingProtocol LiveEventInputProtocol `json:"streamingProtocol,omitempty"` 6131 // AccessControl - The access control for LiveEvent Input. 6132 AccessControl *LiveEventInputAccessControl `json:"accessControl,omitempty"` 6133 // KeyFrameIntervalDuration - ISO 8601 timespan duration of the key frame interval duration. 6134 KeyFrameIntervalDuration *string `json:"keyFrameIntervalDuration,omitempty"` 6135 // AccessToken - A unique identifier for a stream. This can be specified at creation time but cannot be updated. If omitted, the service will generate a unique value. 6136 AccessToken *string `json:"accessToken,omitempty"` 6137 // Endpoints - The input endpoints for the Live Event. 6138 Endpoints *[]LiveEventEndpoint `json:"endpoints,omitempty"` 6139} 6140 6141// LiveEventInputAccessControl the IP access control for Live Event Input. 6142type LiveEventInputAccessControl struct { 6143 // IP - The IP access control properties. 6144 IP *IPAccessControl `json:"ip,omitempty"` 6145} 6146 6147// LiveEventInputTrackSelection a track selection condition. 6148type LiveEventInputTrackSelection struct { 6149 // Property - Property name to select. 6150 Property *string `json:"property,omitempty"` 6151 // Operation - Comparing operation. 6152 Operation *string `json:"operation,omitempty"` 6153 // Value - Property value to select. 6154 Value *string `json:"value,omitempty"` 6155} 6156 6157// LiveEventListResult the LiveEvent list result. 6158type LiveEventListResult struct { 6159 autorest.Response `json:"-"` 6160 // Value - The result of the List Live Event operation. 6161 Value *[]LiveEvent `json:"value,omitempty"` 6162 // OdataCount - The number of result. 6163 OdataCount *int32 `json:"@odata.count,omitempty"` 6164 // OdataNextLink - Th link to the next set of results. Not empty if value contains incomplete list of Live Outputs. 6165 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 6166} 6167 6168// LiveEventListResultIterator provides access to a complete listing of LiveEvent values. 6169type LiveEventListResultIterator struct { 6170 i int 6171 page LiveEventListResultPage 6172} 6173 6174// NextWithContext advances to the next value. If there was an error making 6175// the request the iterator does not advance and the error is returned. 6176func (iter *LiveEventListResultIterator) NextWithContext(ctx context.Context) (err error) { 6177 if tracing.IsEnabled() { 6178 ctx = tracing.StartSpan(ctx, fqdn+"/LiveEventListResultIterator.NextWithContext") 6179 defer func() { 6180 sc := -1 6181 if iter.Response().Response.Response != nil { 6182 sc = iter.Response().Response.Response.StatusCode 6183 } 6184 tracing.EndSpan(ctx, sc, err) 6185 }() 6186 } 6187 iter.i++ 6188 if iter.i < len(iter.page.Values()) { 6189 return nil 6190 } 6191 err = iter.page.NextWithContext(ctx) 6192 if err != nil { 6193 iter.i-- 6194 return err 6195 } 6196 iter.i = 0 6197 return nil 6198} 6199 6200// Next advances to the next value. If there was an error making 6201// the request the iterator does not advance and the error is returned. 6202// Deprecated: Use NextWithContext() instead. 6203func (iter *LiveEventListResultIterator) Next() error { 6204 return iter.NextWithContext(context.Background()) 6205} 6206 6207// NotDone returns true if the enumeration should be started or is not yet complete. 6208func (iter LiveEventListResultIterator) NotDone() bool { 6209 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 6210} 6211 6212// Response returns the raw server response from the last page request. 6213func (iter LiveEventListResultIterator) Response() LiveEventListResult { 6214 return iter.page.Response() 6215} 6216 6217// Value returns the current value or a zero-initialized value if the 6218// iterator has advanced beyond the end of the collection. 6219func (iter LiveEventListResultIterator) Value() LiveEvent { 6220 if !iter.page.NotDone() { 6221 return LiveEvent{} 6222 } 6223 return iter.page.Values()[iter.i] 6224} 6225 6226// Creates a new instance of the LiveEventListResultIterator type. 6227func NewLiveEventListResultIterator(page LiveEventListResultPage) LiveEventListResultIterator { 6228 return LiveEventListResultIterator{page: page} 6229} 6230 6231// IsEmpty returns true if the ListResult contains no values. 6232func (lelr LiveEventListResult) IsEmpty() bool { 6233 return lelr.Value == nil || len(*lelr.Value) == 0 6234} 6235 6236// hasNextLink returns true if the NextLink is not empty. 6237func (lelr LiveEventListResult) hasNextLink() bool { 6238 return lelr.OdataNextLink != nil && len(*lelr.OdataNextLink) != 0 6239} 6240 6241// liveEventListResultPreparer prepares a request to retrieve the next set of results. 6242// It returns nil if no more results exist. 6243func (lelr LiveEventListResult) liveEventListResultPreparer(ctx context.Context) (*http.Request, error) { 6244 if !lelr.hasNextLink() { 6245 return nil, nil 6246 } 6247 return autorest.Prepare((&http.Request{}).WithContext(ctx), 6248 autorest.AsJSON(), 6249 autorest.AsGet(), 6250 autorest.WithBaseURL(to.String(lelr.OdataNextLink))) 6251} 6252 6253// LiveEventListResultPage contains a page of LiveEvent values. 6254type LiveEventListResultPage struct { 6255 fn func(context.Context, LiveEventListResult) (LiveEventListResult, error) 6256 lelr LiveEventListResult 6257} 6258 6259// NextWithContext advances to the next page of values. If there was an error making 6260// the request the page does not advance and the error is returned. 6261func (page *LiveEventListResultPage) NextWithContext(ctx context.Context) (err error) { 6262 if tracing.IsEnabled() { 6263 ctx = tracing.StartSpan(ctx, fqdn+"/LiveEventListResultPage.NextWithContext") 6264 defer func() { 6265 sc := -1 6266 if page.Response().Response.Response != nil { 6267 sc = page.Response().Response.Response.StatusCode 6268 } 6269 tracing.EndSpan(ctx, sc, err) 6270 }() 6271 } 6272 for { 6273 next, err := page.fn(ctx, page.lelr) 6274 if err != nil { 6275 return err 6276 } 6277 page.lelr = next 6278 if !next.hasNextLink() || !next.IsEmpty() { 6279 break 6280 } 6281 } 6282 return nil 6283} 6284 6285// Next advances to the next page of values. If there was an error making 6286// the request the page does not advance and the error is returned. 6287// Deprecated: Use NextWithContext() instead. 6288func (page *LiveEventListResultPage) Next() error { 6289 return page.NextWithContext(context.Background()) 6290} 6291 6292// NotDone returns true if the page enumeration should be started or is not yet complete. 6293func (page LiveEventListResultPage) NotDone() bool { 6294 return !page.lelr.IsEmpty() 6295} 6296 6297// Response returns the raw server response from the last page request. 6298func (page LiveEventListResultPage) Response() LiveEventListResult { 6299 return page.lelr 6300} 6301 6302// Values returns the slice of values for the current page or nil if there are no values. 6303func (page LiveEventListResultPage) Values() []LiveEvent { 6304 if page.lelr.IsEmpty() { 6305 return nil 6306 } 6307 return *page.lelr.Value 6308} 6309 6310// Creates a new instance of the LiveEventListResultPage type. 6311func NewLiveEventListResultPage(cur LiveEventListResult, getNextPage func(context.Context, LiveEventListResult) (LiveEventListResult, error)) LiveEventListResultPage { 6312 return LiveEventListResultPage{ 6313 fn: getNextPage, 6314 lelr: cur, 6315 } 6316} 6317 6318// LiveEventOutputTranscriptionTrack describes a transcription track in the output of a Live Event, 6319// generated using speech-to-text transcription. 6320type LiveEventOutputTranscriptionTrack struct { 6321 // TrackName - The output track name. 6322 TrackName *string `json:"trackName,omitempty"` 6323} 6324 6325// LiveEventPreview the Live Event preview. 6326type LiveEventPreview struct { 6327 // Endpoints - The endpoints for preview. 6328 Endpoints *[]LiveEventEndpoint `json:"endpoints,omitempty"` 6329 // AccessControl - The access control for LiveEvent preview. 6330 AccessControl *LiveEventPreviewAccessControl `json:"accessControl,omitempty"` 6331 // PreviewLocator - The identifier of the preview locator in Guid format. Specifying this at creation time allows the caller to know the preview locator url before the event is created. If omitted, the service will generate a random identifier. This value cannot be updated once the live event is created. 6332 PreviewLocator *string `json:"previewLocator,omitempty"` 6333 // StreamingPolicyName - The name of streaming policy used for the LiveEvent preview. This value is specified at creation time and cannot be updated. 6334 StreamingPolicyName *string `json:"streamingPolicyName,omitempty"` 6335 // AlternativeMediaID - An Alternative Media Identifier associated with the StreamingLocator created for the preview. This value is specified at creation time and cannot be updated. The identifier can be used in the CustomLicenseAcquisitionUrlTemplate or the CustomKeyAcquisitionUrlTemplate of the StreamingPolicy specified in the StreamingPolicyName field. 6336 AlternativeMediaID *string `json:"alternativeMediaId,omitempty"` 6337} 6338 6339// LiveEventPreviewAccessControl the IP access control for Live Event preview. 6340type LiveEventPreviewAccessControl struct { 6341 // IP - The IP access control properties. 6342 IP *IPAccessControl `json:"ip,omitempty"` 6343} 6344 6345// LiveEventProperties the Live Event properties. 6346type LiveEventProperties struct { 6347 // Description - The Live Event description. 6348 Description *string `json:"description,omitempty"` 6349 // Input - The Live Event input. 6350 Input *LiveEventInput `json:"input,omitempty"` 6351 // Preview - The Live Event preview. 6352 Preview *LiveEventPreview `json:"preview,omitempty"` 6353 // Encoding - The Live Event encoding. 6354 Encoding *LiveEventEncoding `json:"encoding,omitempty"` 6355 // Transcriptions - The Live Event transcription. 6356 Transcriptions *[]LiveEventTranscription `json:"transcriptions,omitempty"` 6357 // ProvisioningState - READ-ONLY; The provisioning state of the Live Event. 6358 ProvisioningState *string `json:"provisioningState,omitempty"` 6359 // ResourceState - READ-ONLY; The resource state of the Live Event. Possible values include: 'Stopped', 'Starting', 'Running', 'Stopping', 'Deleting' 6360 ResourceState LiveEventResourceState `json:"resourceState,omitempty"` 6361 // CrossSiteAccessPolicies - The Live Event access policies. 6362 CrossSiteAccessPolicies *CrossSiteAccessPolicies `json:"crossSiteAccessPolicies,omitempty"` 6363 // VanityURL - Specifies whether to use a vanity url with the Live Event. This value is specified at creation time and cannot be updated. 6364 VanityURL *bool `json:"vanityUrl,omitempty"` 6365 // StreamOptions - The options to use for the LiveEvent. This value is specified at creation time and cannot be updated. 6366 StreamOptions *[]StreamOptionsFlag `json:"streamOptions,omitempty"` 6367 // Created - READ-ONLY; The exact time the Live Event was created. 6368 Created *date.Time `json:"created,omitempty"` 6369 // LastModified - READ-ONLY; The exact time the Live Event was last modified. 6370 LastModified *date.Time `json:"lastModified,omitempty"` 6371} 6372 6373// MarshalJSON is the custom marshaler for LiveEventProperties. 6374func (lep LiveEventProperties) MarshalJSON() ([]byte, error) { 6375 objectMap := make(map[string]interface{}) 6376 if lep.Description != nil { 6377 objectMap["description"] = lep.Description 6378 } 6379 if lep.Input != nil { 6380 objectMap["input"] = lep.Input 6381 } 6382 if lep.Preview != nil { 6383 objectMap["preview"] = lep.Preview 6384 } 6385 if lep.Encoding != nil { 6386 objectMap["encoding"] = lep.Encoding 6387 } 6388 if lep.Transcriptions != nil { 6389 objectMap["transcriptions"] = lep.Transcriptions 6390 } 6391 if lep.CrossSiteAccessPolicies != nil { 6392 objectMap["crossSiteAccessPolicies"] = lep.CrossSiteAccessPolicies 6393 } 6394 if lep.VanityURL != nil { 6395 objectMap["vanityUrl"] = lep.VanityURL 6396 } 6397 if lep.StreamOptions != nil { 6398 objectMap["streamOptions"] = lep.StreamOptions 6399 } 6400 return json.Marshal(objectMap) 6401} 6402 6403// LiveEventsCreateFuture an abstraction for monitoring and retrieving the results of a long-running 6404// operation. 6405type LiveEventsCreateFuture struct { 6406 azure.FutureAPI 6407 // Result returns the result of the asynchronous operation. 6408 // If the operation has not completed it will return an error. 6409 Result func(LiveEventsClient) (LiveEvent, error) 6410} 6411 6412// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6413func (future *LiveEventsCreateFuture) UnmarshalJSON(body []byte) error { 6414 var azFuture azure.Future 6415 if err := json.Unmarshal(body, &azFuture); err != nil { 6416 return err 6417 } 6418 future.FutureAPI = &azFuture 6419 future.Result = future.result 6420 return nil 6421} 6422 6423// result is the default implementation for LiveEventsCreateFuture.Result. 6424func (future *LiveEventsCreateFuture) result(client LiveEventsClient) (le LiveEvent, err error) { 6425 var done bool 6426 done, err = future.DoneWithContext(context.Background(), client) 6427 if err != nil { 6428 err = autorest.NewErrorWithError(err, "media.LiveEventsCreateFuture", "Result", future.Response(), "Polling failure") 6429 return 6430 } 6431 if !done { 6432 le.Response.Response = future.Response() 6433 err = azure.NewAsyncOpIncompleteError("media.LiveEventsCreateFuture") 6434 return 6435 } 6436 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6437 if le.Response.Response, err = future.GetResult(sender); err == nil && le.Response.Response.StatusCode != http.StatusNoContent { 6438 le, err = client.CreateResponder(le.Response.Response) 6439 if err != nil { 6440 err = autorest.NewErrorWithError(err, "media.LiveEventsCreateFuture", "Result", le.Response.Response, "Failure responding to request") 6441 } 6442 } 6443 return 6444} 6445 6446// LiveEventsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 6447// operation. 6448type LiveEventsDeleteFuture struct { 6449 azure.FutureAPI 6450 // Result returns the result of the asynchronous operation. 6451 // If the operation has not completed it will return an error. 6452 Result func(LiveEventsClient) (autorest.Response, error) 6453} 6454 6455// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6456func (future *LiveEventsDeleteFuture) UnmarshalJSON(body []byte) error { 6457 var azFuture azure.Future 6458 if err := json.Unmarshal(body, &azFuture); err != nil { 6459 return err 6460 } 6461 future.FutureAPI = &azFuture 6462 future.Result = future.result 6463 return nil 6464} 6465 6466// result is the default implementation for LiveEventsDeleteFuture.Result. 6467func (future *LiveEventsDeleteFuture) result(client LiveEventsClient) (ar autorest.Response, err error) { 6468 var done bool 6469 done, err = future.DoneWithContext(context.Background(), client) 6470 if err != nil { 6471 err = autorest.NewErrorWithError(err, "media.LiveEventsDeleteFuture", "Result", future.Response(), "Polling failure") 6472 return 6473 } 6474 if !done { 6475 ar.Response = future.Response() 6476 err = azure.NewAsyncOpIncompleteError("media.LiveEventsDeleteFuture") 6477 return 6478 } 6479 ar.Response = future.Response() 6480 return 6481} 6482 6483// LiveEventsResetFuture an abstraction for monitoring and retrieving the results of a long-running 6484// operation. 6485type LiveEventsResetFuture struct { 6486 azure.FutureAPI 6487 // Result returns the result of the asynchronous operation. 6488 // If the operation has not completed it will return an error. 6489 Result func(LiveEventsClient) (autorest.Response, error) 6490} 6491 6492// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6493func (future *LiveEventsResetFuture) UnmarshalJSON(body []byte) error { 6494 var azFuture azure.Future 6495 if err := json.Unmarshal(body, &azFuture); err != nil { 6496 return err 6497 } 6498 future.FutureAPI = &azFuture 6499 future.Result = future.result 6500 return nil 6501} 6502 6503// result is the default implementation for LiveEventsResetFuture.Result. 6504func (future *LiveEventsResetFuture) result(client LiveEventsClient) (ar autorest.Response, err error) { 6505 var done bool 6506 done, err = future.DoneWithContext(context.Background(), client) 6507 if err != nil { 6508 err = autorest.NewErrorWithError(err, "media.LiveEventsResetFuture", "Result", future.Response(), "Polling failure") 6509 return 6510 } 6511 if !done { 6512 ar.Response = future.Response() 6513 err = azure.NewAsyncOpIncompleteError("media.LiveEventsResetFuture") 6514 return 6515 } 6516 ar.Response = future.Response() 6517 return 6518} 6519 6520// LiveEventsStartFuture an abstraction for monitoring and retrieving the results of a long-running 6521// operation. 6522type LiveEventsStartFuture struct { 6523 azure.FutureAPI 6524 // Result returns the result of the asynchronous operation. 6525 // If the operation has not completed it will return an error. 6526 Result func(LiveEventsClient) (autorest.Response, error) 6527} 6528 6529// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6530func (future *LiveEventsStartFuture) UnmarshalJSON(body []byte) error { 6531 var azFuture azure.Future 6532 if err := json.Unmarshal(body, &azFuture); err != nil { 6533 return err 6534 } 6535 future.FutureAPI = &azFuture 6536 future.Result = future.result 6537 return nil 6538} 6539 6540// result is the default implementation for LiveEventsStartFuture.Result. 6541func (future *LiveEventsStartFuture) result(client LiveEventsClient) (ar autorest.Response, err error) { 6542 var done bool 6543 done, err = future.DoneWithContext(context.Background(), client) 6544 if err != nil { 6545 err = autorest.NewErrorWithError(err, "media.LiveEventsStartFuture", "Result", future.Response(), "Polling failure") 6546 return 6547 } 6548 if !done { 6549 ar.Response = future.Response() 6550 err = azure.NewAsyncOpIncompleteError("media.LiveEventsStartFuture") 6551 return 6552 } 6553 ar.Response = future.Response() 6554 return 6555} 6556 6557// LiveEventsStopFuture an abstraction for monitoring and retrieving the results of a long-running 6558// operation. 6559type LiveEventsStopFuture struct { 6560 azure.FutureAPI 6561 // Result returns the result of the asynchronous operation. 6562 // If the operation has not completed it will return an error. 6563 Result func(LiveEventsClient) (autorest.Response, error) 6564} 6565 6566// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6567func (future *LiveEventsStopFuture) UnmarshalJSON(body []byte) error { 6568 var azFuture azure.Future 6569 if err := json.Unmarshal(body, &azFuture); err != nil { 6570 return err 6571 } 6572 future.FutureAPI = &azFuture 6573 future.Result = future.result 6574 return nil 6575} 6576 6577// result is the default implementation for LiveEventsStopFuture.Result. 6578func (future *LiveEventsStopFuture) result(client LiveEventsClient) (ar autorest.Response, err error) { 6579 var done bool 6580 done, err = future.DoneWithContext(context.Background(), client) 6581 if err != nil { 6582 err = autorest.NewErrorWithError(err, "media.LiveEventsStopFuture", "Result", future.Response(), "Polling failure") 6583 return 6584 } 6585 if !done { 6586 ar.Response = future.Response() 6587 err = azure.NewAsyncOpIncompleteError("media.LiveEventsStopFuture") 6588 return 6589 } 6590 ar.Response = future.Response() 6591 return 6592} 6593 6594// LiveEventsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 6595// operation. 6596type LiveEventsUpdateFuture struct { 6597 azure.FutureAPI 6598 // Result returns the result of the asynchronous operation. 6599 // If the operation has not completed it will return an error. 6600 Result func(LiveEventsClient) (LiveEvent, error) 6601} 6602 6603// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6604func (future *LiveEventsUpdateFuture) UnmarshalJSON(body []byte) error { 6605 var azFuture azure.Future 6606 if err := json.Unmarshal(body, &azFuture); err != nil { 6607 return err 6608 } 6609 future.FutureAPI = &azFuture 6610 future.Result = future.result 6611 return nil 6612} 6613 6614// result is the default implementation for LiveEventsUpdateFuture.Result. 6615func (future *LiveEventsUpdateFuture) result(client LiveEventsClient) (le LiveEvent, err error) { 6616 var done bool 6617 done, err = future.DoneWithContext(context.Background(), client) 6618 if err != nil { 6619 err = autorest.NewErrorWithError(err, "media.LiveEventsUpdateFuture", "Result", future.Response(), "Polling failure") 6620 return 6621 } 6622 if !done { 6623 le.Response.Response = future.Response() 6624 err = azure.NewAsyncOpIncompleteError("media.LiveEventsUpdateFuture") 6625 return 6626 } 6627 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6628 if le.Response.Response, err = future.GetResult(sender); err == nil && le.Response.Response.StatusCode != http.StatusNoContent { 6629 le, err = client.UpdateResponder(le.Response.Response) 6630 if err != nil { 6631 err = autorest.NewErrorWithError(err, "media.LiveEventsUpdateFuture", "Result", le.Response.Response, "Failure responding to request") 6632 } 6633 } 6634 return 6635} 6636 6637// LiveEventTranscription describes the transcription tracks in the output of a Live Event, generated using 6638// speech-to-text transcription. 6639type LiveEventTranscription struct { 6640 // Language - Specifies the language (locale) used for speech-to-text transcription � it should match the spoken language in the audio track. The value should be in BCP-47 format of 'language tag-region' (e.g: 'en-US'). The list of supported languages are 'en-US' and 'en-GB'. 6641 Language *string `json:"language,omitempty"` 6642 // InputTrackSelection - Provides a mechanism to select the audio track in the input live feed, to which speech-to-text transcription is applied. 6643 InputTrackSelection *[]LiveEventInputTrackSelection `json:"inputTrackSelection,omitempty"` 6644 // OutputTranscriptionTrack - Describes a transcription track in the output of a Live Event, generated using speech-to-text transcription. 6645 OutputTranscriptionTrack *LiveEventOutputTranscriptionTrack `json:"outputTranscriptionTrack,omitempty"` 6646} 6647 6648// LiveOutput the Live Output. 6649type LiveOutput struct { 6650 autorest.Response `json:"-"` 6651 // LiveOutputProperties - The Live Output properties. 6652 *LiveOutputProperties `json:"properties,omitempty"` 6653 // ID - READ-ONLY; Fully qualified resource ID for the resource. 6654 ID *string `json:"id,omitempty"` 6655 // Name - READ-ONLY; The name of the resource. 6656 Name *string `json:"name,omitempty"` 6657 // Type - READ-ONLY; The type of the resource. 6658 Type *string `json:"type,omitempty"` 6659} 6660 6661// MarshalJSON is the custom marshaler for LiveOutput. 6662func (lo LiveOutput) MarshalJSON() ([]byte, error) { 6663 objectMap := make(map[string]interface{}) 6664 if lo.LiveOutputProperties != nil { 6665 objectMap["properties"] = lo.LiveOutputProperties 6666 } 6667 return json.Marshal(objectMap) 6668} 6669 6670// UnmarshalJSON is the custom unmarshaler for LiveOutput struct. 6671func (lo *LiveOutput) UnmarshalJSON(body []byte) error { 6672 var m map[string]*json.RawMessage 6673 err := json.Unmarshal(body, &m) 6674 if err != nil { 6675 return err 6676 } 6677 for k, v := range m { 6678 switch k { 6679 case "properties": 6680 if v != nil { 6681 var liveOutputProperties LiveOutputProperties 6682 err = json.Unmarshal(*v, &liveOutputProperties) 6683 if err != nil { 6684 return err 6685 } 6686 lo.LiveOutputProperties = &liveOutputProperties 6687 } 6688 case "id": 6689 if v != nil { 6690 var ID string 6691 err = json.Unmarshal(*v, &ID) 6692 if err != nil { 6693 return err 6694 } 6695 lo.ID = &ID 6696 } 6697 case "name": 6698 if v != nil { 6699 var name string 6700 err = json.Unmarshal(*v, &name) 6701 if err != nil { 6702 return err 6703 } 6704 lo.Name = &name 6705 } 6706 case "type": 6707 if v != nil { 6708 var typeVar string 6709 err = json.Unmarshal(*v, &typeVar) 6710 if err != nil { 6711 return err 6712 } 6713 lo.Type = &typeVar 6714 } 6715 } 6716 } 6717 6718 return nil 6719} 6720 6721// LiveOutputListResult the LiveOutput list result. 6722type LiveOutputListResult struct { 6723 autorest.Response `json:"-"` 6724 // Value - The result of the List Live Output operation. 6725 Value *[]LiveOutput `json:"value,omitempty"` 6726 // OdataCount - The number of result. 6727 OdataCount *int32 `json:"@odata.count,omitempty"` 6728 // OdataNextLink - Th link to the next set of results. Not empty if value contains incomplete list of Live Outputs. 6729 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 6730} 6731 6732// LiveOutputListResultIterator provides access to a complete listing of LiveOutput values. 6733type LiveOutputListResultIterator struct { 6734 i int 6735 page LiveOutputListResultPage 6736} 6737 6738// NextWithContext advances to the next value. If there was an error making 6739// the request the iterator does not advance and the error is returned. 6740func (iter *LiveOutputListResultIterator) NextWithContext(ctx context.Context) (err error) { 6741 if tracing.IsEnabled() { 6742 ctx = tracing.StartSpan(ctx, fqdn+"/LiveOutputListResultIterator.NextWithContext") 6743 defer func() { 6744 sc := -1 6745 if iter.Response().Response.Response != nil { 6746 sc = iter.Response().Response.Response.StatusCode 6747 } 6748 tracing.EndSpan(ctx, sc, err) 6749 }() 6750 } 6751 iter.i++ 6752 if iter.i < len(iter.page.Values()) { 6753 return nil 6754 } 6755 err = iter.page.NextWithContext(ctx) 6756 if err != nil { 6757 iter.i-- 6758 return err 6759 } 6760 iter.i = 0 6761 return nil 6762} 6763 6764// Next advances to the next value. If there was an error making 6765// the request the iterator does not advance and the error is returned. 6766// Deprecated: Use NextWithContext() instead. 6767func (iter *LiveOutputListResultIterator) Next() error { 6768 return iter.NextWithContext(context.Background()) 6769} 6770 6771// NotDone returns true if the enumeration should be started or is not yet complete. 6772func (iter LiveOutputListResultIterator) NotDone() bool { 6773 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 6774} 6775 6776// Response returns the raw server response from the last page request. 6777func (iter LiveOutputListResultIterator) Response() LiveOutputListResult { 6778 return iter.page.Response() 6779} 6780 6781// Value returns the current value or a zero-initialized value if the 6782// iterator has advanced beyond the end of the collection. 6783func (iter LiveOutputListResultIterator) Value() LiveOutput { 6784 if !iter.page.NotDone() { 6785 return LiveOutput{} 6786 } 6787 return iter.page.Values()[iter.i] 6788} 6789 6790// Creates a new instance of the LiveOutputListResultIterator type. 6791func NewLiveOutputListResultIterator(page LiveOutputListResultPage) LiveOutputListResultIterator { 6792 return LiveOutputListResultIterator{page: page} 6793} 6794 6795// IsEmpty returns true if the ListResult contains no values. 6796func (lolr LiveOutputListResult) IsEmpty() bool { 6797 return lolr.Value == nil || len(*lolr.Value) == 0 6798} 6799 6800// hasNextLink returns true if the NextLink is not empty. 6801func (lolr LiveOutputListResult) hasNextLink() bool { 6802 return lolr.OdataNextLink != nil && len(*lolr.OdataNextLink) != 0 6803} 6804 6805// liveOutputListResultPreparer prepares a request to retrieve the next set of results. 6806// It returns nil if no more results exist. 6807func (lolr LiveOutputListResult) liveOutputListResultPreparer(ctx context.Context) (*http.Request, error) { 6808 if !lolr.hasNextLink() { 6809 return nil, nil 6810 } 6811 return autorest.Prepare((&http.Request{}).WithContext(ctx), 6812 autorest.AsJSON(), 6813 autorest.AsGet(), 6814 autorest.WithBaseURL(to.String(lolr.OdataNextLink))) 6815} 6816 6817// LiveOutputListResultPage contains a page of LiveOutput values. 6818type LiveOutputListResultPage struct { 6819 fn func(context.Context, LiveOutputListResult) (LiveOutputListResult, error) 6820 lolr LiveOutputListResult 6821} 6822 6823// NextWithContext advances to the next page of values. If there was an error making 6824// the request the page does not advance and the error is returned. 6825func (page *LiveOutputListResultPage) NextWithContext(ctx context.Context) (err error) { 6826 if tracing.IsEnabled() { 6827 ctx = tracing.StartSpan(ctx, fqdn+"/LiveOutputListResultPage.NextWithContext") 6828 defer func() { 6829 sc := -1 6830 if page.Response().Response.Response != nil { 6831 sc = page.Response().Response.Response.StatusCode 6832 } 6833 tracing.EndSpan(ctx, sc, err) 6834 }() 6835 } 6836 for { 6837 next, err := page.fn(ctx, page.lolr) 6838 if err != nil { 6839 return err 6840 } 6841 page.lolr = next 6842 if !next.hasNextLink() || !next.IsEmpty() { 6843 break 6844 } 6845 } 6846 return nil 6847} 6848 6849// Next advances to the next page of values. If there was an error making 6850// the request the page does not advance and the error is returned. 6851// Deprecated: Use NextWithContext() instead. 6852func (page *LiveOutputListResultPage) Next() error { 6853 return page.NextWithContext(context.Background()) 6854} 6855 6856// NotDone returns true if the page enumeration should be started or is not yet complete. 6857func (page LiveOutputListResultPage) NotDone() bool { 6858 return !page.lolr.IsEmpty() 6859} 6860 6861// Response returns the raw server response from the last page request. 6862func (page LiveOutputListResultPage) Response() LiveOutputListResult { 6863 return page.lolr 6864} 6865 6866// Values returns the slice of values for the current page or nil if there are no values. 6867func (page LiveOutputListResultPage) Values() []LiveOutput { 6868 if page.lolr.IsEmpty() { 6869 return nil 6870 } 6871 return *page.lolr.Value 6872} 6873 6874// Creates a new instance of the LiveOutputListResultPage type. 6875func NewLiveOutputListResultPage(cur LiveOutputListResult, getNextPage func(context.Context, LiveOutputListResult) (LiveOutputListResult, error)) LiveOutputListResultPage { 6876 return LiveOutputListResultPage{ 6877 fn: getNextPage, 6878 lolr: cur, 6879 } 6880} 6881 6882// LiveOutputProperties the JSON object that contains the properties required to create a Live Output. 6883type LiveOutputProperties struct { 6884 // Description - The description of the Live Output. 6885 Description *string `json:"description,omitempty"` 6886 // AssetName - The asset name. 6887 AssetName *string `json:"assetName,omitempty"` 6888 // ArchiveWindowLength - ISO 8601 timespan duration of the archive window length. This is duration that customer want to retain the recorded content. 6889 ArchiveWindowLength *string `json:"archiveWindowLength,omitempty"` 6890 // ManifestName - The manifest file name. If not provided, the service will generate one automatically. 6891 ManifestName *string `json:"manifestName,omitempty"` 6892 // Hls - The HLS configuration. 6893 Hls *Hls `json:"hls,omitempty"` 6894 // OutputSnapTime - The output snapshot time. 6895 OutputSnapTime *int64 `json:"outputSnapTime,omitempty"` 6896 // Created - READ-ONLY; The exact time the Live Output was created. 6897 Created *date.Time `json:"created,omitempty"` 6898 // LastModified - READ-ONLY; The exact time the Live Output was last modified. 6899 LastModified *date.Time `json:"lastModified,omitempty"` 6900 // ProvisioningState - READ-ONLY; The provisioning state of the Live Output. 6901 ProvisioningState *string `json:"provisioningState,omitempty"` 6902 // ResourceState - READ-ONLY; The resource state of the Live Output. Possible values include: 'LiveOutputResourceStateCreating', 'LiveOutputResourceStateRunning', 'LiveOutputResourceStateDeleting' 6903 ResourceState LiveOutputResourceState `json:"resourceState,omitempty"` 6904} 6905 6906// MarshalJSON is the custom marshaler for LiveOutputProperties. 6907func (lop LiveOutputProperties) MarshalJSON() ([]byte, error) { 6908 objectMap := make(map[string]interface{}) 6909 if lop.Description != nil { 6910 objectMap["description"] = lop.Description 6911 } 6912 if lop.AssetName != nil { 6913 objectMap["assetName"] = lop.AssetName 6914 } 6915 if lop.ArchiveWindowLength != nil { 6916 objectMap["archiveWindowLength"] = lop.ArchiveWindowLength 6917 } 6918 if lop.ManifestName != nil { 6919 objectMap["manifestName"] = lop.ManifestName 6920 } 6921 if lop.Hls != nil { 6922 objectMap["hls"] = lop.Hls 6923 } 6924 if lop.OutputSnapTime != nil { 6925 objectMap["outputSnapTime"] = lop.OutputSnapTime 6926 } 6927 return json.Marshal(objectMap) 6928} 6929 6930// LiveOutputsCreateFuture an abstraction for monitoring and retrieving the results of a long-running 6931// operation. 6932type LiveOutputsCreateFuture struct { 6933 azure.FutureAPI 6934 // Result returns the result of the asynchronous operation. 6935 // If the operation has not completed it will return an error. 6936 Result func(LiveOutputsClient) (LiveOutput, error) 6937} 6938 6939// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6940func (future *LiveOutputsCreateFuture) UnmarshalJSON(body []byte) error { 6941 var azFuture azure.Future 6942 if err := json.Unmarshal(body, &azFuture); err != nil { 6943 return err 6944 } 6945 future.FutureAPI = &azFuture 6946 future.Result = future.result 6947 return nil 6948} 6949 6950// result is the default implementation for LiveOutputsCreateFuture.Result. 6951func (future *LiveOutputsCreateFuture) result(client LiveOutputsClient) (lo LiveOutput, err error) { 6952 var done bool 6953 done, err = future.DoneWithContext(context.Background(), client) 6954 if err != nil { 6955 err = autorest.NewErrorWithError(err, "media.LiveOutputsCreateFuture", "Result", future.Response(), "Polling failure") 6956 return 6957 } 6958 if !done { 6959 lo.Response.Response = future.Response() 6960 err = azure.NewAsyncOpIncompleteError("media.LiveOutputsCreateFuture") 6961 return 6962 } 6963 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6964 if lo.Response.Response, err = future.GetResult(sender); err == nil && lo.Response.Response.StatusCode != http.StatusNoContent { 6965 lo, err = client.CreateResponder(lo.Response.Response) 6966 if err != nil { 6967 err = autorest.NewErrorWithError(err, "media.LiveOutputsCreateFuture", "Result", lo.Response.Response, "Failure responding to request") 6968 } 6969 } 6970 return 6971} 6972 6973// LiveOutputsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 6974// operation. 6975type LiveOutputsDeleteFuture struct { 6976 azure.FutureAPI 6977 // Result returns the result of the asynchronous operation. 6978 // If the operation has not completed it will return an error. 6979 Result func(LiveOutputsClient) (autorest.Response, error) 6980} 6981 6982// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6983func (future *LiveOutputsDeleteFuture) UnmarshalJSON(body []byte) error { 6984 var azFuture azure.Future 6985 if err := json.Unmarshal(body, &azFuture); err != nil { 6986 return err 6987 } 6988 future.FutureAPI = &azFuture 6989 future.Result = future.result 6990 return nil 6991} 6992 6993// result is the default implementation for LiveOutputsDeleteFuture.Result. 6994func (future *LiveOutputsDeleteFuture) result(client LiveOutputsClient) (ar autorest.Response, err error) { 6995 var done bool 6996 done, err = future.DoneWithContext(context.Background(), client) 6997 if err != nil { 6998 err = autorest.NewErrorWithError(err, "media.LiveOutputsDeleteFuture", "Result", future.Response(), "Polling failure") 6999 return 7000 } 7001 if !done { 7002 ar.Response = future.Response() 7003 err = azure.NewAsyncOpIncompleteError("media.LiveOutputsDeleteFuture") 7004 return 7005 } 7006 ar.Response = future.Response() 7007 return 7008} 7009 7010// Location ... 7011type Location struct { 7012 Name *string `json:"name,omitempty"` 7013} 7014 7015// Metric a metric emitted by service. 7016type Metric struct { 7017 // Name - READ-ONLY; The metric name. 7018 Name *string `json:"name,omitempty"` 7019 // DisplayName - READ-ONLY; The metric display name. 7020 DisplayName *string `json:"displayName,omitempty"` 7021 // DisplayDescription - READ-ONLY; The metric display description. 7022 DisplayDescription *string `json:"displayDescription,omitempty"` 7023 // Unit - READ-ONLY; The metric unit. Possible values include: 'MetricUnitBytes', 'MetricUnitCount', 'MetricUnitMilliseconds' 7024 Unit MetricUnit `json:"unit,omitempty"` 7025 // AggregationType - READ-ONLY; The metric aggregation type. Possible values include: 'Average', 'Count', 'Total' 7026 AggregationType MetricAggregationType `json:"aggregationType,omitempty"` 7027 // Dimensions - READ-ONLY; The metric dimensions. 7028 Dimensions *[]MetricDimension `json:"dimensions,omitempty"` 7029} 7030 7031// MarshalJSON is the custom marshaler for Metric. 7032func (mVar Metric) MarshalJSON() ([]byte, error) { 7033 objectMap := make(map[string]interface{}) 7034 return json.Marshal(objectMap) 7035} 7036 7037// MetricDimension a metric dimension. 7038type MetricDimension struct { 7039 // Name - READ-ONLY; The metric dimension name. 7040 Name *string `json:"name,omitempty"` 7041 // DisplayName - READ-ONLY; The display name for the dimension. 7042 DisplayName *string `json:"displayName,omitempty"` 7043 // ToBeExportedForShoebox - READ-ONLY; Whether to export metric to shoebox. 7044 ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` 7045} 7046 7047// MarshalJSON is the custom marshaler for MetricDimension. 7048func (md MetricDimension) MarshalJSON() ([]byte, error) { 7049 objectMap := make(map[string]interface{}) 7050 return json.Marshal(objectMap) 7051} 7052 7053// MetricProperties metric properties. 7054type MetricProperties struct { 7055 // ServiceSpecification - READ-ONLY; The service specifications. 7056 ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` 7057} 7058 7059// MarshalJSON is the custom marshaler for MetricProperties. 7060func (mp MetricProperties) MarshalJSON() ([]byte, error) { 7061 objectMap := make(map[string]interface{}) 7062 return json.Marshal(objectMap) 7063} 7064 7065// Mp4Format describes the properties for an output ISO MP4 file. 7066type Mp4Format struct { 7067 // OutputFiles - The list of output files to produce. Each entry in the list is a set of audio and video layer labels to be muxed together . 7068 OutputFiles *[]OutputFile `json:"outputFiles,omitempty"` 7069 // FilenamePattern - The pattern of the file names for the generated output files. The following macros are supported in the file name: {Basename} - The base name of the input video {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. Any unsubstituted macros will be collapsed and removed from the filename. 7070 FilenamePattern *string `json:"filenamePattern,omitempty"` 7071 // OdataType - Possible values include: 'OdataTypeFormat', 'OdataTypeMicrosoftMediaImageFormat', 'OdataTypeMicrosoftMediaJpgFormat', 'OdataTypeMicrosoftMediaPngFormat', 'OdataTypeMicrosoftMediaMultiBitrateFormat', 'OdataTypeMicrosoftMediaMp4Format', 'OdataTypeMicrosoftMediaTransportStreamFormat' 7072 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"` 7073} 7074 7075// MarshalJSON is the custom marshaler for Mp4Format. 7076func (m4f Mp4Format) MarshalJSON() ([]byte, error) { 7077 m4f.OdataType = OdataTypeMicrosoftMediaMp4Format 7078 objectMap := make(map[string]interface{}) 7079 if m4f.OutputFiles != nil { 7080 objectMap["outputFiles"] = m4f.OutputFiles 7081 } 7082 if m4f.FilenamePattern != nil { 7083 objectMap["filenamePattern"] = m4f.FilenamePattern 7084 } 7085 if m4f.OdataType != "" { 7086 objectMap["@odata.type"] = m4f.OdataType 7087 } 7088 return json.Marshal(objectMap) 7089} 7090 7091// AsImageFormat is the BasicFormat implementation for Mp4Format. 7092func (m4f Mp4Format) AsImageFormat() (*ImageFormat, bool) { 7093 return nil, false 7094} 7095 7096// AsBasicImageFormat is the BasicFormat implementation for Mp4Format. 7097func (m4f Mp4Format) AsBasicImageFormat() (BasicImageFormat, bool) { 7098 return nil, false 7099} 7100 7101// AsJpgFormat is the BasicFormat implementation for Mp4Format. 7102func (m4f Mp4Format) AsJpgFormat() (*JpgFormat, bool) { 7103 return nil, false 7104} 7105 7106// AsPngFormat is the BasicFormat implementation for Mp4Format. 7107func (m4f Mp4Format) AsPngFormat() (*PngFormat, bool) { 7108 return nil, false 7109} 7110 7111// AsMultiBitrateFormat is the BasicFormat implementation for Mp4Format. 7112func (m4f Mp4Format) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) { 7113 return nil, false 7114} 7115 7116// AsBasicMultiBitrateFormat is the BasicFormat implementation for Mp4Format. 7117func (m4f Mp4Format) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) { 7118 return &m4f, true 7119} 7120 7121// AsMp4Format is the BasicFormat implementation for Mp4Format. 7122func (m4f Mp4Format) AsMp4Format() (*Mp4Format, bool) { 7123 return &m4f, true 7124} 7125 7126// AsTransportStreamFormat is the BasicFormat implementation for Mp4Format. 7127func (m4f Mp4Format) AsTransportStreamFormat() (*TransportStreamFormat, bool) { 7128 return nil, false 7129} 7130 7131// AsFormat is the BasicFormat implementation for Mp4Format. 7132func (m4f Mp4Format) AsFormat() (*Format, bool) { 7133 return nil, false 7134} 7135 7136// AsBasicFormat is the BasicFormat implementation for Mp4Format. 7137func (m4f Mp4Format) AsBasicFormat() (BasicFormat, bool) { 7138 return &m4f, true 7139} 7140 7141// BasicMultiBitrateFormat describes the properties for producing a collection of GOP aligned multi-bitrate files. The 7142// default behavior is to produce one output file for each video layer which is muxed together with all the audios. The 7143// exact output files produced can be controlled by specifying the outputFiles collection. 7144type BasicMultiBitrateFormat interface { 7145 AsMp4Format() (*Mp4Format, bool) 7146 AsTransportStreamFormat() (*TransportStreamFormat, bool) 7147 AsMultiBitrateFormat() (*MultiBitrateFormat, bool) 7148} 7149 7150// MultiBitrateFormat describes the properties for producing a collection of GOP aligned multi-bitrate files. 7151// The default behavior is to produce one output file for each video layer which is muxed together with all the 7152// audios. The exact output files produced can be controlled by specifying the outputFiles collection. 7153type MultiBitrateFormat struct { 7154 // OutputFiles - The list of output files to produce. Each entry in the list is a set of audio and video layer labels to be muxed together . 7155 OutputFiles *[]OutputFile `json:"outputFiles,omitempty"` 7156 // FilenamePattern - The pattern of the file names for the generated output files. The following macros are supported in the file name: {Basename} - The base name of the input video {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. Any unsubstituted macros will be collapsed and removed from the filename. 7157 FilenamePattern *string `json:"filenamePattern,omitempty"` 7158 // OdataType - Possible values include: 'OdataTypeFormat', 'OdataTypeMicrosoftMediaImageFormat', 'OdataTypeMicrosoftMediaJpgFormat', 'OdataTypeMicrosoftMediaPngFormat', 'OdataTypeMicrosoftMediaMultiBitrateFormat', 'OdataTypeMicrosoftMediaMp4Format', 'OdataTypeMicrosoftMediaTransportStreamFormat' 7159 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"` 7160} 7161 7162func unmarshalBasicMultiBitrateFormat(body []byte) (BasicMultiBitrateFormat, error) { 7163 var m map[string]interface{} 7164 err := json.Unmarshal(body, &m) 7165 if err != nil { 7166 return nil, err 7167 } 7168 7169 switch m["@odata.type"] { 7170 case string(OdataTypeMicrosoftMediaMp4Format): 7171 var m4f Mp4Format 7172 err := json.Unmarshal(body, &m4f) 7173 return m4f, err 7174 case string(OdataTypeMicrosoftMediaTransportStreamFormat): 7175 var tsf TransportStreamFormat 7176 err := json.Unmarshal(body, &tsf) 7177 return tsf, err 7178 default: 7179 var mbf MultiBitrateFormat 7180 err := json.Unmarshal(body, &mbf) 7181 return mbf, err 7182 } 7183} 7184func unmarshalBasicMultiBitrateFormatArray(body []byte) ([]BasicMultiBitrateFormat, error) { 7185 var rawMessages []*json.RawMessage 7186 err := json.Unmarshal(body, &rawMessages) 7187 if err != nil { 7188 return nil, err 7189 } 7190 7191 mbfArray := make([]BasicMultiBitrateFormat, len(rawMessages)) 7192 7193 for index, rawMessage := range rawMessages { 7194 mbf, err := unmarshalBasicMultiBitrateFormat(*rawMessage) 7195 if err != nil { 7196 return nil, err 7197 } 7198 mbfArray[index] = mbf 7199 } 7200 return mbfArray, nil 7201} 7202 7203// MarshalJSON is the custom marshaler for MultiBitrateFormat. 7204func (mbf MultiBitrateFormat) MarshalJSON() ([]byte, error) { 7205 mbf.OdataType = OdataTypeMicrosoftMediaMultiBitrateFormat 7206 objectMap := make(map[string]interface{}) 7207 if mbf.OutputFiles != nil { 7208 objectMap["outputFiles"] = mbf.OutputFiles 7209 } 7210 if mbf.FilenamePattern != nil { 7211 objectMap["filenamePattern"] = mbf.FilenamePattern 7212 } 7213 if mbf.OdataType != "" { 7214 objectMap["@odata.type"] = mbf.OdataType 7215 } 7216 return json.Marshal(objectMap) 7217} 7218 7219// AsImageFormat is the BasicFormat implementation for MultiBitrateFormat. 7220func (mbf MultiBitrateFormat) AsImageFormat() (*ImageFormat, bool) { 7221 return nil, false 7222} 7223 7224// AsBasicImageFormat is the BasicFormat implementation for MultiBitrateFormat. 7225func (mbf MultiBitrateFormat) AsBasicImageFormat() (BasicImageFormat, bool) { 7226 return nil, false 7227} 7228 7229// AsJpgFormat is the BasicFormat implementation for MultiBitrateFormat. 7230func (mbf MultiBitrateFormat) AsJpgFormat() (*JpgFormat, bool) { 7231 return nil, false 7232} 7233 7234// AsPngFormat is the BasicFormat implementation for MultiBitrateFormat. 7235func (mbf MultiBitrateFormat) AsPngFormat() (*PngFormat, bool) { 7236 return nil, false 7237} 7238 7239// AsMultiBitrateFormat is the BasicFormat implementation for MultiBitrateFormat. 7240func (mbf MultiBitrateFormat) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) { 7241 return &mbf, true 7242} 7243 7244// AsBasicMultiBitrateFormat is the BasicFormat implementation for MultiBitrateFormat. 7245func (mbf MultiBitrateFormat) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) { 7246 return &mbf, true 7247} 7248 7249// AsMp4Format is the BasicFormat implementation for MultiBitrateFormat. 7250func (mbf MultiBitrateFormat) AsMp4Format() (*Mp4Format, bool) { 7251 return nil, false 7252} 7253 7254// AsTransportStreamFormat is the BasicFormat implementation for MultiBitrateFormat. 7255func (mbf MultiBitrateFormat) AsTransportStreamFormat() (*TransportStreamFormat, bool) { 7256 return nil, false 7257} 7258 7259// AsFormat is the BasicFormat implementation for MultiBitrateFormat. 7260func (mbf MultiBitrateFormat) AsFormat() (*Format, bool) { 7261 return nil, false 7262} 7263 7264// AsBasicFormat is the BasicFormat implementation for MultiBitrateFormat. 7265func (mbf MultiBitrateFormat) AsBasicFormat() (BasicFormat, bool) { 7266 return &mbf, true 7267} 7268 7269// NoEncryption class for NoEncryption scheme 7270type NoEncryption struct { 7271 // EnabledProtocols - Representing supported protocols 7272 EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"` 7273} 7274 7275// ODataError information about an error. 7276type ODataError struct { 7277 // Code - A language-independent error name. 7278 Code *string `json:"code,omitempty"` 7279 // Message - The error message. 7280 Message *string `json:"message,omitempty"` 7281 // Target - The target of the error (for example, the name of the property in error). 7282 Target *string `json:"target,omitempty"` 7283 // Details - The error details. 7284 Details *[]ODataError `json:"details,omitempty"` 7285} 7286 7287// Operation an operation. 7288type Operation struct { 7289 // Name - The operation name. 7290 Name *string `json:"name,omitempty"` 7291 // Display - The operation display name. 7292 Display *OperationDisplay `json:"display,omitempty"` 7293 // Origin - Origin of the operation. 7294 Origin *string `json:"origin,omitempty"` 7295 // Properties - Operation properties format. 7296 Properties *MetricProperties `json:"properties,omitempty"` 7297} 7298 7299// OperationCollection a collection of Operation items. 7300type OperationCollection struct { 7301 autorest.Response `json:"-"` 7302 // Value - A collection of Operation items. 7303 Value *[]Operation `json:"value,omitempty"` 7304 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 7305 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 7306} 7307 7308// OperationCollectionIterator provides access to a complete listing of Operation values. 7309type OperationCollectionIterator struct { 7310 i int 7311 page OperationCollectionPage 7312} 7313 7314// NextWithContext advances to the next value. If there was an error making 7315// the request the iterator does not advance and the error is returned. 7316func (iter *OperationCollectionIterator) NextWithContext(ctx context.Context) (err error) { 7317 if tracing.IsEnabled() { 7318 ctx = tracing.StartSpan(ctx, fqdn+"/OperationCollectionIterator.NextWithContext") 7319 defer func() { 7320 sc := -1 7321 if iter.Response().Response.Response != nil { 7322 sc = iter.Response().Response.Response.StatusCode 7323 } 7324 tracing.EndSpan(ctx, sc, err) 7325 }() 7326 } 7327 iter.i++ 7328 if iter.i < len(iter.page.Values()) { 7329 return nil 7330 } 7331 err = iter.page.NextWithContext(ctx) 7332 if err != nil { 7333 iter.i-- 7334 return err 7335 } 7336 iter.i = 0 7337 return nil 7338} 7339 7340// Next advances to the next value. If there was an error making 7341// the request the iterator does not advance and the error is returned. 7342// Deprecated: Use NextWithContext() instead. 7343func (iter *OperationCollectionIterator) Next() error { 7344 return iter.NextWithContext(context.Background()) 7345} 7346 7347// NotDone returns true if the enumeration should be started or is not yet complete. 7348func (iter OperationCollectionIterator) NotDone() bool { 7349 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 7350} 7351 7352// Response returns the raw server response from the last page request. 7353func (iter OperationCollectionIterator) Response() OperationCollection { 7354 return iter.page.Response() 7355} 7356 7357// Value returns the current value or a zero-initialized value if the 7358// iterator has advanced beyond the end of the collection. 7359func (iter OperationCollectionIterator) Value() Operation { 7360 if !iter.page.NotDone() { 7361 return Operation{} 7362 } 7363 return iter.page.Values()[iter.i] 7364} 7365 7366// Creates a new instance of the OperationCollectionIterator type. 7367func NewOperationCollectionIterator(page OperationCollectionPage) OperationCollectionIterator { 7368 return OperationCollectionIterator{page: page} 7369} 7370 7371// IsEmpty returns true if the ListResult contains no values. 7372func (oc OperationCollection) IsEmpty() bool { 7373 return oc.Value == nil || len(*oc.Value) == 0 7374} 7375 7376// hasNextLink returns true if the NextLink is not empty. 7377func (oc OperationCollection) hasNextLink() bool { 7378 return oc.OdataNextLink != nil && len(*oc.OdataNextLink) != 0 7379} 7380 7381// operationCollectionPreparer prepares a request to retrieve the next set of results. 7382// It returns nil if no more results exist. 7383func (oc OperationCollection) operationCollectionPreparer(ctx context.Context) (*http.Request, error) { 7384 if !oc.hasNextLink() { 7385 return nil, nil 7386 } 7387 return autorest.Prepare((&http.Request{}).WithContext(ctx), 7388 autorest.AsJSON(), 7389 autorest.AsGet(), 7390 autorest.WithBaseURL(to.String(oc.OdataNextLink))) 7391} 7392 7393// OperationCollectionPage contains a page of Operation values. 7394type OperationCollectionPage struct { 7395 fn func(context.Context, OperationCollection) (OperationCollection, error) 7396 oc OperationCollection 7397} 7398 7399// NextWithContext advances to the next page of values. If there was an error making 7400// the request the page does not advance and the error is returned. 7401func (page *OperationCollectionPage) NextWithContext(ctx context.Context) (err error) { 7402 if tracing.IsEnabled() { 7403 ctx = tracing.StartSpan(ctx, fqdn+"/OperationCollectionPage.NextWithContext") 7404 defer func() { 7405 sc := -1 7406 if page.Response().Response.Response != nil { 7407 sc = page.Response().Response.Response.StatusCode 7408 } 7409 tracing.EndSpan(ctx, sc, err) 7410 }() 7411 } 7412 for { 7413 next, err := page.fn(ctx, page.oc) 7414 if err != nil { 7415 return err 7416 } 7417 page.oc = next 7418 if !next.hasNextLink() || !next.IsEmpty() { 7419 break 7420 } 7421 } 7422 return nil 7423} 7424 7425// Next advances to the next page of values. If there was an error making 7426// the request the page does not advance and the error is returned. 7427// Deprecated: Use NextWithContext() instead. 7428func (page *OperationCollectionPage) Next() error { 7429 return page.NextWithContext(context.Background()) 7430} 7431 7432// NotDone returns true if the page enumeration should be started or is not yet complete. 7433func (page OperationCollectionPage) NotDone() bool { 7434 return !page.oc.IsEmpty() 7435} 7436 7437// Response returns the raw server response from the last page request. 7438func (page OperationCollectionPage) Response() OperationCollection { 7439 return page.oc 7440} 7441 7442// Values returns the slice of values for the current page or nil if there are no values. 7443func (page OperationCollectionPage) Values() []Operation { 7444 if page.oc.IsEmpty() { 7445 return nil 7446 } 7447 return *page.oc.Value 7448} 7449 7450// Creates a new instance of the OperationCollectionPage type. 7451func NewOperationCollectionPage(cur OperationCollection, getNextPage func(context.Context, OperationCollection) (OperationCollection, error)) OperationCollectionPage { 7452 return OperationCollectionPage{ 7453 fn: getNextPage, 7454 oc: cur, 7455 } 7456} 7457 7458// OperationDisplay operation details. 7459type OperationDisplay struct { 7460 // Provider - The service provider. 7461 Provider *string `json:"provider,omitempty"` 7462 // Resource - Resource on which the operation is performed. 7463 Resource *string `json:"resource,omitempty"` 7464 // Operation - The operation type. 7465 Operation *string `json:"operation,omitempty"` 7466 // Description - The operation description. 7467 Description *string `json:"description,omitempty"` 7468} 7469 7470// OutputFile represents an output file produced. 7471type OutputFile struct { 7472 // Labels - The list of labels that describe how the encoder should multiplex video and audio into an output file. For example, if the encoder is producing two video layers with labels v1 and v2, and one audio layer with label a1, then an array like '[v1, a1]' tells the encoder to produce an output file with the video track represented by v1 and the audio track represented by a1. 7473 Labels *[]string `json:"labels,omitempty"` 7474} 7475 7476// BasicOverlay base type for all overlays - image, audio or video. 7477type BasicOverlay interface { 7478 AsAudioOverlay() (*AudioOverlay, bool) 7479 AsVideoOverlay() (*VideoOverlay, bool) 7480 AsOverlay() (*Overlay, bool) 7481} 7482 7483// Overlay base type for all overlays - image, audio or video. 7484type Overlay struct { 7485 // InputLabel - The label of the job input which is to be used as an overlay. The Input must specify exactly one file. You can specify an image file in JPG or PNG formats, or an audio file (such as a WAV, MP3, WMA or M4A file), or a video file. See https://aka.ms/mesformats for the complete list of supported audio and video file formats. 7486 InputLabel *string `json:"inputLabel,omitempty"` 7487 // Start - The start position, with reference to the input video, at which the overlay starts. The value should be in ISO 8601 format. For example, PT05S to start the overlay at 5 seconds in to the input video. If not specified the overlay starts from the beginning of the input video. 7488 Start *string `json:"start,omitempty"` 7489 // End - The position in the input video at which the overlay ends. The value should be in ISO 8601 duration format. For example, PT30S to end the overlay at 30 seconds in to the input video. If not specified the overlay will be applied until the end of the input video if inputLoop is true. Else, if inputLoop is false, then overlay will last as long as the duration of the overlay media. 7490 End *string `json:"end,omitempty"` 7491 // FadeInDuration - The duration over which the overlay fades in onto the input video. The value should be in ISO 8601 duration format. If not specified the default behavior is to have no fade in (same as PT0S). 7492 FadeInDuration *string `json:"fadeInDuration,omitempty"` 7493 // FadeOutDuration - The duration over which the overlay fades out of the input video. The value should be in ISO 8601 duration format. If not specified the default behavior is to have no fade out (same as PT0S). 7494 FadeOutDuration *string `json:"fadeOutDuration,omitempty"` 7495 // AudioGainLevel - The gain level of audio in the overlay. The value should be in the range [0, 1.0]. The default is 1.0. 7496 AudioGainLevel *float64 `json:"audioGainLevel,omitempty"` 7497 // OdataType - Possible values include: 'OdataTypeOverlay', 'OdataTypeMicrosoftMediaAudioOverlay', 'OdataTypeMicrosoftMediaVideoOverlay' 7498 OdataType OdataTypeBasicOverlay `json:"@odata.type,omitempty"` 7499} 7500 7501func unmarshalBasicOverlay(body []byte) (BasicOverlay, error) { 7502 var m map[string]interface{} 7503 err := json.Unmarshal(body, &m) 7504 if err != nil { 7505 return nil, err 7506 } 7507 7508 switch m["@odata.type"] { 7509 case string(OdataTypeMicrosoftMediaAudioOverlay): 7510 var ao AudioOverlay 7511 err := json.Unmarshal(body, &ao) 7512 return ao, err 7513 case string(OdataTypeMicrosoftMediaVideoOverlay): 7514 var vo VideoOverlay 7515 err := json.Unmarshal(body, &vo) 7516 return vo, err 7517 default: 7518 var o Overlay 7519 err := json.Unmarshal(body, &o) 7520 return o, err 7521 } 7522} 7523func unmarshalBasicOverlayArray(body []byte) ([]BasicOverlay, error) { 7524 var rawMessages []*json.RawMessage 7525 err := json.Unmarshal(body, &rawMessages) 7526 if err != nil { 7527 return nil, err 7528 } 7529 7530 oArray := make([]BasicOverlay, len(rawMessages)) 7531 7532 for index, rawMessage := range rawMessages { 7533 o, err := unmarshalBasicOverlay(*rawMessage) 7534 if err != nil { 7535 return nil, err 7536 } 7537 oArray[index] = o 7538 } 7539 return oArray, nil 7540} 7541 7542// MarshalJSON is the custom marshaler for Overlay. 7543func (o Overlay) MarshalJSON() ([]byte, error) { 7544 o.OdataType = OdataTypeOverlay 7545 objectMap := make(map[string]interface{}) 7546 if o.InputLabel != nil { 7547 objectMap["inputLabel"] = o.InputLabel 7548 } 7549 if o.Start != nil { 7550 objectMap["start"] = o.Start 7551 } 7552 if o.End != nil { 7553 objectMap["end"] = o.End 7554 } 7555 if o.FadeInDuration != nil { 7556 objectMap["fadeInDuration"] = o.FadeInDuration 7557 } 7558 if o.FadeOutDuration != nil { 7559 objectMap["fadeOutDuration"] = o.FadeOutDuration 7560 } 7561 if o.AudioGainLevel != nil { 7562 objectMap["audioGainLevel"] = o.AudioGainLevel 7563 } 7564 if o.OdataType != "" { 7565 objectMap["@odata.type"] = o.OdataType 7566 } 7567 return json.Marshal(objectMap) 7568} 7569 7570// AsAudioOverlay is the BasicOverlay implementation for Overlay. 7571func (o Overlay) AsAudioOverlay() (*AudioOverlay, bool) { 7572 return nil, false 7573} 7574 7575// AsVideoOverlay is the BasicOverlay implementation for Overlay. 7576func (o Overlay) AsVideoOverlay() (*VideoOverlay, bool) { 7577 return nil, false 7578} 7579 7580// AsOverlay is the BasicOverlay implementation for Overlay. 7581func (o Overlay) AsOverlay() (*Overlay, bool) { 7582 return &o, true 7583} 7584 7585// AsBasicOverlay is the BasicOverlay implementation for Overlay. 7586func (o Overlay) AsBasicOverlay() (BasicOverlay, bool) { 7587 return &o, true 7588} 7589 7590// PngFormat describes the settings for producing PNG thumbnails. 7591type PngFormat struct { 7592 // FilenamePattern - The pattern of the file names for the generated output files. The following macros are supported in the file name: {Basename} - The base name of the input video {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. Any unsubstituted macros will be collapsed and removed from the filename. 7593 FilenamePattern *string `json:"filenamePattern,omitempty"` 7594 // OdataType - Possible values include: 'OdataTypeFormat', 'OdataTypeMicrosoftMediaImageFormat', 'OdataTypeMicrosoftMediaJpgFormat', 'OdataTypeMicrosoftMediaPngFormat', 'OdataTypeMicrosoftMediaMultiBitrateFormat', 'OdataTypeMicrosoftMediaMp4Format', 'OdataTypeMicrosoftMediaTransportStreamFormat' 7595 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"` 7596} 7597 7598// MarshalJSON is the custom marshaler for PngFormat. 7599func (pf PngFormat) MarshalJSON() ([]byte, error) { 7600 pf.OdataType = OdataTypeMicrosoftMediaPngFormat 7601 objectMap := make(map[string]interface{}) 7602 if pf.FilenamePattern != nil { 7603 objectMap["filenamePattern"] = pf.FilenamePattern 7604 } 7605 if pf.OdataType != "" { 7606 objectMap["@odata.type"] = pf.OdataType 7607 } 7608 return json.Marshal(objectMap) 7609} 7610 7611// AsImageFormat is the BasicFormat implementation for PngFormat. 7612func (pf PngFormat) AsImageFormat() (*ImageFormat, bool) { 7613 return nil, false 7614} 7615 7616// AsBasicImageFormat is the BasicFormat implementation for PngFormat. 7617func (pf PngFormat) AsBasicImageFormat() (BasicImageFormat, bool) { 7618 return &pf, true 7619} 7620 7621// AsJpgFormat is the BasicFormat implementation for PngFormat. 7622func (pf PngFormat) AsJpgFormat() (*JpgFormat, bool) { 7623 return nil, false 7624} 7625 7626// AsPngFormat is the BasicFormat implementation for PngFormat. 7627func (pf PngFormat) AsPngFormat() (*PngFormat, bool) { 7628 return &pf, true 7629} 7630 7631// AsMultiBitrateFormat is the BasicFormat implementation for PngFormat. 7632func (pf PngFormat) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) { 7633 return nil, false 7634} 7635 7636// AsBasicMultiBitrateFormat is the BasicFormat implementation for PngFormat. 7637func (pf PngFormat) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) { 7638 return nil, false 7639} 7640 7641// AsMp4Format is the BasicFormat implementation for PngFormat. 7642func (pf PngFormat) AsMp4Format() (*Mp4Format, bool) { 7643 return nil, false 7644} 7645 7646// AsTransportStreamFormat is the BasicFormat implementation for PngFormat. 7647func (pf PngFormat) AsTransportStreamFormat() (*TransportStreamFormat, bool) { 7648 return nil, false 7649} 7650 7651// AsFormat is the BasicFormat implementation for PngFormat. 7652func (pf PngFormat) AsFormat() (*Format, bool) { 7653 return nil, false 7654} 7655 7656// AsBasicFormat is the BasicFormat implementation for PngFormat. 7657func (pf PngFormat) AsBasicFormat() (BasicFormat, bool) { 7658 return &pf, true 7659} 7660 7661// PngImage describes the properties for producing a series of PNG images from the input video. 7662type PngImage struct { 7663 // Layers - A collection of output PNG image layers to be produced by the encoder. 7664 Layers *[]PngLayer `json:"layers,omitempty"` 7665 // Start - The position in the input video from where to start generating thumbnails. The value can be in absolute timestamp (ISO 8601, e.g: PT05S), or a frame count (For example, 10 for the 10th frame), or a relative value (For example, 1%). Also supports a macro {Best}, which tells the encoder to select the best thumbnail from the first few seconds of the video. 7666 Start *string `json:"start,omitempty"` 7667 // Step - The intervals at which thumbnails are generated. The value can be in absolute timestamp (ISO 8601, e.g: PT05S for one image every 5 seconds), or a frame count (For example, 30 for every 30 frames), or a relative value (For example, 1%). 7668 Step *string `json:"step,omitempty"` 7669 // Range - The position in the input video at which to stop generating thumbnails. The value can be in absolute timestamp (ISO 8601, e.g: PT5M30S to stop at 5 minutes and 30 seconds), or a frame count (For example, 300 to stop at the 300th frame), or a relative value (For example, 100%). 7670 Range *string `json:"range,omitempty"` 7671 // KeyFrameInterval - The distance between two key frames, thereby defining a group of pictures (GOP). The value should be a non-zero integer in the range [1, 30] seconds, specified in ISO 8601 format. The default is 2 seconds (PT2S). 7672 KeyFrameInterval *string `json:"keyFrameInterval,omitempty"` 7673 // StretchMode - The resizing mode - how the input video will be resized to fit the desired output resolution(s). Default is AutoSize. Possible values include: 'StretchModeNone', 'StretchModeAutoSize', 'StretchModeAutoFit' 7674 StretchMode StretchMode `json:"stretchMode,omitempty"` 7675 // Label - An optional label for the codec. The label can be used to control muxing behavior. 7676 Label *string `json:"label,omitempty"` 7677 // OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage' 7678 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"` 7679} 7680 7681// MarshalJSON is the custom marshaler for PngImage. 7682func (pi PngImage) MarshalJSON() ([]byte, error) { 7683 pi.OdataType = OdataTypeMicrosoftMediaPngImage 7684 objectMap := make(map[string]interface{}) 7685 if pi.Layers != nil { 7686 objectMap["layers"] = pi.Layers 7687 } 7688 if pi.Start != nil { 7689 objectMap["start"] = pi.Start 7690 } 7691 if pi.Step != nil { 7692 objectMap["step"] = pi.Step 7693 } 7694 if pi.Range != nil { 7695 objectMap["range"] = pi.Range 7696 } 7697 if pi.KeyFrameInterval != nil { 7698 objectMap["keyFrameInterval"] = pi.KeyFrameInterval 7699 } 7700 if pi.StretchMode != "" { 7701 objectMap["stretchMode"] = pi.StretchMode 7702 } 7703 if pi.Label != nil { 7704 objectMap["label"] = pi.Label 7705 } 7706 if pi.OdataType != "" { 7707 objectMap["@odata.type"] = pi.OdataType 7708 } 7709 return json.Marshal(objectMap) 7710} 7711 7712// AsAudio is the BasicCodec implementation for PngImage. 7713func (pi PngImage) AsAudio() (*Audio, bool) { 7714 return nil, false 7715} 7716 7717// AsBasicAudio is the BasicCodec implementation for PngImage. 7718func (pi PngImage) AsBasicAudio() (BasicAudio, bool) { 7719 return nil, false 7720} 7721 7722// AsAacAudio is the BasicCodec implementation for PngImage. 7723func (pi PngImage) AsAacAudio() (*AacAudio, bool) { 7724 return nil, false 7725} 7726 7727// AsCopyVideo is the BasicCodec implementation for PngImage. 7728func (pi PngImage) AsCopyVideo() (*CopyVideo, bool) { 7729 return nil, false 7730} 7731 7732// AsVideo is the BasicCodec implementation for PngImage. 7733func (pi PngImage) AsVideo() (*Video, bool) { 7734 return nil, false 7735} 7736 7737// AsBasicVideo is the BasicCodec implementation for PngImage. 7738func (pi PngImage) AsBasicVideo() (BasicVideo, bool) { 7739 return &pi, true 7740} 7741 7742// AsImage is the BasicCodec implementation for PngImage. 7743func (pi PngImage) AsImage() (*Image, bool) { 7744 return nil, false 7745} 7746 7747// AsBasicImage is the BasicCodec implementation for PngImage. 7748func (pi PngImage) AsBasicImage() (BasicImage, bool) { 7749 return &pi, true 7750} 7751 7752// AsCopyAudio is the BasicCodec implementation for PngImage. 7753func (pi PngImage) AsCopyAudio() (*CopyAudio, bool) { 7754 return nil, false 7755} 7756 7757// AsH264Video is the BasicCodec implementation for PngImage. 7758func (pi PngImage) AsH264Video() (*H264Video, bool) { 7759 return nil, false 7760} 7761 7762// AsJpgImage is the BasicCodec implementation for PngImage. 7763func (pi PngImage) AsJpgImage() (*JpgImage, bool) { 7764 return nil, false 7765} 7766 7767// AsPngImage is the BasicCodec implementation for PngImage. 7768func (pi PngImage) AsPngImage() (*PngImage, bool) { 7769 return &pi, true 7770} 7771 7772// AsCodec is the BasicCodec implementation for PngImage. 7773func (pi PngImage) AsCodec() (*Codec, bool) { 7774 return nil, false 7775} 7776 7777// AsBasicCodec is the BasicCodec implementation for PngImage. 7778func (pi PngImage) AsBasicCodec() (BasicCodec, bool) { 7779 return &pi, true 7780} 7781 7782// PngLayer describes the settings to produce a PNG image from the input video. 7783type PngLayer struct { 7784 // Width - The width of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in width as the input. 7785 Width *string `json:"width,omitempty"` 7786 // Height - The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in height as the input. 7787 Height *string `json:"height,omitempty"` 7788 // Label - The alphanumeric label for this layer, which can be used in multiplexing different video and audio layers, or in naming the output file. 7789 Label *string `json:"label,omitempty"` 7790 // OdataType - Possible values include: 'OdataTypeLayer', 'OdataTypeMicrosoftMediaVideoLayer', 'OdataTypeMicrosoftMediaH264Layer', 'OdataTypeMicrosoftMediaJpgLayer', 'OdataTypeMicrosoftMediaPngLayer' 7791 OdataType OdataTypeBasicLayer `json:"@odata.type,omitempty"` 7792} 7793 7794// MarshalJSON is the custom marshaler for PngLayer. 7795func (pl PngLayer) MarshalJSON() ([]byte, error) { 7796 pl.OdataType = OdataTypeMicrosoftMediaPngLayer 7797 objectMap := make(map[string]interface{}) 7798 if pl.Width != nil { 7799 objectMap["width"] = pl.Width 7800 } 7801 if pl.Height != nil { 7802 objectMap["height"] = pl.Height 7803 } 7804 if pl.Label != nil { 7805 objectMap["label"] = pl.Label 7806 } 7807 if pl.OdataType != "" { 7808 objectMap["@odata.type"] = pl.OdataType 7809 } 7810 return json.Marshal(objectMap) 7811} 7812 7813// AsVideoLayer is the BasicLayer implementation for PngLayer. 7814func (pl PngLayer) AsVideoLayer() (*VideoLayer, bool) { 7815 return nil, false 7816} 7817 7818// AsBasicVideoLayer is the BasicLayer implementation for PngLayer. 7819func (pl PngLayer) AsBasicVideoLayer() (BasicVideoLayer, bool) { 7820 return nil, false 7821} 7822 7823// AsH264Layer is the BasicLayer implementation for PngLayer. 7824func (pl PngLayer) AsH264Layer() (*H264Layer, bool) { 7825 return nil, false 7826} 7827 7828// AsJpgLayer is the BasicLayer implementation for PngLayer. 7829func (pl PngLayer) AsJpgLayer() (*JpgLayer, bool) { 7830 return nil, false 7831} 7832 7833// AsPngLayer is the BasicLayer implementation for PngLayer. 7834func (pl PngLayer) AsPngLayer() (*PngLayer, bool) { 7835 return &pl, true 7836} 7837 7838// AsLayer is the BasicLayer implementation for PngLayer. 7839func (pl PngLayer) AsLayer() (*Layer, bool) { 7840 return nil, false 7841} 7842 7843// AsBasicLayer is the BasicLayer implementation for PngLayer. 7844func (pl PngLayer) AsBasicLayer() (BasicLayer, bool) { 7845 return &pl, true 7846} 7847 7848// PresentationTimeRange the presentation time range, this is asset related and not recommended for Account 7849// Filter. 7850type PresentationTimeRange struct { 7851 // StartTimestamp - The absolute start time boundary. 7852 StartTimestamp *int64 `json:"startTimestamp,omitempty"` 7853 // EndTimestamp - The absolute end time boundary. 7854 EndTimestamp *int64 `json:"endTimestamp,omitempty"` 7855 // PresentationWindowDuration - The relative to end sliding window. 7856 PresentationWindowDuration *int64 `json:"presentationWindowDuration,omitempty"` 7857 // LiveBackoffDuration - The relative to end right edge. 7858 LiveBackoffDuration *int64 `json:"liveBackoffDuration,omitempty"` 7859 // Timescale - The time scale of time stamps. 7860 Timescale *int64 `json:"timescale,omitempty"` 7861 // ForceEndTimestamp - The indicator of forcing existing of end time stamp. 7862 ForceEndTimestamp *bool `json:"forceEndTimestamp,omitempty"` 7863} 7864 7865// BasicPreset base type for all Presets, which define the recipe or instructions on how the input media files should 7866// be processed. 7867type BasicPreset interface { 7868 AsFaceDetectorPreset() (*FaceDetectorPreset, bool) 7869 AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) 7870 AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) 7871 AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) 7872 AsStandardEncoderPreset() (*StandardEncoderPreset, bool) 7873 AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) 7874 AsPreset() (*Preset, bool) 7875} 7876 7877// Preset base type for all Presets, which define the recipe or instructions on how the input media files 7878// should be processed. 7879type Preset struct { 7880 // OdataType - Possible values include: 'OdataTypePreset', 'OdataTypeMicrosoftMediaFaceDetectorPreset', 'OdataTypeMicrosoftMediaAudioAnalyzerPreset', 'OdataTypeMicrosoftMediaBuiltInStandardEncoderPreset', 'OdataTypeMicrosoftMediaStandardEncoderPreset', 'OdataTypeMicrosoftMediaVideoAnalyzerPreset' 7881 OdataType OdataTypeBasicPreset `json:"@odata.type,omitempty"` 7882} 7883 7884func unmarshalBasicPreset(body []byte) (BasicPreset, error) { 7885 var m map[string]interface{} 7886 err := json.Unmarshal(body, &m) 7887 if err != nil { 7888 return nil, err 7889 } 7890 7891 switch m["@odata.type"] { 7892 case string(OdataTypeMicrosoftMediaFaceDetectorPreset): 7893 var fdp FaceDetectorPreset 7894 err := json.Unmarshal(body, &fdp) 7895 return fdp, err 7896 case string(OdataTypeMicrosoftMediaAudioAnalyzerPreset): 7897 var aap AudioAnalyzerPreset 7898 err := json.Unmarshal(body, &aap) 7899 return aap, err 7900 case string(OdataTypeMicrosoftMediaBuiltInStandardEncoderPreset): 7901 var bisep BuiltInStandardEncoderPreset 7902 err := json.Unmarshal(body, &bisep) 7903 return bisep, err 7904 case string(OdataTypeMicrosoftMediaStandardEncoderPreset): 7905 var sep StandardEncoderPreset 7906 err := json.Unmarshal(body, &sep) 7907 return sep, err 7908 case string(OdataTypeMicrosoftMediaVideoAnalyzerPreset): 7909 var vap VideoAnalyzerPreset 7910 err := json.Unmarshal(body, &vap) 7911 return vap, err 7912 default: 7913 var p Preset 7914 err := json.Unmarshal(body, &p) 7915 return p, err 7916 } 7917} 7918func unmarshalBasicPresetArray(body []byte) ([]BasicPreset, error) { 7919 var rawMessages []*json.RawMessage 7920 err := json.Unmarshal(body, &rawMessages) 7921 if err != nil { 7922 return nil, err 7923 } 7924 7925 pArray := make([]BasicPreset, len(rawMessages)) 7926 7927 for index, rawMessage := range rawMessages { 7928 p, err := unmarshalBasicPreset(*rawMessage) 7929 if err != nil { 7930 return nil, err 7931 } 7932 pArray[index] = p 7933 } 7934 return pArray, nil 7935} 7936 7937// MarshalJSON is the custom marshaler for Preset. 7938func (p Preset) MarshalJSON() ([]byte, error) { 7939 p.OdataType = OdataTypePreset 7940 objectMap := make(map[string]interface{}) 7941 if p.OdataType != "" { 7942 objectMap["@odata.type"] = p.OdataType 7943 } 7944 return json.Marshal(objectMap) 7945} 7946 7947// AsFaceDetectorPreset is the BasicPreset implementation for Preset. 7948func (p Preset) AsFaceDetectorPreset() (*FaceDetectorPreset, bool) { 7949 return nil, false 7950} 7951 7952// AsAudioAnalyzerPreset is the BasicPreset implementation for Preset. 7953func (p Preset) AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) { 7954 return nil, false 7955} 7956 7957// AsBasicAudioAnalyzerPreset is the BasicPreset implementation for Preset. 7958func (p Preset) AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) { 7959 return nil, false 7960} 7961 7962// AsBuiltInStandardEncoderPreset is the BasicPreset implementation for Preset. 7963func (p Preset) AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) { 7964 return nil, false 7965} 7966 7967// AsStandardEncoderPreset is the BasicPreset implementation for Preset. 7968func (p Preset) AsStandardEncoderPreset() (*StandardEncoderPreset, bool) { 7969 return nil, false 7970} 7971 7972// AsVideoAnalyzerPreset is the BasicPreset implementation for Preset. 7973func (p Preset) AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) { 7974 return nil, false 7975} 7976 7977// AsPreset is the BasicPreset implementation for Preset. 7978func (p Preset) AsPreset() (*Preset, bool) { 7979 return &p, true 7980} 7981 7982// AsBasicPreset is the BasicPreset implementation for Preset. 7983func (p Preset) AsBasicPreset() (BasicPreset, bool) { 7984 return &p, true 7985} 7986 7987// Provider a resource provider. 7988type Provider struct { 7989 // ProviderName - The provider name. 7990 ProviderName *string `json:"providerName,omitempty"` 7991} 7992 7993// ProxyResource the resource model definition for a ARM proxy resource. 7994type ProxyResource struct { 7995 // ID - READ-ONLY; Fully qualified resource ID for the resource. 7996 ID *string `json:"id,omitempty"` 7997 // Name - READ-ONLY; The name of the resource. 7998 Name *string `json:"name,omitempty"` 7999 // Type - READ-ONLY; The type of the resource. 8000 Type *string `json:"type,omitempty"` 8001} 8002 8003// MarshalJSON is the custom marshaler for ProxyResource. 8004func (pr ProxyResource) MarshalJSON() ([]byte, error) { 8005 objectMap := make(map[string]interface{}) 8006 return json.Marshal(objectMap) 8007} 8008 8009// Rectangle describes the properties of a rectangular window applied to the input media before processing 8010// it. 8011type Rectangle struct { 8012 // Left - The number of pixels from the left-margin. This can be absolute pixel value (e.g 100), or relative to the size of the video (For example, 50%). 8013 Left *string `json:"left,omitempty"` 8014 // Top - The number of pixels from the top-margin. This can be absolute pixel value (e.g 100), or relative to the size of the video (For example, 50%). 8015 Top *string `json:"top,omitempty"` 8016 // Width - The width of the rectangular region in pixels. This can be absolute pixel value (e.g 100), or relative to the size of the video (For example, 50%). 8017 Width *string `json:"width,omitempty"` 8018 // Height - The height of the rectangular region in pixels. This can be absolute pixel value (e.g 100), or relative to the size of the video (For example, 50%). 8019 Height *string `json:"height,omitempty"` 8020} 8021 8022// Resource the core properties of ARM resources. 8023type Resource struct { 8024 // ID - READ-ONLY; Fully qualified resource ID for the resource. 8025 ID *string `json:"id,omitempty"` 8026 // Name - READ-ONLY; The name of the resource. 8027 Name *string `json:"name,omitempty"` 8028 // Type - READ-ONLY; The type of the resource. 8029 Type *string `json:"type,omitempty"` 8030} 8031 8032// MarshalJSON is the custom marshaler for Resource. 8033func (r Resource) MarshalJSON() ([]byte, error) { 8034 objectMap := make(map[string]interface{}) 8035 return json.Marshal(objectMap) 8036} 8037 8038// Service a Media Services account. 8039type Service struct { 8040 autorest.Response `json:"-"` 8041 // ServiceProperties - The resource properties. 8042 *ServiceProperties `json:"properties,omitempty"` 8043 // Tags - Resource tags. 8044 Tags map[string]*string `json:"tags"` 8045 // Location - The Azure Region of the resource. 8046 Location *string `json:"location,omitempty"` 8047 // ID - READ-ONLY; Fully qualified resource ID for the resource. 8048 ID *string `json:"id,omitempty"` 8049 // Name - READ-ONLY; The name of the resource. 8050 Name *string `json:"name,omitempty"` 8051 // Type - READ-ONLY; The type of the resource. 8052 Type *string `json:"type,omitempty"` 8053} 8054 8055// MarshalJSON is the custom marshaler for Service. 8056func (s Service) MarshalJSON() ([]byte, error) { 8057 objectMap := make(map[string]interface{}) 8058 if s.ServiceProperties != nil { 8059 objectMap["properties"] = s.ServiceProperties 8060 } 8061 if s.Tags != nil { 8062 objectMap["tags"] = s.Tags 8063 } 8064 if s.Location != nil { 8065 objectMap["location"] = s.Location 8066 } 8067 return json.Marshal(objectMap) 8068} 8069 8070// UnmarshalJSON is the custom unmarshaler for Service struct. 8071func (s *Service) UnmarshalJSON(body []byte) error { 8072 var m map[string]*json.RawMessage 8073 err := json.Unmarshal(body, &m) 8074 if err != nil { 8075 return err 8076 } 8077 for k, v := range m { 8078 switch k { 8079 case "properties": 8080 if v != nil { 8081 var serviceProperties ServiceProperties 8082 err = json.Unmarshal(*v, &serviceProperties) 8083 if err != nil { 8084 return err 8085 } 8086 s.ServiceProperties = &serviceProperties 8087 } 8088 case "tags": 8089 if v != nil { 8090 var tags map[string]*string 8091 err = json.Unmarshal(*v, &tags) 8092 if err != nil { 8093 return err 8094 } 8095 s.Tags = tags 8096 } 8097 case "location": 8098 if v != nil { 8099 var location string 8100 err = json.Unmarshal(*v, &location) 8101 if err != nil { 8102 return err 8103 } 8104 s.Location = &location 8105 } 8106 case "id": 8107 if v != nil { 8108 var ID string 8109 err = json.Unmarshal(*v, &ID) 8110 if err != nil { 8111 return err 8112 } 8113 s.ID = &ID 8114 } 8115 case "name": 8116 if v != nil { 8117 var name string 8118 err = json.Unmarshal(*v, &name) 8119 if err != nil { 8120 return err 8121 } 8122 s.Name = &name 8123 } 8124 case "type": 8125 if v != nil { 8126 var typeVar string 8127 err = json.Unmarshal(*v, &typeVar) 8128 if err != nil { 8129 return err 8130 } 8131 s.Type = &typeVar 8132 } 8133 } 8134 } 8135 8136 return nil 8137} 8138 8139// ServiceCollection a collection of MediaService items. 8140type ServiceCollection struct { 8141 autorest.Response `json:"-"` 8142 // Value - A collection of MediaService items. 8143 Value *[]Service `json:"value,omitempty"` 8144 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 8145 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 8146} 8147 8148// ServiceCollectionIterator provides access to a complete listing of Service values. 8149type ServiceCollectionIterator struct { 8150 i int 8151 page ServiceCollectionPage 8152} 8153 8154// NextWithContext advances to the next value. If there was an error making 8155// the request the iterator does not advance and the error is returned. 8156func (iter *ServiceCollectionIterator) NextWithContext(ctx context.Context) (err error) { 8157 if tracing.IsEnabled() { 8158 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceCollectionIterator.NextWithContext") 8159 defer func() { 8160 sc := -1 8161 if iter.Response().Response.Response != nil { 8162 sc = iter.Response().Response.Response.StatusCode 8163 } 8164 tracing.EndSpan(ctx, sc, err) 8165 }() 8166 } 8167 iter.i++ 8168 if iter.i < len(iter.page.Values()) { 8169 return nil 8170 } 8171 err = iter.page.NextWithContext(ctx) 8172 if err != nil { 8173 iter.i-- 8174 return err 8175 } 8176 iter.i = 0 8177 return nil 8178} 8179 8180// Next advances to the next value. If there was an error making 8181// the request the iterator does not advance and the error is returned. 8182// Deprecated: Use NextWithContext() instead. 8183func (iter *ServiceCollectionIterator) Next() error { 8184 return iter.NextWithContext(context.Background()) 8185} 8186 8187// NotDone returns true if the enumeration should be started or is not yet complete. 8188func (iter ServiceCollectionIterator) NotDone() bool { 8189 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 8190} 8191 8192// Response returns the raw server response from the last page request. 8193func (iter ServiceCollectionIterator) Response() ServiceCollection { 8194 return iter.page.Response() 8195} 8196 8197// Value returns the current value or a zero-initialized value if the 8198// iterator has advanced beyond the end of the collection. 8199func (iter ServiceCollectionIterator) Value() Service { 8200 if !iter.page.NotDone() { 8201 return Service{} 8202 } 8203 return iter.page.Values()[iter.i] 8204} 8205 8206// Creates a new instance of the ServiceCollectionIterator type. 8207func NewServiceCollectionIterator(page ServiceCollectionPage) ServiceCollectionIterator { 8208 return ServiceCollectionIterator{page: page} 8209} 8210 8211// IsEmpty returns true if the ListResult contains no values. 8212func (sc ServiceCollection) IsEmpty() bool { 8213 return sc.Value == nil || len(*sc.Value) == 0 8214} 8215 8216// hasNextLink returns true if the NextLink is not empty. 8217func (sc ServiceCollection) hasNextLink() bool { 8218 return sc.OdataNextLink != nil && len(*sc.OdataNextLink) != 0 8219} 8220 8221// serviceCollectionPreparer prepares a request to retrieve the next set of results. 8222// It returns nil if no more results exist. 8223func (sc ServiceCollection) serviceCollectionPreparer(ctx context.Context) (*http.Request, error) { 8224 if !sc.hasNextLink() { 8225 return nil, nil 8226 } 8227 return autorest.Prepare((&http.Request{}).WithContext(ctx), 8228 autorest.AsJSON(), 8229 autorest.AsGet(), 8230 autorest.WithBaseURL(to.String(sc.OdataNextLink))) 8231} 8232 8233// ServiceCollectionPage contains a page of Service values. 8234type ServiceCollectionPage struct { 8235 fn func(context.Context, ServiceCollection) (ServiceCollection, error) 8236 sc ServiceCollection 8237} 8238 8239// NextWithContext advances to the next page of values. If there was an error making 8240// the request the page does not advance and the error is returned. 8241func (page *ServiceCollectionPage) NextWithContext(ctx context.Context) (err error) { 8242 if tracing.IsEnabled() { 8243 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceCollectionPage.NextWithContext") 8244 defer func() { 8245 sc := -1 8246 if page.Response().Response.Response != nil { 8247 sc = page.Response().Response.Response.StatusCode 8248 } 8249 tracing.EndSpan(ctx, sc, err) 8250 }() 8251 } 8252 for { 8253 next, err := page.fn(ctx, page.sc) 8254 if err != nil { 8255 return err 8256 } 8257 page.sc = next 8258 if !next.hasNextLink() || !next.IsEmpty() { 8259 break 8260 } 8261 } 8262 return nil 8263} 8264 8265// Next advances to the next page of values. If there was an error making 8266// the request the page does not advance and the error is returned. 8267// Deprecated: Use NextWithContext() instead. 8268func (page *ServiceCollectionPage) Next() error { 8269 return page.NextWithContext(context.Background()) 8270} 8271 8272// NotDone returns true if the page enumeration should be started or is not yet complete. 8273func (page ServiceCollectionPage) NotDone() bool { 8274 return !page.sc.IsEmpty() 8275} 8276 8277// Response returns the raw server response from the last page request. 8278func (page ServiceCollectionPage) Response() ServiceCollection { 8279 return page.sc 8280} 8281 8282// Values returns the slice of values for the current page or nil if there are no values. 8283func (page ServiceCollectionPage) Values() []Service { 8284 if page.sc.IsEmpty() { 8285 return nil 8286 } 8287 return *page.sc.Value 8288} 8289 8290// Creates a new instance of the ServiceCollectionPage type. 8291func NewServiceCollectionPage(cur ServiceCollection, getNextPage func(context.Context, ServiceCollection) (ServiceCollection, error)) ServiceCollectionPage { 8292 return ServiceCollectionPage{ 8293 fn: getNextPage, 8294 sc: cur, 8295 } 8296} 8297 8298// ServiceProperties properties of the Media Services account. 8299type ServiceProperties struct { 8300 // MediaServiceID - READ-ONLY; The Media Services account ID. 8301 MediaServiceID *uuid.UUID `json:"mediaServiceId,omitempty"` 8302 // StorageAccounts - The storage accounts for this resource. 8303 StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` 8304} 8305 8306// MarshalJSON is the custom marshaler for ServiceProperties. 8307func (sp ServiceProperties) MarshalJSON() ([]byte, error) { 8308 objectMap := make(map[string]interface{}) 8309 if sp.StorageAccounts != nil { 8310 objectMap["storageAccounts"] = sp.StorageAccounts 8311 } 8312 return json.Marshal(objectMap) 8313} 8314 8315// ServiceSpecification the service metric specifications. 8316type ServiceSpecification struct { 8317 // MetricSpecifications - READ-ONLY; List of metric specifications. 8318 MetricSpecifications *[]Metric `json:"metricSpecifications,omitempty"` 8319} 8320 8321// MarshalJSON is the custom marshaler for ServiceSpecification. 8322func (ss ServiceSpecification) MarshalJSON() ([]byte, error) { 8323 objectMap := make(map[string]interface{}) 8324 return json.Marshal(objectMap) 8325} 8326 8327// StandardEncoderPreset describes all the settings to be used when encoding the input video with the 8328// Standard Encoder. 8329type StandardEncoderPreset struct { 8330 // Filters - One or more filtering operations that are applied to the input media before encoding. 8331 Filters *Filters `json:"filters,omitempty"` 8332 // Codecs - The list of codecs to be used when encoding the input video. 8333 Codecs *[]BasicCodec `json:"codecs,omitempty"` 8334 // Formats - The list of outputs to be produced by the encoder. 8335 Formats *[]BasicFormat `json:"formats,omitempty"` 8336 // OdataType - Possible values include: 'OdataTypePreset', 'OdataTypeMicrosoftMediaFaceDetectorPreset', 'OdataTypeMicrosoftMediaAudioAnalyzerPreset', 'OdataTypeMicrosoftMediaBuiltInStandardEncoderPreset', 'OdataTypeMicrosoftMediaStandardEncoderPreset', 'OdataTypeMicrosoftMediaVideoAnalyzerPreset' 8337 OdataType OdataTypeBasicPreset `json:"@odata.type,omitempty"` 8338} 8339 8340// MarshalJSON is the custom marshaler for StandardEncoderPreset. 8341func (sep StandardEncoderPreset) MarshalJSON() ([]byte, error) { 8342 sep.OdataType = OdataTypeMicrosoftMediaStandardEncoderPreset 8343 objectMap := make(map[string]interface{}) 8344 if sep.Filters != nil { 8345 objectMap["filters"] = sep.Filters 8346 } 8347 if sep.Codecs != nil { 8348 objectMap["codecs"] = sep.Codecs 8349 } 8350 if sep.Formats != nil { 8351 objectMap["formats"] = sep.Formats 8352 } 8353 if sep.OdataType != "" { 8354 objectMap["@odata.type"] = sep.OdataType 8355 } 8356 return json.Marshal(objectMap) 8357} 8358 8359// AsFaceDetectorPreset is the BasicPreset implementation for StandardEncoderPreset. 8360func (sep StandardEncoderPreset) AsFaceDetectorPreset() (*FaceDetectorPreset, bool) { 8361 return nil, false 8362} 8363 8364// AsAudioAnalyzerPreset is the BasicPreset implementation for StandardEncoderPreset. 8365func (sep StandardEncoderPreset) AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) { 8366 return nil, false 8367} 8368 8369// AsBasicAudioAnalyzerPreset is the BasicPreset implementation for StandardEncoderPreset. 8370func (sep StandardEncoderPreset) AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) { 8371 return nil, false 8372} 8373 8374// AsBuiltInStandardEncoderPreset is the BasicPreset implementation for StandardEncoderPreset. 8375func (sep StandardEncoderPreset) AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) { 8376 return nil, false 8377} 8378 8379// AsStandardEncoderPreset is the BasicPreset implementation for StandardEncoderPreset. 8380func (sep StandardEncoderPreset) AsStandardEncoderPreset() (*StandardEncoderPreset, bool) { 8381 return &sep, true 8382} 8383 8384// AsVideoAnalyzerPreset is the BasicPreset implementation for StandardEncoderPreset. 8385func (sep StandardEncoderPreset) AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) { 8386 return nil, false 8387} 8388 8389// AsPreset is the BasicPreset implementation for StandardEncoderPreset. 8390func (sep StandardEncoderPreset) AsPreset() (*Preset, bool) { 8391 return nil, false 8392} 8393 8394// AsBasicPreset is the BasicPreset implementation for StandardEncoderPreset. 8395func (sep StandardEncoderPreset) AsBasicPreset() (BasicPreset, bool) { 8396 return &sep, true 8397} 8398 8399// UnmarshalJSON is the custom unmarshaler for StandardEncoderPreset struct. 8400func (sep *StandardEncoderPreset) UnmarshalJSON(body []byte) error { 8401 var m map[string]*json.RawMessage 8402 err := json.Unmarshal(body, &m) 8403 if err != nil { 8404 return err 8405 } 8406 for k, v := range m { 8407 switch k { 8408 case "filters": 8409 if v != nil { 8410 var filters Filters 8411 err = json.Unmarshal(*v, &filters) 8412 if err != nil { 8413 return err 8414 } 8415 sep.Filters = &filters 8416 } 8417 case "codecs": 8418 if v != nil { 8419 codecs, err := unmarshalBasicCodecArray(*v) 8420 if err != nil { 8421 return err 8422 } 8423 sep.Codecs = &codecs 8424 } 8425 case "formats": 8426 if v != nil { 8427 formats, err := unmarshalBasicFormatArray(*v) 8428 if err != nil { 8429 return err 8430 } 8431 sep.Formats = &formats 8432 } 8433 case "@odata.type": 8434 if v != nil { 8435 var odataType OdataTypeBasicPreset 8436 err = json.Unmarshal(*v, &odataType) 8437 if err != nil { 8438 return err 8439 } 8440 sep.OdataType = odataType 8441 } 8442 } 8443 } 8444 8445 return nil 8446} 8447 8448// StorageAccount the storage account details. 8449type StorageAccount struct { 8450 // ID - The ID of the storage account resource. Media Services relies on tables and queues as well as blobs, so the primary storage account must be a Standard Storage account (either Microsoft.ClassicStorage or Microsoft.Storage). Blob only storage accounts can be added as secondary storage accounts. 8451 ID *string `json:"id,omitempty"` 8452 // Type - The type of the storage account. Possible values include: 'Primary', 'Secondary' 8453 Type StorageAccountType `json:"type,omitempty"` 8454} 8455 8456// StorageEncryptedAssetDecryptionData data needed to decrypt asset files encrypted with legacy storage 8457// encryption. 8458type StorageEncryptedAssetDecryptionData struct { 8459 autorest.Response `json:"-"` 8460 // Key - The Asset File storage encryption key. 8461 Key *[]byte `json:"key,omitempty"` 8462 // AssetFileEncryptionMetadata - Asset File encryption metadata. 8463 AssetFileEncryptionMetadata *[]AssetFileEncryptionMetadata `json:"assetFileEncryptionMetadata,omitempty"` 8464} 8465 8466// StreamingEndpoint the StreamingEndpoint. 8467type StreamingEndpoint struct { 8468 autorest.Response `json:"-"` 8469 // StreamingEndpointProperties - The StreamingEndpoint properties. 8470 *StreamingEndpointProperties `json:"properties,omitempty"` 8471 // Tags - Resource tags. 8472 Tags map[string]*string `json:"tags"` 8473 // Location - The Azure Region of the resource. 8474 Location *string `json:"location,omitempty"` 8475 // ID - READ-ONLY; Fully qualified resource ID for the resource. 8476 ID *string `json:"id,omitempty"` 8477 // Name - READ-ONLY; The name of the resource. 8478 Name *string `json:"name,omitempty"` 8479 // Type - READ-ONLY; The type of the resource. 8480 Type *string `json:"type,omitempty"` 8481} 8482 8483// MarshalJSON is the custom marshaler for StreamingEndpoint. 8484func (se StreamingEndpoint) MarshalJSON() ([]byte, error) { 8485 objectMap := make(map[string]interface{}) 8486 if se.StreamingEndpointProperties != nil { 8487 objectMap["properties"] = se.StreamingEndpointProperties 8488 } 8489 if se.Tags != nil { 8490 objectMap["tags"] = se.Tags 8491 } 8492 if se.Location != nil { 8493 objectMap["location"] = se.Location 8494 } 8495 return json.Marshal(objectMap) 8496} 8497 8498// UnmarshalJSON is the custom unmarshaler for StreamingEndpoint struct. 8499func (se *StreamingEndpoint) UnmarshalJSON(body []byte) error { 8500 var m map[string]*json.RawMessage 8501 err := json.Unmarshal(body, &m) 8502 if err != nil { 8503 return err 8504 } 8505 for k, v := range m { 8506 switch k { 8507 case "properties": 8508 if v != nil { 8509 var streamingEndpointProperties StreamingEndpointProperties 8510 err = json.Unmarshal(*v, &streamingEndpointProperties) 8511 if err != nil { 8512 return err 8513 } 8514 se.StreamingEndpointProperties = &streamingEndpointProperties 8515 } 8516 case "tags": 8517 if v != nil { 8518 var tags map[string]*string 8519 err = json.Unmarshal(*v, &tags) 8520 if err != nil { 8521 return err 8522 } 8523 se.Tags = tags 8524 } 8525 case "location": 8526 if v != nil { 8527 var location string 8528 err = json.Unmarshal(*v, &location) 8529 if err != nil { 8530 return err 8531 } 8532 se.Location = &location 8533 } 8534 case "id": 8535 if v != nil { 8536 var ID string 8537 err = json.Unmarshal(*v, &ID) 8538 if err != nil { 8539 return err 8540 } 8541 se.ID = &ID 8542 } 8543 case "name": 8544 if v != nil { 8545 var name string 8546 err = json.Unmarshal(*v, &name) 8547 if err != nil { 8548 return err 8549 } 8550 se.Name = &name 8551 } 8552 case "type": 8553 if v != nil { 8554 var typeVar string 8555 err = json.Unmarshal(*v, &typeVar) 8556 if err != nil { 8557 return err 8558 } 8559 se.Type = &typeVar 8560 } 8561 } 8562 } 8563 8564 return nil 8565} 8566 8567// StreamingEndpointAccessControl streamingEndpoint access control definition. 8568type StreamingEndpointAccessControl struct { 8569 // Akamai - The access control of Akamai 8570 Akamai *AkamaiAccessControl `json:"akamai,omitempty"` 8571 // IP - The IP access control of the StreamingEndpoint. 8572 IP *IPAccessControl `json:"ip,omitempty"` 8573} 8574 8575// StreamingEndpointListResult the StreamingEndpoint list result. 8576type StreamingEndpointListResult struct { 8577 autorest.Response `json:"-"` 8578 // Value - The result of the List StreamingEndpoint operation. 8579 Value *[]StreamingEndpoint `json:"value,omitempty"` 8580 // OdataCount - The number of result. 8581 OdataCount *int32 `json:"@odata.count,omitempty"` 8582 // OdataNextLink - Th link to the next set of results. Not empty if value contains incomplete list of StreamingEndpoints. 8583 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 8584} 8585 8586// StreamingEndpointListResultIterator provides access to a complete listing of StreamingEndpoint values. 8587type StreamingEndpointListResultIterator struct { 8588 i int 8589 page StreamingEndpointListResultPage 8590} 8591 8592// NextWithContext advances to the next value. If there was an error making 8593// the request the iterator does not advance and the error is returned. 8594func (iter *StreamingEndpointListResultIterator) NextWithContext(ctx context.Context) (err error) { 8595 if tracing.IsEnabled() { 8596 ctx = tracing.StartSpan(ctx, fqdn+"/StreamingEndpointListResultIterator.NextWithContext") 8597 defer func() { 8598 sc := -1 8599 if iter.Response().Response.Response != nil { 8600 sc = iter.Response().Response.Response.StatusCode 8601 } 8602 tracing.EndSpan(ctx, sc, err) 8603 }() 8604 } 8605 iter.i++ 8606 if iter.i < len(iter.page.Values()) { 8607 return nil 8608 } 8609 err = iter.page.NextWithContext(ctx) 8610 if err != nil { 8611 iter.i-- 8612 return err 8613 } 8614 iter.i = 0 8615 return nil 8616} 8617 8618// Next advances to the next value. If there was an error making 8619// the request the iterator does not advance and the error is returned. 8620// Deprecated: Use NextWithContext() instead. 8621func (iter *StreamingEndpointListResultIterator) Next() error { 8622 return iter.NextWithContext(context.Background()) 8623} 8624 8625// NotDone returns true if the enumeration should be started or is not yet complete. 8626func (iter StreamingEndpointListResultIterator) NotDone() bool { 8627 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 8628} 8629 8630// Response returns the raw server response from the last page request. 8631func (iter StreamingEndpointListResultIterator) Response() StreamingEndpointListResult { 8632 return iter.page.Response() 8633} 8634 8635// Value returns the current value or a zero-initialized value if the 8636// iterator has advanced beyond the end of the collection. 8637func (iter StreamingEndpointListResultIterator) Value() StreamingEndpoint { 8638 if !iter.page.NotDone() { 8639 return StreamingEndpoint{} 8640 } 8641 return iter.page.Values()[iter.i] 8642} 8643 8644// Creates a new instance of the StreamingEndpointListResultIterator type. 8645func NewStreamingEndpointListResultIterator(page StreamingEndpointListResultPage) StreamingEndpointListResultIterator { 8646 return StreamingEndpointListResultIterator{page: page} 8647} 8648 8649// IsEmpty returns true if the ListResult contains no values. 8650func (selr StreamingEndpointListResult) IsEmpty() bool { 8651 return selr.Value == nil || len(*selr.Value) == 0 8652} 8653 8654// hasNextLink returns true if the NextLink is not empty. 8655func (selr StreamingEndpointListResult) hasNextLink() bool { 8656 return selr.OdataNextLink != nil && len(*selr.OdataNextLink) != 0 8657} 8658 8659// streamingEndpointListResultPreparer prepares a request to retrieve the next set of results. 8660// It returns nil if no more results exist. 8661func (selr StreamingEndpointListResult) streamingEndpointListResultPreparer(ctx context.Context) (*http.Request, error) { 8662 if !selr.hasNextLink() { 8663 return nil, nil 8664 } 8665 return autorest.Prepare((&http.Request{}).WithContext(ctx), 8666 autorest.AsJSON(), 8667 autorest.AsGet(), 8668 autorest.WithBaseURL(to.String(selr.OdataNextLink))) 8669} 8670 8671// StreamingEndpointListResultPage contains a page of StreamingEndpoint values. 8672type StreamingEndpointListResultPage struct { 8673 fn func(context.Context, StreamingEndpointListResult) (StreamingEndpointListResult, error) 8674 selr StreamingEndpointListResult 8675} 8676 8677// NextWithContext advances to the next page of values. If there was an error making 8678// the request the page does not advance and the error is returned. 8679func (page *StreamingEndpointListResultPage) NextWithContext(ctx context.Context) (err error) { 8680 if tracing.IsEnabled() { 8681 ctx = tracing.StartSpan(ctx, fqdn+"/StreamingEndpointListResultPage.NextWithContext") 8682 defer func() { 8683 sc := -1 8684 if page.Response().Response.Response != nil { 8685 sc = page.Response().Response.Response.StatusCode 8686 } 8687 tracing.EndSpan(ctx, sc, err) 8688 }() 8689 } 8690 for { 8691 next, err := page.fn(ctx, page.selr) 8692 if err != nil { 8693 return err 8694 } 8695 page.selr = next 8696 if !next.hasNextLink() || !next.IsEmpty() { 8697 break 8698 } 8699 } 8700 return nil 8701} 8702 8703// Next advances to the next page of values. If there was an error making 8704// the request the page does not advance and the error is returned. 8705// Deprecated: Use NextWithContext() instead. 8706func (page *StreamingEndpointListResultPage) Next() error { 8707 return page.NextWithContext(context.Background()) 8708} 8709 8710// NotDone returns true if the page enumeration should be started or is not yet complete. 8711func (page StreamingEndpointListResultPage) NotDone() bool { 8712 return !page.selr.IsEmpty() 8713} 8714 8715// Response returns the raw server response from the last page request. 8716func (page StreamingEndpointListResultPage) Response() StreamingEndpointListResult { 8717 return page.selr 8718} 8719 8720// Values returns the slice of values for the current page or nil if there are no values. 8721func (page StreamingEndpointListResultPage) Values() []StreamingEndpoint { 8722 if page.selr.IsEmpty() { 8723 return nil 8724 } 8725 return *page.selr.Value 8726} 8727 8728// Creates a new instance of the StreamingEndpointListResultPage type. 8729func NewStreamingEndpointListResultPage(cur StreamingEndpointListResult, getNextPage func(context.Context, StreamingEndpointListResult) (StreamingEndpointListResult, error)) StreamingEndpointListResultPage { 8730 return StreamingEndpointListResultPage{ 8731 fn: getNextPage, 8732 selr: cur, 8733 } 8734} 8735 8736// StreamingEndpointProperties the StreamingEndpoint properties. 8737type StreamingEndpointProperties struct { 8738 // Description - The StreamingEndpoint description. 8739 Description *string `json:"description,omitempty"` 8740 // ScaleUnits - The number of scale units. Use the Scale operation to adjust this value. 8741 ScaleUnits *int32 `json:"scaleUnits,omitempty"` 8742 // AvailabilitySetName - The name of the AvailabilitySet used with this StreamingEndpoint for high availability streaming. This value can only be set at creation time. 8743 AvailabilitySetName *string `json:"availabilitySetName,omitempty"` 8744 // AccessControl - The access control definition of the StreamingEndpoint. 8745 AccessControl *StreamingEndpointAccessControl `json:"accessControl,omitempty"` 8746 // MaxCacheAge - Max cache age 8747 MaxCacheAge *int64 `json:"maxCacheAge,omitempty"` 8748 // CustomHostNames - The custom host names of the StreamingEndpoint 8749 CustomHostNames *[]string `json:"customHostNames,omitempty"` 8750 // HostName - READ-ONLY; The StreamingEndpoint host name. 8751 HostName *string `json:"hostName,omitempty"` 8752 // CdnEnabled - The CDN enabled flag. 8753 CdnEnabled *bool `json:"cdnEnabled,omitempty"` 8754 // CdnProvider - The CDN provider name. 8755 CdnProvider *string `json:"cdnProvider,omitempty"` 8756 // CdnProfile - The CDN profile name. 8757 CdnProfile *string `json:"cdnProfile,omitempty"` 8758 // ProvisioningState - READ-ONLY; The provisioning state of the StreamingEndpoint. 8759 ProvisioningState *string `json:"provisioningState,omitempty"` 8760 // ResourceState - READ-ONLY; The resource state of the StreamingEndpoint. Possible values include: 'StreamingEndpointResourceStateStopped', 'StreamingEndpointResourceStateStarting', 'StreamingEndpointResourceStateRunning', 'StreamingEndpointResourceStateStopping', 'StreamingEndpointResourceStateDeleting', 'StreamingEndpointResourceStateScaling' 8761 ResourceState StreamingEndpointResourceState `json:"resourceState,omitempty"` 8762 // CrossSiteAccessPolicies - The StreamingEndpoint access policies. 8763 CrossSiteAccessPolicies *CrossSiteAccessPolicies `json:"crossSiteAccessPolicies,omitempty"` 8764 // FreeTrialEndTime - READ-ONLY; The free trial expiration time. 8765 FreeTrialEndTime *date.Time `json:"freeTrialEndTime,omitempty"` 8766 // Created - READ-ONLY; The exact time the StreamingEndpoint was created. 8767 Created *date.Time `json:"created,omitempty"` 8768 // LastModified - READ-ONLY; The exact time the StreamingEndpoint was last modified. 8769 LastModified *date.Time `json:"lastModified,omitempty"` 8770} 8771 8772// MarshalJSON is the custom marshaler for StreamingEndpointProperties. 8773func (sep StreamingEndpointProperties) MarshalJSON() ([]byte, error) { 8774 objectMap := make(map[string]interface{}) 8775 if sep.Description != nil { 8776 objectMap["description"] = sep.Description 8777 } 8778 if sep.ScaleUnits != nil { 8779 objectMap["scaleUnits"] = sep.ScaleUnits 8780 } 8781 if sep.AvailabilitySetName != nil { 8782 objectMap["availabilitySetName"] = sep.AvailabilitySetName 8783 } 8784 if sep.AccessControl != nil { 8785 objectMap["accessControl"] = sep.AccessControl 8786 } 8787 if sep.MaxCacheAge != nil { 8788 objectMap["maxCacheAge"] = sep.MaxCacheAge 8789 } 8790 if sep.CustomHostNames != nil { 8791 objectMap["customHostNames"] = sep.CustomHostNames 8792 } 8793 if sep.CdnEnabled != nil { 8794 objectMap["cdnEnabled"] = sep.CdnEnabled 8795 } 8796 if sep.CdnProvider != nil { 8797 objectMap["cdnProvider"] = sep.CdnProvider 8798 } 8799 if sep.CdnProfile != nil { 8800 objectMap["cdnProfile"] = sep.CdnProfile 8801 } 8802 if sep.CrossSiteAccessPolicies != nil { 8803 objectMap["crossSiteAccessPolicies"] = sep.CrossSiteAccessPolicies 8804 } 8805 return json.Marshal(objectMap) 8806} 8807 8808// StreamingEndpointsCreateFuture an abstraction for monitoring and retrieving the results of a 8809// long-running operation. 8810type StreamingEndpointsCreateFuture struct { 8811 azure.FutureAPI 8812 // Result returns the result of the asynchronous operation. 8813 // If the operation has not completed it will return an error. 8814 Result func(StreamingEndpointsClient) (StreamingEndpoint, error) 8815} 8816 8817// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8818func (future *StreamingEndpointsCreateFuture) UnmarshalJSON(body []byte) error { 8819 var azFuture azure.Future 8820 if err := json.Unmarshal(body, &azFuture); err != nil { 8821 return err 8822 } 8823 future.FutureAPI = &azFuture 8824 future.Result = future.result 8825 return nil 8826} 8827 8828// result is the default implementation for StreamingEndpointsCreateFuture.Result. 8829func (future *StreamingEndpointsCreateFuture) result(client StreamingEndpointsClient) (se StreamingEndpoint, err error) { 8830 var done bool 8831 done, err = future.DoneWithContext(context.Background(), client) 8832 if err != nil { 8833 err = autorest.NewErrorWithError(err, "media.StreamingEndpointsCreateFuture", "Result", future.Response(), "Polling failure") 8834 return 8835 } 8836 if !done { 8837 se.Response.Response = future.Response() 8838 err = azure.NewAsyncOpIncompleteError("media.StreamingEndpointsCreateFuture") 8839 return 8840 } 8841 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 8842 if se.Response.Response, err = future.GetResult(sender); err == nil && se.Response.Response.StatusCode != http.StatusNoContent { 8843 se, err = client.CreateResponder(se.Response.Response) 8844 if err != nil { 8845 err = autorest.NewErrorWithError(err, "media.StreamingEndpointsCreateFuture", "Result", se.Response.Response, "Failure responding to request") 8846 } 8847 } 8848 return 8849} 8850 8851// StreamingEndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a 8852// long-running operation. 8853type StreamingEndpointsDeleteFuture struct { 8854 azure.FutureAPI 8855 // Result returns the result of the asynchronous operation. 8856 // If the operation has not completed it will return an error. 8857 Result func(StreamingEndpointsClient) (autorest.Response, error) 8858} 8859 8860// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8861func (future *StreamingEndpointsDeleteFuture) UnmarshalJSON(body []byte) error { 8862 var azFuture azure.Future 8863 if err := json.Unmarshal(body, &azFuture); err != nil { 8864 return err 8865 } 8866 future.FutureAPI = &azFuture 8867 future.Result = future.result 8868 return nil 8869} 8870 8871// result is the default implementation for StreamingEndpointsDeleteFuture.Result. 8872func (future *StreamingEndpointsDeleteFuture) result(client StreamingEndpointsClient) (ar autorest.Response, err error) { 8873 var done bool 8874 done, err = future.DoneWithContext(context.Background(), client) 8875 if err != nil { 8876 err = autorest.NewErrorWithError(err, "media.StreamingEndpointsDeleteFuture", "Result", future.Response(), "Polling failure") 8877 return 8878 } 8879 if !done { 8880 ar.Response = future.Response() 8881 err = azure.NewAsyncOpIncompleteError("media.StreamingEndpointsDeleteFuture") 8882 return 8883 } 8884 ar.Response = future.Response() 8885 return 8886} 8887 8888// StreamingEndpointsScaleFuture an abstraction for monitoring and retrieving the results of a long-running 8889// operation. 8890type StreamingEndpointsScaleFuture struct { 8891 azure.FutureAPI 8892 // Result returns the result of the asynchronous operation. 8893 // If the operation has not completed it will return an error. 8894 Result func(StreamingEndpointsClient) (autorest.Response, error) 8895} 8896 8897// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8898func (future *StreamingEndpointsScaleFuture) UnmarshalJSON(body []byte) error { 8899 var azFuture azure.Future 8900 if err := json.Unmarshal(body, &azFuture); err != nil { 8901 return err 8902 } 8903 future.FutureAPI = &azFuture 8904 future.Result = future.result 8905 return nil 8906} 8907 8908// result is the default implementation for StreamingEndpointsScaleFuture.Result. 8909func (future *StreamingEndpointsScaleFuture) result(client StreamingEndpointsClient) (ar autorest.Response, err error) { 8910 var done bool 8911 done, err = future.DoneWithContext(context.Background(), client) 8912 if err != nil { 8913 err = autorest.NewErrorWithError(err, "media.StreamingEndpointsScaleFuture", "Result", future.Response(), "Polling failure") 8914 return 8915 } 8916 if !done { 8917 ar.Response = future.Response() 8918 err = azure.NewAsyncOpIncompleteError("media.StreamingEndpointsScaleFuture") 8919 return 8920 } 8921 ar.Response = future.Response() 8922 return 8923} 8924 8925// StreamingEndpointsStartFuture an abstraction for monitoring and retrieving the results of a long-running 8926// operation. 8927type StreamingEndpointsStartFuture struct { 8928 azure.FutureAPI 8929 // Result returns the result of the asynchronous operation. 8930 // If the operation has not completed it will return an error. 8931 Result func(StreamingEndpointsClient) (autorest.Response, error) 8932} 8933 8934// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8935func (future *StreamingEndpointsStartFuture) UnmarshalJSON(body []byte) error { 8936 var azFuture azure.Future 8937 if err := json.Unmarshal(body, &azFuture); err != nil { 8938 return err 8939 } 8940 future.FutureAPI = &azFuture 8941 future.Result = future.result 8942 return nil 8943} 8944 8945// result is the default implementation for StreamingEndpointsStartFuture.Result. 8946func (future *StreamingEndpointsStartFuture) result(client StreamingEndpointsClient) (ar autorest.Response, err error) { 8947 var done bool 8948 done, err = future.DoneWithContext(context.Background(), client) 8949 if err != nil { 8950 err = autorest.NewErrorWithError(err, "media.StreamingEndpointsStartFuture", "Result", future.Response(), "Polling failure") 8951 return 8952 } 8953 if !done { 8954 ar.Response = future.Response() 8955 err = azure.NewAsyncOpIncompleteError("media.StreamingEndpointsStartFuture") 8956 return 8957 } 8958 ar.Response = future.Response() 8959 return 8960} 8961 8962// StreamingEndpointsStopFuture an abstraction for monitoring and retrieving the results of a long-running 8963// operation. 8964type StreamingEndpointsStopFuture struct { 8965 azure.FutureAPI 8966 // Result returns the result of the asynchronous operation. 8967 // If the operation has not completed it will return an error. 8968 Result func(StreamingEndpointsClient) (autorest.Response, error) 8969} 8970 8971// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8972func (future *StreamingEndpointsStopFuture) UnmarshalJSON(body []byte) error { 8973 var azFuture azure.Future 8974 if err := json.Unmarshal(body, &azFuture); err != nil { 8975 return err 8976 } 8977 future.FutureAPI = &azFuture 8978 future.Result = future.result 8979 return nil 8980} 8981 8982// result is the default implementation for StreamingEndpointsStopFuture.Result. 8983func (future *StreamingEndpointsStopFuture) result(client StreamingEndpointsClient) (ar autorest.Response, err error) { 8984 var done bool 8985 done, err = future.DoneWithContext(context.Background(), client) 8986 if err != nil { 8987 err = autorest.NewErrorWithError(err, "media.StreamingEndpointsStopFuture", "Result", future.Response(), "Polling failure") 8988 return 8989 } 8990 if !done { 8991 ar.Response = future.Response() 8992 err = azure.NewAsyncOpIncompleteError("media.StreamingEndpointsStopFuture") 8993 return 8994 } 8995 ar.Response = future.Response() 8996 return 8997} 8998 8999// StreamingEndpointsUpdateFuture an abstraction for monitoring and retrieving the results of a 9000// long-running operation. 9001type StreamingEndpointsUpdateFuture struct { 9002 azure.FutureAPI 9003 // Result returns the result of the asynchronous operation. 9004 // If the operation has not completed it will return an error. 9005 Result func(StreamingEndpointsClient) (StreamingEndpoint, error) 9006} 9007 9008// UnmarshalJSON is the custom unmarshaller for CreateFuture. 9009func (future *StreamingEndpointsUpdateFuture) UnmarshalJSON(body []byte) error { 9010 var azFuture azure.Future 9011 if err := json.Unmarshal(body, &azFuture); err != nil { 9012 return err 9013 } 9014 future.FutureAPI = &azFuture 9015 future.Result = future.result 9016 return nil 9017} 9018 9019// result is the default implementation for StreamingEndpointsUpdateFuture.Result. 9020func (future *StreamingEndpointsUpdateFuture) result(client StreamingEndpointsClient) (se StreamingEndpoint, err error) { 9021 var done bool 9022 done, err = future.DoneWithContext(context.Background(), client) 9023 if err != nil { 9024 err = autorest.NewErrorWithError(err, "media.StreamingEndpointsUpdateFuture", "Result", future.Response(), "Polling failure") 9025 return 9026 } 9027 if !done { 9028 se.Response.Response = future.Response() 9029 err = azure.NewAsyncOpIncompleteError("media.StreamingEndpointsUpdateFuture") 9030 return 9031 } 9032 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 9033 if se.Response.Response, err = future.GetResult(sender); err == nil && se.Response.Response.StatusCode != http.StatusNoContent { 9034 se, err = client.UpdateResponder(se.Response.Response) 9035 if err != nil { 9036 err = autorest.NewErrorWithError(err, "media.StreamingEndpointsUpdateFuture", "Result", se.Response.Response, "Failure responding to request") 9037 } 9038 } 9039 return 9040} 9041 9042// StreamingEntityScaleUnit scale units definition 9043type StreamingEntityScaleUnit struct { 9044 // ScaleUnit - The scale unit number of the StreamingEndpoint. 9045 ScaleUnit *int32 `json:"scaleUnit,omitempty"` 9046} 9047 9048// StreamingLocator a Streaming Locator resource 9049type StreamingLocator struct { 9050 autorest.Response `json:"-"` 9051 *StreamingLocatorProperties `json:"properties,omitempty"` 9052 // ID - READ-ONLY; Fully qualified resource ID for the resource. 9053 ID *string `json:"id,omitempty"` 9054 // Name - READ-ONLY; The name of the resource. 9055 Name *string `json:"name,omitempty"` 9056 // Type - READ-ONLY; The type of the resource. 9057 Type *string `json:"type,omitempty"` 9058} 9059 9060// MarshalJSON is the custom marshaler for StreamingLocator. 9061func (sl StreamingLocator) MarshalJSON() ([]byte, error) { 9062 objectMap := make(map[string]interface{}) 9063 if sl.StreamingLocatorProperties != nil { 9064 objectMap["properties"] = sl.StreamingLocatorProperties 9065 } 9066 return json.Marshal(objectMap) 9067} 9068 9069// UnmarshalJSON is the custom unmarshaler for StreamingLocator struct. 9070func (sl *StreamingLocator) UnmarshalJSON(body []byte) error { 9071 var m map[string]*json.RawMessage 9072 err := json.Unmarshal(body, &m) 9073 if err != nil { 9074 return err 9075 } 9076 for k, v := range m { 9077 switch k { 9078 case "properties": 9079 if v != nil { 9080 var streamingLocatorProperties StreamingLocatorProperties 9081 err = json.Unmarshal(*v, &streamingLocatorProperties) 9082 if err != nil { 9083 return err 9084 } 9085 sl.StreamingLocatorProperties = &streamingLocatorProperties 9086 } 9087 case "id": 9088 if v != nil { 9089 var ID string 9090 err = json.Unmarshal(*v, &ID) 9091 if err != nil { 9092 return err 9093 } 9094 sl.ID = &ID 9095 } 9096 case "name": 9097 if v != nil { 9098 var name string 9099 err = json.Unmarshal(*v, &name) 9100 if err != nil { 9101 return err 9102 } 9103 sl.Name = &name 9104 } 9105 case "type": 9106 if v != nil { 9107 var typeVar string 9108 err = json.Unmarshal(*v, &typeVar) 9109 if err != nil { 9110 return err 9111 } 9112 sl.Type = &typeVar 9113 } 9114 } 9115 } 9116 9117 return nil 9118} 9119 9120// StreamingLocatorCollection a collection of StreamingLocator items. 9121type StreamingLocatorCollection struct { 9122 autorest.Response `json:"-"` 9123 // Value - A collection of StreamingLocator items. 9124 Value *[]StreamingLocator `json:"value,omitempty"` 9125 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 9126 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 9127} 9128 9129// StreamingLocatorCollectionIterator provides access to a complete listing of StreamingLocator values. 9130type StreamingLocatorCollectionIterator struct { 9131 i int 9132 page StreamingLocatorCollectionPage 9133} 9134 9135// NextWithContext advances to the next value. If there was an error making 9136// the request the iterator does not advance and the error is returned. 9137func (iter *StreamingLocatorCollectionIterator) NextWithContext(ctx context.Context) (err error) { 9138 if tracing.IsEnabled() { 9139 ctx = tracing.StartSpan(ctx, fqdn+"/StreamingLocatorCollectionIterator.NextWithContext") 9140 defer func() { 9141 sc := -1 9142 if iter.Response().Response.Response != nil { 9143 sc = iter.Response().Response.Response.StatusCode 9144 } 9145 tracing.EndSpan(ctx, sc, err) 9146 }() 9147 } 9148 iter.i++ 9149 if iter.i < len(iter.page.Values()) { 9150 return nil 9151 } 9152 err = iter.page.NextWithContext(ctx) 9153 if err != nil { 9154 iter.i-- 9155 return err 9156 } 9157 iter.i = 0 9158 return nil 9159} 9160 9161// Next advances to the next value. If there was an error making 9162// the request the iterator does not advance and the error is returned. 9163// Deprecated: Use NextWithContext() instead. 9164func (iter *StreamingLocatorCollectionIterator) Next() error { 9165 return iter.NextWithContext(context.Background()) 9166} 9167 9168// NotDone returns true if the enumeration should be started or is not yet complete. 9169func (iter StreamingLocatorCollectionIterator) NotDone() bool { 9170 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 9171} 9172 9173// Response returns the raw server response from the last page request. 9174func (iter StreamingLocatorCollectionIterator) Response() StreamingLocatorCollection { 9175 return iter.page.Response() 9176} 9177 9178// Value returns the current value or a zero-initialized value if the 9179// iterator has advanced beyond the end of the collection. 9180func (iter StreamingLocatorCollectionIterator) Value() StreamingLocator { 9181 if !iter.page.NotDone() { 9182 return StreamingLocator{} 9183 } 9184 return iter.page.Values()[iter.i] 9185} 9186 9187// Creates a new instance of the StreamingLocatorCollectionIterator type. 9188func NewStreamingLocatorCollectionIterator(page StreamingLocatorCollectionPage) StreamingLocatorCollectionIterator { 9189 return StreamingLocatorCollectionIterator{page: page} 9190} 9191 9192// IsEmpty returns true if the ListResult contains no values. 9193func (slc StreamingLocatorCollection) IsEmpty() bool { 9194 return slc.Value == nil || len(*slc.Value) == 0 9195} 9196 9197// hasNextLink returns true if the NextLink is not empty. 9198func (slc StreamingLocatorCollection) hasNextLink() bool { 9199 return slc.OdataNextLink != nil && len(*slc.OdataNextLink) != 0 9200} 9201 9202// streamingLocatorCollectionPreparer prepares a request to retrieve the next set of results. 9203// It returns nil if no more results exist. 9204func (slc StreamingLocatorCollection) streamingLocatorCollectionPreparer(ctx context.Context) (*http.Request, error) { 9205 if !slc.hasNextLink() { 9206 return nil, nil 9207 } 9208 return autorest.Prepare((&http.Request{}).WithContext(ctx), 9209 autorest.AsJSON(), 9210 autorest.AsGet(), 9211 autorest.WithBaseURL(to.String(slc.OdataNextLink))) 9212} 9213 9214// StreamingLocatorCollectionPage contains a page of StreamingLocator values. 9215type StreamingLocatorCollectionPage struct { 9216 fn func(context.Context, StreamingLocatorCollection) (StreamingLocatorCollection, error) 9217 slc StreamingLocatorCollection 9218} 9219 9220// NextWithContext advances to the next page of values. If there was an error making 9221// the request the page does not advance and the error is returned. 9222func (page *StreamingLocatorCollectionPage) NextWithContext(ctx context.Context) (err error) { 9223 if tracing.IsEnabled() { 9224 ctx = tracing.StartSpan(ctx, fqdn+"/StreamingLocatorCollectionPage.NextWithContext") 9225 defer func() { 9226 sc := -1 9227 if page.Response().Response.Response != nil { 9228 sc = page.Response().Response.Response.StatusCode 9229 } 9230 tracing.EndSpan(ctx, sc, err) 9231 }() 9232 } 9233 for { 9234 next, err := page.fn(ctx, page.slc) 9235 if err != nil { 9236 return err 9237 } 9238 page.slc = next 9239 if !next.hasNextLink() || !next.IsEmpty() { 9240 break 9241 } 9242 } 9243 return nil 9244} 9245 9246// Next advances to the next page of values. If there was an error making 9247// the request the page does not advance and the error is returned. 9248// Deprecated: Use NextWithContext() instead. 9249func (page *StreamingLocatorCollectionPage) Next() error { 9250 return page.NextWithContext(context.Background()) 9251} 9252 9253// NotDone returns true if the page enumeration should be started or is not yet complete. 9254func (page StreamingLocatorCollectionPage) NotDone() bool { 9255 return !page.slc.IsEmpty() 9256} 9257 9258// Response returns the raw server response from the last page request. 9259func (page StreamingLocatorCollectionPage) Response() StreamingLocatorCollection { 9260 return page.slc 9261} 9262 9263// Values returns the slice of values for the current page or nil if there are no values. 9264func (page StreamingLocatorCollectionPage) Values() []StreamingLocator { 9265 if page.slc.IsEmpty() { 9266 return nil 9267 } 9268 return *page.slc.Value 9269} 9270 9271// Creates a new instance of the StreamingLocatorCollectionPage type. 9272func NewStreamingLocatorCollectionPage(cur StreamingLocatorCollection, getNextPage func(context.Context, StreamingLocatorCollection) (StreamingLocatorCollection, error)) StreamingLocatorCollectionPage { 9273 return StreamingLocatorCollectionPage{ 9274 fn: getNextPage, 9275 slc: cur, 9276 } 9277} 9278 9279// StreamingLocatorContentKey class for content key in Streaming Locator 9280type StreamingLocatorContentKey struct { 9281 // ID - ID of Content Key 9282 ID *uuid.UUID `json:"id,omitempty"` 9283 // Type - READ-ONLY; Encryption type of Content Key. Possible values include: 'StreamingLocatorContentKeyTypeCommonEncryptionCenc', 'StreamingLocatorContentKeyTypeCommonEncryptionCbcs', 'StreamingLocatorContentKeyTypeEnvelopeEncryption' 9284 Type StreamingLocatorContentKeyType `json:"type,omitempty"` 9285 // LabelReferenceInStreamingPolicy - Label of Content Key as specified in the Streaming Policy 9286 LabelReferenceInStreamingPolicy *string `json:"labelReferenceInStreamingPolicy,omitempty"` 9287 // Value - Value of Content Key 9288 Value *string `json:"value,omitempty"` 9289 // PolicyName - READ-ONLY; ContentKeyPolicy used by Content Key 9290 PolicyName *string `json:"policyName,omitempty"` 9291 // Tracks - READ-ONLY; Tracks which use this Content Key 9292 Tracks *[]TrackSelection `json:"tracks,omitempty"` 9293} 9294 9295// MarshalJSON is the custom marshaler for StreamingLocatorContentKey. 9296func (slck StreamingLocatorContentKey) MarshalJSON() ([]byte, error) { 9297 objectMap := make(map[string]interface{}) 9298 if slck.ID != nil { 9299 objectMap["id"] = slck.ID 9300 } 9301 if slck.LabelReferenceInStreamingPolicy != nil { 9302 objectMap["labelReferenceInStreamingPolicy"] = slck.LabelReferenceInStreamingPolicy 9303 } 9304 if slck.Value != nil { 9305 objectMap["value"] = slck.Value 9306 } 9307 return json.Marshal(objectMap) 9308} 9309 9310// StreamingLocatorProperties properties of the Streaming Locator. 9311type StreamingLocatorProperties struct { 9312 // AssetName - Asset Name 9313 AssetName *string `json:"assetName,omitempty"` 9314 // Created - READ-ONLY; The creation time of the Streaming Locator. 9315 Created *date.Time `json:"created,omitempty"` 9316 // StartTime - The start time of the Streaming Locator. 9317 StartTime *date.Time `json:"startTime,omitempty"` 9318 // EndTime - The end time of the Streaming Locator. 9319 EndTime *date.Time `json:"endTime,omitempty"` 9320 // StreamingLocatorID - The StreamingLocatorId of the Streaming Locator. 9321 StreamingLocatorID *uuid.UUID `json:"streamingLocatorId,omitempty"` 9322 // StreamingPolicyName - Name of the Streaming Policy used by this Streaming Locator. Either specify the name of Streaming Policy you created or use one of the predefined Streaming Policies. The predefined Streaming Policies available are: 'Predefined_DownloadOnly', 'Predefined_ClearStreamingOnly', 'Predefined_DownloadAndClearStreaming', 'Predefined_ClearKey', 'Predefined_MultiDrmCencStreaming' and 'Predefined_MultiDrmStreaming' 9323 StreamingPolicyName *string `json:"streamingPolicyName,omitempty"` 9324 // DefaultContentKeyPolicyName - Name of the default ContentKeyPolicy used by this Streaming Locator. 9325 DefaultContentKeyPolicyName *string `json:"defaultContentKeyPolicyName,omitempty"` 9326 // ContentKeys - The ContentKeys used by this Streaming Locator. 9327 ContentKeys *[]StreamingLocatorContentKey `json:"contentKeys,omitempty"` 9328 // AlternativeMediaID - Alternative Media ID of this Streaming Locator 9329 AlternativeMediaID *string `json:"alternativeMediaId,omitempty"` 9330 // Filters - A list of asset or account filters which apply to this streaming locator 9331 Filters *[]string `json:"filters,omitempty"` 9332} 9333 9334// MarshalJSON is the custom marshaler for StreamingLocatorProperties. 9335func (slp StreamingLocatorProperties) MarshalJSON() ([]byte, error) { 9336 objectMap := make(map[string]interface{}) 9337 if slp.AssetName != nil { 9338 objectMap["assetName"] = slp.AssetName 9339 } 9340 if slp.StartTime != nil { 9341 objectMap["startTime"] = slp.StartTime 9342 } 9343 if slp.EndTime != nil { 9344 objectMap["endTime"] = slp.EndTime 9345 } 9346 if slp.StreamingLocatorID != nil { 9347 objectMap["streamingLocatorId"] = slp.StreamingLocatorID 9348 } 9349 if slp.StreamingPolicyName != nil { 9350 objectMap["streamingPolicyName"] = slp.StreamingPolicyName 9351 } 9352 if slp.DefaultContentKeyPolicyName != nil { 9353 objectMap["defaultContentKeyPolicyName"] = slp.DefaultContentKeyPolicyName 9354 } 9355 if slp.ContentKeys != nil { 9356 objectMap["contentKeys"] = slp.ContentKeys 9357 } 9358 if slp.AlternativeMediaID != nil { 9359 objectMap["alternativeMediaId"] = slp.AlternativeMediaID 9360 } 9361 if slp.Filters != nil { 9362 objectMap["filters"] = slp.Filters 9363 } 9364 return json.Marshal(objectMap) 9365} 9366 9367// StreamingPath class of paths for streaming 9368type StreamingPath struct { 9369 // StreamingProtocol - Streaming protocol. Possible values include: 'StreamingPolicyStreamingProtocolHls', 'StreamingPolicyStreamingProtocolDash', 'StreamingPolicyStreamingProtocolSmoothStreaming', 'StreamingPolicyStreamingProtocolDownload' 9370 StreamingProtocol StreamingPolicyStreamingProtocol `json:"streamingProtocol,omitempty"` 9371 // EncryptionScheme - Encryption scheme. Possible values include: 'EncryptionSchemeNoEncryption', 'EncryptionSchemeEnvelopeEncryption', 'EncryptionSchemeCommonEncryptionCenc', 'EncryptionSchemeCommonEncryptionCbcs' 9372 EncryptionScheme EncryptionScheme `json:"encryptionScheme,omitempty"` 9373 // Paths - Streaming paths for each protocol and encryptionScheme pair 9374 Paths *[]string `json:"paths,omitempty"` 9375} 9376 9377// StreamingPolicy a Streaming Policy resource 9378type StreamingPolicy struct { 9379 autorest.Response `json:"-"` 9380 *StreamingPolicyProperties `json:"properties,omitempty"` 9381 // ID - READ-ONLY; Fully qualified resource ID for the resource. 9382 ID *string `json:"id,omitempty"` 9383 // Name - READ-ONLY; The name of the resource. 9384 Name *string `json:"name,omitempty"` 9385 // Type - READ-ONLY; The type of the resource. 9386 Type *string `json:"type,omitempty"` 9387} 9388 9389// MarshalJSON is the custom marshaler for StreamingPolicy. 9390func (sp StreamingPolicy) MarshalJSON() ([]byte, error) { 9391 objectMap := make(map[string]interface{}) 9392 if sp.StreamingPolicyProperties != nil { 9393 objectMap["properties"] = sp.StreamingPolicyProperties 9394 } 9395 return json.Marshal(objectMap) 9396} 9397 9398// UnmarshalJSON is the custom unmarshaler for StreamingPolicy struct. 9399func (sp *StreamingPolicy) UnmarshalJSON(body []byte) error { 9400 var m map[string]*json.RawMessage 9401 err := json.Unmarshal(body, &m) 9402 if err != nil { 9403 return err 9404 } 9405 for k, v := range m { 9406 switch k { 9407 case "properties": 9408 if v != nil { 9409 var streamingPolicyProperties StreamingPolicyProperties 9410 err = json.Unmarshal(*v, &streamingPolicyProperties) 9411 if err != nil { 9412 return err 9413 } 9414 sp.StreamingPolicyProperties = &streamingPolicyProperties 9415 } 9416 case "id": 9417 if v != nil { 9418 var ID string 9419 err = json.Unmarshal(*v, &ID) 9420 if err != nil { 9421 return err 9422 } 9423 sp.ID = &ID 9424 } 9425 case "name": 9426 if v != nil { 9427 var name string 9428 err = json.Unmarshal(*v, &name) 9429 if err != nil { 9430 return err 9431 } 9432 sp.Name = &name 9433 } 9434 case "type": 9435 if v != nil { 9436 var typeVar string 9437 err = json.Unmarshal(*v, &typeVar) 9438 if err != nil { 9439 return err 9440 } 9441 sp.Type = &typeVar 9442 } 9443 } 9444 } 9445 9446 return nil 9447} 9448 9449// StreamingPolicyCollection a collection of StreamingPolicy items. 9450type StreamingPolicyCollection struct { 9451 autorest.Response `json:"-"` 9452 // Value - A collection of StreamingPolicy items. 9453 Value *[]StreamingPolicy `json:"value,omitempty"` 9454 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 9455 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 9456} 9457 9458// StreamingPolicyCollectionIterator provides access to a complete listing of StreamingPolicy values. 9459type StreamingPolicyCollectionIterator struct { 9460 i int 9461 page StreamingPolicyCollectionPage 9462} 9463 9464// NextWithContext advances to the next value. If there was an error making 9465// the request the iterator does not advance and the error is returned. 9466func (iter *StreamingPolicyCollectionIterator) NextWithContext(ctx context.Context) (err error) { 9467 if tracing.IsEnabled() { 9468 ctx = tracing.StartSpan(ctx, fqdn+"/StreamingPolicyCollectionIterator.NextWithContext") 9469 defer func() { 9470 sc := -1 9471 if iter.Response().Response.Response != nil { 9472 sc = iter.Response().Response.Response.StatusCode 9473 } 9474 tracing.EndSpan(ctx, sc, err) 9475 }() 9476 } 9477 iter.i++ 9478 if iter.i < len(iter.page.Values()) { 9479 return nil 9480 } 9481 err = iter.page.NextWithContext(ctx) 9482 if err != nil { 9483 iter.i-- 9484 return err 9485 } 9486 iter.i = 0 9487 return nil 9488} 9489 9490// Next advances to the next value. If there was an error making 9491// the request the iterator does not advance and the error is returned. 9492// Deprecated: Use NextWithContext() instead. 9493func (iter *StreamingPolicyCollectionIterator) Next() error { 9494 return iter.NextWithContext(context.Background()) 9495} 9496 9497// NotDone returns true if the enumeration should be started or is not yet complete. 9498func (iter StreamingPolicyCollectionIterator) NotDone() bool { 9499 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 9500} 9501 9502// Response returns the raw server response from the last page request. 9503func (iter StreamingPolicyCollectionIterator) Response() StreamingPolicyCollection { 9504 return iter.page.Response() 9505} 9506 9507// Value returns the current value or a zero-initialized value if the 9508// iterator has advanced beyond the end of the collection. 9509func (iter StreamingPolicyCollectionIterator) Value() StreamingPolicy { 9510 if !iter.page.NotDone() { 9511 return StreamingPolicy{} 9512 } 9513 return iter.page.Values()[iter.i] 9514} 9515 9516// Creates a new instance of the StreamingPolicyCollectionIterator type. 9517func NewStreamingPolicyCollectionIterator(page StreamingPolicyCollectionPage) StreamingPolicyCollectionIterator { 9518 return StreamingPolicyCollectionIterator{page: page} 9519} 9520 9521// IsEmpty returns true if the ListResult contains no values. 9522func (spc StreamingPolicyCollection) IsEmpty() bool { 9523 return spc.Value == nil || len(*spc.Value) == 0 9524} 9525 9526// hasNextLink returns true if the NextLink is not empty. 9527func (spc StreamingPolicyCollection) hasNextLink() bool { 9528 return spc.OdataNextLink != nil && len(*spc.OdataNextLink) != 0 9529} 9530 9531// streamingPolicyCollectionPreparer prepares a request to retrieve the next set of results. 9532// It returns nil if no more results exist. 9533func (spc StreamingPolicyCollection) streamingPolicyCollectionPreparer(ctx context.Context) (*http.Request, error) { 9534 if !spc.hasNextLink() { 9535 return nil, nil 9536 } 9537 return autorest.Prepare((&http.Request{}).WithContext(ctx), 9538 autorest.AsJSON(), 9539 autorest.AsGet(), 9540 autorest.WithBaseURL(to.String(spc.OdataNextLink))) 9541} 9542 9543// StreamingPolicyCollectionPage contains a page of StreamingPolicy values. 9544type StreamingPolicyCollectionPage struct { 9545 fn func(context.Context, StreamingPolicyCollection) (StreamingPolicyCollection, error) 9546 spc StreamingPolicyCollection 9547} 9548 9549// NextWithContext advances to the next page of values. If there was an error making 9550// the request the page does not advance and the error is returned. 9551func (page *StreamingPolicyCollectionPage) NextWithContext(ctx context.Context) (err error) { 9552 if tracing.IsEnabled() { 9553 ctx = tracing.StartSpan(ctx, fqdn+"/StreamingPolicyCollectionPage.NextWithContext") 9554 defer func() { 9555 sc := -1 9556 if page.Response().Response.Response != nil { 9557 sc = page.Response().Response.Response.StatusCode 9558 } 9559 tracing.EndSpan(ctx, sc, err) 9560 }() 9561 } 9562 for { 9563 next, err := page.fn(ctx, page.spc) 9564 if err != nil { 9565 return err 9566 } 9567 page.spc = next 9568 if !next.hasNextLink() || !next.IsEmpty() { 9569 break 9570 } 9571 } 9572 return nil 9573} 9574 9575// Next advances to the next page of values. If there was an error making 9576// the request the page does not advance and the error is returned. 9577// Deprecated: Use NextWithContext() instead. 9578func (page *StreamingPolicyCollectionPage) Next() error { 9579 return page.NextWithContext(context.Background()) 9580} 9581 9582// NotDone returns true if the page enumeration should be started or is not yet complete. 9583func (page StreamingPolicyCollectionPage) NotDone() bool { 9584 return !page.spc.IsEmpty() 9585} 9586 9587// Response returns the raw server response from the last page request. 9588func (page StreamingPolicyCollectionPage) Response() StreamingPolicyCollection { 9589 return page.spc 9590} 9591 9592// Values returns the slice of values for the current page or nil if there are no values. 9593func (page StreamingPolicyCollectionPage) Values() []StreamingPolicy { 9594 if page.spc.IsEmpty() { 9595 return nil 9596 } 9597 return *page.spc.Value 9598} 9599 9600// Creates a new instance of the StreamingPolicyCollectionPage type. 9601func NewStreamingPolicyCollectionPage(cur StreamingPolicyCollection, getNextPage func(context.Context, StreamingPolicyCollection) (StreamingPolicyCollection, error)) StreamingPolicyCollectionPage { 9602 return StreamingPolicyCollectionPage{ 9603 fn: getNextPage, 9604 spc: cur, 9605 } 9606} 9607 9608// StreamingPolicyContentKey class to specify properties of content key 9609type StreamingPolicyContentKey struct { 9610 // Label - Label can be used to specify Content Key when creating a Streaming Locator 9611 Label *string `json:"label,omitempty"` 9612 // PolicyName - Policy used by Content Key 9613 PolicyName *string `json:"policyName,omitempty"` 9614 // Tracks - Tracks which use this content key 9615 Tracks *[]TrackSelection `json:"tracks,omitempty"` 9616} 9617 9618// StreamingPolicyContentKeys class to specify properties of all content keys in Streaming Policy 9619type StreamingPolicyContentKeys struct { 9620 // DefaultKey - Default content key for an encryption scheme 9621 DefaultKey *DefaultKey `json:"defaultKey,omitempty"` 9622 // KeyToTrackMappings - Representing tracks needs separate content key 9623 KeyToTrackMappings *[]StreamingPolicyContentKey `json:"keyToTrackMappings,omitempty"` 9624} 9625 9626// StreamingPolicyFairPlayConfiguration class to specify configurations of FairPlay in Streaming Policy 9627type StreamingPolicyFairPlayConfiguration struct { 9628 // CustomLicenseAcquisitionURLTemplate - Template for the URL of the custom service delivering licenses to end user players. Not required when using Azure Media Services for issuing licenses. The template supports replaceable tokens that the service will update at runtime with the value specific to the request. The currently supported token values are {AlternativeMediaId}, which is replaced with the value of StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of identifier of the key being requested. 9629 CustomLicenseAcquisitionURLTemplate *string `json:"customLicenseAcquisitionUrlTemplate,omitempty"` 9630 // AllowPersistentLicense - All license to be persistent or not 9631 AllowPersistentLicense *bool `json:"allowPersistentLicense,omitempty"` 9632} 9633 9634// StreamingPolicyPlayReadyConfiguration class to specify configurations of PlayReady in Streaming Policy 9635type StreamingPolicyPlayReadyConfiguration struct { 9636 // CustomLicenseAcquisitionURLTemplate - Template for the URL of the custom service delivering licenses to end user players. Not required when using Azure Media Services for issuing licenses. The template supports replaceable tokens that the service will update at runtime with the value specific to the request. The currently supported token values are {AlternativeMediaId}, which is replaced with the value of StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of identifier of the key being requested. 9637 CustomLicenseAcquisitionURLTemplate *string `json:"customLicenseAcquisitionUrlTemplate,omitempty"` 9638 // PlayReadyCustomAttributes - Custom attributes for PlayReady 9639 PlayReadyCustomAttributes *string `json:"playReadyCustomAttributes,omitempty"` 9640} 9641 9642// StreamingPolicyProperties class to specify properties of Streaming Policy 9643type StreamingPolicyProperties struct { 9644 // Created - READ-ONLY; Creation time of Streaming Policy 9645 Created *date.Time `json:"created,omitempty"` 9646 // DefaultContentKeyPolicyName - Default ContentKey used by current Streaming Policy 9647 DefaultContentKeyPolicyName *string `json:"defaultContentKeyPolicyName,omitempty"` 9648 // EnvelopeEncryption - Configuration of EnvelopeEncryption 9649 EnvelopeEncryption *EnvelopeEncryption `json:"envelopeEncryption,omitempty"` 9650 // CommonEncryptionCenc - Configuration of CommonEncryptionCenc 9651 CommonEncryptionCenc *CommonEncryptionCenc `json:"commonEncryptionCenc,omitempty"` 9652 // CommonEncryptionCbcs - Configuration of CommonEncryptionCbcs 9653 CommonEncryptionCbcs *CommonEncryptionCbcs `json:"commonEncryptionCbcs,omitempty"` 9654 // NoEncryption - Configurations of NoEncryption 9655 NoEncryption *NoEncryption `json:"noEncryption,omitempty"` 9656} 9657 9658// MarshalJSON is the custom marshaler for StreamingPolicyProperties. 9659func (spp StreamingPolicyProperties) MarshalJSON() ([]byte, error) { 9660 objectMap := make(map[string]interface{}) 9661 if spp.DefaultContentKeyPolicyName != nil { 9662 objectMap["defaultContentKeyPolicyName"] = spp.DefaultContentKeyPolicyName 9663 } 9664 if spp.EnvelopeEncryption != nil { 9665 objectMap["envelopeEncryption"] = spp.EnvelopeEncryption 9666 } 9667 if spp.CommonEncryptionCenc != nil { 9668 objectMap["commonEncryptionCenc"] = spp.CommonEncryptionCenc 9669 } 9670 if spp.CommonEncryptionCbcs != nil { 9671 objectMap["commonEncryptionCbcs"] = spp.CommonEncryptionCbcs 9672 } 9673 if spp.NoEncryption != nil { 9674 objectMap["noEncryption"] = spp.NoEncryption 9675 } 9676 return json.Marshal(objectMap) 9677} 9678 9679// StreamingPolicyWidevineConfiguration class to specify configurations of Widevine in Streaming Policy 9680type StreamingPolicyWidevineConfiguration struct { 9681 // CustomLicenseAcquisitionURLTemplate - Template for the URL of the custom service delivering licenses to end user players. Not required when using Azure Media Services for issuing licenses. The template supports replaceable tokens that the service will update at runtime with the value specific to the request. The currently supported token values are {AlternativeMediaId}, which is replaced with the value of StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of identifier of the key being requested. 9682 CustomLicenseAcquisitionURLTemplate *string `json:"customLicenseAcquisitionUrlTemplate,omitempty"` 9683} 9684 9685// SubscriptionMediaService a Media Services account. 9686type SubscriptionMediaService struct { 9687 autorest.Response `json:"-"` 9688 // ServiceProperties - The resource properties. 9689 *ServiceProperties `json:"properties,omitempty"` 9690 // Tags - Resource tags. 9691 Tags map[string]*string `json:"tags"` 9692 // Location - The Azure Region of the resource. 9693 Location *string `json:"location,omitempty"` 9694 // ID - READ-ONLY; Fully qualified resource ID for the resource. 9695 ID *string `json:"id,omitempty"` 9696 // Name - READ-ONLY; The name of the resource. 9697 Name *string `json:"name,omitempty"` 9698 // Type - READ-ONLY; The type of the resource. 9699 Type *string `json:"type,omitempty"` 9700} 9701 9702// MarshalJSON is the custom marshaler for SubscriptionMediaService. 9703func (sms SubscriptionMediaService) MarshalJSON() ([]byte, error) { 9704 objectMap := make(map[string]interface{}) 9705 if sms.ServiceProperties != nil { 9706 objectMap["properties"] = sms.ServiceProperties 9707 } 9708 if sms.Tags != nil { 9709 objectMap["tags"] = sms.Tags 9710 } 9711 if sms.Location != nil { 9712 objectMap["location"] = sms.Location 9713 } 9714 return json.Marshal(objectMap) 9715} 9716 9717// UnmarshalJSON is the custom unmarshaler for SubscriptionMediaService struct. 9718func (sms *SubscriptionMediaService) UnmarshalJSON(body []byte) error { 9719 var m map[string]*json.RawMessage 9720 err := json.Unmarshal(body, &m) 9721 if err != nil { 9722 return err 9723 } 9724 for k, v := range m { 9725 switch k { 9726 case "properties": 9727 if v != nil { 9728 var serviceProperties ServiceProperties 9729 err = json.Unmarshal(*v, &serviceProperties) 9730 if err != nil { 9731 return err 9732 } 9733 sms.ServiceProperties = &serviceProperties 9734 } 9735 case "tags": 9736 if v != nil { 9737 var tags map[string]*string 9738 err = json.Unmarshal(*v, &tags) 9739 if err != nil { 9740 return err 9741 } 9742 sms.Tags = tags 9743 } 9744 case "location": 9745 if v != nil { 9746 var location string 9747 err = json.Unmarshal(*v, &location) 9748 if err != nil { 9749 return err 9750 } 9751 sms.Location = &location 9752 } 9753 case "id": 9754 if v != nil { 9755 var ID string 9756 err = json.Unmarshal(*v, &ID) 9757 if err != nil { 9758 return err 9759 } 9760 sms.ID = &ID 9761 } 9762 case "name": 9763 if v != nil { 9764 var name string 9765 err = json.Unmarshal(*v, &name) 9766 if err != nil { 9767 return err 9768 } 9769 sms.Name = &name 9770 } 9771 case "type": 9772 if v != nil { 9773 var typeVar string 9774 err = json.Unmarshal(*v, &typeVar) 9775 if err != nil { 9776 return err 9777 } 9778 sms.Type = &typeVar 9779 } 9780 } 9781 } 9782 9783 return nil 9784} 9785 9786// SubscriptionMediaServiceCollection a collection of SubscriptionMediaService items. 9787type SubscriptionMediaServiceCollection struct { 9788 autorest.Response `json:"-"` 9789 // Value - A collection of SubscriptionMediaService items. 9790 Value *[]SubscriptionMediaService `json:"value,omitempty"` 9791 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 9792 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 9793} 9794 9795// SubscriptionMediaServiceCollectionIterator provides access to a complete listing of 9796// SubscriptionMediaService values. 9797type SubscriptionMediaServiceCollectionIterator struct { 9798 i int 9799 page SubscriptionMediaServiceCollectionPage 9800} 9801 9802// NextWithContext advances to the next value. If there was an error making 9803// the request the iterator does not advance and the error is returned. 9804func (iter *SubscriptionMediaServiceCollectionIterator) NextWithContext(ctx context.Context) (err error) { 9805 if tracing.IsEnabled() { 9806 ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionMediaServiceCollectionIterator.NextWithContext") 9807 defer func() { 9808 sc := -1 9809 if iter.Response().Response.Response != nil { 9810 sc = iter.Response().Response.Response.StatusCode 9811 } 9812 tracing.EndSpan(ctx, sc, err) 9813 }() 9814 } 9815 iter.i++ 9816 if iter.i < len(iter.page.Values()) { 9817 return nil 9818 } 9819 err = iter.page.NextWithContext(ctx) 9820 if err != nil { 9821 iter.i-- 9822 return err 9823 } 9824 iter.i = 0 9825 return nil 9826} 9827 9828// Next advances to the next value. If there was an error making 9829// the request the iterator does not advance and the error is returned. 9830// Deprecated: Use NextWithContext() instead. 9831func (iter *SubscriptionMediaServiceCollectionIterator) Next() error { 9832 return iter.NextWithContext(context.Background()) 9833} 9834 9835// NotDone returns true if the enumeration should be started or is not yet complete. 9836func (iter SubscriptionMediaServiceCollectionIterator) NotDone() bool { 9837 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 9838} 9839 9840// Response returns the raw server response from the last page request. 9841func (iter SubscriptionMediaServiceCollectionIterator) Response() SubscriptionMediaServiceCollection { 9842 return iter.page.Response() 9843} 9844 9845// Value returns the current value or a zero-initialized value if the 9846// iterator has advanced beyond the end of the collection. 9847func (iter SubscriptionMediaServiceCollectionIterator) Value() SubscriptionMediaService { 9848 if !iter.page.NotDone() { 9849 return SubscriptionMediaService{} 9850 } 9851 return iter.page.Values()[iter.i] 9852} 9853 9854// Creates a new instance of the SubscriptionMediaServiceCollectionIterator type. 9855func NewSubscriptionMediaServiceCollectionIterator(page SubscriptionMediaServiceCollectionPage) SubscriptionMediaServiceCollectionIterator { 9856 return SubscriptionMediaServiceCollectionIterator{page: page} 9857} 9858 9859// IsEmpty returns true if the ListResult contains no values. 9860func (smsc SubscriptionMediaServiceCollection) IsEmpty() bool { 9861 return smsc.Value == nil || len(*smsc.Value) == 0 9862} 9863 9864// hasNextLink returns true if the NextLink is not empty. 9865func (smsc SubscriptionMediaServiceCollection) hasNextLink() bool { 9866 return smsc.OdataNextLink != nil && len(*smsc.OdataNextLink) != 0 9867} 9868 9869// subscriptionMediaServiceCollectionPreparer prepares a request to retrieve the next set of results. 9870// It returns nil if no more results exist. 9871func (smsc SubscriptionMediaServiceCollection) subscriptionMediaServiceCollectionPreparer(ctx context.Context) (*http.Request, error) { 9872 if !smsc.hasNextLink() { 9873 return nil, nil 9874 } 9875 return autorest.Prepare((&http.Request{}).WithContext(ctx), 9876 autorest.AsJSON(), 9877 autorest.AsGet(), 9878 autorest.WithBaseURL(to.String(smsc.OdataNextLink))) 9879} 9880 9881// SubscriptionMediaServiceCollectionPage contains a page of SubscriptionMediaService values. 9882type SubscriptionMediaServiceCollectionPage struct { 9883 fn func(context.Context, SubscriptionMediaServiceCollection) (SubscriptionMediaServiceCollection, error) 9884 smsc SubscriptionMediaServiceCollection 9885} 9886 9887// NextWithContext advances to the next page of values. If there was an error making 9888// the request the page does not advance and the error is returned. 9889func (page *SubscriptionMediaServiceCollectionPage) NextWithContext(ctx context.Context) (err error) { 9890 if tracing.IsEnabled() { 9891 ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionMediaServiceCollectionPage.NextWithContext") 9892 defer func() { 9893 sc := -1 9894 if page.Response().Response.Response != nil { 9895 sc = page.Response().Response.Response.StatusCode 9896 } 9897 tracing.EndSpan(ctx, sc, err) 9898 }() 9899 } 9900 for { 9901 next, err := page.fn(ctx, page.smsc) 9902 if err != nil { 9903 return err 9904 } 9905 page.smsc = next 9906 if !next.hasNextLink() || !next.IsEmpty() { 9907 break 9908 } 9909 } 9910 return nil 9911} 9912 9913// Next advances to the next page of values. If there was an error making 9914// the request the page does not advance and the error is returned. 9915// Deprecated: Use NextWithContext() instead. 9916func (page *SubscriptionMediaServiceCollectionPage) Next() error { 9917 return page.NextWithContext(context.Background()) 9918} 9919 9920// NotDone returns true if the page enumeration should be started or is not yet complete. 9921func (page SubscriptionMediaServiceCollectionPage) NotDone() bool { 9922 return !page.smsc.IsEmpty() 9923} 9924 9925// Response returns the raw server response from the last page request. 9926func (page SubscriptionMediaServiceCollectionPage) Response() SubscriptionMediaServiceCollection { 9927 return page.smsc 9928} 9929 9930// Values returns the slice of values for the current page or nil if there are no values. 9931func (page SubscriptionMediaServiceCollectionPage) Values() []SubscriptionMediaService { 9932 if page.smsc.IsEmpty() { 9933 return nil 9934 } 9935 return *page.smsc.Value 9936} 9937 9938// Creates a new instance of the SubscriptionMediaServiceCollectionPage type. 9939func NewSubscriptionMediaServiceCollectionPage(cur SubscriptionMediaServiceCollection, getNextPage func(context.Context, SubscriptionMediaServiceCollection) (SubscriptionMediaServiceCollection, error)) SubscriptionMediaServiceCollectionPage { 9940 return SubscriptionMediaServiceCollectionPage{ 9941 fn: getNextPage, 9942 smsc: cur, 9943 } 9944} 9945 9946// SyncStorageKeysInput the input to the sync storage keys request. 9947type SyncStorageKeysInput struct { 9948 // ID - The ID of the storage account resource. 9949 ID *string `json:"id,omitempty"` 9950} 9951 9952// TrackedResource the resource model definition for a ARM tracked resource. 9953type TrackedResource struct { 9954 // Tags - Resource tags. 9955 Tags map[string]*string `json:"tags"` 9956 // Location - The Azure Region of the resource. 9957 Location *string `json:"location,omitempty"` 9958 // ID - READ-ONLY; Fully qualified resource ID for the resource. 9959 ID *string `json:"id,omitempty"` 9960 // Name - READ-ONLY; The name of the resource. 9961 Name *string `json:"name,omitempty"` 9962 // Type - READ-ONLY; The type of the resource. 9963 Type *string `json:"type,omitempty"` 9964} 9965 9966// MarshalJSON is the custom marshaler for TrackedResource. 9967func (tr TrackedResource) MarshalJSON() ([]byte, error) { 9968 objectMap := make(map[string]interface{}) 9969 if tr.Tags != nil { 9970 objectMap["tags"] = tr.Tags 9971 } 9972 if tr.Location != nil { 9973 objectMap["location"] = tr.Location 9974 } 9975 return json.Marshal(objectMap) 9976} 9977 9978// TrackPropertyCondition class to specify one track property condition 9979type TrackPropertyCondition struct { 9980 // Property - Track property type. Possible values include: 'TrackPropertyTypeUnknown', 'TrackPropertyTypeFourCC' 9981 Property TrackPropertyType `json:"property,omitempty"` 9982 // Operation - Track property condition operation. Possible values include: 'TrackPropertyCompareOperationUnknown', 'TrackPropertyCompareOperationEqual' 9983 Operation TrackPropertyCompareOperation `json:"operation,omitempty"` 9984 // Value - Track property value 9985 Value *string `json:"value,omitempty"` 9986} 9987 9988// TrackSelection class to select a track 9989type TrackSelection struct { 9990 // TrackSelections - TrackSelections is a track property condition list which can specify track(s) 9991 TrackSelections *[]TrackPropertyCondition `json:"trackSelections,omitempty"` 9992} 9993 9994// Transform a Transform encapsulates the rules or instructions for generating desired outputs from input 9995// media, such as by transcoding or by extracting insights. After the Transform is created, it can be 9996// applied to input media by creating Jobs. 9997type Transform struct { 9998 autorest.Response `json:"-"` 9999 // TransformProperties - The resource properties. 10000 *TransformProperties `json:"properties,omitempty"` 10001 // ID - READ-ONLY; Fully qualified resource ID for the resource. 10002 ID *string `json:"id,omitempty"` 10003 // Name - READ-ONLY; The name of the resource. 10004 Name *string `json:"name,omitempty"` 10005 // Type - READ-ONLY; The type of the resource. 10006 Type *string `json:"type,omitempty"` 10007} 10008 10009// MarshalJSON is the custom marshaler for Transform. 10010func (t Transform) MarshalJSON() ([]byte, error) { 10011 objectMap := make(map[string]interface{}) 10012 if t.TransformProperties != nil { 10013 objectMap["properties"] = t.TransformProperties 10014 } 10015 return json.Marshal(objectMap) 10016} 10017 10018// UnmarshalJSON is the custom unmarshaler for Transform struct. 10019func (t *Transform) UnmarshalJSON(body []byte) error { 10020 var m map[string]*json.RawMessage 10021 err := json.Unmarshal(body, &m) 10022 if err != nil { 10023 return err 10024 } 10025 for k, v := range m { 10026 switch k { 10027 case "properties": 10028 if v != nil { 10029 var transformProperties TransformProperties 10030 err = json.Unmarshal(*v, &transformProperties) 10031 if err != nil { 10032 return err 10033 } 10034 t.TransformProperties = &transformProperties 10035 } 10036 case "id": 10037 if v != nil { 10038 var ID string 10039 err = json.Unmarshal(*v, &ID) 10040 if err != nil { 10041 return err 10042 } 10043 t.ID = &ID 10044 } 10045 case "name": 10046 if v != nil { 10047 var name string 10048 err = json.Unmarshal(*v, &name) 10049 if err != nil { 10050 return err 10051 } 10052 t.Name = &name 10053 } 10054 case "type": 10055 if v != nil { 10056 var typeVar string 10057 err = json.Unmarshal(*v, &typeVar) 10058 if err != nil { 10059 return err 10060 } 10061 t.Type = &typeVar 10062 } 10063 } 10064 } 10065 10066 return nil 10067} 10068 10069// TransformCollection a collection of Transform items. 10070type TransformCollection struct { 10071 autorest.Response `json:"-"` 10072 // Value - A collection of Transform items. 10073 Value *[]Transform `json:"value,omitempty"` 10074 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 10075 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 10076} 10077 10078// TransformCollectionIterator provides access to a complete listing of Transform values. 10079type TransformCollectionIterator struct { 10080 i int 10081 page TransformCollectionPage 10082} 10083 10084// NextWithContext advances to the next value. If there was an error making 10085// the request the iterator does not advance and the error is returned. 10086func (iter *TransformCollectionIterator) NextWithContext(ctx context.Context) (err error) { 10087 if tracing.IsEnabled() { 10088 ctx = tracing.StartSpan(ctx, fqdn+"/TransformCollectionIterator.NextWithContext") 10089 defer func() { 10090 sc := -1 10091 if iter.Response().Response.Response != nil { 10092 sc = iter.Response().Response.Response.StatusCode 10093 } 10094 tracing.EndSpan(ctx, sc, err) 10095 }() 10096 } 10097 iter.i++ 10098 if iter.i < len(iter.page.Values()) { 10099 return nil 10100 } 10101 err = iter.page.NextWithContext(ctx) 10102 if err != nil { 10103 iter.i-- 10104 return err 10105 } 10106 iter.i = 0 10107 return nil 10108} 10109 10110// Next advances to the next value. If there was an error making 10111// the request the iterator does not advance and the error is returned. 10112// Deprecated: Use NextWithContext() instead. 10113func (iter *TransformCollectionIterator) Next() error { 10114 return iter.NextWithContext(context.Background()) 10115} 10116 10117// NotDone returns true if the enumeration should be started or is not yet complete. 10118func (iter TransformCollectionIterator) NotDone() bool { 10119 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 10120} 10121 10122// Response returns the raw server response from the last page request. 10123func (iter TransformCollectionIterator) Response() TransformCollection { 10124 return iter.page.Response() 10125} 10126 10127// Value returns the current value or a zero-initialized value if the 10128// iterator has advanced beyond the end of the collection. 10129func (iter TransformCollectionIterator) Value() Transform { 10130 if !iter.page.NotDone() { 10131 return Transform{} 10132 } 10133 return iter.page.Values()[iter.i] 10134} 10135 10136// Creates a new instance of the TransformCollectionIterator type. 10137func NewTransformCollectionIterator(page TransformCollectionPage) TransformCollectionIterator { 10138 return TransformCollectionIterator{page: page} 10139} 10140 10141// IsEmpty returns true if the ListResult contains no values. 10142func (tc TransformCollection) IsEmpty() bool { 10143 return tc.Value == nil || len(*tc.Value) == 0 10144} 10145 10146// hasNextLink returns true if the NextLink is not empty. 10147func (tc TransformCollection) hasNextLink() bool { 10148 return tc.OdataNextLink != nil && len(*tc.OdataNextLink) != 0 10149} 10150 10151// transformCollectionPreparer prepares a request to retrieve the next set of results. 10152// It returns nil if no more results exist. 10153func (tc TransformCollection) transformCollectionPreparer(ctx context.Context) (*http.Request, error) { 10154 if !tc.hasNextLink() { 10155 return nil, nil 10156 } 10157 return autorest.Prepare((&http.Request{}).WithContext(ctx), 10158 autorest.AsJSON(), 10159 autorest.AsGet(), 10160 autorest.WithBaseURL(to.String(tc.OdataNextLink))) 10161} 10162 10163// TransformCollectionPage contains a page of Transform values. 10164type TransformCollectionPage struct { 10165 fn func(context.Context, TransformCollection) (TransformCollection, error) 10166 tc TransformCollection 10167} 10168 10169// NextWithContext advances to the next page of values. If there was an error making 10170// the request the page does not advance and the error is returned. 10171func (page *TransformCollectionPage) NextWithContext(ctx context.Context) (err error) { 10172 if tracing.IsEnabled() { 10173 ctx = tracing.StartSpan(ctx, fqdn+"/TransformCollectionPage.NextWithContext") 10174 defer func() { 10175 sc := -1 10176 if page.Response().Response.Response != nil { 10177 sc = page.Response().Response.Response.StatusCode 10178 } 10179 tracing.EndSpan(ctx, sc, err) 10180 }() 10181 } 10182 for { 10183 next, err := page.fn(ctx, page.tc) 10184 if err != nil { 10185 return err 10186 } 10187 page.tc = next 10188 if !next.hasNextLink() || !next.IsEmpty() { 10189 break 10190 } 10191 } 10192 return nil 10193} 10194 10195// Next advances to the next page of values. If there was an error making 10196// the request the page does not advance and the error is returned. 10197// Deprecated: Use NextWithContext() instead. 10198func (page *TransformCollectionPage) Next() error { 10199 return page.NextWithContext(context.Background()) 10200} 10201 10202// NotDone returns true if the page enumeration should be started or is not yet complete. 10203func (page TransformCollectionPage) NotDone() bool { 10204 return !page.tc.IsEmpty() 10205} 10206 10207// Response returns the raw server response from the last page request. 10208func (page TransformCollectionPage) Response() TransformCollection { 10209 return page.tc 10210} 10211 10212// Values returns the slice of values for the current page or nil if there are no values. 10213func (page TransformCollectionPage) Values() []Transform { 10214 if page.tc.IsEmpty() { 10215 return nil 10216 } 10217 return *page.tc.Value 10218} 10219 10220// Creates a new instance of the TransformCollectionPage type. 10221func NewTransformCollectionPage(cur TransformCollection, getNextPage func(context.Context, TransformCollection) (TransformCollection, error)) TransformCollectionPage { 10222 return TransformCollectionPage{ 10223 fn: getNextPage, 10224 tc: cur, 10225 } 10226} 10227 10228// TransformOutput describes the properties of a TransformOutput, which are the rules to be applied while 10229// generating the desired output. 10230type TransformOutput struct { 10231 // OnError - A Transform can define more than one outputs. This property defines what the service should do when one output fails - either continue to produce other outputs, or, stop the other outputs. The overall Job state will not reflect failures of outputs that are specified with 'ContinueJob'. The default is 'StopProcessingJob'. Possible values include: 'StopProcessingJob', 'ContinueJob' 10232 OnError OnErrorType `json:"onError,omitempty"` 10233 // RelativePriority - Sets the relative priority of the TransformOutputs within a Transform. This sets the priority that the service uses for processing TransformOutputs. The default priority is Normal. Possible values include: 'Low', 'Normal', 'High' 10234 RelativePriority Priority `json:"relativePriority,omitempty"` 10235 // Preset - Preset that describes the operations that will be used to modify, transcode, or extract insights from the source file to generate the output. 10236 Preset BasicPreset `json:"preset,omitempty"` 10237} 10238 10239// UnmarshalJSON is the custom unmarshaler for TransformOutput struct. 10240func (toVar *TransformOutput) UnmarshalJSON(body []byte) error { 10241 var m map[string]*json.RawMessage 10242 err := json.Unmarshal(body, &m) 10243 if err != nil { 10244 return err 10245 } 10246 for k, v := range m { 10247 switch k { 10248 case "onError": 10249 if v != nil { 10250 var onError OnErrorType 10251 err = json.Unmarshal(*v, &onError) 10252 if err != nil { 10253 return err 10254 } 10255 toVar.OnError = onError 10256 } 10257 case "relativePriority": 10258 if v != nil { 10259 var relativePriority Priority 10260 err = json.Unmarshal(*v, &relativePriority) 10261 if err != nil { 10262 return err 10263 } 10264 toVar.RelativePriority = relativePriority 10265 } 10266 case "preset": 10267 if v != nil { 10268 preset, err := unmarshalBasicPreset(*v) 10269 if err != nil { 10270 return err 10271 } 10272 toVar.Preset = preset 10273 } 10274 } 10275 } 10276 10277 return nil 10278} 10279 10280// TransformProperties a Transform. 10281type TransformProperties struct { 10282 // Created - READ-ONLY; The UTC date and time when the Transform was created, in 'YYYY-MM-DDThh:mm:ssZ' format. 10283 Created *date.Time `json:"created,omitempty"` 10284 // Description - An optional verbose description of the Transform. 10285 Description *string `json:"description,omitempty"` 10286 // LastModified - READ-ONLY; The UTC date and time when the Transform was last updated, in 'YYYY-MM-DDThh:mm:ssZ' format. 10287 LastModified *date.Time `json:"lastModified,omitempty"` 10288 // Outputs - An array of one or more TransformOutputs that the Transform should generate. 10289 Outputs *[]TransformOutput `json:"outputs,omitempty"` 10290} 10291 10292// MarshalJSON is the custom marshaler for TransformProperties. 10293func (tp TransformProperties) MarshalJSON() ([]byte, error) { 10294 objectMap := make(map[string]interface{}) 10295 if tp.Description != nil { 10296 objectMap["description"] = tp.Description 10297 } 10298 if tp.Outputs != nil { 10299 objectMap["outputs"] = tp.Outputs 10300 } 10301 return json.Marshal(objectMap) 10302} 10303 10304// TransportStreamFormat describes the properties for generating an MPEG-2 Transport Stream (ISO/IEC 10305// 13818-1) output video file(s). 10306type TransportStreamFormat struct { 10307 // OutputFiles - The list of output files to produce. Each entry in the list is a set of audio and video layer labels to be muxed together . 10308 OutputFiles *[]OutputFile `json:"outputFiles,omitempty"` 10309 // FilenamePattern - The pattern of the file names for the generated output files. The following macros are supported in the file name: {Basename} - The base name of the input video {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. Any unsubstituted macros will be collapsed and removed from the filename. 10310 FilenamePattern *string `json:"filenamePattern,omitempty"` 10311 // OdataType - Possible values include: 'OdataTypeFormat', 'OdataTypeMicrosoftMediaImageFormat', 'OdataTypeMicrosoftMediaJpgFormat', 'OdataTypeMicrosoftMediaPngFormat', 'OdataTypeMicrosoftMediaMultiBitrateFormat', 'OdataTypeMicrosoftMediaMp4Format', 'OdataTypeMicrosoftMediaTransportStreamFormat' 10312 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"` 10313} 10314 10315// MarshalJSON is the custom marshaler for TransportStreamFormat. 10316func (tsf TransportStreamFormat) MarshalJSON() ([]byte, error) { 10317 tsf.OdataType = OdataTypeMicrosoftMediaTransportStreamFormat 10318 objectMap := make(map[string]interface{}) 10319 if tsf.OutputFiles != nil { 10320 objectMap["outputFiles"] = tsf.OutputFiles 10321 } 10322 if tsf.FilenamePattern != nil { 10323 objectMap["filenamePattern"] = tsf.FilenamePattern 10324 } 10325 if tsf.OdataType != "" { 10326 objectMap["@odata.type"] = tsf.OdataType 10327 } 10328 return json.Marshal(objectMap) 10329} 10330 10331// AsImageFormat is the BasicFormat implementation for TransportStreamFormat. 10332func (tsf TransportStreamFormat) AsImageFormat() (*ImageFormat, bool) { 10333 return nil, false 10334} 10335 10336// AsBasicImageFormat is the BasicFormat implementation for TransportStreamFormat. 10337func (tsf TransportStreamFormat) AsBasicImageFormat() (BasicImageFormat, bool) { 10338 return nil, false 10339} 10340 10341// AsJpgFormat is the BasicFormat implementation for TransportStreamFormat. 10342func (tsf TransportStreamFormat) AsJpgFormat() (*JpgFormat, bool) { 10343 return nil, false 10344} 10345 10346// AsPngFormat is the BasicFormat implementation for TransportStreamFormat. 10347func (tsf TransportStreamFormat) AsPngFormat() (*PngFormat, bool) { 10348 return nil, false 10349} 10350 10351// AsMultiBitrateFormat is the BasicFormat implementation for TransportStreamFormat. 10352func (tsf TransportStreamFormat) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) { 10353 return nil, false 10354} 10355 10356// AsBasicMultiBitrateFormat is the BasicFormat implementation for TransportStreamFormat. 10357func (tsf TransportStreamFormat) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) { 10358 return &tsf, true 10359} 10360 10361// AsMp4Format is the BasicFormat implementation for TransportStreamFormat. 10362func (tsf TransportStreamFormat) AsMp4Format() (*Mp4Format, bool) { 10363 return nil, false 10364} 10365 10366// AsTransportStreamFormat is the BasicFormat implementation for TransportStreamFormat. 10367func (tsf TransportStreamFormat) AsTransportStreamFormat() (*TransportStreamFormat, bool) { 10368 return &tsf, true 10369} 10370 10371// AsFormat is the BasicFormat implementation for TransportStreamFormat. 10372func (tsf TransportStreamFormat) AsFormat() (*Format, bool) { 10373 return nil, false 10374} 10375 10376// AsBasicFormat is the BasicFormat implementation for TransportStreamFormat. 10377func (tsf TransportStreamFormat) AsBasicFormat() (BasicFormat, bool) { 10378 return &tsf, true 10379} 10380 10381// BasicVideo describes the basic properties for encoding the input video. 10382type BasicVideo interface { 10383 AsImage() (*Image, bool) 10384 AsBasicImage() (BasicImage, bool) 10385 AsH264Video() (*H264Video, bool) 10386 AsJpgImage() (*JpgImage, bool) 10387 AsPngImage() (*PngImage, bool) 10388 AsVideo() (*Video, bool) 10389} 10390 10391// Video describes the basic properties for encoding the input video. 10392type Video struct { 10393 // KeyFrameInterval - The distance between two key frames, thereby defining a group of pictures (GOP). The value should be a non-zero integer in the range [1, 30] seconds, specified in ISO 8601 format. The default is 2 seconds (PT2S). 10394 KeyFrameInterval *string `json:"keyFrameInterval,omitempty"` 10395 // StretchMode - The resizing mode - how the input video will be resized to fit the desired output resolution(s). Default is AutoSize. Possible values include: 'StretchModeNone', 'StretchModeAutoSize', 'StretchModeAutoFit' 10396 StretchMode StretchMode `json:"stretchMode,omitempty"` 10397 // Label - An optional label for the codec. The label can be used to control muxing behavior. 10398 Label *string `json:"label,omitempty"` 10399 // OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage' 10400 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"` 10401} 10402 10403func unmarshalBasicVideo(body []byte) (BasicVideo, error) { 10404 var m map[string]interface{} 10405 err := json.Unmarshal(body, &m) 10406 if err != nil { 10407 return nil, err 10408 } 10409 10410 switch m["@odata.type"] { 10411 case string(OdataTypeMicrosoftMediaImage): 10412 var i Image 10413 err := json.Unmarshal(body, &i) 10414 return i, err 10415 case string(OdataTypeMicrosoftMediaH264Video): 10416 var hv H264Video 10417 err := json.Unmarshal(body, &hv) 10418 return hv, err 10419 case string(OdataTypeMicrosoftMediaJpgImage): 10420 var ji JpgImage 10421 err := json.Unmarshal(body, &ji) 10422 return ji, err 10423 case string(OdataTypeMicrosoftMediaPngImage): 10424 var pi PngImage 10425 err := json.Unmarshal(body, &pi) 10426 return pi, err 10427 default: 10428 var vVar Video 10429 err := json.Unmarshal(body, &vVar) 10430 return vVar, err 10431 } 10432} 10433func unmarshalBasicVideoArray(body []byte) ([]BasicVideo, error) { 10434 var rawMessages []*json.RawMessage 10435 err := json.Unmarshal(body, &rawMessages) 10436 if err != nil { 10437 return nil, err 10438 } 10439 10440 vVarArray := make([]BasicVideo, len(rawMessages)) 10441 10442 for index, rawMessage := range rawMessages { 10443 vVar, err := unmarshalBasicVideo(*rawMessage) 10444 if err != nil { 10445 return nil, err 10446 } 10447 vVarArray[index] = vVar 10448 } 10449 return vVarArray, nil 10450} 10451 10452// MarshalJSON is the custom marshaler for Video. 10453func (vVar Video) MarshalJSON() ([]byte, error) { 10454 vVar.OdataType = OdataTypeMicrosoftMediaVideo 10455 objectMap := make(map[string]interface{}) 10456 if vVar.KeyFrameInterval != nil { 10457 objectMap["keyFrameInterval"] = vVar.KeyFrameInterval 10458 } 10459 if vVar.StretchMode != "" { 10460 objectMap["stretchMode"] = vVar.StretchMode 10461 } 10462 if vVar.Label != nil { 10463 objectMap["label"] = vVar.Label 10464 } 10465 if vVar.OdataType != "" { 10466 objectMap["@odata.type"] = vVar.OdataType 10467 } 10468 return json.Marshal(objectMap) 10469} 10470 10471// AsAudio is the BasicCodec implementation for Video. 10472func (vVar Video) AsAudio() (*Audio, bool) { 10473 return nil, false 10474} 10475 10476// AsBasicAudio is the BasicCodec implementation for Video. 10477func (vVar Video) AsBasicAudio() (BasicAudio, bool) { 10478 return nil, false 10479} 10480 10481// AsAacAudio is the BasicCodec implementation for Video. 10482func (vVar Video) AsAacAudio() (*AacAudio, bool) { 10483 return nil, false 10484} 10485 10486// AsCopyVideo is the BasicCodec implementation for Video. 10487func (vVar Video) AsCopyVideo() (*CopyVideo, bool) { 10488 return nil, false 10489} 10490 10491// AsVideo is the BasicCodec implementation for Video. 10492func (vVar Video) AsVideo() (*Video, bool) { 10493 return &vVar, true 10494} 10495 10496// AsBasicVideo is the BasicCodec implementation for Video. 10497func (vVar Video) AsBasicVideo() (BasicVideo, bool) { 10498 return &vVar, true 10499} 10500 10501// AsImage is the BasicCodec implementation for Video. 10502func (vVar Video) AsImage() (*Image, bool) { 10503 return nil, false 10504} 10505 10506// AsBasicImage is the BasicCodec implementation for Video. 10507func (vVar Video) AsBasicImage() (BasicImage, bool) { 10508 return nil, false 10509} 10510 10511// AsCopyAudio is the BasicCodec implementation for Video. 10512func (vVar Video) AsCopyAudio() (*CopyAudio, bool) { 10513 return nil, false 10514} 10515 10516// AsH264Video is the BasicCodec implementation for Video. 10517func (vVar Video) AsH264Video() (*H264Video, bool) { 10518 return nil, false 10519} 10520 10521// AsJpgImage is the BasicCodec implementation for Video. 10522func (vVar Video) AsJpgImage() (*JpgImage, bool) { 10523 return nil, false 10524} 10525 10526// AsPngImage is the BasicCodec implementation for Video. 10527func (vVar Video) AsPngImage() (*PngImage, bool) { 10528 return nil, false 10529} 10530 10531// AsCodec is the BasicCodec implementation for Video. 10532func (vVar Video) AsCodec() (*Codec, bool) { 10533 return nil, false 10534} 10535 10536// AsBasicCodec is the BasicCodec implementation for Video. 10537func (vVar Video) AsBasicCodec() (BasicCodec, bool) { 10538 return &vVar, true 10539} 10540 10541// VideoAnalyzerPreset a video analyzer preset that extracts insights (rich metadata) from both audio and 10542// video, and outputs a JSON format file. 10543type VideoAnalyzerPreset struct { 10544 // InsightsToExtract - Defines the type of insights that you want the service to generate. The allowed values are 'AudioInsightsOnly', 'VideoInsightsOnly', and 'AllInsights'. The default is AllInsights. If you set this to AllInsights and the input is audio only, then only audio insights are generated. Similarly if the input is video only, then only video insights are generated. It is recommended that you not use AudioInsightsOnly if you expect some of your inputs to be video only; or use VideoInsightsOnly if you expect some of your inputs to be audio only. Your Jobs in such conditions would error out. Possible values include: 'AudioInsightsOnly', 'VideoInsightsOnly', 'AllInsights' 10545 InsightsToExtract InsightsType `json:"insightsToExtract,omitempty"` 10546 // AudioLanguage - The language for the audio payload in the input using the BCP-47 format of 'language tag-region' (e.g: 'en-US'). The list of supported languages are English ('en-US' and 'en-GB'), Spanish ('es-ES' and 'es-MX'), French ('fr-FR'), Italian ('it-IT'), Japanese ('ja-JP'), Portuguese ('pt-BR'), Chinese ('zh-CN'), German ('de-DE'), Arabic ('ar-EG' and 'ar-SY'), Russian ('ru-RU'), Hindi ('hi-IN'), and Korean ('ko-KR'). If you know the language of your content, it is recommended that you specify it. If the language isn't specified or set to null, automatic language detection will choose the first language detected and process with the selected language for the duration of the file. This language detection feature currently supports English, Chinese, French, German, Italian, Japanese, Spanish, Russian, and Portuguese. It does not currently support dynamically switching between languages after the first language is detected. The automatic detection works best with audio recordings with clearly discernable speech. If automatic detection fails to find the language, transcription would fallback to 'en-US'." 10547 AudioLanguage *string `json:"audioLanguage,omitempty"` 10548 // OdataType - Possible values include: 'OdataTypePreset', 'OdataTypeMicrosoftMediaFaceDetectorPreset', 'OdataTypeMicrosoftMediaAudioAnalyzerPreset', 'OdataTypeMicrosoftMediaBuiltInStandardEncoderPreset', 'OdataTypeMicrosoftMediaStandardEncoderPreset', 'OdataTypeMicrosoftMediaVideoAnalyzerPreset' 10549 OdataType OdataTypeBasicPreset `json:"@odata.type,omitempty"` 10550} 10551 10552// MarshalJSON is the custom marshaler for VideoAnalyzerPreset. 10553func (vap VideoAnalyzerPreset) MarshalJSON() ([]byte, error) { 10554 vap.OdataType = OdataTypeMicrosoftMediaVideoAnalyzerPreset 10555 objectMap := make(map[string]interface{}) 10556 if vap.InsightsToExtract != "" { 10557 objectMap["insightsToExtract"] = vap.InsightsToExtract 10558 } 10559 if vap.AudioLanguage != nil { 10560 objectMap["audioLanguage"] = vap.AudioLanguage 10561 } 10562 if vap.OdataType != "" { 10563 objectMap["@odata.type"] = vap.OdataType 10564 } 10565 return json.Marshal(objectMap) 10566} 10567 10568// AsFaceDetectorPreset is the BasicPreset implementation for VideoAnalyzerPreset. 10569func (vap VideoAnalyzerPreset) AsFaceDetectorPreset() (*FaceDetectorPreset, bool) { 10570 return nil, false 10571} 10572 10573// AsAudioAnalyzerPreset is the BasicPreset implementation for VideoAnalyzerPreset. 10574func (vap VideoAnalyzerPreset) AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) { 10575 return nil, false 10576} 10577 10578// AsBasicAudioAnalyzerPreset is the BasicPreset implementation for VideoAnalyzerPreset. 10579func (vap VideoAnalyzerPreset) AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) { 10580 return &vap, true 10581} 10582 10583// AsBuiltInStandardEncoderPreset is the BasicPreset implementation for VideoAnalyzerPreset. 10584func (vap VideoAnalyzerPreset) AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) { 10585 return nil, false 10586} 10587 10588// AsStandardEncoderPreset is the BasicPreset implementation for VideoAnalyzerPreset. 10589func (vap VideoAnalyzerPreset) AsStandardEncoderPreset() (*StandardEncoderPreset, bool) { 10590 return nil, false 10591} 10592 10593// AsVideoAnalyzerPreset is the BasicPreset implementation for VideoAnalyzerPreset. 10594func (vap VideoAnalyzerPreset) AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) { 10595 return &vap, true 10596} 10597 10598// AsPreset is the BasicPreset implementation for VideoAnalyzerPreset. 10599func (vap VideoAnalyzerPreset) AsPreset() (*Preset, bool) { 10600 return nil, false 10601} 10602 10603// AsBasicPreset is the BasicPreset implementation for VideoAnalyzerPreset. 10604func (vap VideoAnalyzerPreset) AsBasicPreset() (BasicPreset, bool) { 10605 return &vap, true 10606} 10607 10608// BasicVideoLayer describes the settings to be used when encoding the input video into a desired output bitrate layer. 10609type BasicVideoLayer interface { 10610 AsH264Layer() (*H264Layer, bool) 10611 AsVideoLayer() (*VideoLayer, bool) 10612} 10613 10614// VideoLayer describes the settings to be used when encoding the input video into a desired output bitrate 10615// layer. 10616type VideoLayer struct { 10617 // Bitrate - The average bitrate in bits per second at which to encode the input video when generating this layer. This is a required field. 10618 Bitrate *int32 `json:"bitrate,omitempty"` 10619 // MaxBitrate - The maximum bitrate (in bits per second), at which the VBV buffer should be assumed to refill. If not specified, defaults to the same value as bitrate. 10620 MaxBitrate *int32 `json:"maxBitrate,omitempty"` 10621 // BFrames - The number of B-frames to be used when encoding this layer. If not specified, the encoder chooses an appropriate number based on the video profile and level. 10622 BFrames *int32 `json:"bFrames,omitempty"` 10623 // FrameRate - The frame rate (in frames per second) at which to encode this layer. The value can be in the form of M/N where M and N are integers (For example, 30000/1001), or in the form of a number (For example, 30, or 29.97). The encoder enforces constraints on allowed frame rates based on the profile and level. If it is not specified, the encoder will use the same frame rate as the input video. 10624 FrameRate *string `json:"frameRate,omitempty"` 10625 // Slices - The number of slices to be used when encoding this layer. If not specified, default is zero, which means that encoder will use a single slice for each frame. 10626 Slices *int32 `json:"slices,omitempty"` 10627 // AdaptiveBFrame - Whether or not adaptive B-frames are to be used when encoding this layer. If not specified, the encoder will turn it on whenever the video profile permits its use. 10628 AdaptiveBFrame *bool `json:"adaptiveBFrame,omitempty"` 10629 // Width - The width of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in width as the input. 10630 Width *string `json:"width,omitempty"` 10631 // Height - The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in height as the input. 10632 Height *string `json:"height,omitempty"` 10633 // Label - The alphanumeric label for this layer, which can be used in multiplexing different video and audio layers, or in naming the output file. 10634 Label *string `json:"label,omitempty"` 10635 // OdataType - Possible values include: 'OdataTypeLayer', 'OdataTypeMicrosoftMediaVideoLayer', 'OdataTypeMicrosoftMediaH264Layer', 'OdataTypeMicrosoftMediaJpgLayer', 'OdataTypeMicrosoftMediaPngLayer' 10636 OdataType OdataTypeBasicLayer `json:"@odata.type,omitempty"` 10637} 10638 10639func unmarshalBasicVideoLayer(body []byte) (BasicVideoLayer, error) { 10640 var m map[string]interface{} 10641 err := json.Unmarshal(body, &m) 10642 if err != nil { 10643 return nil, err 10644 } 10645 10646 switch m["@odata.type"] { 10647 case string(OdataTypeMicrosoftMediaH264Layer): 10648 var hl H264Layer 10649 err := json.Unmarshal(body, &hl) 10650 return hl, err 10651 default: 10652 var vl VideoLayer 10653 err := json.Unmarshal(body, &vl) 10654 return vl, err 10655 } 10656} 10657func unmarshalBasicVideoLayerArray(body []byte) ([]BasicVideoLayer, error) { 10658 var rawMessages []*json.RawMessage 10659 err := json.Unmarshal(body, &rawMessages) 10660 if err != nil { 10661 return nil, err 10662 } 10663 10664 vlArray := make([]BasicVideoLayer, len(rawMessages)) 10665 10666 for index, rawMessage := range rawMessages { 10667 vl, err := unmarshalBasicVideoLayer(*rawMessage) 10668 if err != nil { 10669 return nil, err 10670 } 10671 vlArray[index] = vl 10672 } 10673 return vlArray, nil 10674} 10675 10676// MarshalJSON is the custom marshaler for VideoLayer. 10677func (vl VideoLayer) MarshalJSON() ([]byte, error) { 10678 vl.OdataType = OdataTypeMicrosoftMediaVideoLayer 10679 objectMap := make(map[string]interface{}) 10680 if vl.Bitrate != nil { 10681 objectMap["bitrate"] = vl.Bitrate 10682 } 10683 if vl.MaxBitrate != nil { 10684 objectMap["maxBitrate"] = vl.MaxBitrate 10685 } 10686 if vl.BFrames != nil { 10687 objectMap["bFrames"] = vl.BFrames 10688 } 10689 if vl.FrameRate != nil { 10690 objectMap["frameRate"] = vl.FrameRate 10691 } 10692 if vl.Slices != nil { 10693 objectMap["slices"] = vl.Slices 10694 } 10695 if vl.AdaptiveBFrame != nil { 10696 objectMap["adaptiveBFrame"] = vl.AdaptiveBFrame 10697 } 10698 if vl.Width != nil { 10699 objectMap["width"] = vl.Width 10700 } 10701 if vl.Height != nil { 10702 objectMap["height"] = vl.Height 10703 } 10704 if vl.Label != nil { 10705 objectMap["label"] = vl.Label 10706 } 10707 if vl.OdataType != "" { 10708 objectMap["@odata.type"] = vl.OdataType 10709 } 10710 return json.Marshal(objectMap) 10711} 10712 10713// AsVideoLayer is the BasicLayer implementation for VideoLayer. 10714func (vl VideoLayer) AsVideoLayer() (*VideoLayer, bool) { 10715 return &vl, true 10716} 10717 10718// AsBasicVideoLayer is the BasicLayer implementation for VideoLayer. 10719func (vl VideoLayer) AsBasicVideoLayer() (BasicVideoLayer, bool) { 10720 return &vl, true 10721} 10722 10723// AsH264Layer is the BasicLayer implementation for VideoLayer. 10724func (vl VideoLayer) AsH264Layer() (*H264Layer, bool) { 10725 return nil, false 10726} 10727 10728// AsJpgLayer is the BasicLayer implementation for VideoLayer. 10729func (vl VideoLayer) AsJpgLayer() (*JpgLayer, bool) { 10730 return nil, false 10731} 10732 10733// AsPngLayer is the BasicLayer implementation for VideoLayer. 10734func (vl VideoLayer) AsPngLayer() (*PngLayer, bool) { 10735 return nil, false 10736} 10737 10738// AsLayer is the BasicLayer implementation for VideoLayer. 10739func (vl VideoLayer) AsLayer() (*Layer, bool) { 10740 return nil, false 10741} 10742 10743// AsBasicLayer is the BasicLayer implementation for VideoLayer. 10744func (vl VideoLayer) AsBasicLayer() (BasicLayer, bool) { 10745 return &vl, true 10746} 10747 10748// VideoOverlay describes the properties of a video overlay. 10749type VideoOverlay struct { 10750 // Position - The location in the input video where the overlay is applied. 10751 Position *Rectangle `json:"position,omitempty"` 10752 // Opacity - The opacity of the overlay. This is a value in the range [0 - 1.0]. Default is 1.0 which mean the overlay is opaque. 10753 Opacity *float64 `json:"opacity,omitempty"` 10754 // CropRectangle - An optional rectangular window used to crop the overlay image or video. 10755 CropRectangle *Rectangle `json:"cropRectangle,omitempty"` 10756 // InputLabel - The label of the job input which is to be used as an overlay. The Input must specify exactly one file. You can specify an image file in JPG or PNG formats, or an audio file (such as a WAV, MP3, WMA or M4A file), or a video file. See https://aka.ms/mesformats for the complete list of supported audio and video file formats. 10757 InputLabel *string `json:"inputLabel,omitempty"` 10758 // Start - The start position, with reference to the input video, at which the overlay starts. The value should be in ISO 8601 format. For example, PT05S to start the overlay at 5 seconds in to the input video. If not specified the overlay starts from the beginning of the input video. 10759 Start *string `json:"start,omitempty"` 10760 // End - The position in the input video at which the overlay ends. The value should be in ISO 8601 duration format. For example, PT30S to end the overlay at 30 seconds in to the input video. If not specified the overlay will be applied until the end of the input video if inputLoop is true. Else, if inputLoop is false, then overlay will last as long as the duration of the overlay media. 10761 End *string `json:"end,omitempty"` 10762 // FadeInDuration - The duration over which the overlay fades in onto the input video. The value should be in ISO 8601 duration format. If not specified the default behavior is to have no fade in (same as PT0S). 10763 FadeInDuration *string `json:"fadeInDuration,omitempty"` 10764 // FadeOutDuration - The duration over which the overlay fades out of the input video. The value should be in ISO 8601 duration format. If not specified the default behavior is to have no fade out (same as PT0S). 10765 FadeOutDuration *string `json:"fadeOutDuration,omitempty"` 10766 // AudioGainLevel - The gain level of audio in the overlay. The value should be in the range [0, 1.0]. The default is 1.0. 10767 AudioGainLevel *float64 `json:"audioGainLevel,omitempty"` 10768 // OdataType - Possible values include: 'OdataTypeOverlay', 'OdataTypeMicrosoftMediaAudioOverlay', 'OdataTypeMicrosoftMediaVideoOverlay' 10769 OdataType OdataTypeBasicOverlay `json:"@odata.type,omitempty"` 10770} 10771 10772// MarshalJSON is the custom marshaler for VideoOverlay. 10773func (vo VideoOverlay) MarshalJSON() ([]byte, error) { 10774 vo.OdataType = OdataTypeMicrosoftMediaVideoOverlay 10775 objectMap := make(map[string]interface{}) 10776 if vo.Position != nil { 10777 objectMap["position"] = vo.Position 10778 } 10779 if vo.Opacity != nil { 10780 objectMap["opacity"] = vo.Opacity 10781 } 10782 if vo.CropRectangle != nil { 10783 objectMap["cropRectangle"] = vo.CropRectangle 10784 } 10785 if vo.InputLabel != nil { 10786 objectMap["inputLabel"] = vo.InputLabel 10787 } 10788 if vo.Start != nil { 10789 objectMap["start"] = vo.Start 10790 } 10791 if vo.End != nil { 10792 objectMap["end"] = vo.End 10793 } 10794 if vo.FadeInDuration != nil { 10795 objectMap["fadeInDuration"] = vo.FadeInDuration 10796 } 10797 if vo.FadeOutDuration != nil { 10798 objectMap["fadeOutDuration"] = vo.FadeOutDuration 10799 } 10800 if vo.AudioGainLevel != nil { 10801 objectMap["audioGainLevel"] = vo.AudioGainLevel 10802 } 10803 if vo.OdataType != "" { 10804 objectMap["@odata.type"] = vo.OdataType 10805 } 10806 return json.Marshal(objectMap) 10807} 10808 10809// AsAudioOverlay is the BasicOverlay implementation for VideoOverlay. 10810func (vo VideoOverlay) AsAudioOverlay() (*AudioOverlay, bool) { 10811 return nil, false 10812} 10813 10814// AsVideoOverlay is the BasicOverlay implementation for VideoOverlay. 10815func (vo VideoOverlay) AsVideoOverlay() (*VideoOverlay, bool) { 10816 return &vo, true 10817} 10818 10819// AsOverlay is the BasicOverlay implementation for VideoOverlay. 10820func (vo VideoOverlay) AsOverlay() (*Overlay, bool) { 10821 return nil, false 10822} 10823 10824// AsBasicOverlay is the BasicOverlay implementation for VideoOverlay. 10825func (vo VideoOverlay) AsBasicOverlay() (BasicOverlay, bool) { 10826 return &vo, true 10827} 10828