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-06-01-preview/media" 23 24// AacAudio describes Advanced Audio Codec (AAC) audio encoding settings. 25type AacAudio struct { 26 // Profile - The encoding profile to be used when encoding audio with AAC. Possible values include: 'AacLc', 'HeAacV1', 'HeAacV2' 27 Profile AacAudioProfile `json:"profile,omitempty"` 28 // Channels - The number of channels in the audio. 29 Channels *int32 `json:"channels,omitempty"` 30 // SamplingRate - The sampling rate to use for encoding in hertz. 31 SamplingRate *int32 `json:"samplingRate,omitempty"` 32 // Bitrate - The bitrate, in bits per second, of the output encoded audio. 33 Bitrate *int32 `json:"bitrate,omitempty"` 34 // Label - An optional label for the codec. The label can be used to control muxing behavior. 35 Label *string `json:"label,omitempty"` 36 // OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage' 37 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"` 38} 39 40// MarshalJSON is the custom marshaler for AacAudio. 41func (aa AacAudio) MarshalJSON() ([]byte, error) { 42 aa.OdataType = OdataTypeMicrosoftMediaAacAudio 43 objectMap := make(map[string]interface{}) 44 if aa.Profile != "" { 45 objectMap["profile"] = aa.Profile 46 } 47 if aa.Channels != nil { 48 objectMap["channels"] = aa.Channels 49 } 50 if aa.SamplingRate != nil { 51 objectMap["samplingRate"] = aa.SamplingRate 52 } 53 if aa.Bitrate != nil { 54 objectMap["bitrate"] = aa.Bitrate 55 } 56 if aa.Label != nil { 57 objectMap["label"] = aa.Label 58 } 59 if aa.OdataType != "" { 60 objectMap["@odata.type"] = aa.OdataType 61 } 62 return json.Marshal(objectMap) 63} 64 65// AsAudio is the BasicCodec implementation for AacAudio. 66func (aa AacAudio) AsAudio() (*Audio, bool) { 67 return nil, false 68} 69 70// AsBasicAudio is the BasicCodec implementation for AacAudio. 71func (aa AacAudio) AsBasicAudio() (BasicAudio, bool) { 72 return &aa, true 73} 74 75// AsAacAudio is the BasicCodec implementation for AacAudio. 76func (aa AacAudio) AsAacAudio() (*AacAudio, bool) { 77 return &aa, true 78} 79 80// AsCopyVideo is the BasicCodec implementation for AacAudio. 81func (aa AacAudio) AsCopyVideo() (*CopyVideo, bool) { 82 return nil, false 83} 84 85// AsVideo is the BasicCodec implementation for AacAudio. 86func (aa AacAudio) AsVideo() (*Video, bool) { 87 return nil, false 88} 89 90// AsBasicVideo is the BasicCodec implementation for AacAudio. 91func (aa AacAudio) AsBasicVideo() (BasicVideo, bool) { 92 return nil, false 93} 94 95// AsImage is the BasicCodec implementation for AacAudio. 96func (aa AacAudio) AsImage() (*Image, bool) { 97 return nil, false 98} 99 100// AsBasicImage is the BasicCodec implementation for AacAudio. 101func (aa AacAudio) AsBasicImage() (BasicImage, bool) { 102 return nil, false 103} 104 105// AsCopyAudio is the BasicCodec implementation for AacAudio. 106func (aa AacAudio) AsCopyAudio() (*CopyAudio, bool) { 107 return nil, false 108} 109 110// AsH264Video is the BasicCodec implementation for AacAudio. 111func (aa AacAudio) AsH264Video() (*H264Video, bool) { 112 return nil, false 113} 114 115// AsJpgImage is the BasicCodec implementation for AacAudio. 116func (aa AacAudio) AsJpgImage() (*JpgImage, bool) { 117 return nil, false 118} 119 120// AsPngImage is the BasicCodec implementation for AacAudio. 121func (aa AacAudio) AsPngImage() (*PngImage, bool) { 122 return nil, false 123} 124 125// AsCodec is the BasicCodec implementation for AacAudio. 126func (aa AacAudio) AsCodec() (*Codec, bool) { 127 return nil, false 128} 129 130// AsBasicCodec is the BasicCodec implementation for AacAudio. 131func (aa AacAudio) AsBasicCodec() (BasicCodec, bool) { 132 return &aa, true 133} 134 135// 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 a 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 // CustomKeyAcquisitionURLTemplate - KeyAcquisitionUrlTemplate is used to point to user specified service to delivery content keys 2943 CustomKeyAcquisitionURLTemplate *string `json:"customKeyAcquisitionUrlTemplate,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 // CorrelationData - Customer provided correlation data that will be returned in Job completed events. 4557 CorrelationData map[string]*string `json:"correlationData"` 4558} 4559 4560// MarshalJSON is the custom marshaler for JobProperties. 4561func (jp JobProperties) MarshalJSON() ([]byte, error) { 4562 objectMap := make(map[string]interface{}) 4563 if jp.Description != nil { 4564 objectMap["description"] = jp.Description 4565 } 4566 objectMap["input"] = jp.Input 4567 if jp.Outputs != nil { 4568 objectMap["outputs"] = jp.Outputs 4569 } 4570 if jp.Priority != "" { 4571 objectMap["priority"] = jp.Priority 4572 } 4573 if jp.CorrelationData != nil { 4574 objectMap["correlationData"] = jp.CorrelationData 4575 } 4576 return json.Marshal(objectMap) 4577} 4578 4579// UnmarshalJSON is the custom unmarshaler for JobProperties struct. 4580func (jp *JobProperties) UnmarshalJSON(body []byte) error { 4581 var m map[string]*json.RawMessage 4582 err := json.Unmarshal(body, &m) 4583 if err != nil { 4584 return err 4585 } 4586 for k, v := range m { 4587 switch k { 4588 case "created": 4589 if v != nil { 4590 var created date.Time 4591 err = json.Unmarshal(*v, &created) 4592 if err != nil { 4593 return err 4594 } 4595 jp.Created = &created 4596 } 4597 case "state": 4598 if v != nil { 4599 var state JobState 4600 err = json.Unmarshal(*v, &state) 4601 if err != nil { 4602 return err 4603 } 4604 jp.State = state 4605 } 4606 case "description": 4607 if v != nil { 4608 var description string 4609 err = json.Unmarshal(*v, &description) 4610 if err != nil { 4611 return err 4612 } 4613 jp.Description = &description 4614 } 4615 case "input": 4616 if v != nil { 4617 input, err := unmarshalBasicJobInput(*v) 4618 if err != nil { 4619 return err 4620 } 4621 jp.Input = input 4622 } 4623 case "lastModified": 4624 if v != nil { 4625 var lastModified date.Time 4626 err = json.Unmarshal(*v, &lastModified) 4627 if err != nil { 4628 return err 4629 } 4630 jp.LastModified = &lastModified 4631 } 4632 case "outputs": 4633 if v != nil { 4634 outputs, err := unmarshalBasicJobOutputArray(*v) 4635 if err != nil { 4636 return err 4637 } 4638 jp.Outputs = &outputs 4639 } 4640 case "priority": 4641 if v != nil { 4642 var priority Priority 4643 err = json.Unmarshal(*v, &priority) 4644 if err != nil { 4645 return err 4646 } 4647 jp.Priority = priority 4648 } 4649 case "correlationData": 4650 if v != nil { 4651 var correlationData map[string]*string 4652 err = json.Unmarshal(*v, &correlationData) 4653 if err != nil { 4654 return err 4655 } 4656 jp.CorrelationData = correlationData 4657 } 4658 } 4659 } 4660 4661 return nil 4662} 4663 4664// JpgFormat describes the settings for producing JPEG thumbnails. 4665type JpgFormat struct { 4666 // 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. 4667 FilenamePattern *string `json:"filenamePattern,omitempty"` 4668 // OdataType - Possible values include: 'OdataTypeFormat', 'OdataTypeMicrosoftMediaImageFormat', 'OdataTypeMicrosoftMediaJpgFormat', 'OdataTypeMicrosoftMediaPngFormat', 'OdataTypeMicrosoftMediaMultiBitrateFormat', 'OdataTypeMicrosoftMediaMp4Format', 'OdataTypeMicrosoftMediaTransportStreamFormat' 4669 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"` 4670} 4671 4672// MarshalJSON is the custom marshaler for JpgFormat. 4673func (jf JpgFormat) MarshalJSON() ([]byte, error) { 4674 jf.OdataType = OdataTypeMicrosoftMediaJpgFormat 4675 objectMap := make(map[string]interface{}) 4676 if jf.FilenamePattern != nil { 4677 objectMap["filenamePattern"] = jf.FilenamePattern 4678 } 4679 if jf.OdataType != "" { 4680 objectMap["@odata.type"] = jf.OdataType 4681 } 4682 return json.Marshal(objectMap) 4683} 4684 4685// AsImageFormat is the BasicFormat implementation for JpgFormat. 4686func (jf JpgFormat) AsImageFormat() (*ImageFormat, bool) { 4687 return nil, false 4688} 4689 4690// AsBasicImageFormat is the BasicFormat implementation for JpgFormat. 4691func (jf JpgFormat) AsBasicImageFormat() (BasicImageFormat, bool) { 4692 return &jf, true 4693} 4694 4695// AsJpgFormat is the BasicFormat implementation for JpgFormat. 4696func (jf JpgFormat) AsJpgFormat() (*JpgFormat, bool) { 4697 return &jf, true 4698} 4699 4700// AsPngFormat is the BasicFormat implementation for JpgFormat. 4701func (jf JpgFormat) AsPngFormat() (*PngFormat, bool) { 4702 return nil, false 4703} 4704 4705// AsMultiBitrateFormat is the BasicFormat implementation for JpgFormat. 4706func (jf JpgFormat) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) { 4707 return nil, false 4708} 4709 4710// AsBasicMultiBitrateFormat is the BasicFormat implementation for JpgFormat. 4711func (jf JpgFormat) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) { 4712 return nil, false 4713} 4714 4715// AsMp4Format is the BasicFormat implementation for JpgFormat. 4716func (jf JpgFormat) AsMp4Format() (*Mp4Format, bool) { 4717 return nil, false 4718} 4719 4720// AsTransportStreamFormat is the BasicFormat implementation for JpgFormat. 4721func (jf JpgFormat) AsTransportStreamFormat() (*TransportStreamFormat, bool) { 4722 return nil, false 4723} 4724 4725// AsFormat is the BasicFormat implementation for JpgFormat. 4726func (jf JpgFormat) AsFormat() (*Format, bool) { 4727 return nil, false 4728} 4729 4730// AsBasicFormat is the BasicFormat implementation for JpgFormat. 4731func (jf JpgFormat) AsBasicFormat() (BasicFormat, bool) { 4732 return &jf, true 4733} 4734 4735// JpgImage describes the properties for producing a series of JPEG images from the input video. 4736type JpgImage struct { 4737 // Layers - A collection of output JPEG image layers to be produced by the encoder. 4738 Layers *[]JpgLayer `json:"layers,omitempty"` 4739 // 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. 4740 Start *string `json:"start,omitempty"` 4741 // 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%). 4742 Step *string `json:"step,omitempty"` 4743 // 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%). 4744 Range *string `json:"range,omitempty"` 4745 // 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). 4746 KeyFrameInterval *string `json:"keyFrameInterval,omitempty"` 4747 // 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' 4748 StretchMode StretchMode `json:"stretchMode,omitempty"` 4749 // Label - An optional label for the codec. The label can be used to control muxing behavior. 4750 Label *string `json:"label,omitempty"` 4751 // OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage' 4752 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"` 4753} 4754 4755// MarshalJSON is the custom marshaler for JpgImage. 4756func (ji JpgImage) MarshalJSON() ([]byte, error) { 4757 ji.OdataType = OdataTypeMicrosoftMediaJpgImage 4758 objectMap := make(map[string]interface{}) 4759 if ji.Layers != nil { 4760 objectMap["layers"] = ji.Layers 4761 } 4762 if ji.Start != nil { 4763 objectMap["start"] = ji.Start 4764 } 4765 if ji.Step != nil { 4766 objectMap["step"] = ji.Step 4767 } 4768 if ji.Range != nil { 4769 objectMap["range"] = ji.Range 4770 } 4771 if ji.KeyFrameInterval != nil { 4772 objectMap["keyFrameInterval"] = ji.KeyFrameInterval 4773 } 4774 if ji.StretchMode != "" { 4775 objectMap["stretchMode"] = ji.StretchMode 4776 } 4777 if ji.Label != nil { 4778 objectMap["label"] = ji.Label 4779 } 4780 if ji.OdataType != "" { 4781 objectMap["@odata.type"] = ji.OdataType 4782 } 4783 return json.Marshal(objectMap) 4784} 4785 4786// AsAudio is the BasicCodec implementation for JpgImage. 4787func (ji JpgImage) AsAudio() (*Audio, bool) { 4788 return nil, false 4789} 4790 4791// AsBasicAudio is the BasicCodec implementation for JpgImage. 4792func (ji JpgImage) AsBasicAudio() (BasicAudio, bool) { 4793 return nil, false 4794} 4795 4796// AsAacAudio is the BasicCodec implementation for JpgImage. 4797func (ji JpgImage) AsAacAudio() (*AacAudio, bool) { 4798 return nil, false 4799} 4800 4801// AsCopyVideo is the BasicCodec implementation for JpgImage. 4802func (ji JpgImage) AsCopyVideo() (*CopyVideo, bool) { 4803 return nil, false 4804} 4805 4806// AsVideo is the BasicCodec implementation for JpgImage. 4807func (ji JpgImage) AsVideo() (*Video, bool) { 4808 return nil, false 4809} 4810 4811// AsBasicVideo is the BasicCodec implementation for JpgImage. 4812func (ji JpgImage) AsBasicVideo() (BasicVideo, bool) { 4813 return &ji, true 4814} 4815 4816// AsImage is the BasicCodec implementation for JpgImage. 4817func (ji JpgImage) AsImage() (*Image, bool) { 4818 return nil, false 4819} 4820 4821// AsBasicImage is the BasicCodec implementation for JpgImage. 4822func (ji JpgImage) AsBasicImage() (BasicImage, bool) { 4823 return &ji, true 4824} 4825 4826// AsCopyAudio is the BasicCodec implementation for JpgImage. 4827func (ji JpgImage) AsCopyAudio() (*CopyAudio, bool) { 4828 return nil, false 4829} 4830 4831// AsH264Video is the BasicCodec implementation for JpgImage. 4832func (ji JpgImage) AsH264Video() (*H264Video, bool) { 4833 return nil, false 4834} 4835 4836// AsJpgImage is the BasicCodec implementation for JpgImage. 4837func (ji JpgImage) AsJpgImage() (*JpgImage, bool) { 4838 return &ji, true 4839} 4840 4841// AsPngImage is the BasicCodec implementation for JpgImage. 4842func (ji JpgImage) AsPngImage() (*PngImage, bool) { 4843 return nil, false 4844} 4845 4846// AsCodec is the BasicCodec implementation for JpgImage. 4847func (ji JpgImage) AsCodec() (*Codec, bool) { 4848 return nil, false 4849} 4850 4851// AsBasicCodec is the BasicCodec implementation for JpgImage. 4852func (ji JpgImage) AsBasicCodec() (BasicCodec, bool) { 4853 return &ji, true 4854} 4855 4856// JpgLayer describes the settings to produce a JPEG image from the input video. 4857type JpgLayer struct { 4858 // Quality - The compression quality of the JPEG output. Range is from 0-100 and the default is 70. 4859 Quality *int32 `json:"quality,omitempty"` 4860 // 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. 4861 Width *string `json:"width,omitempty"` 4862 // 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. 4863 Height *string `json:"height,omitempty"` 4864 // Label - The alphanumeric label for this layer, which can be used in multiplexing different video and audio layers, or in naming the output file. 4865 Label *string `json:"label,omitempty"` 4866 // OdataType - Possible values include: 'OdataTypeLayer', 'OdataTypeMicrosoftMediaVideoLayer', 'OdataTypeMicrosoftMediaH264Layer', 'OdataTypeMicrosoftMediaJpgLayer', 'OdataTypeMicrosoftMediaPngLayer' 4867 OdataType OdataTypeBasicLayer `json:"@odata.type,omitempty"` 4868} 4869 4870// MarshalJSON is the custom marshaler for JpgLayer. 4871func (jl JpgLayer) MarshalJSON() ([]byte, error) { 4872 jl.OdataType = OdataTypeMicrosoftMediaJpgLayer 4873 objectMap := make(map[string]interface{}) 4874 if jl.Quality != nil { 4875 objectMap["quality"] = jl.Quality 4876 } 4877 if jl.Width != nil { 4878 objectMap["width"] = jl.Width 4879 } 4880 if jl.Height != nil { 4881 objectMap["height"] = jl.Height 4882 } 4883 if jl.Label != nil { 4884 objectMap["label"] = jl.Label 4885 } 4886 if jl.OdataType != "" { 4887 objectMap["@odata.type"] = jl.OdataType 4888 } 4889 return json.Marshal(objectMap) 4890} 4891 4892// AsVideoLayer is the BasicLayer implementation for JpgLayer. 4893func (jl JpgLayer) AsVideoLayer() (*VideoLayer, bool) { 4894 return nil, false 4895} 4896 4897// AsBasicVideoLayer is the BasicLayer implementation for JpgLayer. 4898func (jl JpgLayer) AsBasicVideoLayer() (BasicVideoLayer, bool) { 4899 return nil, false 4900} 4901 4902// AsH264Layer is the BasicLayer implementation for JpgLayer. 4903func (jl JpgLayer) AsH264Layer() (*H264Layer, bool) { 4904 return nil, false 4905} 4906 4907// AsJpgLayer is the BasicLayer implementation for JpgLayer. 4908func (jl JpgLayer) AsJpgLayer() (*JpgLayer, bool) { 4909 return &jl, true 4910} 4911 4912// AsPngLayer is the BasicLayer implementation for JpgLayer. 4913func (jl JpgLayer) AsPngLayer() (*PngLayer, bool) { 4914 return nil, false 4915} 4916 4917// AsLayer is the BasicLayer implementation for JpgLayer. 4918func (jl JpgLayer) AsLayer() (*Layer, bool) { 4919 return nil, false 4920} 4921 4922// AsBasicLayer is the BasicLayer implementation for JpgLayer. 4923func (jl JpgLayer) AsBasicLayer() (BasicLayer, bool) { 4924 return &jl, true 4925} 4926 4927// BasicLayer the encoder can be configured to produce video and/or images (thumbnails) at different resolutions, by 4928// specifying a layer for each desired resolution. A layer represents the properties for the video or image at a 4929// resolution. 4930type BasicLayer interface { 4931 AsVideoLayer() (*VideoLayer, bool) 4932 AsBasicVideoLayer() (BasicVideoLayer, bool) 4933 AsH264Layer() (*H264Layer, bool) 4934 AsJpgLayer() (*JpgLayer, bool) 4935 AsPngLayer() (*PngLayer, bool) 4936 AsLayer() (*Layer, bool) 4937} 4938 4939// Layer the encoder can be configured to produce video and/or images (thumbnails) at different resolutions, by 4940// specifying a layer for each desired resolution. A layer represents the properties for the video or image at 4941// a resolution. 4942type Layer struct { 4943 // 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. 4944 Width *string `json:"width,omitempty"` 4945 // 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. 4946 Height *string `json:"height,omitempty"` 4947 // Label - The alphanumeric label for this layer, which can be used in multiplexing different video and audio layers, or in naming the output file. 4948 Label *string `json:"label,omitempty"` 4949 // OdataType - Possible values include: 'OdataTypeLayer', 'OdataTypeMicrosoftMediaVideoLayer', 'OdataTypeMicrosoftMediaH264Layer', 'OdataTypeMicrosoftMediaJpgLayer', 'OdataTypeMicrosoftMediaPngLayer' 4950 OdataType OdataTypeBasicLayer `json:"@odata.type,omitempty"` 4951} 4952 4953func unmarshalBasicLayer(body []byte) (BasicLayer, error) { 4954 var m map[string]interface{} 4955 err := json.Unmarshal(body, &m) 4956 if err != nil { 4957 return nil, err 4958 } 4959 4960 switch m["@odata.type"] { 4961 case string(OdataTypeMicrosoftMediaVideoLayer): 4962 var vl VideoLayer 4963 err := json.Unmarshal(body, &vl) 4964 return vl, err 4965 case string(OdataTypeMicrosoftMediaH264Layer): 4966 var hl H264Layer 4967 err := json.Unmarshal(body, &hl) 4968 return hl, err 4969 case string(OdataTypeMicrosoftMediaJpgLayer): 4970 var jl JpgLayer 4971 err := json.Unmarshal(body, &jl) 4972 return jl, err 4973 case string(OdataTypeMicrosoftMediaPngLayer): 4974 var pl PngLayer 4975 err := json.Unmarshal(body, &pl) 4976 return pl, err 4977 default: 4978 var l Layer 4979 err := json.Unmarshal(body, &l) 4980 return l, err 4981 } 4982} 4983func unmarshalBasicLayerArray(body []byte) ([]BasicLayer, error) { 4984 var rawMessages []*json.RawMessage 4985 err := json.Unmarshal(body, &rawMessages) 4986 if err != nil { 4987 return nil, err 4988 } 4989 4990 lArray := make([]BasicLayer, len(rawMessages)) 4991 4992 for index, rawMessage := range rawMessages { 4993 l, err := unmarshalBasicLayer(*rawMessage) 4994 if err != nil { 4995 return nil, err 4996 } 4997 lArray[index] = l 4998 } 4999 return lArray, nil 5000} 5001 5002// MarshalJSON is the custom marshaler for Layer. 5003func (l Layer) MarshalJSON() ([]byte, error) { 5004 l.OdataType = OdataTypeLayer 5005 objectMap := make(map[string]interface{}) 5006 if l.Width != nil { 5007 objectMap["width"] = l.Width 5008 } 5009 if l.Height != nil { 5010 objectMap["height"] = l.Height 5011 } 5012 if l.Label != nil { 5013 objectMap["label"] = l.Label 5014 } 5015 if l.OdataType != "" { 5016 objectMap["@odata.type"] = l.OdataType 5017 } 5018 return json.Marshal(objectMap) 5019} 5020 5021// AsVideoLayer is the BasicLayer implementation for Layer. 5022func (l Layer) AsVideoLayer() (*VideoLayer, bool) { 5023 return nil, false 5024} 5025 5026// AsBasicVideoLayer is the BasicLayer implementation for Layer. 5027func (l Layer) AsBasicVideoLayer() (BasicVideoLayer, bool) { 5028 return nil, false 5029} 5030 5031// AsH264Layer is the BasicLayer implementation for Layer. 5032func (l Layer) AsH264Layer() (*H264Layer, bool) { 5033 return nil, false 5034} 5035 5036// AsJpgLayer is the BasicLayer implementation for Layer. 5037func (l Layer) AsJpgLayer() (*JpgLayer, bool) { 5038 return nil, false 5039} 5040 5041// AsPngLayer is the BasicLayer implementation for Layer. 5042func (l Layer) AsPngLayer() (*PngLayer, bool) { 5043 return nil, false 5044} 5045 5046// AsLayer is the BasicLayer implementation for Layer. 5047func (l Layer) AsLayer() (*Layer, bool) { 5048 return &l, true 5049} 5050 5051// AsBasicLayer is the BasicLayer implementation for Layer. 5052func (l Layer) AsBasicLayer() (BasicLayer, bool) { 5053 return &l, true 5054} 5055 5056// ListContainerSasInput the parameters to the list SAS request. 5057type ListContainerSasInput struct { 5058 // Permissions - The permissions to set on the SAS URL. Possible values include: 'Read', 'ReadWrite', 'ReadWriteDelete' 5059 Permissions AssetContainerPermission `json:"permissions,omitempty"` 5060 // ExpiryTime - The SAS URL expiration time. This must be less than 24 hours from the current time. 5061 ExpiryTime *date.Time `json:"expiryTime,omitempty"` 5062} 5063 5064// ListContentKeysResponse class of response for listContentKeys action 5065type ListContentKeysResponse struct { 5066 autorest.Response `json:"-"` 5067 // ContentKeys - ContentKeys used by current Streaming Locator 5068 ContentKeys *[]StreamingLocatorContentKey `json:"contentKeys,omitempty"` 5069} 5070 5071// ListPathsResponse class of response for listPaths action 5072type ListPathsResponse struct { 5073 autorest.Response `json:"-"` 5074 // StreamingPaths - Streaming Paths supported by current Streaming Locator 5075 StreamingPaths *[]StreamingPath `json:"streamingPaths,omitempty"` 5076 // DownloadPaths - Download Paths supported by current Streaming Locator 5077 DownloadPaths *[]string `json:"downloadPaths,omitempty"` 5078} 5079 5080// LiveEvent the Live Event. 5081type LiveEvent struct { 5082 autorest.Response `json:"-"` 5083 // LiveEventProperties - The Live Event properties. 5084 *LiveEventProperties `json:"properties,omitempty"` 5085 // Tags - Resource tags. 5086 Tags map[string]*string `json:"tags"` 5087 // Location - The Azure Region of the resource. 5088 Location *string `json:"location,omitempty"` 5089 // ID - READ-ONLY; Fully qualified resource ID for the resource. 5090 ID *string `json:"id,omitempty"` 5091 // Name - READ-ONLY; The name of the resource. 5092 Name *string `json:"name,omitempty"` 5093 // Type - READ-ONLY; The type of the resource. 5094 Type *string `json:"type,omitempty"` 5095} 5096 5097// MarshalJSON is the custom marshaler for LiveEvent. 5098func (le LiveEvent) MarshalJSON() ([]byte, error) { 5099 objectMap := make(map[string]interface{}) 5100 if le.LiveEventProperties != nil { 5101 objectMap["properties"] = le.LiveEventProperties 5102 } 5103 if le.Tags != nil { 5104 objectMap["tags"] = le.Tags 5105 } 5106 if le.Location != nil { 5107 objectMap["location"] = le.Location 5108 } 5109 return json.Marshal(objectMap) 5110} 5111 5112// UnmarshalJSON is the custom unmarshaler for LiveEvent struct. 5113func (le *LiveEvent) UnmarshalJSON(body []byte) error { 5114 var m map[string]*json.RawMessage 5115 err := json.Unmarshal(body, &m) 5116 if err != nil { 5117 return err 5118 } 5119 for k, v := range m { 5120 switch k { 5121 case "properties": 5122 if v != nil { 5123 var liveEventProperties LiveEventProperties 5124 err = json.Unmarshal(*v, &liveEventProperties) 5125 if err != nil { 5126 return err 5127 } 5128 le.LiveEventProperties = &liveEventProperties 5129 } 5130 case "tags": 5131 if v != nil { 5132 var tags map[string]*string 5133 err = json.Unmarshal(*v, &tags) 5134 if err != nil { 5135 return err 5136 } 5137 le.Tags = tags 5138 } 5139 case "location": 5140 if v != nil { 5141 var location string 5142 err = json.Unmarshal(*v, &location) 5143 if err != nil { 5144 return err 5145 } 5146 le.Location = &location 5147 } 5148 case "id": 5149 if v != nil { 5150 var ID string 5151 err = json.Unmarshal(*v, &ID) 5152 if err != nil { 5153 return err 5154 } 5155 le.ID = &ID 5156 } 5157 case "name": 5158 if v != nil { 5159 var name string 5160 err = json.Unmarshal(*v, &name) 5161 if err != nil { 5162 return err 5163 } 5164 le.Name = &name 5165 } 5166 case "type": 5167 if v != nil { 5168 var typeVar string 5169 err = json.Unmarshal(*v, &typeVar) 5170 if err != nil { 5171 return err 5172 } 5173 le.Type = &typeVar 5174 } 5175 } 5176 } 5177 5178 return nil 5179} 5180 5181// LiveEventActionInput the LiveEvent action input parameter definition. 5182type LiveEventActionInput struct { 5183 // RemoveOutputsOnStop - The flag indicates if remove LiveOutputs on Stop. 5184 RemoveOutputsOnStop *bool `json:"removeOutputsOnStop,omitempty"` 5185} 5186 5187// LiveEventEncoding the Live Event encoding. 5188type LiveEventEncoding struct { 5189 // EncodingType - The encoding type for Live Event. Possible values include: 'LiveEventEncodingTypeNone', 'LiveEventEncodingTypeBasic' 5190 EncodingType LiveEventEncodingType `json:"encodingType,omitempty"` 5191 // PresetName - The encoding preset name. 5192 PresetName *string `json:"presetName,omitempty"` 5193} 5194 5195// LiveEventEndpoint the Live Event endpoint. 5196type LiveEventEndpoint struct { 5197 // Protocol - The endpoint protocol. 5198 Protocol *string `json:"protocol,omitempty"` 5199 // URL - The endpoint URL. 5200 URL *string `json:"url,omitempty"` 5201} 5202 5203// LiveEventInput the Live Event input. 5204type LiveEventInput struct { 5205 // StreamingProtocol - The streaming protocol for the Live Event. Possible values include: 'FragmentedMP4', 'RTMP' 5206 StreamingProtocol LiveEventInputProtocol `json:"streamingProtocol,omitempty"` 5207 // KeyFrameIntervalDuration - ISO 8601 timespan duration of the key frame interval duration. 5208 KeyFrameIntervalDuration *string `json:"keyFrameIntervalDuration,omitempty"` 5209 // AccessToken - The access token. 5210 AccessToken *string `json:"accessToken,omitempty"` 5211 // Endpoints - The input endpoints for the Live Event. 5212 Endpoints *[]LiveEventEndpoint `json:"endpoints,omitempty"` 5213} 5214 5215// LiveEventListResult the LiveEvent list result. 5216type LiveEventListResult struct { 5217 autorest.Response `json:"-"` 5218 // Value - The result of the List Live Event operation. 5219 Value *[]LiveEvent `json:"value,omitempty"` 5220 // OdataCount - The number of result. 5221 OdataCount *int32 `json:"@odata.count,omitempty"` 5222 // OdataNextLink - Th link to the next set of results. Not empty if value contains incomplete list of Live Outputs. 5223 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 5224} 5225 5226// LiveEventListResultIterator provides access to a complete listing of LiveEvent values. 5227type LiveEventListResultIterator struct { 5228 i int 5229 page LiveEventListResultPage 5230} 5231 5232// NextWithContext advances to the next value. If there was an error making 5233// the request the iterator does not advance and the error is returned. 5234func (iter *LiveEventListResultIterator) NextWithContext(ctx context.Context) (err error) { 5235 if tracing.IsEnabled() { 5236 ctx = tracing.StartSpan(ctx, fqdn+"/LiveEventListResultIterator.NextWithContext") 5237 defer func() { 5238 sc := -1 5239 if iter.Response().Response.Response != nil { 5240 sc = iter.Response().Response.Response.StatusCode 5241 } 5242 tracing.EndSpan(ctx, sc, err) 5243 }() 5244 } 5245 iter.i++ 5246 if iter.i < len(iter.page.Values()) { 5247 return nil 5248 } 5249 err = iter.page.NextWithContext(ctx) 5250 if err != nil { 5251 iter.i-- 5252 return err 5253 } 5254 iter.i = 0 5255 return nil 5256} 5257 5258// Next advances to the next value. If there was an error making 5259// the request the iterator does not advance and the error is returned. 5260// Deprecated: Use NextWithContext() instead. 5261func (iter *LiveEventListResultIterator) Next() error { 5262 return iter.NextWithContext(context.Background()) 5263} 5264 5265// NotDone returns true if the enumeration should be started or is not yet complete. 5266func (iter LiveEventListResultIterator) NotDone() bool { 5267 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 5268} 5269 5270// Response returns the raw server response from the last page request. 5271func (iter LiveEventListResultIterator) Response() LiveEventListResult { 5272 return iter.page.Response() 5273} 5274 5275// Value returns the current value or a zero-initialized value if the 5276// iterator has advanced beyond the end of the collection. 5277func (iter LiveEventListResultIterator) Value() LiveEvent { 5278 if !iter.page.NotDone() { 5279 return LiveEvent{} 5280 } 5281 return iter.page.Values()[iter.i] 5282} 5283 5284// Creates a new instance of the LiveEventListResultIterator type. 5285func NewLiveEventListResultIterator(page LiveEventListResultPage) LiveEventListResultIterator { 5286 return LiveEventListResultIterator{page: page} 5287} 5288 5289// IsEmpty returns true if the ListResult contains no values. 5290func (lelr LiveEventListResult) IsEmpty() bool { 5291 return lelr.Value == nil || len(*lelr.Value) == 0 5292} 5293 5294// hasNextLink returns true if the NextLink is not empty. 5295func (lelr LiveEventListResult) hasNextLink() bool { 5296 return lelr.OdataNextLink != nil && len(*lelr.OdataNextLink) != 0 5297} 5298 5299// liveEventListResultPreparer prepares a request to retrieve the next set of results. 5300// It returns nil if no more results exist. 5301func (lelr LiveEventListResult) liveEventListResultPreparer(ctx context.Context) (*http.Request, error) { 5302 if !lelr.hasNextLink() { 5303 return nil, nil 5304 } 5305 return autorest.Prepare((&http.Request{}).WithContext(ctx), 5306 autorest.AsJSON(), 5307 autorest.AsGet(), 5308 autorest.WithBaseURL(to.String(lelr.OdataNextLink))) 5309} 5310 5311// LiveEventListResultPage contains a page of LiveEvent values. 5312type LiveEventListResultPage struct { 5313 fn func(context.Context, LiveEventListResult) (LiveEventListResult, error) 5314 lelr LiveEventListResult 5315} 5316 5317// NextWithContext advances to the next page of values. If there was an error making 5318// the request the page does not advance and the error is returned. 5319func (page *LiveEventListResultPage) NextWithContext(ctx context.Context) (err error) { 5320 if tracing.IsEnabled() { 5321 ctx = tracing.StartSpan(ctx, fqdn+"/LiveEventListResultPage.NextWithContext") 5322 defer func() { 5323 sc := -1 5324 if page.Response().Response.Response != nil { 5325 sc = page.Response().Response.Response.StatusCode 5326 } 5327 tracing.EndSpan(ctx, sc, err) 5328 }() 5329 } 5330 for { 5331 next, err := page.fn(ctx, page.lelr) 5332 if err != nil { 5333 return err 5334 } 5335 page.lelr = next 5336 if !next.hasNextLink() || !next.IsEmpty() { 5337 break 5338 } 5339 } 5340 return nil 5341} 5342 5343// Next advances to the next page of values. If there was an error making 5344// the request the page does not advance and the error is returned. 5345// Deprecated: Use NextWithContext() instead. 5346func (page *LiveEventListResultPage) Next() error { 5347 return page.NextWithContext(context.Background()) 5348} 5349 5350// NotDone returns true if the page enumeration should be started or is not yet complete. 5351func (page LiveEventListResultPage) NotDone() bool { 5352 return !page.lelr.IsEmpty() 5353} 5354 5355// Response returns the raw server response from the last page request. 5356func (page LiveEventListResultPage) Response() LiveEventListResult { 5357 return page.lelr 5358} 5359 5360// Values returns the slice of values for the current page or nil if there are no values. 5361func (page LiveEventListResultPage) Values() []LiveEvent { 5362 if page.lelr.IsEmpty() { 5363 return nil 5364 } 5365 return *page.lelr.Value 5366} 5367 5368// Creates a new instance of the LiveEventListResultPage type. 5369func NewLiveEventListResultPage(cur LiveEventListResult, getNextPage func(context.Context, LiveEventListResult) (LiveEventListResult, error)) LiveEventListResultPage { 5370 return LiveEventListResultPage{ 5371 fn: getNextPage, 5372 lelr: cur, 5373 } 5374} 5375 5376// LiveEventPreview the Live Event preview. 5377type LiveEventPreview struct { 5378 // Endpoints - The endpoints for preview. 5379 Endpoints *[]LiveEventEndpoint `json:"endpoints,omitempty"` 5380 // AccessControl - The access control for LiveEvent preview. 5381 AccessControl *LiveEventPreviewAccessControl `json:"accessControl,omitempty"` 5382 // PreviewLocator - The preview locator Guid. 5383 PreviewLocator *string `json:"previewLocator,omitempty"` 5384 // StreamingPolicyName - The name of streaming policy used for LiveEvent preview 5385 StreamingPolicyName *string `json:"streamingPolicyName,omitempty"` 5386 // AlternativeMediaID - An Alternative Media Identifier associated with the preview url. This identifier can be used to distinguish the preview of different live events for authorization purposes in the CustomLicenseAcquisitionUrlTemplate or the CustomKeyAcquisitionUrlTemplate of the StreamingPolicy specified in the StreamingPolicyName field. 5387 AlternativeMediaID *string `json:"alternativeMediaId,omitempty"` 5388} 5389 5390// LiveEventPreviewAccessControl the IP access control for Live Event preview. 5391type LiveEventPreviewAccessControl struct { 5392 // IP - The IP access control properties. 5393 IP *IPAccessControl `json:"ip,omitempty"` 5394} 5395 5396// LiveEventProperties the Live Event properties. 5397type LiveEventProperties struct { 5398 // Description - The Live Event description. 5399 Description *string `json:"description,omitempty"` 5400 // Input - The Live Event input. 5401 Input *LiveEventInput `json:"input,omitempty"` 5402 // Preview - The Live Event preview. 5403 Preview *LiveEventPreview `json:"preview,omitempty"` 5404 // Encoding - The Live Event encoding. 5405 Encoding *LiveEventEncoding `json:"encoding,omitempty"` 5406 // ProvisioningState - READ-ONLY; The provisioning state of the Live Event. 5407 ProvisioningState *string `json:"provisioningState,omitempty"` 5408 // ResourceState - READ-ONLY; The resource state of the Live Event. Possible values include: 'Stopped', 'Starting', 'Running', 'Stopping', 'Deleting' 5409 ResourceState LiveEventResourceState `json:"resourceState,omitempty"` 5410 // CrossSiteAccessPolicies - The Live Event access policies. 5411 CrossSiteAccessPolicies *CrossSiteAccessPolicies `json:"crossSiteAccessPolicies,omitempty"` 5412 // VanityURL - The Live Event vanity URL flag. 5413 VanityURL *bool `json:"vanityUrl,omitempty"` 5414 // StreamOptions - The stream options. 5415 StreamOptions *[]StreamOptionsFlag `json:"streamOptions,omitempty"` 5416 // Created - READ-ONLY; The exact time the Live Event was created. 5417 Created *date.Time `json:"created,omitempty"` 5418 // LastModified - READ-ONLY; The exact time the Live Event was last modified. 5419 LastModified *date.Time `json:"lastModified,omitempty"` 5420} 5421 5422// MarshalJSON is the custom marshaler for LiveEventProperties. 5423func (lep LiveEventProperties) MarshalJSON() ([]byte, error) { 5424 objectMap := make(map[string]interface{}) 5425 if lep.Description != nil { 5426 objectMap["description"] = lep.Description 5427 } 5428 if lep.Input != nil { 5429 objectMap["input"] = lep.Input 5430 } 5431 if lep.Preview != nil { 5432 objectMap["preview"] = lep.Preview 5433 } 5434 if lep.Encoding != nil { 5435 objectMap["encoding"] = lep.Encoding 5436 } 5437 if lep.CrossSiteAccessPolicies != nil { 5438 objectMap["crossSiteAccessPolicies"] = lep.CrossSiteAccessPolicies 5439 } 5440 if lep.VanityURL != nil { 5441 objectMap["vanityUrl"] = lep.VanityURL 5442 } 5443 if lep.StreamOptions != nil { 5444 objectMap["streamOptions"] = lep.StreamOptions 5445 } 5446 return json.Marshal(objectMap) 5447} 5448 5449// LiveEventsCreateFuture an abstraction for monitoring and retrieving the results of a long-running 5450// operation. 5451type LiveEventsCreateFuture struct { 5452 azure.FutureAPI 5453 // Result returns the result of the asynchronous operation. 5454 // If the operation has not completed it will return an error. 5455 Result func(LiveEventsClient) (LiveEvent, error) 5456} 5457 5458// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5459func (future *LiveEventsCreateFuture) UnmarshalJSON(body []byte) error { 5460 var azFuture azure.Future 5461 if err := json.Unmarshal(body, &azFuture); err != nil { 5462 return err 5463 } 5464 future.FutureAPI = &azFuture 5465 future.Result = future.result 5466 return nil 5467} 5468 5469// result is the default implementation for LiveEventsCreateFuture.Result. 5470func (future *LiveEventsCreateFuture) result(client LiveEventsClient) (le LiveEvent, err error) { 5471 var done bool 5472 done, err = future.DoneWithContext(context.Background(), client) 5473 if err != nil { 5474 err = autorest.NewErrorWithError(err, "media.LiveEventsCreateFuture", "Result", future.Response(), "Polling failure") 5475 return 5476 } 5477 if !done { 5478 le.Response.Response = future.Response() 5479 err = azure.NewAsyncOpIncompleteError("media.LiveEventsCreateFuture") 5480 return 5481 } 5482 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5483 if le.Response.Response, err = future.GetResult(sender); err == nil && le.Response.Response.StatusCode != http.StatusNoContent { 5484 le, err = client.CreateResponder(le.Response.Response) 5485 if err != nil { 5486 err = autorest.NewErrorWithError(err, "media.LiveEventsCreateFuture", "Result", le.Response.Response, "Failure responding to request") 5487 } 5488 } 5489 return 5490} 5491 5492// LiveEventsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 5493// operation. 5494type LiveEventsDeleteFuture struct { 5495 azure.FutureAPI 5496 // Result returns the result of the asynchronous operation. 5497 // If the operation has not completed it will return an error. 5498 Result func(LiveEventsClient) (autorest.Response, error) 5499} 5500 5501// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5502func (future *LiveEventsDeleteFuture) UnmarshalJSON(body []byte) error { 5503 var azFuture azure.Future 5504 if err := json.Unmarshal(body, &azFuture); err != nil { 5505 return err 5506 } 5507 future.FutureAPI = &azFuture 5508 future.Result = future.result 5509 return nil 5510} 5511 5512// result is the default implementation for LiveEventsDeleteFuture.Result. 5513func (future *LiveEventsDeleteFuture) result(client LiveEventsClient) (ar autorest.Response, err error) { 5514 var done bool 5515 done, err = future.DoneWithContext(context.Background(), client) 5516 if err != nil { 5517 err = autorest.NewErrorWithError(err, "media.LiveEventsDeleteFuture", "Result", future.Response(), "Polling failure") 5518 return 5519 } 5520 if !done { 5521 ar.Response = future.Response() 5522 err = azure.NewAsyncOpIncompleteError("media.LiveEventsDeleteFuture") 5523 return 5524 } 5525 ar.Response = future.Response() 5526 return 5527} 5528 5529// LiveEventsResetFuture an abstraction for monitoring and retrieving the results of a long-running 5530// operation. 5531type LiveEventsResetFuture struct { 5532 azure.FutureAPI 5533 // Result returns the result of the asynchronous operation. 5534 // If the operation has not completed it will return an error. 5535 Result func(LiveEventsClient) (autorest.Response, error) 5536} 5537 5538// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5539func (future *LiveEventsResetFuture) UnmarshalJSON(body []byte) error { 5540 var azFuture azure.Future 5541 if err := json.Unmarshal(body, &azFuture); err != nil { 5542 return err 5543 } 5544 future.FutureAPI = &azFuture 5545 future.Result = future.result 5546 return nil 5547} 5548 5549// result is the default implementation for LiveEventsResetFuture.Result. 5550func (future *LiveEventsResetFuture) result(client LiveEventsClient) (ar autorest.Response, err error) { 5551 var done bool 5552 done, err = future.DoneWithContext(context.Background(), client) 5553 if err != nil { 5554 err = autorest.NewErrorWithError(err, "media.LiveEventsResetFuture", "Result", future.Response(), "Polling failure") 5555 return 5556 } 5557 if !done { 5558 ar.Response = future.Response() 5559 err = azure.NewAsyncOpIncompleteError("media.LiveEventsResetFuture") 5560 return 5561 } 5562 ar.Response = future.Response() 5563 return 5564} 5565 5566// LiveEventsStartFuture an abstraction for monitoring and retrieving the results of a long-running 5567// operation. 5568type LiveEventsStartFuture struct { 5569 azure.FutureAPI 5570 // Result returns the result of the asynchronous operation. 5571 // If the operation has not completed it will return an error. 5572 Result func(LiveEventsClient) (autorest.Response, error) 5573} 5574 5575// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5576func (future *LiveEventsStartFuture) UnmarshalJSON(body []byte) error { 5577 var azFuture azure.Future 5578 if err := json.Unmarshal(body, &azFuture); err != nil { 5579 return err 5580 } 5581 future.FutureAPI = &azFuture 5582 future.Result = future.result 5583 return nil 5584} 5585 5586// result is the default implementation for LiveEventsStartFuture.Result. 5587func (future *LiveEventsStartFuture) result(client LiveEventsClient) (ar autorest.Response, err error) { 5588 var done bool 5589 done, err = future.DoneWithContext(context.Background(), client) 5590 if err != nil { 5591 err = autorest.NewErrorWithError(err, "media.LiveEventsStartFuture", "Result", future.Response(), "Polling failure") 5592 return 5593 } 5594 if !done { 5595 ar.Response = future.Response() 5596 err = azure.NewAsyncOpIncompleteError("media.LiveEventsStartFuture") 5597 return 5598 } 5599 ar.Response = future.Response() 5600 return 5601} 5602 5603// LiveEventsStopFuture an abstraction for monitoring and retrieving the results of a long-running 5604// operation. 5605type LiveEventsStopFuture struct { 5606 azure.FutureAPI 5607 // Result returns the result of the asynchronous operation. 5608 // If the operation has not completed it will return an error. 5609 Result func(LiveEventsClient) (autorest.Response, error) 5610} 5611 5612// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5613func (future *LiveEventsStopFuture) UnmarshalJSON(body []byte) error { 5614 var azFuture azure.Future 5615 if err := json.Unmarshal(body, &azFuture); err != nil { 5616 return err 5617 } 5618 future.FutureAPI = &azFuture 5619 future.Result = future.result 5620 return nil 5621} 5622 5623// result is the default implementation for LiveEventsStopFuture.Result. 5624func (future *LiveEventsStopFuture) result(client LiveEventsClient) (ar autorest.Response, err error) { 5625 var done bool 5626 done, err = future.DoneWithContext(context.Background(), client) 5627 if err != nil { 5628 err = autorest.NewErrorWithError(err, "media.LiveEventsStopFuture", "Result", future.Response(), "Polling failure") 5629 return 5630 } 5631 if !done { 5632 ar.Response = future.Response() 5633 err = azure.NewAsyncOpIncompleteError("media.LiveEventsStopFuture") 5634 return 5635 } 5636 ar.Response = future.Response() 5637 return 5638} 5639 5640// LiveEventsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 5641// operation. 5642type LiveEventsUpdateFuture struct { 5643 azure.FutureAPI 5644 // Result returns the result of the asynchronous operation. 5645 // If the operation has not completed it will return an error. 5646 Result func(LiveEventsClient) (LiveEvent, error) 5647} 5648 5649// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5650func (future *LiveEventsUpdateFuture) UnmarshalJSON(body []byte) error { 5651 var azFuture azure.Future 5652 if err := json.Unmarshal(body, &azFuture); err != nil { 5653 return err 5654 } 5655 future.FutureAPI = &azFuture 5656 future.Result = future.result 5657 return nil 5658} 5659 5660// result is the default implementation for LiveEventsUpdateFuture.Result. 5661func (future *LiveEventsUpdateFuture) result(client LiveEventsClient) (le LiveEvent, err error) { 5662 var done bool 5663 done, err = future.DoneWithContext(context.Background(), client) 5664 if err != nil { 5665 err = autorest.NewErrorWithError(err, "media.LiveEventsUpdateFuture", "Result", future.Response(), "Polling failure") 5666 return 5667 } 5668 if !done { 5669 le.Response.Response = future.Response() 5670 err = azure.NewAsyncOpIncompleteError("media.LiveEventsUpdateFuture") 5671 return 5672 } 5673 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5674 if le.Response.Response, err = future.GetResult(sender); err == nil && le.Response.Response.StatusCode != http.StatusNoContent { 5675 le, err = client.UpdateResponder(le.Response.Response) 5676 if err != nil { 5677 err = autorest.NewErrorWithError(err, "media.LiveEventsUpdateFuture", "Result", le.Response.Response, "Failure responding to request") 5678 } 5679 } 5680 return 5681} 5682 5683// LiveOutput the Live Output. 5684type LiveOutput struct { 5685 autorest.Response `json:"-"` 5686 // LiveOutputProperties - The Live Output properties. 5687 *LiveOutputProperties `json:"properties,omitempty"` 5688 // ID - READ-ONLY; Fully qualified resource ID for the resource. 5689 ID *string `json:"id,omitempty"` 5690 // Name - READ-ONLY; The name of the resource. 5691 Name *string `json:"name,omitempty"` 5692 // Type - READ-ONLY; The type of the resource. 5693 Type *string `json:"type,omitempty"` 5694} 5695 5696// MarshalJSON is the custom marshaler for LiveOutput. 5697func (lo LiveOutput) MarshalJSON() ([]byte, error) { 5698 objectMap := make(map[string]interface{}) 5699 if lo.LiveOutputProperties != nil { 5700 objectMap["properties"] = lo.LiveOutputProperties 5701 } 5702 return json.Marshal(objectMap) 5703} 5704 5705// UnmarshalJSON is the custom unmarshaler for LiveOutput struct. 5706func (lo *LiveOutput) UnmarshalJSON(body []byte) error { 5707 var m map[string]*json.RawMessage 5708 err := json.Unmarshal(body, &m) 5709 if err != nil { 5710 return err 5711 } 5712 for k, v := range m { 5713 switch k { 5714 case "properties": 5715 if v != nil { 5716 var liveOutputProperties LiveOutputProperties 5717 err = json.Unmarshal(*v, &liveOutputProperties) 5718 if err != nil { 5719 return err 5720 } 5721 lo.LiveOutputProperties = &liveOutputProperties 5722 } 5723 case "id": 5724 if v != nil { 5725 var ID string 5726 err = json.Unmarshal(*v, &ID) 5727 if err != nil { 5728 return err 5729 } 5730 lo.ID = &ID 5731 } 5732 case "name": 5733 if v != nil { 5734 var name string 5735 err = json.Unmarshal(*v, &name) 5736 if err != nil { 5737 return err 5738 } 5739 lo.Name = &name 5740 } 5741 case "type": 5742 if v != nil { 5743 var typeVar string 5744 err = json.Unmarshal(*v, &typeVar) 5745 if err != nil { 5746 return err 5747 } 5748 lo.Type = &typeVar 5749 } 5750 } 5751 } 5752 5753 return nil 5754} 5755 5756// LiveOutputListResult the LiveOutput list result. 5757type LiveOutputListResult struct { 5758 autorest.Response `json:"-"` 5759 // Value - The result of the List Live Output operation. 5760 Value *[]LiveOutput `json:"value,omitempty"` 5761 // OdataCount - The number of result. 5762 OdataCount *int32 `json:"@odata.count,omitempty"` 5763 // OdataNextLink - Th link to the next set of results. Not empty if value contains incomplete list of Live Outputs. 5764 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 5765} 5766 5767// LiveOutputListResultIterator provides access to a complete listing of LiveOutput values. 5768type LiveOutputListResultIterator struct { 5769 i int 5770 page LiveOutputListResultPage 5771} 5772 5773// NextWithContext advances to the next value. If there was an error making 5774// the request the iterator does not advance and the error is returned. 5775func (iter *LiveOutputListResultIterator) NextWithContext(ctx context.Context) (err error) { 5776 if tracing.IsEnabled() { 5777 ctx = tracing.StartSpan(ctx, fqdn+"/LiveOutputListResultIterator.NextWithContext") 5778 defer func() { 5779 sc := -1 5780 if iter.Response().Response.Response != nil { 5781 sc = iter.Response().Response.Response.StatusCode 5782 } 5783 tracing.EndSpan(ctx, sc, err) 5784 }() 5785 } 5786 iter.i++ 5787 if iter.i < len(iter.page.Values()) { 5788 return nil 5789 } 5790 err = iter.page.NextWithContext(ctx) 5791 if err != nil { 5792 iter.i-- 5793 return err 5794 } 5795 iter.i = 0 5796 return nil 5797} 5798 5799// Next advances to the next value. If there was an error making 5800// the request the iterator does not advance and the error is returned. 5801// Deprecated: Use NextWithContext() instead. 5802func (iter *LiveOutputListResultIterator) Next() error { 5803 return iter.NextWithContext(context.Background()) 5804} 5805 5806// NotDone returns true if the enumeration should be started or is not yet complete. 5807func (iter LiveOutputListResultIterator) NotDone() bool { 5808 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 5809} 5810 5811// Response returns the raw server response from the last page request. 5812func (iter LiveOutputListResultIterator) Response() LiveOutputListResult { 5813 return iter.page.Response() 5814} 5815 5816// Value returns the current value or a zero-initialized value if the 5817// iterator has advanced beyond the end of the collection. 5818func (iter LiveOutputListResultIterator) Value() LiveOutput { 5819 if !iter.page.NotDone() { 5820 return LiveOutput{} 5821 } 5822 return iter.page.Values()[iter.i] 5823} 5824 5825// Creates a new instance of the LiveOutputListResultIterator type. 5826func NewLiveOutputListResultIterator(page LiveOutputListResultPage) LiveOutputListResultIterator { 5827 return LiveOutputListResultIterator{page: page} 5828} 5829 5830// IsEmpty returns true if the ListResult contains no values. 5831func (lolr LiveOutputListResult) IsEmpty() bool { 5832 return lolr.Value == nil || len(*lolr.Value) == 0 5833} 5834 5835// hasNextLink returns true if the NextLink is not empty. 5836func (lolr LiveOutputListResult) hasNextLink() bool { 5837 return lolr.OdataNextLink != nil && len(*lolr.OdataNextLink) != 0 5838} 5839 5840// liveOutputListResultPreparer prepares a request to retrieve the next set of results. 5841// It returns nil if no more results exist. 5842func (lolr LiveOutputListResult) liveOutputListResultPreparer(ctx context.Context) (*http.Request, error) { 5843 if !lolr.hasNextLink() { 5844 return nil, nil 5845 } 5846 return autorest.Prepare((&http.Request{}).WithContext(ctx), 5847 autorest.AsJSON(), 5848 autorest.AsGet(), 5849 autorest.WithBaseURL(to.String(lolr.OdataNextLink))) 5850} 5851 5852// LiveOutputListResultPage contains a page of LiveOutput values. 5853type LiveOutputListResultPage struct { 5854 fn func(context.Context, LiveOutputListResult) (LiveOutputListResult, error) 5855 lolr LiveOutputListResult 5856} 5857 5858// NextWithContext advances to the next page of values. If there was an error making 5859// the request the page does not advance and the error is returned. 5860func (page *LiveOutputListResultPage) NextWithContext(ctx context.Context) (err error) { 5861 if tracing.IsEnabled() { 5862 ctx = tracing.StartSpan(ctx, fqdn+"/LiveOutputListResultPage.NextWithContext") 5863 defer func() { 5864 sc := -1 5865 if page.Response().Response.Response != nil { 5866 sc = page.Response().Response.Response.StatusCode 5867 } 5868 tracing.EndSpan(ctx, sc, err) 5869 }() 5870 } 5871 for { 5872 next, err := page.fn(ctx, page.lolr) 5873 if err != nil { 5874 return err 5875 } 5876 page.lolr = next 5877 if !next.hasNextLink() || !next.IsEmpty() { 5878 break 5879 } 5880 } 5881 return nil 5882} 5883 5884// Next advances to the next page of values. If there was an error making 5885// the request the page does not advance and the error is returned. 5886// Deprecated: Use NextWithContext() instead. 5887func (page *LiveOutputListResultPage) Next() error { 5888 return page.NextWithContext(context.Background()) 5889} 5890 5891// NotDone returns true if the page enumeration should be started or is not yet complete. 5892func (page LiveOutputListResultPage) NotDone() bool { 5893 return !page.lolr.IsEmpty() 5894} 5895 5896// Response returns the raw server response from the last page request. 5897func (page LiveOutputListResultPage) Response() LiveOutputListResult { 5898 return page.lolr 5899} 5900 5901// Values returns the slice of values for the current page or nil if there are no values. 5902func (page LiveOutputListResultPage) Values() []LiveOutput { 5903 if page.lolr.IsEmpty() { 5904 return nil 5905 } 5906 return *page.lolr.Value 5907} 5908 5909// Creates a new instance of the LiveOutputListResultPage type. 5910func NewLiveOutputListResultPage(cur LiveOutputListResult, getNextPage func(context.Context, LiveOutputListResult) (LiveOutputListResult, error)) LiveOutputListResultPage { 5911 return LiveOutputListResultPage{ 5912 fn: getNextPage, 5913 lolr: cur, 5914 } 5915} 5916 5917// LiveOutputProperties the JSON object that contains the properties required to create a Live Output. 5918type LiveOutputProperties struct { 5919 // Description - The description of the Live Output. 5920 Description *string `json:"description,omitempty"` 5921 // AssetName - The asset name. 5922 AssetName *string `json:"assetName,omitempty"` 5923 // ArchiveWindowLength - ISO 8601 timespan duration of the archive window length. This is duration that customer want to retain the recorded content. 5924 ArchiveWindowLength *string `json:"archiveWindowLength,omitempty"` 5925 // ManifestName - The manifest file name. 5926 ManifestName *string `json:"manifestName,omitempty"` 5927 // Hls - The HLS configuration. 5928 Hls *Hls `json:"hls,omitempty"` 5929 // OutputSnapTime - The output snapshot time. 5930 OutputSnapTime *int64 `json:"outputSnapTime,omitempty"` 5931 // Created - READ-ONLY; The exact time the Live Output was created. 5932 Created *date.Time `json:"created,omitempty"` 5933 // LastModified - READ-ONLY; The exact time the Live Output was last modified. 5934 LastModified *date.Time `json:"lastModified,omitempty"` 5935 // ProvisioningState - READ-ONLY; The provisioning state of the Live Output. 5936 ProvisioningState *string `json:"provisioningState,omitempty"` 5937 // ResourceState - READ-ONLY; The resource state of the Live Output. Possible values include: 'LiveOutputResourceStateCreating', 'LiveOutputResourceStateRunning', 'LiveOutputResourceStateDeleting' 5938 ResourceState LiveOutputResourceState `json:"resourceState,omitempty"` 5939} 5940 5941// MarshalJSON is the custom marshaler for LiveOutputProperties. 5942func (lop LiveOutputProperties) MarshalJSON() ([]byte, error) { 5943 objectMap := make(map[string]interface{}) 5944 if lop.Description != nil { 5945 objectMap["description"] = lop.Description 5946 } 5947 if lop.AssetName != nil { 5948 objectMap["assetName"] = lop.AssetName 5949 } 5950 if lop.ArchiveWindowLength != nil { 5951 objectMap["archiveWindowLength"] = lop.ArchiveWindowLength 5952 } 5953 if lop.ManifestName != nil { 5954 objectMap["manifestName"] = lop.ManifestName 5955 } 5956 if lop.Hls != nil { 5957 objectMap["hls"] = lop.Hls 5958 } 5959 if lop.OutputSnapTime != nil { 5960 objectMap["outputSnapTime"] = lop.OutputSnapTime 5961 } 5962 return json.Marshal(objectMap) 5963} 5964 5965// LiveOutputsCreateFuture an abstraction for monitoring and retrieving the results of a long-running 5966// operation. 5967type LiveOutputsCreateFuture struct { 5968 azure.FutureAPI 5969 // Result returns the result of the asynchronous operation. 5970 // If the operation has not completed it will return an error. 5971 Result func(LiveOutputsClient) (LiveOutput, error) 5972} 5973 5974// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5975func (future *LiveOutputsCreateFuture) UnmarshalJSON(body []byte) error { 5976 var azFuture azure.Future 5977 if err := json.Unmarshal(body, &azFuture); err != nil { 5978 return err 5979 } 5980 future.FutureAPI = &azFuture 5981 future.Result = future.result 5982 return nil 5983} 5984 5985// result is the default implementation for LiveOutputsCreateFuture.Result. 5986func (future *LiveOutputsCreateFuture) result(client LiveOutputsClient) (lo LiveOutput, err error) { 5987 var done bool 5988 done, err = future.DoneWithContext(context.Background(), client) 5989 if err != nil { 5990 err = autorest.NewErrorWithError(err, "media.LiveOutputsCreateFuture", "Result", future.Response(), "Polling failure") 5991 return 5992 } 5993 if !done { 5994 lo.Response.Response = future.Response() 5995 err = azure.NewAsyncOpIncompleteError("media.LiveOutputsCreateFuture") 5996 return 5997 } 5998 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5999 if lo.Response.Response, err = future.GetResult(sender); err == nil && lo.Response.Response.StatusCode != http.StatusNoContent { 6000 lo, err = client.CreateResponder(lo.Response.Response) 6001 if err != nil { 6002 err = autorest.NewErrorWithError(err, "media.LiveOutputsCreateFuture", "Result", lo.Response.Response, "Failure responding to request") 6003 } 6004 } 6005 return 6006} 6007 6008// LiveOutputsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 6009// operation. 6010type LiveOutputsDeleteFuture struct { 6011 azure.FutureAPI 6012 // Result returns the result of the asynchronous operation. 6013 // If the operation has not completed it will return an error. 6014 Result func(LiveOutputsClient) (autorest.Response, error) 6015} 6016 6017// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6018func (future *LiveOutputsDeleteFuture) UnmarshalJSON(body []byte) error { 6019 var azFuture azure.Future 6020 if err := json.Unmarshal(body, &azFuture); err != nil { 6021 return err 6022 } 6023 future.FutureAPI = &azFuture 6024 future.Result = future.result 6025 return nil 6026} 6027 6028// result is the default implementation for LiveOutputsDeleteFuture.Result. 6029func (future *LiveOutputsDeleteFuture) result(client LiveOutputsClient) (ar autorest.Response, err error) { 6030 var done bool 6031 done, err = future.DoneWithContext(context.Background(), client) 6032 if err != nil { 6033 err = autorest.NewErrorWithError(err, "media.LiveOutputsDeleteFuture", "Result", future.Response(), "Polling failure") 6034 return 6035 } 6036 if !done { 6037 ar.Response = future.Response() 6038 err = azure.NewAsyncOpIncompleteError("media.LiveOutputsDeleteFuture") 6039 return 6040 } 6041 ar.Response = future.Response() 6042 return 6043} 6044 6045// Location ... 6046type Location struct { 6047 Name *string `json:"name,omitempty"` 6048} 6049 6050// Mp4Format describes the properties for an output ISO MP4 file. 6051type Mp4Format struct { 6052 // 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 . 6053 OutputFiles *[]OutputFile `json:"outputFiles,omitempty"` 6054 // 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. 6055 FilenamePattern *string `json:"filenamePattern,omitempty"` 6056 // OdataType - Possible values include: 'OdataTypeFormat', 'OdataTypeMicrosoftMediaImageFormat', 'OdataTypeMicrosoftMediaJpgFormat', 'OdataTypeMicrosoftMediaPngFormat', 'OdataTypeMicrosoftMediaMultiBitrateFormat', 'OdataTypeMicrosoftMediaMp4Format', 'OdataTypeMicrosoftMediaTransportStreamFormat' 6057 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"` 6058} 6059 6060// MarshalJSON is the custom marshaler for Mp4Format. 6061func (m4f Mp4Format) MarshalJSON() ([]byte, error) { 6062 m4f.OdataType = OdataTypeMicrosoftMediaMp4Format 6063 objectMap := make(map[string]interface{}) 6064 if m4f.OutputFiles != nil { 6065 objectMap["outputFiles"] = m4f.OutputFiles 6066 } 6067 if m4f.FilenamePattern != nil { 6068 objectMap["filenamePattern"] = m4f.FilenamePattern 6069 } 6070 if m4f.OdataType != "" { 6071 objectMap["@odata.type"] = m4f.OdataType 6072 } 6073 return json.Marshal(objectMap) 6074} 6075 6076// AsImageFormat is the BasicFormat implementation for Mp4Format. 6077func (m4f Mp4Format) AsImageFormat() (*ImageFormat, bool) { 6078 return nil, false 6079} 6080 6081// AsBasicImageFormat is the BasicFormat implementation for Mp4Format. 6082func (m4f Mp4Format) AsBasicImageFormat() (BasicImageFormat, bool) { 6083 return nil, false 6084} 6085 6086// AsJpgFormat is the BasicFormat implementation for Mp4Format. 6087func (m4f Mp4Format) AsJpgFormat() (*JpgFormat, bool) { 6088 return nil, false 6089} 6090 6091// AsPngFormat is the BasicFormat implementation for Mp4Format. 6092func (m4f Mp4Format) AsPngFormat() (*PngFormat, bool) { 6093 return nil, false 6094} 6095 6096// AsMultiBitrateFormat is the BasicFormat implementation for Mp4Format. 6097func (m4f Mp4Format) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) { 6098 return nil, false 6099} 6100 6101// AsBasicMultiBitrateFormat is the BasicFormat implementation for Mp4Format. 6102func (m4f Mp4Format) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) { 6103 return &m4f, true 6104} 6105 6106// AsMp4Format is the BasicFormat implementation for Mp4Format. 6107func (m4f Mp4Format) AsMp4Format() (*Mp4Format, bool) { 6108 return &m4f, true 6109} 6110 6111// AsTransportStreamFormat is the BasicFormat implementation for Mp4Format. 6112func (m4f Mp4Format) AsTransportStreamFormat() (*TransportStreamFormat, bool) { 6113 return nil, false 6114} 6115 6116// AsFormat is the BasicFormat implementation for Mp4Format. 6117func (m4f Mp4Format) AsFormat() (*Format, bool) { 6118 return nil, false 6119} 6120 6121// AsBasicFormat is the BasicFormat implementation for Mp4Format. 6122func (m4f Mp4Format) AsBasicFormat() (BasicFormat, bool) { 6123 return &m4f, true 6124} 6125 6126// BasicMultiBitrateFormat describes the properties for producing a collection of GOP aligned multi-bitrate files. The 6127// default behavior is to produce one output file for each video layer which is muxed together with all the audios. The 6128// exact output files produced can be controlled by specifying the outputFiles collection. 6129type BasicMultiBitrateFormat interface { 6130 AsMp4Format() (*Mp4Format, bool) 6131 AsTransportStreamFormat() (*TransportStreamFormat, bool) 6132 AsMultiBitrateFormat() (*MultiBitrateFormat, bool) 6133} 6134 6135// MultiBitrateFormat describes the properties for producing a collection of GOP aligned multi-bitrate files. 6136// The default behavior is to produce one output file for each video layer which is muxed together with all the 6137// audios. The exact output files produced can be controlled by specifying the outputFiles collection. 6138type MultiBitrateFormat struct { 6139 // 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 . 6140 OutputFiles *[]OutputFile `json:"outputFiles,omitempty"` 6141 // 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. 6142 FilenamePattern *string `json:"filenamePattern,omitempty"` 6143 // OdataType - Possible values include: 'OdataTypeFormat', 'OdataTypeMicrosoftMediaImageFormat', 'OdataTypeMicrosoftMediaJpgFormat', 'OdataTypeMicrosoftMediaPngFormat', 'OdataTypeMicrosoftMediaMultiBitrateFormat', 'OdataTypeMicrosoftMediaMp4Format', 'OdataTypeMicrosoftMediaTransportStreamFormat' 6144 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"` 6145} 6146 6147func unmarshalBasicMultiBitrateFormat(body []byte) (BasicMultiBitrateFormat, error) { 6148 var m map[string]interface{} 6149 err := json.Unmarshal(body, &m) 6150 if err != nil { 6151 return nil, err 6152 } 6153 6154 switch m["@odata.type"] { 6155 case string(OdataTypeMicrosoftMediaMp4Format): 6156 var m4f Mp4Format 6157 err := json.Unmarshal(body, &m4f) 6158 return m4f, err 6159 case string(OdataTypeMicrosoftMediaTransportStreamFormat): 6160 var tsf TransportStreamFormat 6161 err := json.Unmarshal(body, &tsf) 6162 return tsf, err 6163 default: 6164 var mbf MultiBitrateFormat 6165 err := json.Unmarshal(body, &mbf) 6166 return mbf, err 6167 } 6168} 6169func unmarshalBasicMultiBitrateFormatArray(body []byte) ([]BasicMultiBitrateFormat, error) { 6170 var rawMessages []*json.RawMessage 6171 err := json.Unmarshal(body, &rawMessages) 6172 if err != nil { 6173 return nil, err 6174 } 6175 6176 mbfArray := make([]BasicMultiBitrateFormat, len(rawMessages)) 6177 6178 for index, rawMessage := range rawMessages { 6179 mbf, err := unmarshalBasicMultiBitrateFormat(*rawMessage) 6180 if err != nil { 6181 return nil, err 6182 } 6183 mbfArray[index] = mbf 6184 } 6185 return mbfArray, nil 6186} 6187 6188// MarshalJSON is the custom marshaler for MultiBitrateFormat. 6189func (mbf MultiBitrateFormat) MarshalJSON() ([]byte, error) { 6190 mbf.OdataType = OdataTypeMicrosoftMediaMultiBitrateFormat 6191 objectMap := make(map[string]interface{}) 6192 if mbf.OutputFiles != nil { 6193 objectMap["outputFiles"] = mbf.OutputFiles 6194 } 6195 if mbf.FilenamePattern != nil { 6196 objectMap["filenamePattern"] = mbf.FilenamePattern 6197 } 6198 if mbf.OdataType != "" { 6199 objectMap["@odata.type"] = mbf.OdataType 6200 } 6201 return json.Marshal(objectMap) 6202} 6203 6204// AsImageFormat is the BasicFormat implementation for MultiBitrateFormat. 6205func (mbf MultiBitrateFormat) AsImageFormat() (*ImageFormat, bool) { 6206 return nil, false 6207} 6208 6209// AsBasicImageFormat is the BasicFormat implementation for MultiBitrateFormat. 6210func (mbf MultiBitrateFormat) AsBasicImageFormat() (BasicImageFormat, bool) { 6211 return nil, false 6212} 6213 6214// AsJpgFormat is the BasicFormat implementation for MultiBitrateFormat. 6215func (mbf MultiBitrateFormat) AsJpgFormat() (*JpgFormat, bool) { 6216 return nil, false 6217} 6218 6219// AsPngFormat is the BasicFormat implementation for MultiBitrateFormat. 6220func (mbf MultiBitrateFormat) AsPngFormat() (*PngFormat, bool) { 6221 return nil, false 6222} 6223 6224// AsMultiBitrateFormat is the BasicFormat implementation for MultiBitrateFormat. 6225func (mbf MultiBitrateFormat) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) { 6226 return &mbf, true 6227} 6228 6229// AsBasicMultiBitrateFormat is the BasicFormat implementation for MultiBitrateFormat. 6230func (mbf MultiBitrateFormat) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) { 6231 return &mbf, true 6232} 6233 6234// AsMp4Format is the BasicFormat implementation for MultiBitrateFormat. 6235func (mbf MultiBitrateFormat) AsMp4Format() (*Mp4Format, bool) { 6236 return nil, false 6237} 6238 6239// AsTransportStreamFormat is the BasicFormat implementation for MultiBitrateFormat. 6240func (mbf MultiBitrateFormat) AsTransportStreamFormat() (*TransportStreamFormat, bool) { 6241 return nil, false 6242} 6243 6244// AsFormat is the BasicFormat implementation for MultiBitrateFormat. 6245func (mbf MultiBitrateFormat) AsFormat() (*Format, bool) { 6246 return nil, false 6247} 6248 6249// AsBasicFormat is the BasicFormat implementation for MultiBitrateFormat. 6250func (mbf MultiBitrateFormat) AsBasicFormat() (BasicFormat, bool) { 6251 return &mbf, true 6252} 6253 6254// NoEncryption class for NoEncryption scheme 6255type NoEncryption struct { 6256 // EnabledProtocols - Representing supported protocols 6257 EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"` 6258} 6259 6260// ODataError information about an error. 6261type ODataError struct { 6262 // Code - A language-independent error name. 6263 Code *string `json:"code,omitempty"` 6264 // Message - The error message. 6265 Message *string `json:"message,omitempty"` 6266 // Target - The target of the error (for example, the name of the property in error). 6267 Target *string `json:"target,omitempty"` 6268 // Details - The error details. 6269 Details *[]ODataError `json:"details,omitempty"` 6270} 6271 6272// Operation an operation. 6273type Operation struct { 6274 // Name - The operation name. 6275 Name *string `json:"name,omitempty"` 6276 // Display - The operation display name. 6277 Display *OperationDisplay `json:"display,omitempty"` 6278} 6279 6280// OperationCollection a collection of Operation items. 6281type OperationCollection struct { 6282 autorest.Response `json:"-"` 6283 // Value - A collection of Operation items. 6284 Value *[]Operation `json:"value,omitempty"` 6285 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 6286 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 6287} 6288 6289// OperationCollectionIterator provides access to a complete listing of Operation values. 6290type OperationCollectionIterator struct { 6291 i int 6292 page OperationCollectionPage 6293} 6294 6295// NextWithContext advances to the next value. If there was an error making 6296// the request the iterator does not advance and the error is returned. 6297func (iter *OperationCollectionIterator) NextWithContext(ctx context.Context) (err error) { 6298 if tracing.IsEnabled() { 6299 ctx = tracing.StartSpan(ctx, fqdn+"/OperationCollectionIterator.NextWithContext") 6300 defer func() { 6301 sc := -1 6302 if iter.Response().Response.Response != nil { 6303 sc = iter.Response().Response.Response.StatusCode 6304 } 6305 tracing.EndSpan(ctx, sc, err) 6306 }() 6307 } 6308 iter.i++ 6309 if iter.i < len(iter.page.Values()) { 6310 return nil 6311 } 6312 err = iter.page.NextWithContext(ctx) 6313 if err != nil { 6314 iter.i-- 6315 return err 6316 } 6317 iter.i = 0 6318 return nil 6319} 6320 6321// Next advances to the next value. If there was an error making 6322// the request the iterator does not advance and the error is returned. 6323// Deprecated: Use NextWithContext() instead. 6324func (iter *OperationCollectionIterator) Next() error { 6325 return iter.NextWithContext(context.Background()) 6326} 6327 6328// NotDone returns true if the enumeration should be started or is not yet complete. 6329func (iter OperationCollectionIterator) NotDone() bool { 6330 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 6331} 6332 6333// Response returns the raw server response from the last page request. 6334func (iter OperationCollectionIterator) Response() OperationCollection { 6335 return iter.page.Response() 6336} 6337 6338// Value returns the current value or a zero-initialized value if the 6339// iterator has advanced beyond the end of the collection. 6340func (iter OperationCollectionIterator) Value() Operation { 6341 if !iter.page.NotDone() { 6342 return Operation{} 6343 } 6344 return iter.page.Values()[iter.i] 6345} 6346 6347// Creates a new instance of the OperationCollectionIterator type. 6348func NewOperationCollectionIterator(page OperationCollectionPage) OperationCollectionIterator { 6349 return OperationCollectionIterator{page: page} 6350} 6351 6352// IsEmpty returns true if the ListResult contains no values. 6353func (oc OperationCollection) IsEmpty() bool { 6354 return oc.Value == nil || len(*oc.Value) == 0 6355} 6356 6357// hasNextLink returns true if the NextLink is not empty. 6358func (oc OperationCollection) hasNextLink() bool { 6359 return oc.OdataNextLink != nil && len(*oc.OdataNextLink) != 0 6360} 6361 6362// operationCollectionPreparer prepares a request to retrieve the next set of results. 6363// It returns nil if no more results exist. 6364func (oc OperationCollection) operationCollectionPreparer(ctx context.Context) (*http.Request, error) { 6365 if !oc.hasNextLink() { 6366 return nil, nil 6367 } 6368 return autorest.Prepare((&http.Request{}).WithContext(ctx), 6369 autorest.AsJSON(), 6370 autorest.AsGet(), 6371 autorest.WithBaseURL(to.String(oc.OdataNextLink))) 6372} 6373 6374// OperationCollectionPage contains a page of Operation values. 6375type OperationCollectionPage struct { 6376 fn func(context.Context, OperationCollection) (OperationCollection, error) 6377 oc OperationCollection 6378} 6379 6380// NextWithContext advances to the next page of values. If there was an error making 6381// the request the page does not advance and the error is returned. 6382func (page *OperationCollectionPage) NextWithContext(ctx context.Context) (err error) { 6383 if tracing.IsEnabled() { 6384 ctx = tracing.StartSpan(ctx, fqdn+"/OperationCollectionPage.NextWithContext") 6385 defer func() { 6386 sc := -1 6387 if page.Response().Response.Response != nil { 6388 sc = page.Response().Response.Response.StatusCode 6389 } 6390 tracing.EndSpan(ctx, sc, err) 6391 }() 6392 } 6393 for { 6394 next, err := page.fn(ctx, page.oc) 6395 if err != nil { 6396 return err 6397 } 6398 page.oc = next 6399 if !next.hasNextLink() || !next.IsEmpty() { 6400 break 6401 } 6402 } 6403 return nil 6404} 6405 6406// Next advances to the next page of values. If there was an error making 6407// the request the page does not advance and the error is returned. 6408// Deprecated: Use NextWithContext() instead. 6409func (page *OperationCollectionPage) Next() error { 6410 return page.NextWithContext(context.Background()) 6411} 6412 6413// NotDone returns true if the page enumeration should be started or is not yet complete. 6414func (page OperationCollectionPage) NotDone() bool { 6415 return !page.oc.IsEmpty() 6416} 6417 6418// Response returns the raw server response from the last page request. 6419func (page OperationCollectionPage) Response() OperationCollection { 6420 return page.oc 6421} 6422 6423// Values returns the slice of values for the current page or nil if there are no values. 6424func (page OperationCollectionPage) Values() []Operation { 6425 if page.oc.IsEmpty() { 6426 return nil 6427 } 6428 return *page.oc.Value 6429} 6430 6431// Creates a new instance of the OperationCollectionPage type. 6432func NewOperationCollectionPage(cur OperationCollection, getNextPage func(context.Context, OperationCollection) (OperationCollection, error)) OperationCollectionPage { 6433 return OperationCollectionPage{ 6434 fn: getNextPage, 6435 oc: cur, 6436 } 6437} 6438 6439// OperationDisplay operation details. 6440type OperationDisplay struct { 6441 // Provider - The service provider. 6442 Provider *string `json:"provider,omitempty"` 6443 // Resource - Resource on which the operation is performed. 6444 Resource *string `json:"resource,omitempty"` 6445 // Operation - The operation type. 6446 Operation *string `json:"operation,omitempty"` 6447 // Description - The operation description. 6448 Description *string `json:"description,omitempty"` 6449} 6450 6451// OutputFile represents an output file produced. 6452type OutputFile struct { 6453 // 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. 6454 Labels *[]string `json:"labels,omitempty"` 6455} 6456 6457// BasicOverlay base type for all overlays - image, audio or video. 6458type BasicOverlay interface { 6459 AsAudioOverlay() (*AudioOverlay, bool) 6460 AsVideoOverlay() (*VideoOverlay, bool) 6461 AsOverlay() (*Overlay, bool) 6462} 6463 6464// Overlay base type for all overlays - image, audio or video. 6465type Overlay struct { 6466 // 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. 6467 InputLabel *string `json:"inputLabel,omitempty"` 6468 // 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. 6469 Start *string `json:"start,omitempty"` 6470 // 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. 6471 End *string `json:"end,omitempty"` 6472 // 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). 6473 FadeInDuration *string `json:"fadeInDuration,omitempty"` 6474 // 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). 6475 FadeOutDuration *string `json:"fadeOutDuration,omitempty"` 6476 // AudioGainLevel - The gain level of audio in the overlay. The value should be in the range [0, 1.0]. The default is 1.0. 6477 AudioGainLevel *float64 `json:"audioGainLevel,omitempty"` 6478 // OdataType - Possible values include: 'OdataTypeOverlay', 'OdataTypeMicrosoftMediaAudioOverlay', 'OdataTypeMicrosoftMediaVideoOverlay' 6479 OdataType OdataTypeBasicOverlay `json:"@odata.type,omitempty"` 6480} 6481 6482func unmarshalBasicOverlay(body []byte) (BasicOverlay, error) { 6483 var m map[string]interface{} 6484 err := json.Unmarshal(body, &m) 6485 if err != nil { 6486 return nil, err 6487 } 6488 6489 switch m["@odata.type"] { 6490 case string(OdataTypeMicrosoftMediaAudioOverlay): 6491 var ao AudioOverlay 6492 err := json.Unmarshal(body, &ao) 6493 return ao, err 6494 case string(OdataTypeMicrosoftMediaVideoOverlay): 6495 var vo VideoOverlay 6496 err := json.Unmarshal(body, &vo) 6497 return vo, err 6498 default: 6499 var o Overlay 6500 err := json.Unmarshal(body, &o) 6501 return o, err 6502 } 6503} 6504func unmarshalBasicOverlayArray(body []byte) ([]BasicOverlay, error) { 6505 var rawMessages []*json.RawMessage 6506 err := json.Unmarshal(body, &rawMessages) 6507 if err != nil { 6508 return nil, err 6509 } 6510 6511 oArray := make([]BasicOverlay, len(rawMessages)) 6512 6513 for index, rawMessage := range rawMessages { 6514 o, err := unmarshalBasicOverlay(*rawMessage) 6515 if err != nil { 6516 return nil, err 6517 } 6518 oArray[index] = o 6519 } 6520 return oArray, nil 6521} 6522 6523// MarshalJSON is the custom marshaler for Overlay. 6524func (o Overlay) MarshalJSON() ([]byte, error) { 6525 o.OdataType = OdataTypeOverlay 6526 objectMap := make(map[string]interface{}) 6527 if o.InputLabel != nil { 6528 objectMap["inputLabel"] = o.InputLabel 6529 } 6530 if o.Start != nil { 6531 objectMap["start"] = o.Start 6532 } 6533 if o.End != nil { 6534 objectMap["end"] = o.End 6535 } 6536 if o.FadeInDuration != nil { 6537 objectMap["fadeInDuration"] = o.FadeInDuration 6538 } 6539 if o.FadeOutDuration != nil { 6540 objectMap["fadeOutDuration"] = o.FadeOutDuration 6541 } 6542 if o.AudioGainLevel != nil { 6543 objectMap["audioGainLevel"] = o.AudioGainLevel 6544 } 6545 if o.OdataType != "" { 6546 objectMap["@odata.type"] = o.OdataType 6547 } 6548 return json.Marshal(objectMap) 6549} 6550 6551// AsAudioOverlay is the BasicOverlay implementation for Overlay. 6552func (o Overlay) AsAudioOverlay() (*AudioOverlay, bool) { 6553 return nil, false 6554} 6555 6556// AsVideoOverlay is the BasicOverlay implementation for Overlay. 6557func (o Overlay) AsVideoOverlay() (*VideoOverlay, bool) { 6558 return nil, false 6559} 6560 6561// AsOverlay is the BasicOverlay implementation for Overlay. 6562func (o Overlay) AsOverlay() (*Overlay, bool) { 6563 return &o, true 6564} 6565 6566// AsBasicOverlay is the BasicOverlay implementation for Overlay. 6567func (o Overlay) AsBasicOverlay() (BasicOverlay, bool) { 6568 return &o, true 6569} 6570 6571// PngFormat describes the settings for producing PNG thumbnails. 6572type PngFormat struct { 6573 // 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. 6574 FilenamePattern *string `json:"filenamePattern,omitempty"` 6575 // OdataType - Possible values include: 'OdataTypeFormat', 'OdataTypeMicrosoftMediaImageFormat', 'OdataTypeMicrosoftMediaJpgFormat', 'OdataTypeMicrosoftMediaPngFormat', 'OdataTypeMicrosoftMediaMultiBitrateFormat', 'OdataTypeMicrosoftMediaMp4Format', 'OdataTypeMicrosoftMediaTransportStreamFormat' 6576 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"` 6577} 6578 6579// MarshalJSON is the custom marshaler for PngFormat. 6580func (pf PngFormat) MarshalJSON() ([]byte, error) { 6581 pf.OdataType = OdataTypeMicrosoftMediaPngFormat 6582 objectMap := make(map[string]interface{}) 6583 if pf.FilenamePattern != nil { 6584 objectMap["filenamePattern"] = pf.FilenamePattern 6585 } 6586 if pf.OdataType != "" { 6587 objectMap["@odata.type"] = pf.OdataType 6588 } 6589 return json.Marshal(objectMap) 6590} 6591 6592// AsImageFormat is the BasicFormat implementation for PngFormat. 6593func (pf PngFormat) AsImageFormat() (*ImageFormat, bool) { 6594 return nil, false 6595} 6596 6597// AsBasicImageFormat is the BasicFormat implementation for PngFormat. 6598func (pf PngFormat) AsBasicImageFormat() (BasicImageFormat, bool) { 6599 return &pf, true 6600} 6601 6602// AsJpgFormat is the BasicFormat implementation for PngFormat. 6603func (pf PngFormat) AsJpgFormat() (*JpgFormat, bool) { 6604 return nil, false 6605} 6606 6607// AsPngFormat is the BasicFormat implementation for PngFormat. 6608func (pf PngFormat) AsPngFormat() (*PngFormat, bool) { 6609 return &pf, true 6610} 6611 6612// AsMultiBitrateFormat is the BasicFormat implementation for PngFormat. 6613func (pf PngFormat) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) { 6614 return nil, false 6615} 6616 6617// AsBasicMultiBitrateFormat is the BasicFormat implementation for PngFormat. 6618func (pf PngFormat) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) { 6619 return nil, false 6620} 6621 6622// AsMp4Format is the BasicFormat implementation for PngFormat. 6623func (pf PngFormat) AsMp4Format() (*Mp4Format, bool) { 6624 return nil, false 6625} 6626 6627// AsTransportStreamFormat is the BasicFormat implementation for PngFormat. 6628func (pf PngFormat) AsTransportStreamFormat() (*TransportStreamFormat, bool) { 6629 return nil, false 6630} 6631 6632// AsFormat is the BasicFormat implementation for PngFormat. 6633func (pf PngFormat) AsFormat() (*Format, bool) { 6634 return nil, false 6635} 6636 6637// AsBasicFormat is the BasicFormat implementation for PngFormat. 6638func (pf PngFormat) AsBasicFormat() (BasicFormat, bool) { 6639 return &pf, true 6640} 6641 6642// PngImage describes the properties for producing a series of PNG images from the input video. 6643type PngImage struct { 6644 // Layers - A collection of output PNG image layers to be produced by the encoder. 6645 Layers *[]PngLayer `json:"layers,omitempty"` 6646 // 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. 6647 Start *string `json:"start,omitempty"` 6648 // 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%). 6649 Step *string `json:"step,omitempty"` 6650 // 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%). 6651 Range *string `json:"range,omitempty"` 6652 // 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). 6653 KeyFrameInterval *string `json:"keyFrameInterval,omitempty"` 6654 // 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' 6655 StretchMode StretchMode `json:"stretchMode,omitempty"` 6656 // Label - An optional label for the codec. The label can be used to control muxing behavior. 6657 Label *string `json:"label,omitempty"` 6658 // OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage' 6659 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"` 6660} 6661 6662// MarshalJSON is the custom marshaler for PngImage. 6663func (pi PngImage) MarshalJSON() ([]byte, error) { 6664 pi.OdataType = OdataTypeMicrosoftMediaPngImage 6665 objectMap := make(map[string]interface{}) 6666 if pi.Layers != nil { 6667 objectMap["layers"] = pi.Layers 6668 } 6669 if pi.Start != nil { 6670 objectMap["start"] = pi.Start 6671 } 6672 if pi.Step != nil { 6673 objectMap["step"] = pi.Step 6674 } 6675 if pi.Range != nil { 6676 objectMap["range"] = pi.Range 6677 } 6678 if pi.KeyFrameInterval != nil { 6679 objectMap["keyFrameInterval"] = pi.KeyFrameInterval 6680 } 6681 if pi.StretchMode != "" { 6682 objectMap["stretchMode"] = pi.StretchMode 6683 } 6684 if pi.Label != nil { 6685 objectMap["label"] = pi.Label 6686 } 6687 if pi.OdataType != "" { 6688 objectMap["@odata.type"] = pi.OdataType 6689 } 6690 return json.Marshal(objectMap) 6691} 6692 6693// AsAudio is the BasicCodec implementation for PngImage. 6694func (pi PngImage) AsAudio() (*Audio, bool) { 6695 return nil, false 6696} 6697 6698// AsBasicAudio is the BasicCodec implementation for PngImage. 6699func (pi PngImage) AsBasicAudio() (BasicAudio, bool) { 6700 return nil, false 6701} 6702 6703// AsAacAudio is the BasicCodec implementation for PngImage. 6704func (pi PngImage) AsAacAudio() (*AacAudio, bool) { 6705 return nil, false 6706} 6707 6708// AsCopyVideo is the BasicCodec implementation for PngImage. 6709func (pi PngImage) AsCopyVideo() (*CopyVideo, bool) { 6710 return nil, false 6711} 6712 6713// AsVideo is the BasicCodec implementation for PngImage. 6714func (pi PngImage) AsVideo() (*Video, bool) { 6715 return nil, false 6716} 6717 6718// AsBasicVideo is the BasicCodec implementation for PngImage. 6719func (pi PngImage) AsBasicVideo() (BasicVideo, bool) { 6720 return &pi, true 6721} 6722 6723// AsImage is the BasicCodec implementation for PngImage. 6724func (pi PngImage) AsImage() (*Image, bool) { 6725 return nil, false 6726} 6727 6728// AsBasicImage is the BasicCodec implementation for PngImage. 6729func (pi PngImage) AsBasicImage() (BasicImage, bool) { 6730 return &pi, true 6731} 6732 6733// AsCopyAudio is the BasicCodec implementation for PngImage. 6734func (pi PngImage) AsCopyAudio() (*CopyAudio, bool) { 6735 return nil, false 6736} 6737 6738// AsH264Video is the BasicCodec implementation for PngImage. 6739func (pi PngImage) AsH264Video() (*H264Video, bool) { 6740 return nil, false 6741} 6742 6743// AsJpgImage is the BasicCodec implementation for PngImage. 6744func (pi PngImage) AsJpgImage() (*JpgImage, bool) { 6745 return nil, false 6746} 6747 6748// AsPngImage is the BasicCodec implementation for PngImage. 6749func (pi PngImage) AsPngImage() (*PngImage, bool) { 6750 return &pi, true 6751} 6752 6753// AsCodec is the BasicCodec implementation for PngImage. 6754func (pi PngImage) AsCodec() (*Codec, bool) { 6755 return nil, false 6756} 6757 6758// AsBasicCodec is the BasicCodec implementation for PngImage. 6759func (pi PngImage) AsBasicCodec() (BasicCodec, bool) { 6760 return &pi, true 6761} 6762 6763// PngLayer describes the settings to produce a PNG image from the input video. 6764type PngLayer struct { 6765 // 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. 6766 Width *string `json:"width,omitempty"` 6767 // 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. 6768 Height *string `json:"height,omitempty"` 6769 // Label - The alphanumeric label for this layer, which can be used in multiplexing different video and audio layers, or in naming the output file. 6770 Label *string `json:"label,omitempty"` 6771 // OdataType - Possible values include: 'OdataTypeLayer', 'OdataTypeMicrosoftMediaVideoLayer', 'OdataTypeMicrosoftMediaH264Layer', 'OdataTypeMicrosoftMediaJpgLayer', 'OdataTypeMicrosoftMediaPngLayer' 6772 OdataType OdataTypeBasicLayer `json:"@odata.type,omitempty"` 6773} 6774 6775// MarshalJSON is the custom marshaler for PngLayer. 6776func (pl PngLayer) MarshalJSON() ([]byte, error) { 6777 pl.OdataType = OdataTypeMicrosoftMediaPngLayer 6778 objectMap := make(map[string]interface{}) 6779 if pl.Width != nil { 6780 objectMap["width"] = pl.Width 6781 } 6782 if pl.Height != nil { 6783 objectMap["height"] = pl.Height 6784 } 6785 if pl.Label != nil { 6786 objectMap["label"] = pl.Label 6787 } 6788 if pl.OdataType != "" { 6789 objectMap["@odata.type"] = pl.OdataType 6790 } 6791 return json.Marshal(objectMap) 6792} 6793 6794// AsVideoLayer is the BasicLayer implementation for PngLayer. 6795func (pl PngLayer) AsVideoLayer() (*VideoLayer, bool) { 6796 return nil, false 6797} 6798 6799// AsBasicVideoLayer is the BasicLayer implementation for PngLayer. 6800func (pl PngLayer) AsBasicVideoLayer() (BasicVideoLayer, bool) { 6801 return nil, false 6802} 6803 6804// AsH264Layer is the BasicLayer implementation for PngLayer. 6805func (pl PngLayer) AsH264Layer() (*H264Layer, bool) { 6806 return nil, false 6807} 6808 6809// AsJpgLayer is the BasicLayer implementation for PngLayer. 6810func (pl PngLayer) AsJpgLayer() (*JpgLayer, bool) { 6811 return nil, false 6812} 6813 6814// AsPngLayer is the BasicLayer implementation for PngLayer. 6815func (pl PngLayer) AsPngLayer() (*PngLayer, bool) { 6816 return &pl, true 6817} 6818 6819// AsLayer is the BasicLayer implementation for PngLayer. 6820func (pl PngLayer) AsLayer() (*Layer, bool) { 6821 return nil, false 6822} 6823 6824// AsBasicLayer is the BasicLayer implementation for PngLayer. 6825func (pl PngLayer) AsBasicLayer() (BasicLayer, bool) { 6826 return &pl, true 6827} 6828 6829// BasicPreset base type for all Presets, which define the recipe or instructions on how the input media files should 6830// be processed. 6831type BasicPreset interface { 6832 AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) 6833 AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) 6834 AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) 6835 AsStandardEncoderPreset() (*StandardEncoderPreset, bool) 6836 AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) 6837 AsPreset() (*Preset, bool) 6838} 6839 6840// Preset base type for all Presets, which define the recipe or instructions on how the input media files 6841// should be processed. 6842type Preset struct { 6843 // OdataType - Possible values include: 'OdataTypePreset', 'OdataTypeMicrosoftMediaAudioAnalyzerPreset', 'OdataTypeMicrosoftMediaBuiltInStandardEncoderPreset', 'OdataTypeMicrosoftMediaStandardEncoderPreset', 'OdataTypeMicrosoftMediaVideoAnalyzerPreset' 6844 OdataType OdataTypeBasicPreset `json:"@odata.type,omitempty"` 6845} 6846 6847func unmarshalBasicPreset(body []byte) (BasicPreset, error) { 6848 var m map[string]interface{} 6849 err := json.Unmarshal(body, &m) 6850 if err != nil { 6851 return nil, err 6852 } 6853 6854 switch m["@odata.type"] { 6855 case string(OdataTypeMicrosoftMediaAudioAnalyzerPreset): 6856 var aap AudioAnalyzerPreset 6857 err := json.Unmarshal(body, &aap) 6858 return aap, err 6859 case string(OdataTypeMicrosoftMediaBuiltInStandardEncoderPreset): 6860 var bisep BuiltInStandardEncoderPreset 6861 err := json.Unmarshal(body, &bisep) 6862 return bisep, err 6863 case string(OdataTypeMicrosoftMediaStandardEncoderPreset): 6864 var sep StandardEncoderPreset 6865 err := json.Unmarshal(body, &sep) 6866 return sep, err 6867 case string(OdataTypeMicrosoftMediaVideoAnalyzerPreset): 6868 var vap VideoAnalyzerPreset 6869 err := json.Unmarshal(body, &vap) 6870 return vap, err 6871 default: 6872 var p Preset 6873 err := json.Unmarshal(body, &p) 6874 return p, err 6875 } 6876} 6877func unmarshalBasicPresetArray(body []byte) ([]BasicPreset, error) { 6878 var rawMessages []*json.RawMessage 6879 err := json.Unmarshal(body, &rawMessages) 6880 if err != nil { 6881 return nil, err 6882 } 6883 6884 pArray := make([]BasicPreset, len(rawMessages)) 6885 6886 for index, rawMessage := range rawMessages { 6887 p, err := unmarshalBasicPreset(*rawMessage) 6888 if err != nil { 6889 return nil, err 6890 } 6891 pArray[index] = p 6892 } 6893 return pArray, nil 6894} 6895 6896// MarshalJSON is the custom marshaler for Preset. 6897func (p Preset) MarshalJSON() ([]byte, error) { 6898 p.OdataType = OdataTypePreset 6899 objectMap := make(map[string]interface{}) 6900 if p.OdataType != "" { 6901 objectMap["@odata.type"] = p.OdataType 6902 } 6903 return json.Marshal(objectMap) 6904} 6905 6906// AsAudioAnalyzerPreset is the BasicPreset implementation for Preset. 6907func (p Preset) AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) { 6908 return nil, false 6909} 6910 6911// AsBasicAudioAnalyzerPreset is the BasicPreset implementation for Preset. 6912func (p Preset) AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) { 6913 return nil, false 6914} 6915 6916// AsBuiltInStandardEncoderPreset is the BasicPreset implementation for Preset. 6917func (p Preset) AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) { 6918 return nil, false 6919} 6920 6921// AsStandardEncoderPreset is the BasicPreset implementation for Preset. 6922func (p Preset) AsStandardEncoderPreset() (*StandardEncoderPreset, bool) { 6923 return nil, false 6924} 6925 6926// AsVideoAnalyzerPreset is the BasicPreset implementation for Preset. 6927func (p Preset) AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) { 6928 return nil, false 6929} 6930 6931// AsPreset is the BasicPreset implementation for Preset. 6932func (p Preset) AsPreset() (*Preset, bool) { 6933 return &p, true 6934} 6935 6936// AsBasicPreset is the BasicPreset implementation for Preset. 6937func (p Preset) AsBasicPreset() (BasicPreset, bool) { 6938 return &p, true 6939} 6940 6941// Provider a resource provider. 6942type Provider struct { 6943 // ProviderName - The provider name. 6944 ProviderName *string `json:"providerName,omitempty"` 6945} 6946 6947// ProxyResource the resource model definition for a ARM proxy resource. 6948type ProxyResource struct { 6949 // ID - READ-ONLY; Fully qualified resource ID for the resource. 6950 ID *string `json:"id,omitempty"` 6951 // Name - READ-ONLY; The name of the resource. 6952 Name *string `json:"name,omitempty"` 6953 // Type - READ-ONLY; The type of the resource. 6954 Type *string `json:"type,omitempty"` 6955} 6956 6957// MarshalJSON is the custom marshaler for ProxyResource. 6958func (pr ProxyResource) MarshalJSON() ([]byte, error) { 6959 objectMap := make(map[string]interface{}) 6960 return json.Marshal(objectMap) 6961} 6962 6963// Rectangle describes the properties of a rectangular window applied to the input media before processing 6964// it. 6965type Rectangle struct { 6966 // 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%). 6967 Left *string `json:"left,omitempty"` 6968 // 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%). 6969 Top *string `json:"top,omitempty"` 6970 // 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%). 6971 Width *string `json:"width,omitempty"` 6972 // 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%). 6973 Height *string `json:"height,omitempty"` 6974} 6975 6976// Resource the core properties of ARM resources. 6977type Resource struct { 6978 // ID - READ-ONLY; Fully qualified resource ID for the resource. 6979 ID *string `json:"id,omitempty"` 6980 // Name - READ-ONLY; The name of the resource. 6981 Name *string `json:"name,omitempty"` 6982 // Type - READ-ONLY; The type of the resource. 6983 Type *string `json:"type,omitempty"` 6984} 6985 6986// MarshalJSON is the custom marshaler for Resource. 6987func (r Resource) MarshalJSON() ([]byte, error) { 6988 objectMap := make(map[string]interface{}) 6989 return json.Marshal(objectMap) 6990} 6991 6992// Service a Media Services account. 6993type Service struct { 6994 autorest.Response `json:"-"` 6995 // ServiceProperties - The resource properties. 6996 *ServiceProperties `json:"properties,omitempty"` 6997 // Tags - Resource tags. 6998 Tags map[string]*string `json:"tags"` 6999 // Location - The Azure Region of the resource. 7000 Location *string `json:"location,omitempty"` 7001 // ID - READ-ONLY; Fully qualified resource ID for the resource. 7002 ID *string `json:"id,omitempty"` 7003 // Name - READ-ONLY; The name of the resource. 7004 Name *string `json:"name,omitempty"` 7005 // Type - READ-ONLY; The type of the resource. 7006 Type *string `json:"type,omitempty"` 7007} 7008 7009// MarshalJSON is the custom marshaler for Service. 7010func (s Service) MarshalJSON() ([]byte, error) { 7011 objectMap := make(map[string]interface{}) 7012 if s.ServiceProperties != nil { 7013 objectMap["properties"] = s.ServiceProperties 7014 } 7015 if s.Tags != nil { 7016 objectMap["tags"] = s.Tags 7017 } 7018 if s.Location != nil { 7019 objectMap["location"] = s.Location 7020 } 7021 return json.Marshal(objectMap) 7022} 7023 7024// UnmarshalJSON is the custom unmarshaler for Service struct. 7025func (s *Service) UnmarshalJSON(body []byte) error { 7026 var m map[string]*json.RawMessage 7027 err := json.Unmarshal(body, &m) 7028 if err != nil { 7029 return err 7030 } 7031 for k, v := range m { 7032 switch k { 7033 case "properties": 7034 if v != nil { 7035 var serviceProperties ServiceProperties 7036 err = json.Unmarshal(*v, &serviceProperties) 7037 if err != nil { 7038 return err 7039 } 7040 s.ServiceProperties = &serviceProperties 7041 } 7042 case "tags": 7043 if v != nil { 7044 var tags map[string]*string 7045 err = json.Unmarshal(*v, &tags) 7046 if err != nil { 7047 return err 7048 } 7049 s.Tags = tags 7050 } 7051 case "location": 7052 if v != nil { 7053 var location string 7054 err = json.Unmarshal(*v, &location) 7055 if err != nil { 7056 return err 7057 } 7058 s.Location = &location 7059 } 7060 case "id": 7061 if v != nil { 7062 var ID string 7063 err = json.Unmarshal(*v, &ID) 7064 if err != nil { 7065 return err 7066 } 7067 s.ID = &ID 7068 } 7069 case "name": 7070 if v != nil { 7071 var name string 7072 err = json.Unmarshal(*v, &name) 7073 if err != nil { 7074 return err 7075 } 7076 s.Name = &name 7077 } 7078 case "type": 7079 if v != nil { 7080 var typeVar string 7081 err = json.Unmarshal(*v, &typeVar) 7082 if err != nil { 7083 return err 7084 } 7085 s.Type = &typeVar 7086 } 7087 } 7088 } 7089 7090 return nil 7091} 7092 7093// ServiceCollection a collection of MediaService items. 7094type ServiceCollection struct { 7095 autorest.Response `json:"-"` 7096 // Value - A collection of MediaService items. 7097 Value *[]Service `json:"value,omitempty"` 7098 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 7099 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 7100} 7101 7102// ServiceCollectionIterator provides access to a complete listing of Service values. 7103type ServiceCollectionIterator struct { 7104 i int 7105 page ServiceCollectionPage 7106} 7107 7108// NextWithContext advances to the next value. If there was an error making 7109// the request the iterator does not advance and the error is returned. 7110func (iter *ServiceCollectionIterator) NextWithContext(ctx context.Context) (err error) { 7111 if tracing.IsEnabled() { 7112 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceCollectionIterator.NextWithContext") 7113 defer func() { 7114 sc := -1 7115 if iter.Response().Response.Response != nil { 7116 sc = iter.Response().Response.Response.StatusCode 7117 } 7118 tracing.EndSpan(ctx, sc, err) 7119 }() 7120 } 7121 iter.i++ 7122 if iter.i < len(iter.page.Values()) { 7123 return nil 7124 } 7125 err = iter.page.NextWithContext(ctx) 7126 if err != nil { 7127 iter.i-- 7128 return err 7129 } 7130 iter.i = 0 7131 return nil 7132} 7133 7134// Next advances to the next value. If there was an error making 7135// the request the iterator does not advance and the error is returned. 7136// Deprecated: Use NextWithContext() instead. 7137func (iter *ServiceCollectionIterator) Next() error { 7138 return iter.NextWithContext(context.Background()) 7139} 7140 7141// NotDone returns true if the enumeration should be started or is not yet complete. 7142func (iter ServiceCollectionIterator) NotDone() bool { 7143 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 7144} 7145 7146// Response returns the raw server response from the last page request. 7147func (iter ServiceCollectionIterator) Response() ServiceCollection { 7148 return iter.page.Response() 7149} 7150 7151// Value returns the current value or a zero-initialized value if the 7152// iterator has advanced beyond the end of the collection. 7153func (iter ServiceCollectionIterator) Value() Service { 7154 if !iter.page.NotDone() { 7155 return Service{} 7156 } 7157 return iter.page.Values()[iter.i] 7158} 7159 7160// Creates a new instance of the ServiceCollectionIterator type. 7161func NewServiceCollectionIterator(page ServiceCollectionPage) ServiceCollectionIterator { 7162 return ServiceCollectionIterator{page: page} 7163} 7164 7165// IsEmpty returns true if the ListResult contains no values. 7166func (sc ServiceCollection) IsEmpty() bool { 7167 return sc.Value == nil || len(*sc.Value) == 0 7168} 7169 7170// hasNextLink returns true if the NextLink is not empty. 7171func (sc ServiceCollection) hasNextLink() bool { 7172 return sc.OdataNextLink != nil && len(*sc.OdataNextLink) != 0 7173} 7174 7175// serviceCollectionPreparer prepares a request to retrieve the next set of results. 7176// It returns nil if no more results exist. 7177func (sc ServiceCollection) serviceCollectionPreparer(ctx context.Context) (*http.Request, error) { 7178 if !sc.hasNextLink() { 7179 return nil, nil 7180 } 7181 return autorest.Prepare((&http.Request{}).WithContext(ctx), 7182 autorest.AsJSON(), 7183 autorest.AsGet(), 7184 autorest.WithBaseURL(to.String(sc.OdataNextLink))) 7185} 7186 7187// ServiceCollectionPage contains a page of Service values. 7188type ServiceCollectionPage struct { 7189 fn func(context.Context, ServiceCollection) (ServiceCollection, error) 7190 sc ServiceCollection 7191} 7192 7193// NextWithContext advances to the next page of values. If there was an error making 7194// the request the page does not advance and the error is returned. 7195func (page *ServiceCollectionPage) NextWithContext(ctx context.Context) (err error) { 7196 if tracing.IsEnabled() { 7197 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceCollectionPage.NextWithContext") 7198 defer func() { 7199 sc := -1 7200 if page.Response().Response.Response != nil { 7201 sc = page.Response().Response.Response.StatusCode 7202 } 7203 tracing.EndSpan(ctx, sc, err) 7204 }() 7205 } 7206 for { 7207 next, err := page.fn(ctx, page.sc) 7208 if err != nil { 7209 return err 7210 } 7211 page.sc = next 7212 if !next.hasNextLink() || !next.IsEmpty() { 7213 break 7214 } 7215 } 7216 return nil 7217} 7218 7219// Next advances to the next page of values. If there was an error making 7220// the request the page does not advance and the error is returned. 7221// Deprecated: Use NextWithContext() instead. 7222func (page *ServiceCollectionPage) Next() error { 7223 return page.NextWithContext(context.Background()) 7224} 7225 7226// NotDone returns true if the page enumeration should be started or is not yet complete. 7227func (page ServiceCollectionPage) NotDone() bool { 7228 return !page.sc.IsEmpty() 7229} 7230 7231// Response returns the raw server response from the last page request. 7232func (page ServiceCollectionPage) Response() ServiceCollection { 7233 return page.sc 7234} 7235 7236// Values returns the slice of values for the current page or nil if there are no values. 7237func (page ServiceCollectionPage) Values() []Service { 7238 if page.sc.IsEmpty() { 7239 return nil 7240 } 7241 return *page.sc.Value 7242} 7243 7244// Creates a new instance of the ServiceCollectionPage type. 7245func NewServiceCollectionPage(cur ServiceCollection, getNextPage func(context.Context, ServiceCollection) (ServiceCollection, error)) ServiceCollectionPage { 7246 return ServiceCollectionPage{ 7247 fn: getNextPage, 7248 sc: cur, 7249 } 7250} 7251 7252// ServiceProperties properties of the Media Services account. 7253type ServiceProperties struct { 7254 // MediaServiceID - READ-ONLY; The Media Services account ID. 7255 MediaServiceID *uuid.UUID `json:"mediaServiceId,omitempty"` 7256 // StorageAccounts - The storage accounts for this resource. 7257 StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` 7258} 7259 7260// MarshalJSON is the custom marshaler for ServiceProperties. 7261func (sp ServiceProperties) MarshalJSON() ([]byte, error) { 7262 objectMap := make(map[string]interface{}) 7263 if sp.StorageAccounts != nil { 7264 objectMap["storageAccounts"] = sp.StorageAccounts 7265 } 7266 return json.Marshal(objectMap) 7267} 7268 7269// StandardEncoderPreset describes all the settings to be used when encoding the input video with the 7270// Standard Encoder. 7271type StandardEncoderPreset struct { 7272 // Filters - One or more filtering operations that are applied to the input media before encoding. 7273 Filters *Filters `json:"filters,omitempty"` 7274 // Codecs - The list of codecs to be used when encoding the input video. 7275 Codecs *[]BasicCodec `json:"codecs,omitempty"` 7276 // Formats - The list of outputs to be produced by the encoder. 7277 Formats *[]BasicFormat `json:"formats,omitempty"` 7278 // OdataType - Possible values include: 'OdataTypePreset', 'OdataTypeMicrosoftMediaAudioAnalyzerPreset', 'OdataTypeMicrosoftMediaBuiltInStandardEncoderPreset', 'OdataTypeMicrosoftMediaStandardEncoderPreset', 'OdataTypeMicrosoftMediaVideoAnalyzerPreset' 7279 OdataType OdataTypeBasicPreset `json:"@odata.type,omitempty"` 7280} 7281 7282// MarshalJSON is the custom marshaler for StandardEncoderPreset. 7283func (sep StandardEncoderPreset) MarshalJSON() ([]byte, error) { 7284 sep.OdataType = OdataTypeMicrosoftMediaStandardEncoderPreset 7285 objectMap := make(map[string]interface{}) 7286 if sep.Filters != nil { 7287 objectMap["filters"] = sep.Filters 7288 } 7289 if sep.Codecs != nil { 7290 objectMap["codecs"] = sep.Codecs 7291 } 7292 if sep.Formats != nil { 7293 objectMap["formats"] = sep.Formats 7294 } 7295 if sep.OdataType != "" { 7296 objectMap["@odata.type"] = sep.OdataType 7297 } 7298 return json.Marshal(objectMap) 7299} 7300 7301// AsAudioAnalyzerPreset is the BasicPreset implementation for StandardEncoderPreset. 7302func (sep StandardEncoderPreset) AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) { 7303 return nil, false 7304} 7305 7306// AsBasicAudioAnalyzerPreset is the BasicPreset implementation for StandardEncoderPreset. 7307func (sep StandardEncoderPreset) AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) { 7308 return nil, false 7309} 7310 7311// AsBuiltInStandardEncoderPreset is the BasicPreset implementation for StandardEncoderPreset. 7312func (sep StandardEncoderPreset) AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) { 7313 return nil, false 7314} 7315 7316// AsStandardEncoderPreset is the BasicPreset implementation for StandardEncoderPreset. 7317func (sep StandardEncoderPreset) AsStandardEncoderPreset() (*StandardEncoderPreset, bool) { 7318 return &sep, true 7319} 7320 7321// AsVideoAnalyzerPreset is the BasicPreset implementation for StandardEncoderPreset. 7322func (sep StandardEncoderPreset) AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) { 7323 return nil, false 7324} 7325 7326// AsPreset is the BasicPreset implementation for StandardEncoderPreset. 7327func (sep StandardEncoderPreset) AsPreset() (*Preset, bool) { 7328 return nil, false 7329} 7330 7331// AsBasicPreset is the BasicPreset implementation for StandardEncoderPreset. 7332func (sep StandardEncoderPreset) AsBasicPreset() (BasicPreset, bool) { 7333 return &sep, true 7334} 7335 7336// UnmarshalJSON is the custom unmarshaler for StandardEncoderPreset struct. 7337func (sep *StandardEncoderPreset) UnmarshalJSON(body []byte) error { 7338 var m map[string]*json.RawMessage 7339 err := json.Unmarshal(body, &m) 7340 if err != nil { 7341 return err 7342 } 7343 for k, v := range m { 7344 switch k { 7345 case "filters": 7346 if v != nil { 7347 var filters Filters 7348 err = json.Unmarshal(*v, &filters) 7349 if err != nil { 7350 return err 7351 } 7352 sep.Filters = &filters 7353 } 7354 case "codecs": 7355 if v != nil { 7356 codecs, err := unmarshalBasicCodecArray(*v) 7357 if err != nil { 7358 return err 7359 } 7360 sep.Codecs = &codecs 7361 } 7362 case "formats": 7363 if v != nil { 7364 formats, err := unmarshalBasicFormatArray(*v) 7365 if err != nil { 7366 return err 7367 } 7368 sep.Formats = &formats 7369 } 7370 case "@odata.type": 7371 if v != nil { 7372 var odataType OdataTypeBasicPreset 7373 err = json.Unmarshal(*v, &odataType) 7374 if err != nil { 7375 return err 7376 } 7377 sep.OdataType = odataType 7378 } 7379 } 7380 } 7381 7382 return nil 7383} 7384 7385// StorageAccount the storage account details. 7386type StorageAccount struct { 7387 // 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. 7388 ID *string `json:"id,omitempty"` 7389 // Type - The type of the storage account. Possible values include: 'Primary', 'Secondary' 7390 Type StorageAccountType `json:"type,omitempty"` 7391} 7392 7393// StreamingEndpoint the StreamingEndpoint. 7394type StreamingEndpoint struct { 7395 autorest.Response `json:"-"` 7396 // StreamingEndpointProperties - The StreamingEndpoint properties. 7397 *StreamingEndpointProperties `json:"properties,omitempty"` 7398 // Tags - Resource tags. 7399 Tags map[string]*string `json:"tags"` 7400 // Location - The Azure Region of the resource. 7401 Location *string `json:"location,omitempty"` 7402 // ID - READ-ONLY; Fully qualified resource ID for the resource. 7403 ID *string `json:"id,omitempty"` 7404 // Name - READ-ONLY; The name of the resource. 7405 Name *string `json:"name,omitempty"` 7406 // Type - READ-ONLY; The type of the resource. 7407 Type *string `json:"type,omitempty"` 7408} 7409 7410// MarshalJSON is the custom marshaler for StreamingEndpoint. 7411func (se StreamingEndpoint) MarshalJSON() ([]byte, error) { 7412 objectMap := make(map[string]interface{}) 7413 if se.StreamingEndpointProperties != nil { 7414 objectMap["properties"] = se.StreamingEndpointProperties 7415 } 7416 if se.Tags != nil { 7417 objectMap["tags"] = se.Tags 7418 } 7419 if se.Location != nil { 7420 objectMap["location"] = se.Location 7421 } 7422 return json.Marshal(objectMap) 7423} 7424 7425// UnmarshalJSON is the custom unmarshaler for StreamingEndpoint struct. 7426func (se *StreamingEndpoint) UnmarshalJSON(body []byte) error { 7427 var m map[string]*json.RawMessage 7428 err := json.Unmarshal(body, &m) 7429 if err != nil { 7430 return err 7431 } 7432 for k, v := range m { 7433 switch k { 7434 case "properties": 7435 if v != nil { 7436 var streamingEndpointProperties StreamingEndpointProperties 7437 err = json.Unmarshal(*v, &streamingEndpointProperties) 7438 if err != nil { 7439 return err 7440 } 7441 se.StreamingEndpointProperties = &streamingEndpointProperties 7442 } 7443 case "tags": 7444 if v != nil { 7445 var tags map[string]*string 7446 err = json.Unmarshal(*v, &tags) 7447 if err != nil { 7448 return err 7449 } 7450 se.Tags = tags 7451 } 7452 case "location": 7453 if v != nil { 7454 var location string 7455 err = json.Unmarshal(*v, &location) 7456 if err != nil { 7457 return err 7458 } 7459 se.Location = &location 7460 } 7461 case "id": 7462 if v != nil { 7463 var ID string 7464 err = json.Unmarshal(*v, &ID) 7465 if err != nil { 7466 return err 7467 } 7468 se.ID = &ID 7469 } 7470 case "name": 7471 if v != nil { 7472 var name string 7473 err = json.Unmarshal(*v, &name) 7474 if err != nil { 7475 return err 7476 } 7477 se.Name = &name 7478 } 7479 case "type": 7480 if v != nil { 7481 var typeVar string 7482 err = json.Unmarshal(*v, &typeVar) 7483 if err != nil { 7484 return err 7485 } 7486 se.Type = &typeVar 7487 } 7488 } 7489 } 7490 7491 return nil 7492} 7493 7494// StreamingEndpointAccessControl streamingEndpoint access control definition. 7495type StreamingEndpointAccessControl struct { 7496 // Akamai - The access control of Akamai 7497 Akamai *AkamaiAccessControl `json:"akamai,omitempty"` 7498 // IP - The IP access control of the StreamingEndpoint. 7499 IP *IPAccessControl `json:"ip,omitempty"` 7500} 7501 7502// StreamingEndpointListResult the StreamingEndpoint list result. 7503type StreamingEndpointListResult struct { 7504 autorest.Response `json:"-"` 7505 // Value - The result of the List StreamingEndpoint operation. 7506 Value *[]StreamingEndpoint `json:"value,omitempty"` 7507 // OdataCount - The number of result. 7508 OdataCount *int32 `json:"@odata.count,omitempty"` 7509 // OdataNextLink - Th link to the next set of results. Not empty if value contains incomplete list of StreamingEndpoints. 7510 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 7511} 7512 7513// StreamingEndpointListResultIterator provides access to a complete listing of StreamingEndpoint values. 7514type StreamingEndpointListResultIterator struct { 7515 i int 7516 page StreamingEndpointListResultPage 7517} 7518 7519// NextWithContext advances to the next value. If there was an error making 7520// the request the iterator does not advance and the error is returned. 7521func (iter *StreamingEndpointListResultIterator) NextWithContext(ctx context.Context) (err error) { 7522 if tracing.IsEnabled() { 7523 ctx = tracing.StartSpan(ctx, fqdn+"/StreamingEndpointListResultIterator.NextWithContext") 7524 defer func() { 7525 sc := -1 7526 if iter.Response().Response.Response != nil { 7527 sc = iter.Response().Response.Response.StatusCode 7528 } 7529 tracing.EndSpan(ctx, sc, err) 7530 }() 7531 } 7532 iter.i++ 7533 if iter.i < len(iter.page.Values()) { 7534 return nil 7535 } 7536 err = iter.page.NextWithContext(ctx) 7537 if err != nil { 7538 iter.i-- 7539 return err 7540 } 7541 iter.i = 0 7542 return nil 7543} 7544 7545// Next advances to the next value. If there was an error making 7546// the request the iterator does not advance and the error is returned. 7547// Deprecated: Use NextWithContext() instead. 7548func (iter *StreamingEndpointListResultIterator) Next() error { 7549 return iter.NextWithContext(context.Background()) 7550} 7551 7552// NotDone returns true if the enumeration should be started or is not yet complete. 7553func (iter StreamingEndpointListResultIterator) NotDone() bool { 7554 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 7555} 7556 7557// Response returns the raw server response from the last page request. 7558func (iter StreamingEndpointListResultIterator) Response() StreamingEndpointListResult { 7559 return iter.page.Response() 7560} 7561 7562// Value returns the current value or a zero-initialized value if the 7563// iterator has advanced beyond the end of the collection. 7564func (iter StreamingEndpointListResultIterator) Value() StreamingEndpoint { 7565 if !iter.page.NotDone() { 7566 return StreamingEndpoint{} 7567 } 7568 return iter.page.Values()[iter.i] 7569} 7570 7571// Creates a new instance of the StreamingEndpointListResultIterator type. 7572func NewStreamingEndpointListResultIterator(page StreamingEndpointListResultPage) StreamingEndpointListResultIterator { 7573 return StreamingEndpointListResultIterator{page: page} 7574} 7575 7576// IsEmpty returns true if the ListResult contains no values. 7577func (selr StreamingEndpointListResult) IsEmpty() bool { 7578 return selr.Value == nil || len(*selr.Value) == 0 7579} 7580 7581// hasNextLink returns true if the NextLink is not empty. 7582func (selr StreamingEndpointListResult) hasNextLink() bool { 7583 return selr.OdataNextLink != nil && len(*selr.OdataNextLink) != 0 7584} 7585 7586// streamingEndpointListResultPreparer prepares a request to retrieve the next set of results. 7587// It returns nil if no more results exist. 7588func (selr StreamingEndpointListResult) streamingEndpointListResultPreparer(ctx context.Context) (*http.Request, error) { 7589 if !selr.hasNextLink() { 7590 return nil, nil 7591 } 7592 return autorest.Prepare((&http.Request{}).WithContext(ctx), 7593 autorest.AsJSON(), 7594 autorest.AsGet(), 7595 autorest.WithBaseURL(to.String(selr.OdataNextLink))) 7596} 7597 7598// StreamingEndpointListResultPage contains a page of StreamingEndpoint values. 7599type StreamingEndpointListResultPage struct { 7600 fn func(context.Context, StreamingEndpointListResult) (StreamingEndpointListResult, error) 7601 selr StreamingEndpointListResult 7602} 7603 7604// NextWithContext advances to the next page of values. If there was an error making 7605// the request the page does not advance and the error is returned. 7606func (page *StreamingEndpointListResultPage) NextWithContext(ctx context.Context) (err error) { 7607 if tracing.IsEnabled() { 7608 ctx = tracing.StartSpan(ctx, fqdn+"/StreamingEndpointListResultPage.NextWithContext") 7609 defer func() { 7610 sc := -1 7611 if page.Response().Response.Response != nil { 7612 sc = page.Response().Response.Response.StatusCode 7613 } 7614 tracing.EndSpan(ctx, sc, err) 7615 }() 7616 } 7617 for { 7618 next, err := page.fn(ctx, page.selr) 7619 if err != nil { 7620 return err 7621 } 7622 page.selr = next 7623 if !next.hasNextLink() || !next.IsEmpty() { 7624 break 7625 } 7626 } 7627 return nil 7628} 7629 7630// Next advances to the next page of values. If there was an error making 7631// the request the page does not advance and the error is returned. 7632// Deprecated: Use NextWithContext() instead. 7633func (page *StreamingEndpointListResultPage) Next() error { 7634 return page.NextWithContext(context.Background()) 7635} 7636 7637// NotDone returns true if the page enumeration should be started or is not yet complete. 7638func (page StreamingEndpointListResultPage) NotDone() bool { 7639 return !page.selr.IsEmpty() 7640} 7641 7642// Response returns the raw server response from the last page request. 7643func (page StreamingEndpointListResultPage) Response() StreamingEndpointListResult { 7644 return page.selr 7645} 7646 7647// Values returns the slice of values for the current page or nil if there are no values. 7648func (page StreamingEndpointListResultPage) Values() []StreamingEndpoint { 7649 if page.selr.IsEmpty() { 7650 return nil 7651 } 7652 return *page.selr.Value 7653} 7654 7655// Creates a new instance of the StreamingEndpointListResultPage type. 7656func NewStreamingEndpointListResultPage(cur StreamingEndpointListResult, getNextPage func(context.Context, StreamingEndpointListResult) (StreamingEndpointListResult, error)) StreamingEndpointListResultPage { 7657 return StreamingEndpointListResultPage{ 7658 fn: getNextPage, 7659 selr: cur, 7660 } 7661} 7662 7663// StreamingEndpointProperties the StreamingEndpoint properties. 7664type StreamingEndpointProperties struct { 7665 // Description - The StreamingEndpoint description. 7666 Description *string `json:"description,omitempty"` 7667 // ScaleUnits - The number of scale units. 7668 ScaleUnits *int32 `json:"scaleUnits,omitempty"` 7669 // AvailabilitySetName - AvailabilitySet name 7670 AvailabilitySetName *string `json:"availabilitySetName,omitempty"` 7671 // AccessControl - The access control definition of the StreamingEndpoint. 7672 AccessControl *StreamingEndpointAccessControl `json:"accessControl,omitempty"` 7673 // MaxCacheAge - Max cache age 7674 MaxCacheAge *int64 `json:"maxCacheAge,omitempty"` 7675 // CustomHostNames - The custom host names of the StreamingEndpoint 7676 CustomHostNames *[]string `json:"customHostNames,omitempty"` 7677 // HostName - READ-ONLY; The StreamingEndpoint host name. 7678 HostName *string `json:"hostName,omitempty"` 7679 // CdnEnabled - The CDN enabled flag. 7680 CdnEnabled *bool `json:"cdnEnabled,omitempty"` 7681 // CdnProvider - The CDN provider name. 7682 CdnProvider *string `json:"cdnProvider,omitempty"` 7683 // CdnProfile - The CDN profile name. 7684 CdnProfile *string `json:"cdnProfile,omitempty"` 7685 // ProvisioningState - READ-ONLY; The provisioning state of the StreamingEndpoint. 7686 ProvisioningState *string `json:"provisioningState,omitempty"` 7687 // ResourceState - READ-ONLY; The resource state of the StreamingEndpoint. Possible values include: 'StreamingEndpointResourceStateStopped', 'StreamingEndpointResourceStateStarting', 'StreamingEndpointResourceStateRunning', 'StreamingEndpointResourceStateStopping', 'StreamingEndpointResourceStateDeleting', 'StreamingEndpointResourceStateScaling' 7688 ResourceState StreamingEndpointResourceState `json:"resourceState,omitempty"` 7689 // CrossSiteAccessPolicies - The StreamingEndpoint access policies. 7690 CrossSiteAccessPolicies *CrossSiteAccessPolicies `json:"crossSiteAccessPolicies,omitempty"` 7691 // FreeTrialEndTime - READ-ONLY; The free trial expiration time. 7692 FreeTrialEndTime *date.Time `json:"freeTrialEndTime,omitempty"` 7693 // Created - READ-ONLY; The exact time the StreamingEndpoint was created. 7694 Created *date.Time `json:"created,omitempty"` 7695 // LastModified - READ-ONLY; The exact time the StreamingEndpoint was last modified. 7696 LastModified *date.Time `json:"lastModified,omitempty"` 7697} 7698 7699// MarshalJSON is the custom marshaler for StreamingEndpointProperties. 7700func (sep StreamingEndpointProperties) MarshalJSON() ([]byte, error) { 7701 objectMap := make(map[string]interface{}) 7702 if sep.Description != nil { 7703 objectMap["description"] = sep.Description 7704 } 7705 if sep.ScaleUnits != nil { 7706 objectMap["scaleUnits"] = sep.ScaleUnits 7707 } 7708 if sep.AvailabilitySetName != nil { 7709 objectMap["availabilitySetName"] = sep.AvailabilitySetName 7710 } 7711 if sep.AccessControl != nil { 7712 objectMap["accessControl"] = sep.AccessControl 7713 } 7714 if sep.MaxCacheAge != nil { 7715 objectMap["maxCacheAge"] = sep.MaxCacheAge 7716 } 7717 if sep.CustomHostNames != nil { 7718 objectMap["customHostNames"] = sep.CustomHostNames 7719 } 7720 if sep.CdnEnabled != nil { 7721 objectMap["cdnEnabled"] = sep.CdnEnabled 7722 } 7723 if sep.CdnProvider != nil { 7724 objectMap["cdnProvider"] = sep.CdnProvider 7725 } 7726 if sep.CdnProfile != nil { 7727 objectMap["cdnProfile"] = sep.CdnProfile 7728 } 7729 if sep.CrossSiteAccessPolicies != nil { 7730 objectMap["crossSiteAccessPolicies"] = sep.CrossSiteAccessPolicies 7731 } 7732 return json.Marshal(objectMap) 7733} 7734 7735// StreamingEndpointsCreateFuture an abstraction for monitoring and retrieving the results of a 7736// long-running operation. 7737type StreamingEndpointsCreateFuture struct { 7738 azure.FutureAPI 7739 // Result returns the result of the asynchronous operation. 7740 // If the operation has not completed it will return an error. 7741 Result func(StreamingEndpointsClient) (StreamingEndpoint, error) 7742} 7743 7744// UnmarshalJSON is the custom unmarshaller for CreateFuture. 7745func (future *StreamingEndpointsCreateFuture) UnmarshalJSON(body []byte) error { 7746 var azFuture azure.Future 7747 if err := json.Unmarshal(body, &azFuture); err != nil { 7748 return err 7749 } 7750 future.FutureAPI = &azFuture 7751 future.Result = future.result 7752 return nil 7753} 7754 7755// result is the default implementation for StreamingEndpointsCreateFuture.Result. 7756func (future *StreamingEndpointsCreateFuture) result(client StreamingEndpointsClient) (se StreamingEndpoint, err error) { 7757 var done bool 7758 done, err = future.DoneWithContext(context.Background(), client) 7759 if err != nil { 7760 err = autorest.NewErrorWithError(err, "media.StreamingEndpointsCreateFuture", "Result", future.Response(), "Polling failure") 7761 return 7762 } 7763 if !done { 7764 se.Response.Response = future.Response() 7765 err = azure.NewAsyncOpIncompleteError("media.StreamingEndpointsCreateFuture") 7766 return 7767 } 7768 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7769 if se.Response.Response, err = future.GetResult(sender); err == nil && se.Response.Response.StatusCode != http.StatusNoContent { 7770 se, err = client.CreateResponder(se.Response.Response) 7771 if err != nil { 7772 err = autorest.NewErrorWithError(err, "media.StreamingEndpointsCreateFuture", "Result", se.Response.Response, "Failure responding to request") 7773 } 7774 } 7775 return 7776} 7777 7778// StreamingEndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a 7779// long-running operation. 7780type StreamingEndpointsDeleteFuture struct { 7781 azure.FutureAPI 7782 // Result returns the result of the asynchronous operation. 7783 // If the operation has not completed it will return an error. 7784 Result func(StreamingEndpointsClient) (autorest.Response, error) 7785} 7786 7787// UnmarshalJSON is the custom unmarshaller for CreateFuture. 7788func (future *StreamingEndpointsDeleteFuture) UnmarshalJSON(body []byte) error { 7789 var azFuture azure.Future 7790 if err := json.Unmarshal(body, &azFuture); err != nil { 7791 return err 7792 } 7793 future.FutureAPI = &azFuture 7794 future.Result = future.result 7795 return nil 7796} 7797 7798// result is the default implementation for StreamingEndpointsDeleteFuture.Result. 7799func (future *StreamingEndpointsDeleteFuture) result(client StreamingEndpointsClient) (ar autorest.Response, err error) { 7800 var done bool 7801 done, err = future.DoneWithContext(context.Background(), client) 7802 if err != nil { 7803 err = autorest.NewErrorWithError(err, "media.StreamingEndpointsDeleteFuture", "Result", future.Response(), "Polling failure") 7804 return 7805 } 7806 if !done { 7807 ar.Response = future.Response() 7808 err = azure.NewAsyncOpIncompleteError("media.StreamingEndpointsDeleteFuture") 7809 return 7810 } 7811 ar.Response = future.Response() 7812 return 7813} 7814 7815// StreamingEndpointsScaleFuture an abstraction for monitoring and retrieving the results of a long-running 7816// operation. 7817type StreamingEndpointsScaleFuture struct { 7818 azure.FutureAPI 7819 // Result returns the result of the asynchronous operation. 7820 // If the operation has not completed it will return an error. 7821 Result func(StreamingEndpointsClient) (autorest.Response, error) 7822} 7823 7824// UnmarshalJSON is the custom unmarshaller for CreateFuture. 7825func (future *StreamingEndpointsScaleFuture) UnmarshalJSON(body []byte) error { 7826 var azFuture azure.Future 7827 if err := json.Unmarshal(body, &azFuture); err != nil { 7828 return err 7829 } 7830 future.FutureAPI = &azFuture 7831 future.Result = future.result 7832 return nil 7833} 7834 7835// result is the default implementation for StreamingEndpointsScaleFuture.Result. 7836func (future *StreamingEndpointsScaleFuture) result(client StreamingEndpointsClient) (ar autorest.Response, err error) { 7837 var done bool 7838 done, err = future.DoneWithContext(context.Background(), client) 7839 if err != nil { 7840 err = autorest.NewErrorWithError(err, "media.StreamingEndpointsScaleFuture", "Result", future.Response(), "Polling failure") 7841 return 7842 } 7843 if !done { 7844 ar.Response = future.Response() 7845 err = azure.NewAsyncOpIncompleteError("media.StreamingEndpointsScaleFuture") 7846 return 7847 } 7848 ar.Response = future.Response() 7849 return 7850} 7851 7852// StreamingEndpointsStartFuture an abstraction for monitoring and retrieving the results of a long-running 7853// operation. 7854type StreamingEndpointsStartFuture struct { 7855 azure.FutureAPI 7856 // Result returns the result of the asynchronous operation. 7857 // If the operation has not completed it will return an error. 7858 Result func(StreamingEndpointsClient) (autorest.Response, error) 7859} 7860 7861// UnmarshalJSON is the custom unmarshaller for CreateFuture. 7862func (future *StreamingEndpointsStartFuture) UnmarshalJSON(body []byte) error { 7863 var azFuture azure.Future 7864 if err := json.Unmarshal(body, &azFuture); err != nil { 7865 return err 7866 } 7867 future.FutureAPI = &azFuture 7868 future.Result = future.result 7869 return nil 7870} 7871 7872// result is the default implementation for StreamingEndpointsStartFuture.Result. 7873func (future *StreamingEndpointsStartFuture) result(client StreamingEndpointsClient) (ar autorest.Response, err error) { 7874 var done bool 7875 done, err = future.DoneWithContext(context.Background(), client) 7876 if err != nil { 7877 err = autorest.NewErrorWithError(err, "media.StreamingEndpointsStartFuture", "Result", future.Response(), "Polling failure") 7878 return 7879 } 7880 if !done { 7881 ar.Response = future.Response() 7882 err = azure.NewAsyncOpIncompleteError("media.StreamingEndpointsStartFuture") 7883 return 7884 } 7885 ar.Response = future.Response() 7886 return 7887} 7888 7889// StreamingEndpointsStopFuture an abstraction for monitoring and retrieving the results of a long-running 7890// operation. 7891type StreamingEndpointsStopFuture struct { 7892 azure.FutureAPI 7893 // Result returns the result of the asynchronous operation. 7894 // If the operation has not completed it will return an error. 7895 Result func(StreamingEndpointsClient) (autorest.Response, error) 7896} 7897 7898// UnmarshalJSON is the custom unmarshaller for CreateFuture. 7899func (future *StreamingEndpointsStopFuture) UnmarshalJSON(body []byte) error { 7900 var azFuture azure.Future 7901 if err := json.Unmarshal(body, &azFuture); err != nil { 7902 return err 7903 } 7904 future.FutureAPI = &azFuture 7905 future.Result = future.result 7906 return nil 7907} 7908 7909// result is the default implementation for StreamingEndpointsStopFuture.Result. 7910func (future *StreamingEndpointsStopFuture) result(client StreamingEndpointsClient) (ar autorest.Response, err error) { 7911 var done bool 7912 done, err = future.DoneWithContext(context.Background(), client) 7913 if err != nil { 7914 err = autorest.NewErrorWithError(err, "media.StreamingEndpointsStopFuture", "Result", future.Response(), "Polling failure") 7915 return 7916 } 7917 if !done { 7918 ar.Response = future.Response() 7919 err = azure.NewAsyncOpIncompleteError("media.StreamingEndpointsStopFuture") 7920 return 7921 } 7922 ar.Response = future.Response() 7923 return 7924} 7925 7926// StreamingEndpointsUpdateFuture an abstraction for monitoring and retrieving the results of a 7927// long-running operation. 7928type StreamingEndpointsUpdateFuture struct { 7929 azure.FutureAPI 7930 // Result returns the result of the asynchronous operation. 7931 // If the operation has not completed it will return an error. 7932 Result func(StreamingEndpointsClient) (StreamingEndpoint, error) 7933} 7934 7935// UnmarshalJSON is the custom unmarshaller for CreateFuture. 7936func (future *StreamingEndpointsUpdateFuture) UnmarshalJSON(body []byte) error { 7937 var azFuture azure.Future 7938 if err := json.Unmarshal(body, &azFuture); err != nil { 7939 return err 7940 } 7941 future.FutureAPI = &azFuture 7942 future.Result = future.result 7943 return nil 7944} 7945 7946// result is the default implementation for StreamingEndpointsUpdateFuture.Result. 7947func (future *StreamingEndpointsUpdateFuture) result(client StreamingEndpointsClient) (se StreamingEndpoint, err error) { 7948 var done bool 7949 done, err = future.DoneWithContext(context.Background(), client) 7950 if err != nil { 7951 err = autorest.NewErrorWithError(err, "media.StreamingEndpointsUpdateFuture", "Result", future.Response(), "Polling failure") 7952 return 7953 } 7954 if !done { 7955 se.Response.Response = future.Response() 7956 err = azure.NewAsyncOpIncompleteError("media.StreamingEndpointsUpdateFuture") 7957 return 7958 } 7959 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7960 if se.Response.Response, err = future.GetResult(sender); err == nil && se.Response.Response.StatusCode != http.StatusNoContent { 7961 se, err = client.UpdateResponder(se.Response.Response) 7962 if err != nil { 7963 err = autorest.NewErrorWithError(err, "media.StreamingEndpointsUpdateFuture", "Result", se.Response.Response, "Failure responding to request") 7964 } 7965 } 7966 return 7967} 7968 7969// StreamingEntityScaleUnit scale units definition 7970type StreamingEntityScaleUnit struct { 7971 // ScaleUnit - The scale unit number of the StreamingEndpoint. 7972 ScaleUnit *int32 `json:"scaleUnit,omitempty"` 7973} 7974 7975// StreamingLocator a Streaming Locator resource 7976type StreamingLocator struct { 7977 autorest.Response `json:"-"` 7978 *StreamingLocatorProperties `json:"properties,omitempty"` 7979 // ID - READ-ONLY; Fully qualified resource ID for the resource. 7980 ID *string `json:"id,omitempty"` 7981 // Name - READ-ONLY; The name of the resource. 7982 Name *string `json:"name,omitempty"` 7983 // Type - READ-ONLY; The type of the resource. 7984 Type *string `json:"type,omitempty"` 7985} 7986 7987// MarshalJSON is the custom marshaler for StreamingLocator. 7988func (sl StreamingLocator) MarshalJSON() ([]byte, error) { 7989 objectMap := make(map[string]interface{}) 7990 if sl.StreamingLocatorProperties != nil { 7991 objectMap["properties"] = sl.StreamingLocatorProperties 7992 } 7993 return json.Marshal(objectMap) 7994} 7995 7996// UnmarshalJSON is the custom unmarshaler for StreamingLocator struct. 7997func (sl *StreamingLocator) UnmarshalJSON(body []byte) error { 7998 var m map[string]*json.RawMessage 7999 err := json.Unmarshal(body, &m) 8000 if err != nil { 8001 return err 8002 } 8003 for k, v := range m { 8004 switch k { 8005 case "properties": 8006 if v != nil { 8007 var streamingLocatorProperties StreamingLocatorProperties 8008 err = json.Unmarshal(*v, &streamingLocatorProperties) 8009 if err != nil { 8010 return err 8011 } 8012 sl.StreamingLocatorProperties = &streamingLocatorProperties 8013 } 8014 case "id": 8015 if v != nil { 8016 var ID string 8017 err = json.Unmarshal(*v, &ID) 8018 if err != nil { 8019 return err 8020 } 8021 sl.ID = &ID 8022 } 8023 case "name": 8024 if v != nil { 8025 var name string 8026 err = json.Unmarshal(*v, &name) 8027 if err != nil { 8028 return err 8029 } 8030 sl.Name = &name 8031 } 8032 case "type": 8033 if v != nil { 8034 var typeVar string 8035 err = json.Unmarshal(*v, &typeVar) 8036 if err != nil { 8037 return err 8038 } 8039 sl.Type = &typeVar 8040 } 8041 } 8042 } 8043 8044 return nil 8045} 8046 8047// StreamingLocatorCollection a collection of StreamingLocator items. 8048type StreamingLocatorCollection struct { 8049 autorest.Response `json:"-"` 8050 // Value - A collection of StreamingLocator items. 8051 Value *[]StreamingLocator `json:"value,omitempty"` 8052 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 8053 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 8054} 8055 8056// StreamingLocatorCollectionIterator provides access to a complete listing of StreamingLocator values. 8057type StreamingLocatorCollectionIterator struct { 8058 i int 8059 page StreamingLocatorCollectionPage 8060} 8061 8062// NextWithContext advances to the next value. If there was an error making 8063// the request the iterator does not advance and the error is returned. 8064func (iter *StreamingLocatorCollectionIterator) NextWithContext(ctx context.Context) (err error) { 8065 if tracing.IsEnabled() { 8066 ctx = tracing.StartSpan(ctx, fqdn+"/StreamingLocatorCollectionIterator.NextWithContext") 8067 defer func() { 8068 sc := -1 8069 if iter.Response().Response.Response != nil { 8070 sc = iter.Response().Response.Response.StatusCode 8071 } 8072 tracing.EndSpan(ctx, sc, err) 8073 }() 8074 } 8075 iter.i++ 8076 if iter.i < len(iter.page.Values()) { 8077 return nil 8078 } 8079 err = iter.page.NextWithContext(ctx) 8080 if err != nil { 8081 iter.i-- 8082 return err 8083 } 8084 iter.i = 0 8085 return nil 8086} 8087 8088// Next advances to the next value. If there was an error making 8089// the request the iterator does not advance and the error is returned. 8090// Deprecated: Use NextWithContext() instead. 8091func (iter *StreamingLocatorCollectionIterator) Next() error { 8092 return iter.NextWithContext(context.Background()) 8093} 8094 8095// NotDone returns true if the enumeration should be started or is not yet complete. 8096func (iter StreamingLocatorCollectionIterator) NotDone() bool { 8097 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 8098} 8099 8100// Response returns the raw server response from the last page request. 8101func (iter StreamingLocatorCollectionIterator) Response() StreamingLocatorCollection { 8102 return iter.page.Response() 8103} 8104 8105// Value returns the current value or a zero-initialized value if the 8106// iterator has advanced beyond the end of the collection. 8107func (iter StreamingLocatorCollectionIterator) Value() StreamingLocator { 8108 if !iter.page.NotDone() { 8109 return StreamingLocator{} 8110 } 8111 return iter.page.Values()[iter.i] 8112} 8113 8114// Creates a new instance of the StreamingLocatorCollectionIterator type. 8115func NewStreamingLocatorCollectionIterator(page StreamingLocatorCollectionPage) StreamingLocatorCollectionIterator { 8116 return StreamingLocatorCollectionIterator{page: page} 8117} 8118 8119// IsEmpty returns true if the ListResult contains no values. 8120func (slc StreamingLocatorCollection) IsEmpty() bool { 8121 return slc.Value == nil || len(*slc.Value) == 0 8122} 8123 8124// hasNextLink returns true if the NextLink is not empty. 8125func (slc StreamingLocatorCollection) hasNextLink() bool { 8126 return slc.OdataNextLink != nil && len(*slc.OdataNextLink) != 0 8127} 8128 8129// streamingLocatorCollectionPreparer prepares a request to retrieve the next set of results. 8130// It returns nil if no more results exist. 8131func (slc StreamingLocatorCollection) streamingLocatorCollectionPreparer(ctx context.Context) (*http.Request, error) { 8132 if !slc.hasNextLink() { 8133 return nil, nil 8134 } 8135 return autorest.Prepare((&http.Request{}).WithContext(ctx), 8136 autorest.AsJSON(), 8137 autorest.AsGet(), 8138 autorest.WithBaseURL(to.String(slc.OdataNextLink))) 8139} 8140 8141// StreamingLocatorCollectionPage contains a page of StreamingLocator values. 8142type StreamingLocatorCollectionPage struct { 8143 fn func(context.Context, StreamingLocatorCollection) (StreamingLocatorCollection, error) 8144 slc StreamingLocatorCollection 8145} 8146 8147// NextWithContext advances to the next page of values. If there was an error making 8148// the request the page does not advance and the error is returned. 8149func (page *StreamingLocatorCollectionPage) NextWithContext(ctx context.Context) (err error) { 8150 if tracing.IsEnabled() { 8151 ctx = tracing.StartSpan(ctx, fqdn+"/StreamingLocatorCollectionPage.NextWithContext") 8152 defer func() { 8153 sc := -1 8154 if page.Response().Response.Response != nil { 8155 sc = page.Response().Response.Response.StatusCode 8156 } 8157 tracing.EndSpan(ctx, sc, err) 8158 }() 8159 } 8160 for { 8161 next, err := page.fn(ctx, page.slc) 8162 if err != nil { 8163 return err 8164 } 8165 page.slc = next 8166 if !next.hasNextLink() || !next.IsEmpty() { 8167 break 8168 } 8169 } 8170 return nil 8171} 8172 8173// Next advances to the next page of values. If there was an error making 8174// the request the page does not advance and the error is returned. 8175// Deprecated: Use NextWithContext() instead. 8176func (page *StreamingLocatorCollectionPage) Next() error { 8177 return page.NextWithContext(context.Background()) 8178} 8179 8180// NotDone returns true if the page enumeration should be started or is not yet complete. 8181func (page StreamingLocatorCollectionPage) NotDone() bool { 8182 return !page.slc.IsEmpty() 8183} 8184 8185// Response returns the raw server response from the last page request. 8186func (page StreamingLocatorCollectionPage) Response() StreamingLocatorCollection { 8187 return page.slc 8188} 8189 8190// Values returns the slice of values for the current page or nil if there are no values. 8191func (page StreamingLocatorCollectionPage) Values() []StreamingLocator { 8192 if page.slc.IsEmpty() { 8193 return nil 8194 } 8195 return *page.slc.Value 8196} 8197 8198// Creates a new instance of the StreamingLocatorCollectionPage type. 8199func NewStreamingLocatorCollectionPage(cur StreamingLocatorCollection, getNextPage func(context.Context, StreamingLocatorCollection) (StreamingLocatorCollection, error)) StreamingLocatorCollectionPage { 8200 return StreamingLocatorCollectionPage{ 8201 fn: getNextPage, 8202 slc: cur, 8203 } 8204} 8205 8206// StreamingLocatorContentKey class for content key in Streaming Locator 8207type StreamingLocatorContentKey struct { 8208 // ID - ID of Content Key 8209 ID *uuid.UUID `json:"id,omitempty"` 8210 // Type - READ-ONLY; Encryption type of Content Key. Possible values include: 'StreamingLocatorContentKeyTypeCommonEncryptionCenc', 'StreamingLocatorContentKeyTypeCommonEncryptionCbcs', 'StreamingLocatorContentKeyTypeEnvelopeEncryption' 8211 Type StreamingLocatorContentKeyType `json:"type,omitempty"` 8212 // Label - Label of Content Key 8213 Label *string `json:"label,omitempty"` 8214 // Value - Value of Content Key 8215 Value *string `json:"value,omitempty"` 8216 // PolicyName - READ-ONLY; ContentKeyPolicy used by Content Key 8217 PolicyName *string `json:"policyName,omitempty"` 8218 // Tracks - Tracks which use this Content Key 8219 Tracks *[]TrackSelection `json:"tracks,omitempty"` 8220} 8221 8222// MarshalJSON is the custom marshaler for StreamingLocatorContentKey. 8223func (slck StreamingLocatorContentKey) MarshalJSON() ([]byte, error) { 8224 objectMap := make(map[string]interface{}) 8225 if slck.ID != nil { 8226 objectMap["id"] = slck.ID 8227 } 8228 if slck.Label != nil { 8229 objectMap["label"] = slck.Label 8230 } 8231 if slck.Value != nil { 8232 objectMap["value"] = slck.Value 8233 } 8234 if slck.Tracks != nil { 8235 objectMap["tracks"] = slck.Tracks 8236 } 8237 return json.Marshal(objectMap) 8238} 8239 8240// StreamingLocatorProperties class to specify properties of Streaming Locator 8241type StreamingLocatorProperties struct { 8242 // AssetName - Asset Name 8243 AssetName *string `json:"assetName,omitempty"` 8244 // Created - READ-ONLY; Creation time of Streaming Locator 8245 Created *date.Time `json:"created,omitempty"` 8246 // StartTime - StartTime of Streaming Locator 8247 StartTime *date.Time `json:"startTime,omitempty"` 8248 // EndTime - EndTime of Streaming Locator 8249 EndTime *date.Time `json:"endTime,omitempty"` 8250 // StreamingLocatorID - StreamingLocatorId of Streaming Locator 8251 StreamingLocatorID *uuid.UUID `json:"streamingLocatorId,omitempty"` 8252 // 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' 8253 StreamingPolicyName *string `json:"streamingPolicyName,omitempty"` 8254 // DefaultContentKeyPolicyName - Default ContentKeyPolicy used by this Streaming Locator 8255 DefaultContentKeyPolicyName *string `json:"defaultContentKeyPolicyName,omitempty"` 8256 // ContentKeys - ContentKeys used by this Streaming Locator 8257 ContentKeys *[]StreamingLocatorContentKey `json:"contentKeys,omitempty"` 8258 // AlternativeMediaID - An Alternative Media Identifier associated with the StreamingLocator. This identifier can be used to distinguish different StreamingLocators for the same Asset for authorization purposes in the CustomLicenseAcquisitionUrlTemplate or the CustomKeyAcquisitionUrlTemplate of the StreamingPolicy specified in the StreamingPolicyName field. 8259 AlternativeMediaID *string `json:"alternativeMediaId,omitempty"` 8260} 8261 8262// MarshalJSON is the custom marshaler for StreamingLocatorProperties. 8263func (slp StreamingLocatorProperties) MarshalJSON() ([]byte, error) { 8264 objectMap := make(map[string]interface{}) 8265 if slp.AssetName != nil { 8266 objectMap["assetName"] = slp.AssetName 8267 } 8268 if slp.StartTime != nil { 8269 objectMap["startTime"] = slp.StartTime 8270 } 8271 if slp.EndTime != nil { 8272 objectMap["endTime"] = slp.EndTime 8273 } 8274 if slp.StreamingLocatorID != nil { 8275 objectMap["streamingLocatorId"] = slp.StreamingLocatorID 8276 } 8277 if slp.StreamingPolicyName != nil { 8278 objectMap["streamingPolicyName"] = slp.StreamingPolicyName 8279 } 8280 if slp.DefaultContentKeyPolicyName != nil { 8281 objectMap["defaultContentKeyPolicyName"] = slp.DefaultContentKeyPolicyName 8282 } 8283 if slp.ContentKeys != nil { 8284 objectMap["contentKeys"] = slp.ContentKeys 8285 } 8286 if slp.AlternativeMediaID != nil { 8287 objectMap["alternativeMediaId"] = slp.AlternativeMediaID 8288 } 8289 return json.Marshal(objectMap) 8290} 8291 8292// StreamingPath class of paths for streaming 8293type StreamingPath struct { 8294 // StreamingProtocol - Streaming protocol. Possible values include: 'StreamingPolicyStreamingProtocolHls', 'StreamingPolicyStreamingProtocolDash', 'StreamingPolicyStreamingProtocolSmoothStreaming', 'StreamingPolicyStreamingProtocolDownload' 8295 StreamingProtocol StreamingPolicyStreamingProtocol `json:"streamingProtocol,omitempty"` 8296 // EncryptionScheme - Encryption scheme. Possible values include: 'EncryptionSchemeNoEncryption', 'EncryptionSchemeEnvelopeEncryption', 'EncryptionSchemeCommonEncryptionCenc', 'EncryptionSchemeCommonEncryptionCbcs' 8297 EncryptionScheme EncryptionScheme `json:"encryptionScheme,omitempty"` 8298 // Paths - Streaming paths for each protocol and encryptionScheme pair 8299 Paths *[]string `json:"paths,omitempty"` 8300} 8301 8302// StreamingPolicy a Streaming Policy resource 8303type StreamingPolicy struct { 8304 autorest.Response `json:"-"` 8305 *StreamingPolicyProperties `json:"properties,omitempty"` 8306 // ID - READ-ONLY; Fully qualified resource ID for the resource. 8307 ID *string `json:"id,omitempty"` 8308 // Name - READ-ONLY; The name of the resource. 8309 Name *string `json:"name,omitempty"` 8310 // Type - READ-ONLY; The type of the resource. 8311 Type *string `json:"type,omitempty"` 8312} 8313 8314// MarshalJSON is the custom marshaler for StreamingPolicy. 8315func (sp StreamingPolicy) MarshalJSON() ([]byte, error) { 8316 objectMap := make(map[string]interface{}) 8317 if sp.StreamingPolicyProperties != nil { 8318 objectMap["properties"] = sp.StreamingPolicyProperties 8319 } 8320 return json.Marshal(objectMap) 8321} 8322 8323// UnmarshalJSON is the custom unmarshaler for StreamingPolicy struct. 8324func (sp *StreamingPolicy) UnmarshalJSON(body []byte) error { 8325 var m map[string]*json.RawMessage 8326 err := json.Unmarshal(body, &m) 8327 if err != nil { 8328 return err 8329 } 8330 for k, v := range m { 8331 switch k { 8332 case "properties": 8333 if v != nil { 8334 var streamingPolicyProperties StreamingPolicyProperties 8335 err = json.Unmarshal(*v, &streamingPolicyProperties) 8336 if err != nil { 8337 return err 8338 } 8339 sp.StreamingPolicyProperties = &streamingPolicyProperties 8340 } 8341 case "id": 8342 if v != nil { 8343 var ID string 8344 err = json.Unmarshal(*v, &ID) 8345 if err != nil { 8346 return err 8347 } 8348 sp.ID = &ID 8349 } 8350 case "name": 8351 if v != nil { 8352 var name string 8353 err = json.Unmarshal(*v, &name) 8354 if err != nil { 8355 return err 8356 } 8357 sp.Name = &name 8358 } 8359 case "type": 8360 if v != nil { 8361 var typeVar string 8362 err = json.Unmarshal(*v, &typeVar) 8363 if err != nil { 8364 return err 8365 } 8366 sp.Type = &typeVar 8367 } 8368 } 8369 } 8370 8371 return nil 8372} 8373 8374// StreamingPolicyCollection a collection of StreamingPolicy items. 8375type StreamingPolicyCollection struct { 8376 autorest.Response `json:"-"` 8377 // Value - A collection of StreamingPolicy items. 8378 Value *[]StreamingPolicy `json:"value,omitempty"` 8379 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 8380 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 8381} 8382 8383// StreamingPolicyCollectionIterator provides access to a complete listing of StreamingPolicy values. 8384type StreamingPolicyCollectionIterator struct { 8385 i int 8386 page StreamingPolicyCollectionPage 8387} 8388 8389// NextWithContext advances to the next value. If there was an error making 8390// the request the iterator does not advance and the error is returned. 8391func (iter *StreamingPolicyCollectionIterator) NextWithContext(ctx context.Context) (err error) { 8392 if tracing.IsEnabled() { 8393 ctx = tracing.StartSpan(ctx, fqdn+"/StreamingPolicyCollectionIterator.NextWithContext") 8394 defer func() { 8395 sc := -1 8396 if iter.Response().Response.Response != nil { 8397 sc = iter.Response().Response.Response.StatusCode 8398 } 8399 tracing.EndSpan(ctx, sc, err) 8400 }() 8401 } 8402 iter.i++ 8403 if iter.i < len(iter.page.Values()) { 8404 return nil 8405 } 8406 err = iter.page.NextWithContext(ctx) 8407 if err != nil { 8408 iter.i-- 8409 return err 8410 } 8411 iter.i = 0 8412 return nil 8413} 8414 8415// Next advances to the next value. If there was an error making 8416// the request the iterator does not advance and the error is returned. 8417// Deprecated: Use NextWithContext() instead. 8418func (iter *StreamingPolicyCollectionIterator) Next() error { 8419 return iter.NextWithContext(context.Background()) 8420} 8421 8422// NotDone returns true if the enumeration should be started or is not yet complete. 8423func (iter StreamingPolicyCollectionIterator) NotDone() bool { 8424 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 8425} 8426 8427// Response returns the raw server response from the last page request. 8428func (iter StreamingPolicyCollectionIterator) Response() StreamingPolicyCollection { 8429 return iter.page.Response() 8430} 8431 8432// Value returns the current value or a zero-initialized value if the 8433// iterator has advanced beyond the end of the collection. 8434func (iter StreamingPolicyCollectionIterator) Value() StreamingPolicy { 8435 if !iter.page.NotDone() { 8436 return StreamingPolicy{} 8437 } 8438 return iter.page.Values()[iter.i] 8439} 8440 8441// Creates a new instance of the StreamingPolicyCollectionIterator type. 8442func NewStreamingPolicyCollectionIterator(page StreamingPolicyCollectionPage) StreamingPolicyCollectionIterator { 8443 return StreamingPolicyCollectionIterator{page: page} 8444} 8445 8446// IsEmpty returns true if the ListResult contains no values. 8447func (spc StreamingPolicyCollection) IsEmpty() bool { 8448 return spc.Value == nil || len(*spc.Value) == 0 8449} 8450 8451// hasNextLink returns true if the NextLink is not empty. 8452func (spc StreamingPolicyCollection) hasNextLink() bool { 8453 return spc.OdataNextLink != nil && len(*spc.OdataNextLink) != 0 8454} 8455 8456// streamingPolicyCollectionPreparer prepares a request to retrieve the next set of results. 8457// It returns nil if no more results exist. 8458func (spc StreamingPolicyCollection) streamingPolicyCollectionPreparer(ctx context.Context) (*http.Request, error) { 8459 if !spc.hasNextLink() { 8460 return nil, nil 8461 } 8462 return autorest.Prepare((&http.Request{}).WithContext(ctx), 8463 autorest.AsJSON(), 8464 autorest.AsGet(), 8465 autorest.WithBaseURL(to.String(spc.OdataNextLink))) 8466} 8467 8468// StreamingPolicyCollectionPage contains a page of StreamingPolicy values. 8469type StreamingPolicyCollectionPage struct { 8470 fn func(context.Context, StreamingPolicyCollection) (StreamingPolicyCollection, error) 8471 spc StreamingPolicyCollection 8472} 8473 8474// NextWithContext advances to the next page of values. If there was an error making 8475// the request the page does not advance and the error is returned. 8476func (page *StreamingPolicyCollectionPage) NextWithContext(ctx context.Context) (err error) { 8477 if tracing.IsEnabled() { 8478 ctx = tracing.StartSpan(ctx, fqdn+"/StreamingPolicyCollectionPage.NextWithContext") 8479 defer func() { 8480 sc := -1 8481 if page.Response().Response.Response != nil { 8482 sc = page.Response().Response.Response.StatusCode 8483 } 8484 tracing.EndSpan(ctx, sc, err) 8485 }() 8486 } 8487 for { 8488 next, err := page.fn(ctx, page.spc) 8489 if err != nil { 8490 return err 8491 } 8492 page.spc = next 8493 if !next.hasNextLink() || !next.IsEmpty() { 8494 break 8495 } 8496 } 8497 return nil 8498} 8499 8500// Next advances to the next page of values. If there was an error making 8501// the request the page does not advance and the error is returned. 8502// Deprecated: Use NextWithContext() instead. 8503func (page *StreamingPolicyCollectionPage) Next() error { 8504 return page.NextWithContext(context.Background()) 8505} 8506 8507// NotDone returns true if the page enumeration should be started or is not yet complete. 8508func (page StreamingPolicyCollectionPage) NotDone() bool { 8509 return !page.spc.IsEmpty() 8510} 8511 8512// Response returns the raw server response from the last page request. 8513func (page StreamingPolicyCollectionPage) Response() StreamingPolicyCollection { 8514 return page.spc 8515} 8516 8517// Values returns the slice of values for the current page or nil if there are no values. 8518func (page StreamingPolicyCollectionPage) Values() []StreamingPolicy { 8519 if page.spc.IsEmpty() { 8520 return nil 8521 } 8522 return *page.spc.Value 8523} 8524 8525// Creates a new instance of the StreamingPolicyCollectionPage type. 8526func NewStreamingPolicyCollectionPage(cur StreamingPolicyCollection, getNextPage func(context.Context, StreamingPolicyCollection) (StreamingPolicyCollection, error)) StreamingPolicyCollectionPage { 8527 return StreamingPolicyCollectionPage{ 8528 fn: getNextPage, 8529 spc: cur, 8530 } 8531} 8532 8533// StreamingPolicyContentKey class to specify properties of content key 8534type StreamingPolicyContentKey struct { 8535 // Label - Label can be used to specify Content Key when creating a Streaming Locator 8536 Label *string `json:"label,omitempty"` 8537 // PolicyName - Policy used by Content Key 8538 PolicyName *string `json:"policyName,omitempty"` 8539 // Tracks - Tracks which use this content key 8540 Tracks *[]TrackSelection `json:"tracks,omitempty"` 8541} 8542 8543// StreamingPolicyContentKeys class to specify properties of all content keys in Streaming Policy 8544type StreamingPolicyContentKeys struct { 8545 // DefaultKey - Default content key for an encryption scheme 8546 DefaultKey *DefaultKey `json:"defaultKey,omitempty"` 8547 // KeyToTrackMappings - Representing tracks needs separate content key 8548 KeyToTrackMappings *[]StreamingPolicyContentKey `json:"keyToTrackMappings,omitempty"` 8549} 8550 8551// StreamingPolicyFairPlayConfiguration class to specify configurations of FairPlay in Streaming Policy 8552type StreamingPolicyFairPlayConfiguration struct { 8553 // CustomLicenseAcquisitionURLTemplate - The template for a customer service to deliver keys to end users. Not needed when using Azure Media Services for issuing keys. 8554 CustomLicenseAcquisitionURLTemplate *string `json:"customLicenseAcquisitionUrlTemplate,omitempty"` 8555 // AllowPersistentLicense - All license to be persistent or not 8556 AllowPersistentLicense *bool `json:"allowPersistentLicense,omitempty"` 8557} 8558 8559// StreamingPolicyPlayReadyConfiguration class to specify configurations of PlayReady in Streaming Policy 8560type StreamingPolicyPlayReadyConfiguration struct { 8561 // CustomLicenseAcquisitionURLTemplate - The template for a customer service to deliver keys to end users. Not needed when using Azure Media Services for issuing keys. 8562 CustomLicenseAcquisitionURLTemplate *string `json:"customLicenseAcquisitionUrlTemplate,omitempty"` 8563 // PlayReadyCustomAttributes - Custom attributes for PlayReady 8564 PlayReadyCustomAttributes *string `json:"playReadyCustomAttributes,omitempty"` 8565} 8566 8567// StreamingPolicyProperties class to specify properties of Streaming Policy 8568type StreamingPolicyProperties struct { 8569 // Created - READ-ONLY; Creation time of Streaming Policy 8570 Created *date.Time `json:"created,omitempty"` 8571 // DefaultContentKeyPolicyName - Default ContentKey used by current Streaming Policy 8572 DefaultContentKeyPolicyName *string `json:"defaultContentKeyPolicyName,omitempty"` 8573 // EnvelopeEncryption - Configuration of EnvelopeEncryption 8574 EnvelopeEncryption *EnvelopeEncryption `json:"envelopeEncryption,omitempty"` 8575 // CommonEncryptionCenc - Configuration of CommonEncryptionCenc 8576 CommonEncryptionCenc *CommonEncryptionCenc `json:"commonEncryptionCenc,omitempty"` 8577 // CommonEncryptionCbcs - Configuration of CommonEncryptionCbcs 8578 CommonEncryptionCbcs *CommonEncryptionCbcs `json:"commonEncryptionCbcs,omitempty"` 8579 // NoEncryption - Configurations of NoEncryption 8580 NoEncryption *NoEncryption `json:"noEncryption,omitempty"` 8581} 8582 8583// MarshalJSON is the custom marshaler for StreamingPolicyProperties. 8584func (spp StreamingPolicyProperties) MarshalJSON() ([]byte, error) { 8585 objectMap := make(map[string]interface{}) 8586 if spp.DefaultContentKeyPolicyName != nil { 8587 objectMap["defaultContentKeyPolicyName"] = spp.DefaultContentKeyPolicyName 8588 } 8589 if spp.EnvelopeEncryption != nil { 8590 objectMap["envelopeEncryption"] = spp.EnvelopeEncryption 8591 } 8592 if spp.CommonEncryptionCenc != nil { 8593 objectMap["commonEncryptionCenc"] = spp.CommonEncryptionCenc 8594 } 8595 if spp.CommonEncryptionCbcs != nil { 8596 objectMap["commonEncryptionCbcs"] = spp.CommonEncryptionCbcs 8597 } 8598 if spp.NoEncryption != nil { 8599 objectMap["noEncryption"] = spp.NoEncryption 8600 } 8601 return json.Marshal(objectMap) 8602} 8603 8604// StreamingPolicyWidevineConfiguration class to specify configurations of Widevine in Streaming Policy 8605type StreamingPolicyWidevineConfiguration struct { 8606 // CustomLicenseAcquisitionURLTemplate - The template for a customer service to deliver keys to end users. Not needed when using Azure Media Services for issuing keys. 8607 CustomLicenseAcquisitionURLTemplate *string `json:"customLicenseAcquisitionUrlTemplate,omitempty"` 8608} 8609 8610// SubscriptionMediaService a Media Services account. 8611type SubscriptionMediaService struct { 8612 autorest.Response `json:"-"` 8613 // ServiceProperties - The resource properties. 8614 *ServiceProperties `json:"properties,omitempty"` 8615 // Tags - Resource tags. 8616 Tags map[string]*string `json:"tags"` 8617 // Location - The Azure Region of the resource. 8618 Location *string `json:"location,omitempty"` 8619 // ID - READ-ONLY; Fully qualified resource ID for the resource. 8620 ID *string `json:"id,omitempty"` 8621 // Name - READ-ONLY; The name of the resource. 8622 Name *string `json:"name,omitempty"` 8623 // Type - READ-ONLY; The type of the resource. 8624 Type *string `json:"type,omitempty"` 8625} 8626 8627// MarshalJSON is the custom marshaler for SubscriptionMediaService. 8628func (sms SubscriptionMediaService) MarshalJSON() ([]byte, error) { 8629 objectMap := make(map[string]interface{}) 8630 if sms.ServiceProperties != nil { 8631 objectMap["properties"] = sms.ServiceProperties 8632 } 8633 if sms.Tags != nil { 8634 objectMap["tags"] = sms.Tags 8635 } 8636 if sms.Location != nil { 8637 objectMap["location"] = sms.Location 8638 } 8639 return json.Marshal(objectMap) 8640} 8641 8642// UnmarshalJSON is the custom unmarshaler for SubscriptionMediaService struct. 8643func (sms *SubscriptionMediaService) UnmarshalJSON(body []byte) error { 8644 var m map[string]*json.RawMessage 8645 err := json.Unmarshal(body, &m) 8646 if err != nil { 8647 return err 8648 } 8649 for k, v := range m { 8650 switch k { 8651 case "properties": 8652 if v != nil { 8653 var serviceProperties ServiceProperties 8654 err = json.Unmarshal(*v, &serviceProperties) 8655 if err != nil { 8656 return err 8657 } 8658 sms.ServiceProperties = &serviceProperties 8659 } 8660 case "tags": 8661 if v != nil { 8662 var tags map[string]*string 8663 err = json.Unmarshal(*v, &tags) 8664 if err != nil { 8665 return err 8666 } 8667 sms.Tags = tags 8668 } 8669 case "location": 8670 if v != nil { 8671 var location string 8672 err = json.Unmarshal(*v, &location) 8673 if err != nil { 8674 return err 8675 } 8676 sms.Location = &location 8677 } 8678 case "id": 8679 if v != nil { 8680 var ID string 8681 err = json.Unmarshal(*v, &ID) 8682 if err != nil { 8683 return err 8684 } 8685 sms.ID = &ID 8686 } 8687 case "name": 8688 if v != nil { 8689 var name string 8690 err = json.Unmarshal(*v, &name) 8691 if err != nil { 8692 return err 8693 } 8694 sms.Name = &name 8695 } 8696 case "type": 8697 if v != nil { 8698 var typeVar string 8699 err = json.Unmarshal(*v, &typeVar) 8700 if err != nil { 8701 return err 8702 } 8703 sms.Type = &typeVar 8704 } 8705 } 8706 } 8707 8708 return nil 8709} 8710 8711// SubscriptionMediaServiceCollection a collection of SubscriptionMediaService items. 8712type SubscriptionMediaServiceCollection struct { 8713 autorest.Response `json:"-"` 8714 // Value - A collection of SubscriptionMediaService items. 8715 Value *[]SubscriptionMediaService `json:"value,omitempty"` 8716 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 8717 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 8718} 8719 8720// SubscriptionMediaServiceCollectionIterator provides access to a complete listing of 8721// SubscriptionMediaService values. 8722type SubscriptionMediaServiceCollectionIterator struct { 8723 i int 8724 page SubscriptionMediaServiceCollectionPage 8725} 8726 8727// NextWithContext advances to the next value. If there was an error making 8728// the request the iterator does not advance and the error is returned. 8729func (iter *SubscriptionMediaServiceCollectionIterator) NextWithContext(ctx context.Context) (err error) { 8730 if tracing.IsEnabled() { 8731 ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionMediaServiceCollectionIterator.NextWithContext") 8732 defer func() { 8733 sc := -1 8734 if iter.Response().Response.Response != nil { 8735 sc = iter.Response().Response.Response.StatusCode 8736 } 8737 tracing.EndSpan(ctx, sc, err) 8738 }() 8739 } 8740 iter.i++ 8741 if iter.i < len(iter.page.Values()) { 8742 return nil 8743 } 8744 err = iter.page.NextWithContext(ctx) 8745 if err != nil { 8746 iter.i-- 8747 return err 8748 } 8749 iter.i = 0 8750 return nil 8751} 8752 8753// Next advances to the next value. If there was an error making 8754// the request the iterator does not advance and the error is returned. 8755// Deprecated: Use NextWithContext() instead. 8756func (iter *SubscriptionMediaServiceCollectionIterator) Next() error { 8757 return iter.NextWithContext(context.Background()) 8758} 8759 8760// NotDone returns true if the enumeration should be started or is not yet complete. 8761func (iter SubscriptionMediaServiceCollectionIterator) NotDone() bool { 8762 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 8763} 8764 8765// Response returns the raw server response from the last page request. 8766func (iter SubscriptionMediaServiceCollectionIterator) Response() SubscriptionMediaServiceCollection { 8767 return iter.page.Response() 8768} 8769 8770// Value returns the current value or a zero-initialized value if the 8771// iterator has advanced beyond the end of the collection. 8772func (iter SubscriptionMediaServiceCollectionIterator) Value() SubscriptionMediaService { 8773 if !iter.page.NotDone() { 8774 return SubscriptionMediaService{} 8775 } 8776 return iter.page.Values()[iter.i] 8777} 8778 8779// Creates a new instance of the SubscriptionMediaServiceCollectionIterator type. 8780func NewSubscriptionMediaServiceCollectionIterator(page SubscriptionMediaServiceCollectionPage) SubscriptionMediaServiceCollectionIterator { 8781 return SubscriptionMediaServiceCollectionIterator{page: page} 8782} 8783 8784// IsEmpty returns true if the ListResult contains no values. 8785func (smsc SubscriptionMediaServiceCollection) IsEmpty() bool { 8786 return smsc.Value == nil || len(*smsc.Value) == 0 8787} 8788 8789// hasNextLink returns true if the NextLink is not empty. 8790func (smsc SubscriptionMediaServiceCollection) hasNextLink() bool { 8791 return smsc.OdataNextLink != nil && len(*smsc.OdataNextLink) != 0 8792} 8793 8794// subscriptionMediaServiceCollectionPreparer prepares a request to retrieve the next set of results. 8795// It returns nil if no more results exist. 8796func (smsc SubscriptionMediaServiceCollection) subscriptionMediaServiceCollectionPreparer(ctx context.Context) (*http.Request, error) { 8797 if !smsc.hasNextLink() { 8798 return nil, nil 8799 } 8800 return autorest.Prepare((&http.Request{}).WithContext(ctx), 8801 autorest.AsJSON(), 8802 autorest.AsGet(), 8803 autorest.WithBaseURL(to.String(smsc.OdataNextLink))) 8804} 8805 8806// SubscriptionMediaServiceCollectionPage contains a page of SubscriptionMediaService values. 8807type SubscriptionMediaServiceCollectionPage struct { 8808 fn func(context.Context, SubscriptionMediaServiceCollection) (SubscriptionMediaServiceCollection, error) 8809 smsc SubscriptionMediaServiceCollection 8810} 8811 8812// NextWithContext advances to the next page of values. If there was an error making 8813// the request the page does not advance and the error is returned. 8814func (page *SubscriptionMediaServiceCollectionPage) NextWithContext(ctx context.Context) (err error) { 8815 if tracing.IsEnabled() { 8816 ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionMediaServiceCollectionPage.NextWithContext") 8817 defer func() { 8818 sc := -1 8819 if page.Response().Response.Response != nil { 8820 sc = page.Response().Response.Response.StatusCode 8821 } 8822 tracing.EndSpan(ctx, sc, err) 8823 }() 8824 } 8825 for { 8826 next, err := page.fn(ctx, page.smsc) 8827 if err != nil { 8828 return err 8829 } 8830 page.smsc = next 8831 if !next.hasNextLink() || !next.IsEmpty() { 8832 break 8833 } 8834 } 8835 return nil 8836} 8837 8838// Next advances to the next page of values. If there was an error making 8839// the request the page does not advance and the error is returned. 8840// Deprecated: Use NextWithContext() instead. 8841func (page *SubscriptionMediaServiceCollectionPage) Next() error { 8842 return page.NextWithContext(context.Background()) 8843} 8844 8845// NotDone returns true if the page enumeration should be started or is not yet complete. 8846func (page SubscriptionMediaServiceCollectionPage) NotDone() bool { 8847 return !page.smsc.IsEmpty() 8848} 8849 8850// Response returns the raw server response from the last page request. 8851func (page SubscriptionMediaServiceCollectionPage) Response() SubscriptionMediaServiceCollection { 8852 return page.smsc 8853} 8854 8855// Values returns the slice of values for the current page or nil if there are no values. 8856func (page SubscriptionMediaServiceCollectionPage) Values() []SubscriptionMediaService { 8857 if page.smsc.IsEmpty() { 8858 return nil 8859 } 8860 return *page.smsc.Value 8861} 8862 8863// Creates a new instance of the SubscriptionMediaServiceCollectionPage type. 8864func NewSubscriptionMediaServiceCollectionPage(cur SubscriptionMediaServiceCollection, getNextPage func(context.Context, SubscriptionMediaServiceCollection) (SubscriptionMediaServiceCollection, error)) SubscriptionMediaServiceCollectionPage { 8865 return SubscriptionMediaServiceCollectionPage{ 8866 fn: getNextPage, 8867 smsc: cur, 8868 } 8869} 8870 8871// SyncStorageKeysInput the input to the sync storage keys request. 8872type SyncStorageKeysInput struct { 8873 // ID - The ID of the storage account resource. 8874 ID *string `json:"id,omitempty"` 8875} 8876 8877// TrackedResource the resource model definition for a ARM tracked resource. 8878type TrackedResource struct { 8879 // Tags - Resource tags. 8880 Tags map[string]*string `json:"tags"` 8881 // Location - The Azure Region of the resource. 8882 Location *string `json:"location,omitempty"` 8883 // ID - READ-ONLY; Fully qualified resource ID for the resource. 8884 ID *string `json:"id,omitempty"` 8885 // Name - READ-ONLY; The name of the resource. 8886 Name *string `json:"name,omitempty"` 8887 // Type - READ-ONLY; The type of the resource. 8888 Type *string `json:"type,omitempty"` 8889} 8890 8891// MarshalJSON is the custom marshaler for TrackedResource. 8892func (tr TrackedResource) MarshalJSON() ([]byte, error) { 8893 objectMap := make(map[string]interface{}) 8894 if tr.Tags != nil { 8895 objectMap["tags"] = tr.Tags 8896 } 8897 if tr.Location != nil { 8898 objectMap["location"] = tr.Location 8899 } 8900 return json.Marshal(objectMap) 8901} 8902 8903// TrackPropertyCondition class to specify one track property condition 8904type TrackPropertyCondition struct { 8905 // Property - Track property type. Possible values include: 'TrackPropertyTypeUnknown', 'TrackPropertyTypeFourCC' 8906 Property TrackPropertyType `json:"property,omitempty"` 8907 // Operation - Track property condition operation. Possible values include: 'TrackPropertyCompareOperationUnknown', 'TrackPropertyCompareOperationEqual' 8908 Operation TrackPropertyCompareOperation `json:"operation,omitempty"` 8909 // Value - Track property value 8910 Value *string `json:"value,omitempty"` 8911} 8912 8913// TrackSelection class to select a track 8914type TrackSelection struct { 8915 // TrackSelections - TrackSelections is a track property condition list which can specify track(s) 8916 TrackSelections *[]TrackPropertyCondition `json:"trackSelections,omitempty"` 8917} 8918 8919// Transform a Transform encapsulates the rules or instructions for generating desired outputs from input 8920// media, such as by transcoding or by extracting insights. After the Transform is created, it can be 8921// applied to input media by creating Jobs. 8922type Transform struct { 8923 autorest.Response `json:"-"` 8924 // TransformProperties - The resource properties. 8925 *TransformProperties `json:"properties,omitempty"` 8926 // ID - READ-ONLY; Fully qualified resource ID for the resource. 8927 ID *string `json:"id,omitempty"` 8928 // Name - READ-ONLY; The name of the resource. 8929 Name *string `json:"name,omitempty"` 8930 // Type - READ-ONLY; The type of the resource. 8931 Type *string `json:"type,omitempty"` 8932} 8933 8934// MarshalJSON is the custom marshaler for Transform. 8935func (t Transform) MarshalJSON() ([]byte, error) { 8936 objectMap := make(map[string]interface{}) 8937 if t.TransformProperties != nil { 8938 objectMap["properties"] = t.TransformProperties 8939 } 8940 return json.Marshal(objectMap) 8941} 8942 8943// UnmarshalJSON is the custom unmarshaler for Transform struct. 8944func (t *Transform) UnmarshalJSON(body []byte) error { 8945 var m map[string]*json.RawMessage 8946 err := json.Unmarshal(body, &m) 8947 if err != nil { 8948 return err 8949 } 8950 for k, v := range m { 8951 switch k { 8952 case "properties": 8953 if v != nil { 8954 var transformProperties TransformProperties 8955 err = json.Unmarshal(*v, &transformProperties) 8956 if err != nil { 8957 return err 8958 } 8959 t.TransformProperties = &transformProperties 8960 } 8961 case "id": 8962 if v != nil { 8963 var ID string 8964 err = json.Unmarshal(*v, &ID) 8965 if err != nil { 8966 return err 8967 } 8968 t.ID = &ID 8969 } 8970 case "name": 8971 if v != nil { 8972 var name string 8973 err = json.Unmarshal(*v, &name) 8974 if err != nil { 8975 return err 8976 } 8977 t.Name = &name 8978 } 8979 case "type": 8980 if v != nil { 8981 var typeVar string 8982 err = json.Unmarshal(*v, &typeVar) 8983 if err != nil { 8984 return err 8985 } 8986 t.Type = &typeVar 8987 } 8988 } 8989 } 8990 8991 return nil 8992} 8993 8994// TransformCollection a collection of Transform items. 8995type TransformCollection struct { 8996 autorest.Response `json:"-"` 8997 // Value - A collection of Transform items. 8998 Value *[]Transform `json:"value,omitempty"` 8999 // OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response). 9000 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 9001} 9002 9003// TransformCollectionIterator provides access to a complete listing of Transform values. 9004type TransformCollectionIterator struct { 9005 i int 9006 page TransformCollectionPage 9007} 9008 9009// NextWithContext advances to the next value. If there was an error making 9010// the request the iterator does not advance and the error is returned. 9011func (iter *TransformCollectionIterator) NextWithContext(ctx context.Context) (err error) { 9012 if tracing.IsEnabled() { 9013 ctx = tracing.StartSpan(ctx, fqdn+"/TransformCollectionIterator.NextWithContext") 9014 defer func() { 9015 sc := -1 9016 if iter.Response().Response.Response != nil { 9017 sc = iter.Response().Response.Response.StatusCode 9018 } 9019 tracing.EndSpan(ctx, sc, err) 9020 }() 9021 } 9022 iter.i++ 9023 if iter.i < len(iter.page.Values()) { 9024 return nil 9025 } 9026 err = iter.page.NextWithContext(ctx) 9027 if err != nil { 9028 iter.i-- 9029 return err 9030 } 9031 iter.i = 0 9032 return nil 9033} 9034 9035// Next advances to the next value. If there was an error making 9036// the request the iterator does not advance and the error is returned. 9037// Deprecated: Use NextWithContext() instead. 9038func (iter *TransformCollectionIterator) Next() error { 9039 return iter.NextWithContext(context.Background()) 9040} 9041 9042// NotDone returns true if the enumeration should be started or is not yet complete. 9043func (iter TransformCollectionIterator) NotDone() bool { 9044 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 9045} 9046 9047// Response returns the raw server response from the last page request. 9048func (iter TransformCollectionIterator) Response() TransformCollection { 9049 return iter.page.Response() 9050} 9051 9052// Value returns the current value or a zero-initialized value if the 9053// iterator has advanced beyond the end of the collection. 9054func (iter TransformCollectionIterator) Value() Transform { 9055 if !iter.page.NotDone() { 9056 return Transform{} 9057 } 9058 return iter.page.Values()[iter.i] 9059} 9060 9061// Creates a new instance of the TransformCollectionIterator type. 9062func NewTransformCollectionIterator(page TransformCollectionPage) TransformCollectionIterator { 9063 return TransformCollectionIterator{page: page} 9064} 9065 9066// IsEmpty returns true if the ListResult contains no values. 9067func (tc TransformCollection) IsEmpty() bool { 9068 return tc.Value == nil || len(*tc.Value) == 0 9069} 9070 9071// hasNextLink returns true if the NextLink is not empty. 9072func (tc TransformCollection) hasNextLink() bool { 9073 return tc.OdataNextLink != nil && len(*tc.OdataNextLink) != 0 9074} 9075 9076// transformCollectionPreparer prepares a request to retrieve the next set of results. 9077// It returns nil if no more results exist. 9078func (tc TransformCollection) transformCollectionPreparer(ctx context.Context) (*http.Request, error) { 9079 if !tc.hasNextLink() { 9080 return nil, nil 9081 } 9082 return autorest.Prepare((&http.Request{}).WithContext(ctx), 9083 autorest.AsJSON(), 9084 autorest.AsGet(), 9085 autorest.WithBaseURL(to.String(tc.OdataNextLink))) 9086} 9087 9088// TransformCollectionPage contains a page of Transform values. 9089type TransformCollectionPage struct { 9090 fn func(context.Context, TransformCollection) (TransformCollection, error) 9091 tc TransformCollection 9092} 9093 9094// NextWithContext advances to the next page of values. If there was an error making 9095// the request the page does not advance and the error is returned. 9096func (page *TransformCollectionPage) NextWithContext(ctx context.Context) (err error) { 9097 if tracing.IsEnabled() { 9098 ctx = tracing.StartSpan(ctx, fqdn+"/TransformCollectionPage.NextWithContext") 9099 defer func() { 9100 sc := -1 9101 if page.Response().Response.Response != nil { 9102 sc = page.Response().Response.Response.StatusCode 9103 } 9104 tracing.EndSpan(ctx, sc, err) 9105 }() 9106 } 9107 for { 9108 next, err := page.fn(ctx, page.tc) 9109 if err != nil { 9110 return err 9111 } 9112 page.tc = next 9113 if !next.hasNextLink() || !next.IsEmpty() { 9114 break 9115 } 9116 } 9117 return nil 9118} 9119 9120// Next advances to the next page of values. If there was an error making 9121// the request the page does not advance and the error is returned. 9122// Deprecated: Use NextWithContext() instead. 9123func (page *TransformCollectionPage) Next() error { 9124 return page.NextWithContext(context.Background()) 9125} 9126 9127// NotDone returns true if the page enumeration should be started or is not yet complete. 9128func (page TransformCollectionPage) NotDone() bool { 9129 return !page.tc.IsEmpty() 9130} 9131 9132// Response returns the raw server response from the last page request. 9133func (page TransformCollectionPage) Response() TransformCollection { 9134 return page.tc 9135} 9136 9137// Values returns the slice of values for the current page or nil if there are no values. 9138func (page TransformCollectionPage) Values() []Transform { 9139 if page.tc.IsEmpty() { 9140 return nil 9141 } 9142 return *page.tc.Value 9143} 9144 9145// Creates a new instance of the TransformCollectionPage type. 9146func NewTransformCollectionPage(cur TransformCollection, getNextPage func(context.Context, TransformCollection) (TransformCollection, error)) TransformCollectionPage { 9147 return TransformCollectionPage{ 9148 fn: getNextPage, 9149 tc: cur, 9150 } 9151} 9152 9153// TransformOutput describes the properties of a TransformOutput, which are the rules to be applied while 9154// generating the desired output. 9155type TransformOutput struct { 9156 // 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' 9157 OnError OnErrorType `json:"onError,omitempty"` 9158 // 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' 9159 RelativePriority Priority `json:"relativePriority,omitempty"` 9160 // Preset - Preset that describes the operations that will be used to modify, transcode, or extract insights from the source file to generate the output. 9161 Preset BasicPreset `json:"preset,omitempty"` 9162} 9163 9164// UnmarshalJSON is the custom unmarshaler for TransformOutput struct. 9165func (toVar *TransformOutput) UnmarshalJSON(body []byte) error { 9166 var m map[string]*json.RawMessage 9167 err := json.Unmarshal(body, &m) 9168 if err != nil { 9169 return err 9170 } 9171 for k, v := range m { 9172 switch k { 9173 case "onError": 9174 if v != nil { 9175 var onError OnErrorType 9176 err = json.Unmarshal(*v, &onError) 9177 if err != nil { 9178 return err 9179 } 9180 toVar.OnError = onError 9181 } 9182 case "relativePriority": 9183 if v != nil { 9184 var relativePriority Priority 9185 err = json.Unmarshal(*v, &relativePriority) 9186 if err != nil { 9187 return err 9188 } 9189 toVar.RelativePriority = relativePriority 9190 } 9191 case "preset": 9192 if v != nil { 9193 preset, err := unmarshalBasicPreset(*v) 9194 if err != nil { 9195 return err 9196 } 9197 toVar.Preset = preset 9198 } 9199 } 9200 } 9201 9202 return nil 9203} 9204 9205// TransformProperties a Transform. 9206type TransformProperties struct { 9207 // Created - READ-ONLY; The UTC date and time when the Transform was created, in 'YYYY-MM-DDThh:mm:ssZ' format. 9208 Created *date.Time `json:"created,omitempty"` 9209 // Description - An optional verbose description of the Transform. 9210 Description *string `json:"description,omitempty"` 9211 // LastModified - READ-ONLY; The UTC date and time when the Transform was last updated, in 'YYYY-MM-DDThh:mm:ssZ' format. 9212 LastModified *date.Time `json:"lastModified,omitempty"` 9213 // Outputs - An array of one or more TransformOutputs that the Transform should generate. 9214 Outputs *[]TransformOutput `json:"outputs,omitempty"` 9215} 9216 9217// MarshalJSON is the custom marshaler for TransformProperties. 9218func (tp TransformProperties) MarshalJSON() ([]byte, error) { 9219 objectMap := make(map[string]interface{}) 9220 if tp.Description != nil { 9221 objectMap["description"] = tp.Description 9222 } 9223 if tp.Outputs != nil { 9224 objectMap["outputs"] = tp.Outputs 9225 } 9226 return json.Marshal(objectMap) 9227} 9228 9229// TransportStreamFormat describes the properties for generating an MPEG-2 Transport Stream (ISO/IEC 9230// 13818-1) output video file(s). 9231type TransportStreamFormat struct { 9232 // 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 . 9233 OutputFiles *[]OutputFile `json:"outputFiles,omitempty"` 9234 // 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. 9235 FilenamePattern *string `json:"filenamePattern,omitempty"` 9236 // OdataType - Possible values include: 'OdataTypeFormat', 'OdataTypeMicrosoftMediaImageFormat', 'OdataTypeMicrosoftMediaJpgFormat', 'OdataTypeMicrosoftMediaPngFormat', 'OdataTypeMicrosoftMediaMultiBitrateFormat', 'OdataTypeMicrosoftMediaMp4Format', 'OdataTypeMicrosoftMediaTransportStreamFormat' 9237 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"` 9238} 9239 9240// MarshalJSON is the custom marshaler for TransportStreamFormat. 9241func (tsf TransportStreamFormat) MarshalJSON() ([]byte, error) { 9242 tsf.OdataType = OdataTypeMicrosoftMediaTransportStreamFormat 9243 objectMap := make(map[string]interface{}) 9244 if tsf.OutputFiles != nil { 9245 objectMap["outputFiles"] = tsf.OutputFiles 9246 } 9247 if tsf.FilenamePattern != nil { 9248 objectMap["filenamePattern"] = tsf.FilenamePattern 9249 } 9250 if tsf.OdataType != "" { 9251 objectMap["@odata.type"] = tsf.OdataType 9252 } 9253 return json.Marshal(objectMap) 9254} 9255 9256// AsImageFormat is the BasicFormat implementation for TransportStreamFormat. 9257func (tsf TransportStreamFormat) AsImageFormat() (*ImageFormat, bool) { 9258 return nil, false 9259} 9260 9261// AsBasicImageFormat is the BasicFormat implementation for TransportStreamFormat. 9262func (tsf TransportStreamFormat) AsBasicImageFormat() (BasicImageFormat, bool) { 9263 return nil, false 9264} 9265 9266// AsJpgFormat is the BasicFormat implementation for TransportStreamFormat. 9267func (tsf TransportStreamFormat) AsJpgFormat() (*JpgFormat, bool) { 9268 return nil, false 9269} 9270 9271// AsPngFormat is the BasicFormat implementation for TransportStreamFormat. 9272func (tsf TransportStreamFormat) AsPngFormat() (*PngFormat, bool) { 9273 return nil, false 9274} 9275 9276// AsMultiBitrateFormat is the BasicFormat implementation for TransportStreamFormat. 9277func (tsf TransportStreamFormat) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) { 9278 return nil, false 9279} 9280 9281// AsBasicMultiBitrateFormat is the BasicFormat implementation for TransportStreamFormat. 9282func (tsf TransportStreamFormat) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) { 9283 return &tsf, true 9284} 9285 9286// AsMp4Format is the BasicFormat implementation for TransportStreamFormat. 9287func (tsf TransportStreamFormat) AsMp4Format() (*Mp4Format, bool) { 9288 return nil, false 9289} 9290 9291// AsTransportStreamFormat is the BasicFormat implementation for TransportStreamFormat. 9292func (tsf TransportStreamFormat) AsTransportStreamFormat() (*TransportStreamFormat, bool) { 9293 return &tsf, true 9294} 9295 9296// AsFormat is the BasicFormat implementation for TransportStreamFormat. 9297func (tsf TransportStreamFormat) AsFormat() (*Format, bool) { 9298 return nil, false 9299} 9300 9301// AsBasicFormat is the BasicFormat implementation for TransportStreamFormat. 9302func (tsf TransportStreamFormat) AsBasicFormat() (BasicFormat, bool) { 9303 return &tsf, true 9304} 9305 9306// BasicVideo describes the basic properties for encoding the input video. 9307type BasicVideo interface { 9308 AsImage() (*Image, bool) 9309 AsBasicImage() (BasicImage, bool) 9310 AsH264Video() (*H264Video, bool) 9311 AsJpgImage() (*JpgImage, bool) 9312 AsPngImage() (*PngImage, bool) 9313 AsVideo() (*Video, bool) 9314} 9315 9316// Video describes the basic properties for encoding the input video. 9317type Video struct { 9318 // 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). 9319 KeyFrameInterval *string `json:"keyFrameInterval,omitempty"` 9320 // 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' 9321 StretchMode StretchMode `json:"stretchMode,omitempty"` 9322 // Label - An optional label for the codec. The label can be used to control muxing behavior. 9323 Label *string `json:"label,omitempty"` 9324 // OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage' 9325 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"` 9326} 9327 9328func unmarshalBasicVideo(body []byte) (BasicVideo, error) { 9329 var m map[string]interface{} 9330 err := json.Unmarshal(body, &m) 9331 if err != nil { 9332 return nil, err 9333 } 9334 9335 switch m["@odata.type"] { 9336 case string(OdataTypeMicrosoftMediaImage): 9337 var i Image 9338 err := json.Unmarshal(body, &i) 9339 return i, err 9340 case string(OdataTypeMicrosoftMediaH264Video): 9341 var hv H264Video 9342 err := json.Unmarshal(body, &hv) 9343 return hv, err 9344 case string(OdataTypeMicrosoftMediaJpgImage): 9345 var ji JpgImage 9346 err := json.Unmarshal(body, &ji) 9347 return ji, err 9348 case string(OdataTypeMicrosoftMediaPngImage): 9349 var pi PngImage 9350 err := json.Unmarshal(body, &pi) 9351 return pi, err 9352 default: 9353 var vVar Video 9354 err := json.Unmarshal(body, &vVar) 9355 return vVar, err 9356 } 9357} 9358func unmarshalBasicVideoArray(body []byte) ([]BasicVideo, error) { 9359 var rawMessages []*json.RawMessage 9360 err := json.Unmarshal(body, &rawMessages) 9361 if err != nil { 9362 return nil, err 9363 } 9364 9365 vVarArray := make([]BasicVideo, len(rawMessages)) 9366 9367 for index, rawMessage := range rawMessages { 9368 vVar, err := unmarshalBasicVideo(*rawMessage) 9369 if err != nil { 9370 return nil, err 9371 } 9372 vVarArray[index] = vVar 9373 } 9374 return vVarArray, nil 9375} 9376 9377// MarshalJSON is the custom marshaler for Video. 9378func (vVar Video) MarshalJSON() ([]byte, error) { 9379 vVar.OdataType = OdataTypeMicrosoftMediaVideo 9380 objectMap := make(map[string]interface{}) 9381 if vVar.KeyFrameInterval != nil { 9382 objectMap["keyFrameInterval"] = vVar.KeyFrameInterval 9383 } 9384 if vVar.StretchMode != "" { 9385 objectMap["stretchMode"] = vVar.StretchMode 9386 } 9387 if vVar.Label != nil { 9388 objectMap["label"] = vVar.Label 9389 } 9390 if vVar.OdataType != "" { 9391 objectMap["@odata.type"] = vVar.OdataType 9392 } 9393 return json.Marshal(objectMap) 9394} 9395 9396// AsAudio is the BasicCodec implementation for Video. 9397func (vVar Video) AsAudio() (*Audio, bool) { 9398 return nil, false 9399} 9400 9401// AsBasicAudio is the BasicCodec implementation for Video. 9402func (vVar Video) AsBasicAudio() (BasicAudio, bool) { 9403 return nil, false 9404} 9405 9406// AsAacAudio is the BasicCodec implementation for Video. 9407func (vVar Video) AsAacAudio() (*AacAudio, bool) { 9408 return nil, false 9409} 9410 9411// AsCopyVideo is the BasicCodec implementation for Video. 9412func (vVar Video) AsCopyVideo() (*CopyVideo, bool) { 9413 return nil, false 9414} 9415 9416// AsVideo is the BasicCodec implementation for Video. 9417func (vVar Video) AsVideo() (*Video, bool) { 9418 return &vVar, true 9419} 9420 9421// AsBasicVideo is the BasicCodec implementation for Video. 9422func (vVar Video) AsBasicVideo() (BasicVideo, bool) { 9423 return &vVar, true 9424} 9425 9426// AsImage is the BasicCodec implementation for Video. 9427func (vVar Video) AsImage() (*Image, bool) { 9428 return nil, false 9429} 9430 9431// AsBasicImage is the BasicCodec implementation for Video. 9432func (vVar Video) AsBasicImage() (BasicImage, bool) { 9433 return nil, false 9434} 9435 9436// AsCopyAudio is the BasicCodec implementation for Video. 9437func (vVar Video) AsCopyAudio() (*CopyAudio, bool) { 9438 return nil, false 9439} 9440 9441// AsH264Video is the BasicCodec implementation for Video. 9442func (vVar Video) AsH264Video() (*H264Video, bool) { 9443 return nil, false 9444} 9445 9446// AsJpgImage is the BasicCodec implementation for Video. 9447func (vVar Video) AsJpgImage() (*JpgImage, bool) { 9448 return nil, false 9449} 9450 9451// AsPngImage is the BasicCodec implementation for Video. 9452func (vVar Video) AsPngImage() (*PngImage, bool) { 9453 return nil, false 9454} 9455 9456// AsCodec is the BasicCodec implementation for Video. 9457func (vVar Video) AsCodec() (*Codec, bool) { 9458 return nil, false 9459} 9460 9461// AsBasicCodec is the BasicCodec implementation for Video. 9462func (vVar Video) AsBasicCodec() (BasicCodec, bool) { 9463 return &vVar, true 9464} 9465 9466// VideoAnalyzerPreset a video analyzer preset that extracts insights (rich metadata) from both audio and 9467// video, and outputs a JSON format file. 9468type VideoAnalyzerPreset struct { 9469 // AudioInsightsOnly - Whether to only extract audio insights when processing a video file. 9470 AudioInsightsOnly *bool `json:"audioInsightsOnly,omitempty"` 9471 // 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'. 9472 AudioLanguage *string `json:"audioLanguage,omitempty"` 9473 // OdataType - Possible values include: 'OdataTypePreset', 'OdataTypeMicrosoftMediaAudioAnalyzerPreset', 'OdataTypeMicrosoftMediaBuiltInStandardEncoderPreset', 'OdataTypeMicrosoftMediaStandardEncoderPreset', 'OdataTypeMicrosoftMediaVideoAnalyzerPreset' 9474 OdataType OdataTypeBasicPreset `json:"@odata.type,omitempty"` 9475} 9476 9477// MarshalJSON is the custom marshaler for VideoAnalyzerPreset. 9478func (vap VideoAnalyzerPreset) MarshalJSON() ([]byte, error) { 9479 vap.OdataType = OdataTypeMicrosoftMediaVideoAnalyzerPreset 9480 objectMap := make(map[string]interface{}) 9481 if vap.AudioInsightsOnly != nil { 9482 objectMap["audioInsightsOnly"] = vap.AudioInsightsOnly 9483 } 9484 if vap.AudioLanguage != nil { 9485 objectMap["audioLanguage"] = vap.AudioLanguage 9486 } 9487 if vap.OdataType != "" { 9488 objectMap["@odata.type"] = vap.OdataType 9489 } 9490 return json.Marshal(objectMap) 9491} 9492 9493// AsAudioAnalyzerPreset is the BasicPreset implementation for VideoAnalyzerPreset. 9494func (vap VideoAnalyzerPreset) AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) { 9495 return nil, false 9496} 9497 9498// AsBasicAudioAnalyzerPreset is the BasicPreset implementation for VideoAnalyzerPreset. 9499func (vap VideoAnalyzerPreset) AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) { 9500 return &vap, true 9501} 9502 9503// AsBuiltInStandardEncoderPreset is the BasicPreset implementation for VideoAnalyzerPreset. 9504func (vap VideoAnalyzerPreset) AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) { 9505 return nil, false 9506} 9507 9508// AsStandardEncoderPreset is the BasicPreset implementation for VideoAnalyzerPreset. 9509func (vap VideoAnalyzerPreset) AsStandardEncoderPreset() (*StandardEncoderPreset, bool) { 9510 return nil, false 9511} 9512 9513// AsVideoAnalyzerPreset is the BasicPreset implementation for VideoAnalyzerPreset. 9514func (vap VideoAnalyzerPreset) AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) { 9515 return &vap, true 9516} 9517 9518// AsPreset is the BasicPreset implementation for VideoAnalyzerPreset. 9519func (vap VideoAnalyzerPreset) AsPreset() (*Preset, bool) { 9520 return nil, false 9521} 9522 9523// AsBasicPreset is the BasicPreset implementation for VideoAnalyzerPreset. 9524func (vap VideoAnalyzerPreset) AsBasicPreset() (BasicPreset, bool) { 9525 return &vap, true 9526} 9527 9528// BasicVideoLayer describes the settings to be used when encoding the input video into a desired output bitrate layer. 9529type BasicVideoLayer interface { 9530 AsH264Layer() (*H264Layer, bool) 9531 AsVideoLayer() (*VideoLayer, bool) 9532} 9533 9534// VideoLayer describes the settings to be used when encoding the input video into a desired output bitrate 9535// layer. 9536type VideoLayer struct { 9537 // Bitrate - The average bitrate in bits per second at which to encode the input video when generating this layer. This is a required field. 9538 Bitrate *int32 `json:"bitrate,omitempty"` 9539 // 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. 9540 MaxBitrate *int32 `json:"maxBitrate,omitempty"` 9541 // 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. 9542 BFrames *int32 `json:"bFrames,omitempty"` 9543 // 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. 9544 FrameRate *string `json:"frameRate,omitempty"` 9545 // 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. 9546 Slices *int32 `json:"slices,omitempty"` 9547 // 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. 9548 AdaptiveBFrame *bool `json:"adaptiveBFrame,omitempty"` 9549 // 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. 9550 Width *string `json:"width,omitempty"` 9551 // 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. 9552 Height *string `json:"height,omitempty"` 9553 // Label - The alphanumeric label for this layer, which can be used in multiplexing different video and audio layers, or in naming the output file. 9554 Label *string `json:"label,omitempty"` 9555 // OdataType - Possible values include: 'OdataTypeLayer', 'OdataTypeMicrosoftMediaVideoLayer', 'OdataTypeMicrosoftMediaH264Layer', 'OdataTypeMicrosoftMediaJpgLayer', 'OdataTypeMicrosoftMediaPngLayer' 9556 OdataType OdataTypeBasicLayer `json:"@odata.type,omitempty"` 9557} 9558 9559func unmarshalBasicVideoLayer(body []byte) (BasicVideoLayer, error) { 9560 var m map[string]interface{} 9561 err := json.Unmarshal(body, &m) 9562 if err != nil { 9563 return nil, err 9564 } 9565 9566 switch m["@odata.type"] { 9567 case string(OdataTypeMicrosoftMediaH264Layer): 9568 var hl H264Layer 9569 err := json.Unmarshal(body, &hl) 9570 return hl, err 9571 default: 9572 var vl VideoLayer 9573 err := json.Unmarshal(body, &vl) 9574 return vl, err 9575 } 9576} 9577func unmarshalBasicVideoLayerArray(body []byte) ([]BasicVideoLayer, error) { 9578 var rawMessages []*json.RawMessage 9579 err := json.Unmarshal(body, &rawMessages) 9580 if err != nil { 9581 return nil, err 9582 } 9583 9584 vlArray := make([]BasicVideoLayer, len(rawMessages)) 9585 9586 for index, rawMessage := range rawMessages { 9587 vl, err := unmarshalBasicVideoLayer(*rawMessage) 9588 if err != nil { 9589 return nil, err 9590 } 9591 vlArray[index] = vl 9592 } 9593 return vlArray, nil 9594} 9595 9596// MarshalJSON is the custom marshaler for VideoLayer. 9597func (vl VideoLayer) MarshalJSON() ([]byte, error) { 9598 vl.OdataType = OdataTypeMicrosoftMediaVideoLayer 9599 objectMap := make(map[string]interface{}) 9600 if vl.Bitrate != nil { 9601 objectMap["bitrate"] = vl.Bitrate 9602 } 9603 if vl.MaxBitrate != nil { 9604 objectMap["maxBitrate"] = vl.MaxBitrate 9605 } 9606 if vl.BFrames != nil { 9607 objectMap["bFrames"] = vl.BFrames 9608 } 9609 if vl.FrameRate != nil { 9610 objectMap["frameRate"] = vl.FrameRate 9611 } 9612 if vl.Slices != nil { 9613 objectMap["slices"] = vl.Slices 9614 } 9615 if vl.AdaptiveBFrame != nil { 9616 objectMap["adaptiveBFrame"] = vl.AdaptiveBFrame 9617 } 9618 if vl.Width != nil { 9619 objectMap["width"] = vl.Width 9620 } 9621 if vl.Height != nil { 9622 objectMap["height"] = vl.Height 9623 } 9624 if vl.Label != nil { 9625 objectMap["label"] = vl.Label 9626 } 9627 if vl.OdataType != "" { 9628 objectMap["@odata.type"] = vl.OdataType 9629 } 9630 return json.Marshal(objectMap) 9631} 9632 9633// AsVideoLayer is the BasicLayer implementation for VideoLayer. 9634func (vl VideoLayer) AsVideoLayer() (*VideoLayer, bool) { 9635 return &vl, true 9636} 9637 9638// AsBasicVideoLayer is the BasicLayer implementation for VideoLayer. 9639func (vl VideoLayer) AsBasicVideoLayer() (BasicVideoLayer, bool) { 9640 return &vl, true 9641} 9642 9643// AsH264Layer is the BasicLayer implementation for VideoLayer. 9644func (vl VideoLayer) AsH264Layer() (*H264Layer, bool) { 9645 return nil, false 9646} 9647 9648// AsJpgLayer is the BasicLayer implementation for VideoLayer. 9649func (vl VideoLayer) AsJpgLayer() (*JpgLayer, bool) { 9650 return nil, false 9651} 9652 9653// AsPngLayer is the BasicLayer implementation for VideoLayer. 9654func (vl VideoLayer) AsPngLayer() (*PngLayer, bool) { 9655 return nil, false 9656} 9657 9658// AsLayer is the BasicLayer implementation for VideoLayer. 9659func (vl VideoLayer) AsLayer() (*Layer, bool) { 9660 return nil, false 9661} 9662 9663// AsBasicLayer is the BasicLayer implementation for VideoLayer. 9664func (vl VideoLayer) AsBasicLayer() (BasicLayer, bool) { 9665 return &vl, true 9666} 9667 9668// VideoOverlay describes the properties of a video overlay. 9669type VideoOverlay struct { 9670 // Position - The location in the input video where the overlay is applied. 9671 Position *Rectangle `json:"position,omitempty"` 9672 // 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. 9673 Opacity *float64 `json:"opacity,omitempty"` 9674 // CropRectangle - An optional rectangular window used to crop the overlay image or video. 9675 CropRectangle *Rectangle `json:"cropRectangle,omitempty"` 9676 // 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. 9677 InputLabel *string `json:"inputLabel,omitempty"` 9678 // 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. 9679 Start *string `json:"start,omitempty"` 9680 // 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. 9681 End *string `json:"end,omitempty"` 9682 // 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). 9683 FadeInDuration *string `json:"fadeInDuration,omitempty"` 9684 // 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). 9685 FadeOutDuration *string `json:"fadeOutDuration,omitempty"` 9686 // AudioGainLevel - The gain level of audio in the overlay. The value should be in the range [0, 1.0]. The default is 1.0. 9687 AudioGainLevel *float64 `json:"audioGainLevel,omitempty"` 9688 // OdataType - Possible values include: 'OdataTypeOverlay', 'OdataTypeMicrosoftMediaAudioOverlay', 'OdataTypeMicrosoftMediaVideoOverlay' 9689 OdataType OdataTypeBasicOverlay `json:"@odata.type,omitempty"` 9690} 9691 9692// MarshalJSON is the custom marshaler for VideoOverlay. 9693func (vo VideoOverlay) MarshalJSON() ([]byte, error) { 9694 vo.OdataType = OdataTypeMicrosoftMediaVideoOverlay 9695 objectMap := make(map[string]interface{}) 9696 if vo.Position != nil { 9697 objectMap["position"] = vo.Position 9698 } 9699 if vo.Opacity != nil { 9700 objectMap["opacity"] = vo.Opacity 9701 } 9702 if vo.CropRectangle != nil { 9703 objectMap["cropRectangle"] = vo.CropRectangle 9704 } 9705 if vo.InputLabel != nil { 9706 objectMap["inputLabel"] = vo.InputLabel 9707 } 9708 if vo.Start != nil { 9709 objectMap["start"] = vo.Start 9710 } 9711 if vo.End != nil { 9712 objectMap["end"] = vo.End 9713 } 9714 if vo.FadeInDuration != nil { 9715 objectMap["fadeInDuration"] = vo.FadeInDuration 9716 } 9717 if vo.FadeOutDuration != nil { 9718 objectMap["fadeOutDuration"] = vo.FadeOutDuration 9719 } 9720 if vo.AudioGainLevel != nil { 9721 objectMap["audioGainLevel"] = vo.AudioGainLevel 9722 } 9723 if vo.OdataType != "" { 9724 objectMap["@odata.type"] = vo.OdataType 9725 } 9726 return json.Marshal(objectMap) 9727} 9728 9729// AsAudioOverlay is the BasicOverlay implementation for VideoOverlay. 9730func (vo VideoOverlay) AsAudioOverlay() (*AudioOverlay, bool) { 9731 return nil, false 9732} 9733 9734// AsVideoOverlay is the BasicOverlay implementation for VideoOverlay. 9735func (vo VideoOverlay) AsVideoOverlay() (*VideoOverlay, bool) { 9736 return &vo, true 9737} 9738 9739// AsOverlay is the BasicOverlay implementation for VideoOverlay. 9740func (vo VideoOverlay) AsOverlay() (*Overlay, bool) { 9741 return nil, false 9742} 9743 9744// AsBasicOverlay is the BasicOverlay implementation for VideoOverlay. 9745func (vo VideoOverlay) AsBasicOverlay() (BasicOverlay, bool) { 9746 return &vo, true 9747} 9748