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