1 package media
2
3
4
5
6
7
8
9 import (
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
22 const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/mediaservices/mgmt/2018-06-01-preview/media"
23
24
25 type AacAudio struct {
26
27 Profile AacAudioProfile `json:"profile,omitempty"`
28
29 Channels *int32 `json:"channels,omitempty"`
30
31 SamplingRate *int32 `json:"samplingRate,omitempty"`
32
33 Bitrate *int32 `json:"bitrate,omitempty"`
34
35 Label *string `json:"label,omitempty"`
36
37 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"`
38 }
39
40
41 func (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
66 func (aa AacAudio) AsAudio() (*Audio, bool) {
67 return nil, false
68 }
69
70
71 func (aa AacAudio) AsBasicAudio() (BasicAudio, bool) {
72 return &aa, true
73 }
74
75
76 func (aa AacAudio) AsAacAudio() (*AacAudio, bool) {
77 return &aa, true
78 }
79
80
81 func (aa AacAudio) AsCopyVideo() (*CopyVideo, bool) {
82 return nil, false
83 }
84
85
86 func (aa AacAudio) AsVideo() (*Video, bool) {
87 return nil, false
88 }
89
90
91 func (aa AacAudio) AsBasicVideo() (BasicVideo, bool) {
92 return nil, false
93 }
94
95
96 func (aa AacAudio) AsImage() (*Image, bool) {
97 return nil, false
98 }
99
100
101 func (aa AacAudio) AsBasicImage() (BasicImage, bool) {
102 return nil, false
103 }
104
105
106 func (aa AacAudio) AsCopyAudio() (*CopyAudio, bool) {
107 return nil, false
108 }
109
110
111 func (aa AacAudio) AsH264Video() (*H264Video, bool) {
112 return nil, false
113 }
114
115
116 func (aa AacAudio) AsJpgImage() (*JpgImage, bool) {
117 return nil, false
118 }
119
120
121 func (aa AacAudio) AsPngImage() (*PngImage, bool) {
122 return nil, false
123 }
124
125
126 func (aa AacAudio) AsCodec() (*Codec, bool) {
127 return nil, false
128 }
129
130
131 func (aa AacAudio) AsBasicCodec() (BasicCodec, bool) {
132 return &aa, true
133 }
134
135
136 type AkamaiAccessControl struct {
137
138 AkamaiSignatureHeaderAuthenticationKeyList *[]AkamaiSignatureHeaderAuthenticationKey `json:"akamaiSignatureHeaderAuthenticationKeyList,omitempty"`
139 }
140
141
142 type AkamaiSignatureHeaderAuthenticationKey struct {
143
144 Identifier *string `json:"identifier,omitempty"`
145
146 Base64Key *string `json:"base64Key,omitempty"`
147
148 Expiration *date.Time `json:"expiration,omitempty"`
149 }
150
151
152 type APIError struct {
153
154 Error *ODataError `json:"error,omitempty"`
155 }
156
157
158 type Asset struct {
159 autorest.Response `json:"-"`
160
161 *AssetProperties `json:"properties,omitempty"`
162
163 ID *string `json:"id,omitempty"`
164
165 Name *string `json:"name,omitempty"`
166
167 Type *string `json:"type,omitempty"`
168 }
169
170
171 func (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
180 func (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
231 type AssetCollection struct {
232 autorest.Response `json:"-"`
233
234 Value *[]Asset `json:"value,omitempty"`
235
236 OdataNextLink *string `json:"@odata.nextLink,omitempty"`
237 }
238
239
240 type AssetCollectionIterator struct {
241 i int
242 page AssetCollectionPage
243 }
244
245
246
247 func (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
272
273
274 func (iter *AssetCollectionIterator) Next() error {
275 return iter.NextWithContext(context.Background())
276 }
277
278
279 func (iter AssetCollectionIterator) NotDone() bool {
280 return iter.page.NotDone() && iter.i < len(iter.page.Values())
281 }
282
283
284 func (iter AssetCollectionIterator) Response() AssetCollection {
285 return iter.page.Response()
286 }
287
288
289
290 func (iter AssetCollectionIterator) Value() Asset {
291 if !iter.page.NotDone() {
292 return Asset{}
293 }
294 return iter.page.Values()[iter.i]
295 }
296
297
298 func NewAssetCollectionIterator(page AssetCollectionPage) AssetCollectionIterator {
299 return AssetCollectionIterator{page: page}
300 }
301
302
303 func (ac AssetCollection) IsEmpty() bool {
304 return ac.Value == nil || len(*ac.Value) == 0
305 }
306
307
308 func (ac AssetCollection) hasNextLink() bool {
309 return ac.OdataNextLink != nil && len(*ac.OdataNextLink) != 0
310 }
311
312
313
314 func (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
325 type AssetCollectionPage struct {
326 fn func(context.Context, AssetCollection) (AssetCollection, error)
327 ac AssetCollection
328 }
329
330
331
332 func (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
357
358
359 func (page *AssetCollectionPage) Next() error {
360 return page.NextWithContext(context.Background())
361 }
362
363
364 func (page AssetCollectionPage) NotDone() bool {
365 return !page.ac.IsEmpty()
366 }
367
368
369 func (page AssetCollectionPage) Response() AssetCollection {
370 return page.ac
371 }
372
373
374 func (page AssetCollectionPage) Values() []Asset {
375 if page.ac.IsEmpty() {
376 return nil
377 }
378 return *page.ac.Value
379 }
380
381
382 func NewAssetCollectionPage(cur AssetCollection, getNextPage func(context.Context, AssetCollection) (AssetCollection, error)) AssetCollectionPage {
383 return AssetCollectionPage{
384 fn: getNextPage,
385 ac: cur,
386 }
387 }
388
389
390 type AssetContainerSas struct {
391 autorest.Response `json:"-"`
392
393 AssetContainerSasUrls *[]string `json:"assetContainerSasUrls,omitempty"`
394 }
395
396
397 type AssetProperties struct {
398
399 AssetID *uuid.UUID `json:"assetId,omitempty"`
400
401 Created *date.Time `json:"created,omitempty"`
402
403 LastModified *date.Time `json:"lastModified,omitempty"`
404
405 AlternateID *string `json:"alternateId,omitempty"`
406
407 Description *string `json:"description,omitempty"`
408
409 Container *string `json:"container,omitempty"`
410
411 StorageAccountName *string `json:"storageAccountName,omitempty"`
412
413 StorageEncryptionFormat AssetStorageEncryptionFormat `json:"storageEncryptionFormat,omitempty"`
414 }
415
416
417 func (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
435 type AssetStorageEncryptionKey struct {
436 autorest.Response `json:"-"`
437
438 StorageEncryptionKey *string `json:"storageEncryptionKey,omitempty"`
439 }
440
441
442 type BasicAudio interface {
443 AsAacAudio() (*AacAudio, bool)
444 AsAudio() (*Audio, bool)
445 }
446
447
448 type Audio struct {
449
450 Channels *int32 `json:"channels,omitempty"`
451
452 SamplingRate *int32 `json:"samplingRate,omitempty"`
453
454 Bitrate *int32 `json:"bitrate,omitempty"`
455
456 Label *string `json:"label,omitempty"`
457
458 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"`
459 }
460
461 func 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 }
479 func 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
499 func (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
521 func (a Audio) AsAudio() (*Audio, bool) {
522 return &a, true
523 }
524
525
526 func (a Audio) AsBasicAudio() (BasicAudio, bool) {
527 return &a, true
528 }
529
530
531 func (a Audio) AsAacAudio() (*AacAudio, bool) {
532 return nil, false
533 }
534
535
536 func (a Audio) AsCopyVideo() (*CopyVideo, bool) {
537 return nil, false
538 }
539
540
541 func (a Audio) AsVideo() (*Video, bool) {
542 return nil, false
543 }
544
545
546 func (a Audio) AsBasicVideo() (BasicVideo, bool) {
547 return nil, false
548 }
549
550
551 func (a Audio) AsImage() (*Image, bool) {
552 return nil, false
553 }
554
555
556 func (a Audio) AsBasicImage() (BasicImage, bool) {
557 return nil, false
558 }
559
560
561 func (a Audio) AsCopyAudio() (*CopyAudio, bool) {
562 return nil, false
563 }
564
565
566 func (a Audio) AsH264Video() (*H264Video, bool) {
567 return nil, false
568 }
569
570
571 func (a Audio) AsJpgImage() (*JpgImage, bool) {
572 return nil, false
573 }
574
575
576 func (a Audio) AsPngImage() (*PngImage, bool) {
577 return nil, false
578 }
579
580
581 func (a Audio) AsCodec() (*Codec, bool) {
582 return nil, false
583 }
584
585
586 func (a Audio) AsBasicCodec() (BasicCodec, bool) {
587 return &a, true
588 }
589
590
591
592 type BasicAudioAnalyzerPreset interface {
593 AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool)
594 AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool)
595 }
596
597
598
599
600 type AudioAnalyzerPreset struct {
601
602 AudioLanguage *string `json:"audioLanguage,omitempty"`
603
604 OdataType OdataTypeBasicPreset `json:"@odata.type,omitempty"`
605 }
606
607 func 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 }
625 func 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
645 func (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
658 func (aap AudioAnalyzerPreset) AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) {
659 return &aap, true
660 }
661
662
663 func (aap AudioAnalyzerPreset) AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) {
664 return &aap, true
665 }
666
667
668 func (aap AudioAnalyzerPreset) AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) {
669 return nil, false
670 }
671
672
673 func (aap AudioAnalyzerPreset) AsStandardEncoderPreset() (*StandardEncoderPreset, bool) {
674 return nil, false
675 }
676
677
678 func (aap AudioAnalyzerPreset) AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) {
679 return nil, false
680 }
681
682
683 func (aap AudioAnalyzerPreset) AsPreset() (*Preset, bool) {
684 return nil, false
685 }
686
687
688 func (aap AudioAnalyzerPreset) AsBasicPreset() (BasicPreset, bool) {
689 return &aap, true
690 }
691
692
693 type AudioOverlay struct {
694
695 InputLabel *string `json:"inputLabel,omitempty"`
696
697 Start *string `json:"start,omitempty"`
698
699 End *string `json:"end,omitempty"`
700
701 FadeInDuration *string `json:"fadeInDuration,omitempty"`
702
703 FadeOutDuration *string `json:"fadeOutDuration,omitempty"`
704
705 AudioGainLevel *float64 `json:"audioGainLevel,omitempty"`
706
707 OdataType OdataTypeBasicOverlay `json:"@odata.type,omitempty"`
708 }
709
710
711 func (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
739 func (ao AudioOverlay) AsAudioOverlay() (*AudioOverlay, bool) {
740 return &ao, true
741 }
742
743
744 func (ao AudioOverlay) AsVideoOverlay() (*VideoOverlay, bool) {
745 return nil, false
746 }
747
748
749 func (ao AudioOverlay) AsOverlay() (*Overlay, bool) {
750 return nil, false
751 }
752
753
754 func (ao AudioOverlay) AsBasicOverlay() (BasicOverlay, bool) {
755 return &ao, true
756 }
757
758
759
760 type BuiltInStandardEncoderPreset struct {
761
762 PresetName EncoderNamedPreset `json:"presetName,omitempty"`
763
764 OdataType OdataTypeBasicPreset `json:"@odata.type,omitempty"`
765 }
766
767
768 func (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
781 func (bisep BuiltInStandardEncoderPreset) AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) {
782 return nil, false
783 }
784
785
786 func (bisep BuiltInStandardEncoderPreset) AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) {
787 return nil, false
788 }
789
790
791 func (bisep BuiltInStandardEncoderPreset) AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) {
792 return &bisep, true
793 }
794
795
796 func (bisep BuiltInStandardEncoderPreset) AsStandardEncoderPreset() (*StandardEncoderPreset, bool) {
797 return nil, false
798 }
799
800
801 func (bisep BuiltInStandardEncoderPreset) AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) {
802 return nil, false
803 }
804
805
806 func (bisep BuiltInStandardEncoderPreset) AsPreset() (*Preset, bool) {
807 return nil, false
808 }
809
810
811 func (bisep BuiltInStandardEncoderPreset) AsBasicPreset() (BasicPreset, bool) {
812 return &bisep, true
813 }
814
815
816
817 type CbcsDrmConfiguration struct {
818
819 FairPlay *StreamingPolicyFairPlayConfiguration `json:"fairPlay,omitempty"`
820
821 PlayReady *StreamingPolicyPlayReadyConfiguration `json:"playReady,omitempty"`
822
823 Widevine *StreamingPolicyWidevineConfiguration `json:"widevine,omitempty"`
824 }
825
826
827
828 type CencDrmConfiguration struct {
829
830 PlayReady *StreamingPolicyPlayReadyConfiguration `json:"playReady,omitempty"`
831
832 Widevine *StreamingPolicyWidevineConfiguration `json:"widevine,omitempty"`
833 }
834
835
836 type CheckNameAvailabilityInput struct {
837
838 Name *string `json:"name,omitempty"`
839
840 Type *string `json:"type,omitempty"`
841 }
842
843
844 type 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
861 type Codec struct {
862
863 Label *string `json:"label,omitempty"`
864
865 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"`
866 }
867
868 func 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 }
918 func 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
938 func (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
951 func (c Codec) AsAudio() (*Audio, bool) {
952 return nil, false
953 }
954
955
956 func (c Codec) AsBasicAudio() (BasicAudio, bool) {
957 return nil, false
958 }
959
960
961 func (c Codec) AsAacAudio() (*AacAudio, bool) {
962 return nil, false
963 }
964
965
966 func (c Codec) AsCopyVideo() (*CopyVideo, bool) {
967 return nil, false
968 }
969
970
971 func (c Codec) AsVideo() (*Video, bool) {
972 return nil, false
973 }
974
975
976 func (c Codec) AsBasicVideo() (BasicVideo, bool) {
977 return nil, false
978 }
979
980
981 func (c Codec) AsImage() (*Image, bool) {
982 return nil, false
983 }
984
985
986 func (c Codec) AsBasicImage() (BasicImage, bool) {
987 return nil, false
988 }
989
990
991 func (c Codec) AsCopyAudio() (*CopyAudio, bool) {
992 return nil, false
993 }
994
995
996 func (c Codec) AsH264Video() (*H264Video, bool) {
997 return nil, false
998 }
999
1000
1001 func (c Codec) AsJpgImage() (*JpgImage, bool) {
1002 return nil, false
1003 }
1004
1005
1006 func (c Codec) AsPngImage() (*PngImage, bool) {
1007 return nil, false
1008 }
1009
1010
1011 func (c Codec) AsCodec() (*Codec, bool) {
1012 return &c, true
1013 }
1014
1015
1016 func (c Codec) AsBasicCodec() (BasicCodec, bool) {
1017 return &c, true
1018 }
1019
1020
1021 type CommonEncryptionCbcs struct {
1022
1023 EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"`
1024
1025 ClearTracks *[]TrackSelection `json:"clearTracks,omitempty"`
1026
1027 ContentKeys *StreamingPolicyContentKeys `json:"contentKeys,omitempty"`
1028
1029 Drm *CbcsDrmConfiguration `json:"drm,omitempty"`
1030 }
1031
1032
1033 type CommonEncryptionCenc struct {
1034
1035 EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"`
1036
1037 ClearTracks *[]TrackSelection `json:"clearTracks,omitempty"`
1038
1039 ContentKeys *StreamingPolicyContentKeys `json:"contentKeys,omitempty"`
1040
1041 Drm *CencDrmConfiguration `json:"drm,omitempty"`
1042 }
1043
1044
1045 type ContentKeyPolicy struct {
1046 autorest.Response `json:"-"`
1047 *ContentKeyPolicyProperties `json:"properties,omitempty"`
1048
1049 ID *string `json:"id,omitempty"`
1050
1051 Name *string `json:"name,omitempty"`
1052
1053 Type *string `json:"type,omitempty"`
1054 }
1055
1056
1057 func (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
1066 func (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
1117 type ContentKeyPolicyClearKeyConfiguration struct {
1118
1119 OdataType OdataTypeBasicContentKeyPolicyConfiguration `json:"@odata.type,omitempty"`
1120 }
1121
1122
1123 func (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
1133 func (ckpckc ContentKeyPolicyClearKeyConfiguration) AsContentKeyPolicyClearKeyConfiguration() (*ContentKeyPolicyClearKeyConfiguration, bool) {
1134 return &ckpckc, true
1135 }
1136
1137
1138 func (ckpckc ContentKeyPolicyClearKeyConfiguration) AsContentKeyPolicyUnknownConfiguration() (*ContentKeyPolicyUnknownConfiguration, bool) {
1139 return nil, false
1140 }
1141
1142
1143 func (ckpckc ContentKeyPolicyClearKeyConfiguration) AsContentKeyPolicyWidevineConfiguration() (*ContentKeyPolicyWidevineConfiguration, bool) {
1144 return nil, false
1145 }
1146
1147
1148 func (ckpckc ContentKeyPolicyClearKeyConfiguration) AsContentKeyPolicyPlayReadyConfiguration() (*ContentKeyPolicyPlayReadyConfiguration, bool) {
1149 return nil, false
1150 }
1151
1152
1153 func (ckpckc ContentKeyPolicyClearKeyConfiguration) AsContentKeyPolicyFairPlayConfiguration() (*ContentKeyPolicyFairPlayConfiguration, bool) {
1154 return nil, false
1155 }
1156
1157
1158 func (ckpckc ContentKeyPolicyClearKeyConfiguration) AsContentKeyPolicyConfiguration() (*ContentKeyPolicyConfiguration, bool) {
1159 return nil, false
1160 }
1161
1162
1163 func (ckpckc ContentKeyPolicyClearKeyConfiguration) AsBasicContentKeyPolicyConfiguration() (BasicContentKeyPolicyConfiguration, bool) {
1164 return &ckpckc, true
1165 }
1166
1167
1168 type ContentKeyPolicyCollection struct {
1169 autorest.Response `json:"-"`
1170
1171 Value *[]ContentKeyPolicy `json:"value,omitempty"`
1172
1173 OdataNextLink *string `json:"@odata.nextLink,omitempty"`
1174 }
1175
1176
1177 type ContentKeyPolicyCollectionIterator struct {
1178 i int
1179 page ContentKeyPolicyCollectionPage
1180 }
1181
1182
1183
1184 func (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
1209
1210
1211 func (iter *ContentKeyPolicyCollectionIterator) Next() error {
1212 return iter.NextWithContext(context.Background())
1213 }
1214
1215
1216 func (iter ContentKeyPolicyCollectionIterator) NotDone() bool {
1217 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1218 }
1219
1220
1221 func (iter ContentKeyPolicyCollectionIterator) Response() ContentKeyPolicyCollection {
1222 return iter.page.Response()
1223 }
1224
1225
1226
1227 func (iter ContentKeyPolicyCollectionIterator) Value() ContentKeyPolicy {
1228 if !iter.page.NotDone() {
1229 return ContentKeyPolicy{}
1230 }
1231 return iter.page.Values()[iter.i]
1232 }
1233
1234
1235 func NewContentKeyPolicyCollectionIterator(page ContentKeyPolicyCollectionPage) ContentKeyPolicyCollectionIterator {
1236 return ContentKeyPolicyCollectionIterator{page: page}
1237 }
1238
1239
1240 func (ckpc ContentKeyPolicyCollection) IsEmpty() bool {
1241 return ckpc.Value == nil || len(*ckpc.Value) == 0
1242 }
1243
1244
1245 func (ckpc ContentKeyPolicyCollection) hasNextLink() bool {
1246 return ckpc.OdataNextLink != nil && len(*ckpc.OdataNextLink) != 0
1247 }
1248
1249
1250
1251 func (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
1262 type ContentKeyPolicyCollectionPage struct {
1263 fn func(context.Context, ContentKeyPolicyCollection) (ContentKeyPolicyCollection, error)
1264 ckpc ContentKeyPolicyCollection
1265 }
1266
1267
1268
1269 func (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
1294
1295
1296 func (page *ContentKeyPolicyCollectionPage) Next() error {
1297 return page.NextWithContext(context.Background())
1298 }
1299
1300
1301 func (page ContentKeyPolicyCollectionPage) NotDone() bool {
1302 return !page.ckpc.IsEmpty()
1303 }
1304
1305
1306 func (page ContentKeyPolicyCollectionPage) Response() ContentKeyPolicyCollection {
1307 return page.ckpc
1308 }
1309
1310
1311 func (page ContentKeyPolicyCollectionPage) Values() []ContentKeyPolicy {
1312 if page.ckpc.IsEmpty() {
1313 return nil
1314 }
1315 return *page.ckpc.Value
1316 }
1317
1318
1319 func NewContentKeyPolicyCollectionPage(cur ContentKeyPolicyCollection, getNextPage func(context.Context, ContentKeyPolicyCollection) (ContentKeyPolicyCollection, error)) ContentKeyPolicyCollectionPage {
1320 return ContentKeyPolicyCollectionPage{
1321 fn: getNextPage,
1322 ckpc: cur,
1323 }
1324 }
1325
1326
1327
1328 type 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
1338
1339 type ContentKeyPolicyConfiguration struct {
1340
1341 OdataType OdataTypeBasicContentKeyPolicyConfiguration `json:"@odata.type,omitempty"`
1342 }
1343
1344 func 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 }
1378 func 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
1398 func (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
1408 func (ckpc ContentKeyPolicyConfiguration) AsContentKeyPolicyClearKeyConfiguration() (*ContentKeyPolicyClearKeyConfiguration, bool) {
1409 return nil, false
1410 }
1411
1412
1413 func (ckpc ContentKeyPolicyConfiguration) AsContentKeyPolicyUnknownConfiguration() (*ContentKeyPolicyUnknownConfiguration, bool) {
1414 return nil, false
1415 }
1416
1417
1418 func (ckpc ContentKeyPolicyConfiguration) AsContentKeyPolicyWidevineConfiguration() (*ContentKeyPolicyWidevineConfiguration, bool) {
1419 return nil, false
1420 }
1421
1422
1423 func (ckpc ContentKeyPolicyConfiguration) AsContentKeyPolicyPlayReadyConfiguration() (*ContentKeyPolicyPlayReadyConfiguration, bool) {
1424 return nil, false
1425 }
1426
1427
1428 func (ckpc ContentKeyPolicyConfiguration) AsContentKeyPolicyFairPlayConfiguration() (*ContentKeyPolicyFairPlayConfiguration, bool) {
1429 return nil, false
1430 }
1431
1432
1433 func (ckpc ContentKeyPolicyConfiguration) AsContentKeyPolicyConfiguration() (*ContentKeyPolicyConfiguration, bool) {
1434 return &ckpc, true
1435 }
1436
1437
1438 func (ckpc ContentKeyPolicyConfiguration) AsBasicContentKeyPolicyConfiguration() (BasicContentKeyPolicyConfiguration, bool) {
1439 return &ckpc, true
1440 }
1441
1442
1443 type ContentKeyPolicyFairPlayConfiguration struct {
1444
1445 Ask *[]byte `json:"ask,omitempty"`
1446
1447 FairPlayPfxPassword *string `json:"fairPlayPfxPassword,omitempty"`
1448
1449 FairPlayPfx *string `json:"fairPlayPfx,omitempty"`
1450
1451 RentalAndLeaseKeyType ContentKeyPolicyFairPlayRentalAndLeaseKeyType `json:"rentalAndLeaseKeyType,omitempty"`
1452
1453 RentalDuration *int64 `json:"rentalDuration,omitempty"`
1454
1455 OdataType OdataTypeBasicContentKeyPolicyConfiguration `json:"@odata.type,omitempty"`
1456 }
1457
1458
1459 func (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
1484 func (ckpfpc ContentKeyPolicyFairPlayConfiguration) AsContentKeyPolicyClearKeyConfiguration() (*ContentKeyPolicyClearKeyConfiguration, bool) {
1485 return nil, false
1486 }
1487
1488
1489 func (ckpfpc ContentKeyPolicyFairPlayConfiguration) AsContentKeyPolicyUnknownConfiguration() (*ContentKeyPolicyUnknownConfiguration, bool) {
1490 return nil, false
1491 }
1492
1493
1494 func (ckpfpc ContentKeyPolicyFairPlayConfiguration) AsContentKeyPolicyWidevineConfiguration() (*ContentKeyPolicyWidevineConfiguration, bool) {
1495 return nil, false
1496 }
1497
1498
1499 func (ckpfpc ContentKeyPolicyFairPlayConfiguration) AsContentKeyPolicyPlayReadyConfiguration() (*ContentKeyPolicyPlayReadyConfiguration, bool) {
1500 return nil, false
1501 }
1502
1503
1504 func (ckpfpc ContentKeyPolicyFairPlayConfiguration) AsContentKeyPolicyFairPlayConfiguration() (*ContentKeyPolicyFairPlayConfiguration, bool) {
1505 return &ckpfpc, true
1506 }
1507
1508
1509 func (ckpfpc ContentKeyPolicyFairPlayConfiguration) AsContentKeyPolicyConfiguration() (*ContentKeyPolicyConfiguration, bool) {
1510 return nil, false
1511 }
1512
1513
1514 func (ckpfpc ContentKeyPolicyFairPlayConfiguration) AsBasicContentKeyPolicyConfiguration() (BasicContentKeyPolicyConfiguration, bool) {
1515 return &ckpfpc, true
1516 }
1517
1518
1519
1520 type ContentKeyPolicyOpenRestriction struct {
1521
1522 OdataType OdataTypeBasicContentKeyPolicyRestriction `json:"@odata.type,omitempty"`
1523 }
1524
1525
1526 func (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
1536 func (ckpor ContentKeyPolicyOpenRestriction) AsContentKeyPolicyOpenRestriction() (*ContentKeyPolicyOpenRestriction, bool) {
1537 return &ckpor, true
1538 }
1539
1540
1541 func (ckpor ContentKeyPolicyOpenRestriction) AsContentKeyPolicyUnknownRestriction() (*ContentKeyPolicyUnknownRestriction, bool) {
1542 return nil, false
1543 }
1544
1545
1546 func (ckpor ContentKeyPolicyOpenRestriction) AsContentKeyPolicyTokenRestriction() (*ContentKeyPolicyTokenRestriction, bool) {
1547 return nil, false
1548 }
1549
1550
1551 func (ckpor ContentKeyPolicyOpenRestriction) AsContentKeyPolicyRestriction() (*ContentKeyPolicyRestriction, bool) {
1552 return nil, false
1553 }
1554
1555
1556 func (ckpor ContentKeyPolicyOpenRestriction) AsBasicContentKeyPolicyRestriction() (BasicContentKeyPolicyRestriction, bool) {
1557 return &ckpor, true
1558 }
1559
1560
1561 type ContentKeyPolicyOption struct {
1562
1563 PolicyOptionID *uuid.UUID `json:"policyOptionId,omitempty"`
1564
1565 Name *string `json:"name,omitempty"`
1566
1567 Configuration BasicContentKeyPolicyConfiguration `json:"configuration,omitempty"`
1568
1569 Restriction BasicContentKeyPolicyRestriction `json:"restriction,omitempty"`
1570 }
1571
1572
1573 func (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
1584 func (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
1633 type ContentKeyPolicyPlayReadyConfiguration struct {
1634
1635 Licenses *[]ContentKeyPolicyPlayReadyLicense `json:"licenses,omitempty"`
1636
1637 ResponseCustomData *string `json:"responseCustomData,omitempty"`
1638
1639 OdataType OdataTypeBasicContentKeyPolicyConfiguration `json:"@odata.type,omitempty"`
1640 }
1641
1642
1643 func (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
1659 func (ckpprc ContentKeyPolicyPlayReadyConfiguration) AsContentKeyPolicyClearKeyConfiguration() (*ContentKeyPolicyClearKeyConfiguration, bool) {
1660 return nil, false
1661 }
1662
1663
1664 func (ckpprc ContentKeyPolicyPlayReadyConfiguration) AsContentKeyPolicyUnknownConfiguration() (*ContentKeyPolicyUnknownConfiguration, bool) {
1665 return nil, false
1666 }
1667
1668
1669 func (ckpprc ContentKeyPolicyPlayReadyConfiguration) AsContentKeyPolicyWidevineConfiguration() (*ContentKeyPolicyWidevineConfiguration, bool) {
1670 return nil, false
1671 }
1672
1673
1674 func (ckpprc ContentKeyPolicyPlayReadyConfiguration) AsContentKeyPolicyPlayReadyConfiguration() (*ContentKeyPolicyPlayReadyConfiguration, bool) {
1675 return &ckpprc, true
1676 }
1677
1678
1679 func (ckpprc ContentKeyPolicyPlayReadyConfiguration) AsContentKeyPolicyFairPlayConfiguration() (*ContentKeyPolicyFairPlayConfiguration, bool) {
1680 return nil, false
1681 }
1682
1683
1684 func (ckpprc ContentKeyPolicyPlayReadyConfiguration) AsContentKeyPolicyConfiguration() (*ContentKeyPolicyConfiguration, bool) {
1685 return nil, false
1686 }
1687
1688
1689 func (ckpprc ContentKeyPolicyPlayReadyConfiguration) AsBasicContentKeyPolicyConfiguration() (BasicContentKeyPolicyConfiguration, bool) {
1690 return &ckpprc, true
1691 }
1692
1693
1694
1695 type ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader struct {
1696
1697 OdataType OdataType `json:"@odata.type,omitempty"`
1698 }
1699
1700
1701 func (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
1711 func (ckpprcekfh ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) AsContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader() (*ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, bool) {
1712 return &ckpprcekfh, true
1713 }
1714
1715
1716 func (ckpprcekfh ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) AsContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier() (*ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier, bool) {
1717 return nil, false
1718 }
1719
1720
1721 func (ckpprcekfh ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) AsContentKeyPolicyPlayReadyContentKeyLocation() (*ContentKeyPolicyPlayReadyContentKeyLocation, bool) {
1722 return nil, false
1723 }
1724
1725
1726 func (ckpprcekfh ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) AsBasicContentKeyPolicyPlayReadyContentKeyLocation() (BasicContentKeyPolicyPlayReadyContentKeyLocation, bool) {
1727 return &ckpprcekfh, true
1728 }
1729
1730
1731
1732 type ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier struct {
1733
1734 KeyID *uuid.UUID `json:"keyId,omitempty"`
1735
1736 OdataType OdataType `json:"@odata.type,omitempty"`
1737 }
1738
1739
1740 func (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
1753 func (ckpprcekfki ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) AsContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader() (*ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, bool) {
1754 return nil, false
1755 }
1756
1757
1758 func (ckpprcekfki ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) AsContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier() (*ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier, bool) {
1759 return &ckpprcekfki, true
1760 }
1761
1762
1763 func (ckpprcekfki ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) AsContentKeyPolicyPlayReadyContentKeyLocation() (*ContentKeyPolicyPlayReadyContentKeyLocation, bool) {
1764 return nil, false
1765 }
1766
1767
1768 func (ckpprcekfki ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) AsBasicContentKeyPolicyPlayReadyContentKeyLocation() (BasicContentKeyPolicyPlayReadyContentKeyLocation, bool) {
1769 return &ckpprcekfki, true
1770 }
1771
1772
1773
1774 type BasicContentKeyPolicyPlayReadyContentKeyLocation interface {
1775 AsContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader() (*ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, bool)
1776 AsContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier() (*ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier, bool)
1777 AsContentKeyPolicyPlayReadyContentKeyLocation() (*ContentKeyPolicyPlayReadyContentKeyLocation, bool)
1778 }
1779
1780
1781
1782 type ContentKeyPolicyPlayReadyContentKeyLocation struct {
1783
1784 OdataType OdataType `json:"@odata.type,omitempty"`
1785 }
1786
1787 func 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 }
1809 func 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
1829 func (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
1839 func (ckpprckl ContentKeyPolicyPlayReadyContentKeyLocation) AsContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader() (*ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, bool) {
1840 return nil, false
1841 }
1842
1843
1844 func (ckpprckl ContentKeyPolicyPlayReadyContentKeyLocation) AsContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier() (*ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier, bool) {
1845 return nil, false
1846 }
1847
1848
1849 func (ckpprckl ContentKeyPolicyPlayReadyContentKeyLocation) AsContentKeyPolicyPlayReadyContentKeyLocation() (*ContentKeyPolicyPlayReadyContentKeyLocation, bool) {
1850 return &ckpprckl, true
1851 }
1852
1853
1854 func (ckpprckl ContentKeyPolicyPlayReadyContentKeyLocation) AsBasicContentKeyPolicyPlayReadyContentKeyLocation() (BasicContentKeyPolicyPlayReadyContentKeyLocation, bool) {
1855 return &ckpprckl, true
1856 }
1857
1858
1859
1860 type ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction struct {
1861
1862 BestEffort *bool `json:"bestEffort,omitempty"`
1863
1864 ConfigurationData *int32 `json:"configurationData,omitempty"`
1865 }
1866
1867
1868 type ContentKeyPolicyPlayReadyLicense struct {
1869
1870 AllowTestDevices *bool `json:"allowTestDevices,omitempty"`
1871
1872 BeginDate *date.Time `json:"beginDate,omitempty"`
1873
1874 ExpirationDate *date.Time `json:"expirationDate,omitempty"`
1875
1876 RelativeBeginDate *string `json:"relativeBeginDate,omitempty"`
1877
1878 RelativeExpirationDate *string `json:"relativeExpirationDate,omitempty"`
1879
1880 GracePeriod *string `json:"gracePeriod,omitempty"`
1881
1882 PlayRight *ContentKeyPolicyPlayReadyPlayRight `json:"playRight,omitempty"`
1883
1884 LicenseType ContentKeyPolicyPlayReadyLicenseType `json:"licenseType,omitempty"`
1885
1886 ContentKeyLocation BasicContentKeyPolicyPlayReadyContentKeyLocation `json:"contentKeyLocation,omitempty"`
1887
1888 ContentType ContentKeyPolicyPlayReadyContentType `json:"contentType,omitempty"`
1889 }
1890
1891
1892 func (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
1996 type ContentKeyPolicyPlayReadyPlayRight struct {
1997
1998 FirstPlayExpiration *string `json:"firstPlayExpiration,omitempty"`
1999
2000 ScmsRestriction *int32 `json:"scmsRestriction,omitempty"`
2001
2002 AgcAndColorStripeRestriction *int32 `json:"agcAndColorStripeRestriction,omitempty"`
2003
2004 ExplicitAnalogTelevisionOutputRestriction *ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction `json:"explicitAnalogTelevisionOutputRestriction,omitempty"`
2005
2006 DigitalVideoOnlyContentRestriction *bool `json:"digitalVideoOnlyContentRestriction,omitempty"`
2007
2008 ImageConstraintForAnalogComponentVideoRestriction *bool `json:"imageConstraintForAnalogComponentVideoRestriction,omitempty"`
2009
2010 ImageConstraintForAnalogComputerMonitorRestriction *bool `json:"imageConstraintForAnalogComputerMonitorRestriction,omitempty"`
2011
2012 AllowPassingVideoContentToUnknownOutput ContentKeyPolicyPlayReadyUnknownOutputPassingOption `json:"allowPassingVideoContentToUnknownOutput,omitempty"`
2013
2014 UncompressedDigitalVideoOpl *int32 `json:"uncompressedDigitalVideoOpl,omitempty"`
2015
2016 CompressedDigitalVideoOpl *int32 `json:"compressedDigitalVideoOpl,omitempty"`
2017
2018 AnalogVideoOpl *int32 `json:"analogVideoOpl,omitempty"`
2019
2020 CompressedDigitalAudioOpl *int32 `json:"compressedDigitalAudioOpl,omitempty"`
2021
2022 UncompressedDigitalAudioOpl *int32 `json:"uncompressedDigitalAudioOpl,omitempty"`
2023 }
2024
2025
2026 type ContentKeyPolicyProperties struct {
2027 autorest.Response `json:"-"`
2028
2029 PolicyID *uuid.UUID `json:"policyId,omitempty"`
2030
2031 Created *date.Time `json:"created,omitempty"`
2032
2033 LastModified *date.Time `json:"lastModified,omitempty"`
2034
2035 Description *string `json:"description,omitempty"`
2036
2037 Options *[]ContentKeyPolicyOption `json:"options,omitempty"`
2038 }
2039
2040
2041 func (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
2053
2054 type BasicContentKeyPolicyRestriction interface {
2055 AsContentKeyPolicyOpenRestriction() (*ContentKeyPolicyOpenRestriction, bool)
2056 AsContentKeyPolicyUnknownRestriction() (*ContentKeyPolicyUnknownRestriction, bool)
2057 AsContentKeyPolicyTokenRestriction() (*ContentKeyPolicyTokenRestriction, bool)
2058 AsContentKeyPolicyRestriction() (*ContentKeyPolicyRestriction, bool)
2059 }
2060
2061
2062
2063 type ContentKeyPolicyRestriction struct {
2064
2065 OdataType OdataTypeBasicContentKeyPolicyRestriction `json:"@odata.type,omitempty"`
2066 }
2067
2068 func 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 }
2094 func 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
2114 func (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
2124 func (ckpr ContentKeyPolicyRestriction) AsContentKeyPolicyOpenRestriction() (*ContentKeyPolicyOpenRestriction, bool) {
2125 return nil, false
2126 }
2127
2128
2129 func (ckpr ContentKeyPolicyRestriction) AsContentKeyPolicyUnknownRestriction() (*ContentKeyPolicyUnknownRestriction, bool) {
2130 return nil, false
2131 }
2132
2133
2134 func (ckpr ContentKeyPolicyRestriction) AsContentKeyPolicyTokenRestriction() (*ContentKeyPolicyTokenRestriction, bool) {
2135 return nil, false
2136 }
2137
2138
2139 func (ckpr ContentKeyPolicyRestriction) AsContentKeyPolicyRestriction() (*ContentKeyPolicyRestriction, bool) {
2140 return &ckpr, true
2141 }
2142
2143
2144 func (ckpr ContentKeyPolicyRestriction) AsBasicContentKeyPolicyRestriction() (BasicContentKeyPolicyRestriction, bool) {
2145 return &ckpr, true
2146 }
2147
2148
2149
2150 type BasicContentKeyPolicyRestrictionTokenKey interface {
2151 AsContentKeyPolicySymmetricTokenKey() (*ContentKeyPolicySymmetricTokenKey, bool)
2152 AsContentKeyPolicyRsaTokenKey() (*ContentKeyPolicyRsaTokenKey, bool)
2153 AsContentKeyPolicyX509CertificateTokenKey() (*ContentKeyPolicyX509CertificateTokenKey, bool)
2154 AsContentKeyPolicyRestrictionTokenKey() (*ContentKeyPolicyRestrictionTokenKey, bool)
2155 }
2156
2157
2158
2159 type ContentKeyPolicyRestrictionTokenKey struct {
2160
2161 OdataType OdataTypeBasicContentKeyPolicyRestrictionTokenKey `json:"@odata.type,omitempty"`
2162 }
2163
2164 func 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 }
2190 func 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
2210 func (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
2220 func (ckprtk ContentKeyPolicyRestrictionTokenKey) AsContentKeyPolicySymmetricTokenKey() (*ContentKeyPolicySymmetricTokenKey, bool) {
2221 return nil, false
2222 }
2223
2224
2225 func (ckprtk ContentKeyPolicyRestrictionTokenKey) AsContentKeyPolicyRsaTokenKey() (*ContentKeyPolicyRsaTokenKey, bool) {
2226 return nil, false
2227 }
2228
2229
2230 func (ckprtk ContentKeyPolicyRestrictionTokenKey) AsContentKeyPolicyX509CertificateTokenKey() (*ContentKeyPolicyX509CertificateTokenKey, bool) {
2231 return nil, false
2232 }
2233
2234
2235 func (ckprtk ContentKeyPolicyRestrictionTokenKey) AsContentKeyPolicyRestrictionTokenKey() (*ContentKeyPolicyRestrictionTokenKey, bool) {
2236 return &ckprtk, true
2237 }
2238
2239
2240 func (ckprtk ContentKeyPolicyRestrictionTokenKey) AsBasicContentKeyPolicyRestrictionTokenKey() (BasicContentKeyPolicyRestrictionTokenKey, bool) {
2241 return &ckprtk, true
2242 }
2243
2244
2245 type ContentKeyPolicyRsaTokenKey struct {
2246
2247 Exponent *[]byte `json:"exponent,omitempty"`
2248
2249 Modulus *[]byte `json:"modulus,omitempty"`
2250
2251 OdataType OdataTypeBasicContentKeyPolicyRestrictionTokenKey `json:"@odata.type,omitempty"`
2252 }
2253
2254
2255 func (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
2271 func (ckprtk ContentKeyPolicyRsaTokenKey) AsContentKeyPolicySymmetricTokenKey() (*ContentKeyPolicySymmetricTokenKey, bool) {
2272 return nil, false
2273 }
2274
2275
2276 func (ckprtk ContentKeyPolicyRsaTokenKey) AsContentKeyPolicyRsaTokenKey() (*ContentKeyPolicyRsaTokenKey, bool) {
2277 return &ckprtk, true
2278 }
2279
2280
2281 func (ckprtk ContentKeyPolicyRsaTokenKey) AsContentKeyPolicyX509CertificateTokenKey() (*ContentKeyPolicyX509CertificateTokenKey, bool) {
2282 return nil, false
2283 }
2284
2285
2286 func (ckprtk ContentKeyPolicyRsaTokenKey) AsContentKeyPolicyRestrictionTokenKey() (*ContentKeyPolicyRestrictionTokenKey, bool) {
2287 return nil, false
2288 }
2289
2290
2291 func (ckprtk ContentKeyPolicyRsaTokenKey) AsBasicContentKeyPolicyRestrictionTokenKey() (BasicContentKeyPolicyRestrictionTokenKey, bool) {
2292 return &ckprtk, true
2293 }
2294
2295
2296 type ContentKeyPolicySymmetricTokenKey struct {
2297
2298 KeyValue *[]byte `json:"keyValue,omitempty"`
2299
2300 OdataType OdataTypeBasicContentKeyPolicyRestrictionTokenKey `json:"@odata.type,omitempty"`
2301 }
2302
2303
2304 func (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
2317 func (ckpstk ContentKeyPolicySymmetricTokenKey) AsContentKeyPolicySymmetricTokenKey() (*ContentKeyPolicySymmetricTokenKey, bool) {
2318 return &ckpstk, true
2319 }
2320
2321
2322 func (ckpstk ContentKeyPolicySymmetricTokenKey) AsContentKeyPolicyRsaTokenKey() (*ContentKeyPolicyRsaTokenKey, bool) {
2323 return nil, false
2324 }
2325
2326
2327 func (ckpstk ContentKeyPolicySymmetricTokenKey) AsContentKeyPolicyX509CertificateTokenKey() (*ContentKeyPolicyX509CertificateTokenKey, bool) {
2328 return nil, false
2329 }
2330
2331
2332 func (ckpstk ContentKeyPolicySymmetricTokenKey) AsContentKeyPolicyRestrictionTokenKey() (*ContentKeyPolicyRestrictionTokenKey, bool) {
2333 return nil, false
2334 }
2335
2336
2337 func (ckpstk ContentKeyPolicySymmetricTokenKey) AsBasicContentKeyPolicyRestrictionTokenKey() (BasicContentKeyPolicyRestrictionTokenKey, bool) {
2338 return &ckpstk, true
2339 }
2340
2341
2342 type ContentKeyPolicyTokenClaim struct {
2343
2344 ClaimType *string `json:"claimType,omitempty"`
2345
2346 ClaimValue *string `json:"claimValue,omitempty"`
2347 }
2348
2349
2350
2351 type ContentKeyPolicyTokenRestriction struct {
2352
2353 Issuer *string `json:"issuer,omitempty"`
2354
2355 Audience *string `json:"audience,omitempty"`
2356
2357 PrimaryVerificationKey BasicContentKeyPolicyRestrictionTokenKey `json:"primaryVerificationKey,omitempty"`
2358
2359 AlternateVerificationKeys *[]BasicContentKeyPolicyRestrictionTokenKey `json:"alternateVerificationKeys,omitempty"`
2360
2361 RequiredClaims *[]ContentKeyPolicyTokenClaim `json:"requiredClaims,omitempty"`
2362
2363 RestrictionTokenType ContentKeyPolicyRestrictionTokenType `json:"restrictionTokenType,omitempty"`
2364
2365 OpenIDConnectDiscoveryDocument *string `json:"openIdConnectDiscoveryDocument,omitempty"`
2366
2367 OdataType OdataTypeBasicContentKeyPolicyRestriction `json:"@odata.type,omitempty"`
2368 }
2369
2370
2371 func (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
2400 func (ckptr ContentKeyPolicyTokenRestriction) AsContentKeyPolicyOpenRestriction() (*ContentKeyPolicyOpenRestriction, bool) {
2401 return nil, false
2402 }
2403
2404
2405 func (ckptr ContentKeyPolicyTokenRestriction) AsContentKeyPolicyUnknownRestriction() (*ContentKeyPolicyUnknownRestriction, bool) {
2406 return nil, false
2407 }
2408
2409
2410 func (ckptr ContentKeyPolicyTokenRestriction) AsContentKeyPolicyTokenRestriction() (*ContentKeyPolicyTokenRestriction, bool) {
2411 return &ckptr, true
2412 }
2413
2414
2415 func (ckptr ContentKeyPolicyTokenRestriction) AsContentKeyPolicyRestriction() (*ContentKeyPolicyRestriction, bool) {
2416 return nil, false
2417 }
2418
2419
2420 func (ckptr ContentKeyPolicyTokenRestriction) AsBasicContentKeyPolicyRestriction() (BasicContentKeyPolicyRestriction, bool) {
2421 return &ckptr, true
2422 }
2423
2424
2425 func (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
2510
2511 type ContentKeyPolicyUnknownConfiguration struct {
2512
2513 OdataType OdataTypeBasicContentKeyPolicyConfiguration `json:"@odata.type,omitempty"`
2514 }
2515
2516
2517 func (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
2527 func (ckpuc ContentKeyPolicyUnknownConfiguration) AsContentKeyPolicyClearKeyConfiguration() (*ContentKeyPolicyClearKeyConfiguration, bool) {
2528 return nil, false
2529 }
2530
2531
2532 func (ckpuc ContentKeyPolicyUnknownConfiguration) AsContentKeyPolicyUnknownConfiguration() (*ContentKeyPolicyUnknownConfiguration, bool) {
2533 return &ckpuc, true
2534 }
2535
2536
2537 func (ckpuc ContentKeyPolicyUnknownConfiguration) AsContentKeyPolicyWidevineConfiguration() (*ContentKeyPolicyWidevineConfiguration, bool) {
2538 return nil, false
2539 }
2540
2541
2542 func (ckpuc ContentKeyPolicyUnknownConfiguration) AsContentKeyPolicyPlayReadyConfiguration() (*ContentKeyPolicyPlayReadyConfiguration, bool) {
2543 return nil, false
2544 }
2545
2546
2547 func (ckpuc ContentKeyPolicyUnknownConfiguration) AsContentKeyPolicyFairPlayConfiguration() (*ContentKeyPolicyFairPlayConfiguration, bool) {
2548 return nil, false
2549 }
2550
2551
2552 func (ckpuc ContentKeyPolicyUnknownConfiguration) AsContentKeyPolicyConfiguration() (*ContentKeyPolicyConfiguration, bool) {
2553 return nil, false
2554 }
2555
2556
2557 func (ckpuc ContentKeyPolicyUnknownConfiguration) AsBasicContentKeyPolicyConfiguration() (BasicContentKeyPolicyConfiguration, bool) {
2558 return &ckpuc, true
2559 }
2560
2561
2562
2563 type ContentKeyPolicyUnknownRestriction struct {
2564
2565 OdataType OdataTypeBasicContentKeyPolicyRestriction `json:"@odata.type,omitempty"`
2566 }
2567
2568
2569 func (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
2579 func (ckpur ContentKeyPolicyUnknownRestriction) AsContentKeyPolicyOpenRestriction() (*ContentKeyPolicyOpenRestriction, bool) {
2580 return nil, false
2581 }
2582
2583
2584 func (ckpur ContentKeyPolicyUnknownRestriction) AsContentKeyPolicyUnknownRestriction() (*ContentKeyPolicyUnknownRestriction, bool) {
2585 return &ckpur, true
2586 }
2587
2588
2589 func (ckpur ContentKeyPolicyUnknownRestriction) AsContentKeyPolicyTokenRestriction() (*ContentKeyPolicyTokenRestriction, bool) {
2590 return nil, false
2591 }
2592
2593
2594 func (ckpur ContentKeyPolicyUnknownRestriction) AsContentKeyPolicyRestriction() (*ContentKeyPolicyRestriction, bool) {
2595 return nil, false
2596 }
2597
2598
2599 func (ckpur ContentKeyPolicyUnknownRestriction) AsBasicContentKeyPolicyRestriction() (BasicContentKeyPolicyRestriction, bool) {
2600 return &ckpur, true
2601 }
2602
2603
2604 type ContentKeyPolicyWidevineConfiguration struct {
2605
2606 WidevineTemplate *string `json:"widevineTemplate,omitempty"`
2607
2608 OdataType OdataTypeBasicContentKeyPolicyConfiguration `json:"@odata.type,omitempty"`
2609 }
2610
2611
2612 func (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
2625 func (ckpwc ContentKeyPolicyWidevineConfiguration) AsContentKeyPolicyClearKeyConfiguration() (*ContentKeyPolicyClearKeyConfiguration, bool) {
2626 return nil, false
2627 }
2628
2629
2630 func (ckpwc ContentKeyPolicyWidevineConfiguration) AsContentKeyPolicyUnknownConfiguration() (*ContentKeyPolicyUnknownConfiguration, bool) {
2631 return nil, false
2632 }
2633
2634
2635 func (ckpwc ContentKeyPolicyWidevineConfiguration) AsContentKeyPolicyWidevineConfiguration() (*ContentKeyPolicyWidevineConfiguration, bool) {
2636 return &ckpwc, true
2637 }
2638
2639
2640 func (ckpwc ContentKeyPolicyWidevineConfiguration) AsContentKeyPolicyPlayReadyConfiguration() (*ContentKeyPolicyPlayReadyConfiguration, bool) {
2641 return nil, false
2642 }
2643
2644
2645 func (ckpwc ContentKeyPolicyWidevineConfiguration) AsContentKeyPolicyFairPlayConfiguration() (*ContentKeyPolicyFairPlayConfiguration, bool) {
2646 return nil, false
2647 }
2648
2649
2650 func (ckpwc ContentKeyPolicyWidevineConfiguration) AsContentKeyPolicyConfiguration() (*ContentKeyPolicyConfiguration, bool) {
2651 return nil, false
2652 }
2653
2654
2655 func (ckpwc ContentKeyPolicyWidevineConfiguration) AsBasicContentKeyPolicyConfiguration() (BasicContentKeyPolicyConfiguration, bool) {
2656 return &ckpwc, true
2657 }
2658
2659
2660 type ContentKeyPolicyX509CertificateTokenKey struct {
2661
2662 RawBody *[]byte `json:"rawBody,omitempty"`
2663
2664 OdataType OdataTypeBasicContentKeyPolicyRestrictionTokenKey `json:"@odata.type,omitempty"`
2665 }
2666
2667
2668 func (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
2681 func (ckpxctk ContentKeyPolicyX509CertificateTokenKey) AsContentKeyPolicySymmetricTokenKey() (*ContentKeyPolicySymmetricTokenKey, bool) {
2682 return nil, false
2683 }
2684
2685
2686 func (ckpxctk ContentKeyPolicyX509CertificateTokenKey) AsContentKeyPolicyRsaTokenKey() (*ContentKeyPolicyRsaTokenKey, bool) {
2687 return nil, false
2688 }
2689
2690
2691 func (ckpxctk ContentKeyPolicyX509CertificateTokenKey) AsContentKeyPolicyX509CertificateTokenKey() (*ContentKeyPolicyX509CertificateTokenKey, bool) {
2692 return &ckpxctk, true
2693 }
2694
2695
2696 func (ckpxctk ContentKeyPolicyX509CertificateTokenKey) AsContentKeyPolicyRestrictionTokenKey() (*ContentKeyPolicyRestrictionTokenKey, bool) {
2697 return nil, false
2698 }
2699
2700
2701 func (ckpxctk ContentKeyPolicyX509CertificateTokenKey) AsBasicContentKeyPolicyRestrictionTokenKey() (BasicContentKeyPolicyRestrictionTokenKey, bool) {
2702 return &ckpxctk, true
2703 }
2704
2705
2706 type CopyAudio struct {
2707
2708 Label *string `json:"label,omitempty"`
2709
2710 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"`
2711 }
2712
2713
2714 func (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
2727 func (ca CopyAudio) AsAudio() (*Audio, bool) {
2728 return nil, false
2729 }
2730
2731
2732 func (ca CopyAudio) AsBasicAudio() (BasicAudio, bool) {
2733 return nil, false
2734 }
2735
2736
2737 func (ca CopyAudio) AsAacAudio() (*AacAudio, bool) {
2738 return nil, false
2739 }
2740
2741
2742 func (ca CopyAudio) AsCopyVideo() (*CopyVideo, bool) {
2743 return nil, false
2744 }
2745
2746
2747 func (ca CopyAudio) AsVideo() (*Video, bool) {
2748 return nil, false
2749 }
2750
2751
2752 func (ca CopyAudio) AsBasicVideo() (BasicVideo, bool) {
2753 return nil, false
2754 }
2755
2756
2757 func (ca CopyAudio) AsImage() (*Image, bool) {
2758 return nil, false
2759 }
2760
2761
2762 func (ca CopyAudio) AsBasicImage() (BasicImage, bool) {
2763 return nil, false
2764 }
2765
2766
2767 func (ca CopyAudio) AsCopyAudio() (*CopyAudio, bool) {
2768 return &ca, true
2769 }
2770
2771
2772 func (ca CopyAudio) AsH264Video() (*H264Video, bool) {
2773 return nil, false
2774 }
2775
2776
2777 func (ca CopyAudio) AsJpgImage() (*JpgImage, bool) {
2778 return nil, false
2779 }
2780
2781
2782 func (ca CopyAudio) AsPngImage() (*PngImage, bool) {
2783 return nil, false
2784 }
2785
2786
2787 func (ca CopyAudio) AsCodec() (*Codec, bool) {
2788 return nil, false
2789 }
2790
2791
2792 func (ca CopyAudio) AsBasicCodec() (BasicCodec, bool) {
2793 return &ca, true
2794 }
2795
2796
2797 type CopyVideo struct {
2798
2799 Label *string `json:"label,omitempty"`
2800
2801 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"`
2802 }
2803
2804
2805 func (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
2818 func (cv CopyVideo) AsAudio() (*Audio, bool) {
2819 return nil, false
2820 }
2821
2822
2823 func (cv CopyVideo) AsBasicAudio() (BasicAudio, bool) {
2824 return nil, false
2825 }
2826
2827
2828 func (cv CopyVideo) AsAacAudio() (*AacAudio, bool) {
2829 return nil, false
2830 }
2831
2832
2833 func (cv CopyVideo) AsCopyVideo() (*CopyVideo, bool) {
2834 return &cv, true
2835 }
2836
2837
2838 func (cv CopyVideo) AsVideo() (*Video, bool) {
2839 return nil, false
2840 }
2841
2842
2843 func (cv CopyVideo) AsBasicVideo() (BasicVideo, bool) {
2844 return nil, false
2845 }
2846
2847
2848 func (cv CopyVideo) AsImage() (*Image, bool) {
2849 return nil, false
2850 }
2851
2852
2853 func (cv CopyVideo) AsBasicImage() (BasicImage, bool) {
2854 return nil, false
2855 }
2856
2857
2858 func (cv CopyVideo) AsCopyAudio() (*CopyAudio, bool) {
2859 return nil, false
2860 }
2861
2862
2863 func (cv CopyVideo) AsH264Video() (*H264Video, bool) {
2864 return nil, false
2865 }
2866
2867
2868 func (cv CopyVideo) AsJpgImage() (*JpgImage, bool) {
2869 return nil, false
2870 }
2871
2872
2873 func (cv CopyVideo) AsPngImage() (*PngImage, bool) {
2874 return nil, false
2875 }
2876
2877
2878 func (cv CopyVideo) AsCodec() (*Codec, bool) {
2879 return nil, false
2880 }
2881
2882
2883 func (cv CopyVideo) AsBasicCodec() (BasicCodec, bool) {
2884 return &cv, true
2885 }
2886
2887
2888 type CrossSiteAccessPolicies struct {
2889
2890 ClientAccessPolicy *string `json:"clientAccessPolicy,omitempty"`
2891
2892 CrossDomainPolicy *string `json:"crossDomainPolicy,omitempty"`
2893 }
2894
2895
2896 type DefaultKey struct {
2897
2898 Label *string `json:"label,omitempty"`
2899
2900 PolicyName *string `json:"policyName,omitempty"`
2901 }
2902
2903
2904 type Deinterlace struct {
2905
2906 Parity DeinterlaceParity `json:"parity,omitempty"`
2907
2908 Mode DeinterlaceMode `json:"mode,omitempty"`
2909 }
2910
2911
2912 type EnabledProtocols struct {
2913
2914 Download *bool `json:"download,omitempty"`
2915
2916 Dash *bool `json:"dash,omitempty"`
2917
2918 Hls *bool `json:"hls,omitempty"`
2919
2920 SmoothStreaming *bool `json:"smoothStreaming,omitempty"`
2921 }
2922
2923
2924 type EntityNameAvailabilityCheckOutput struct {
2925 autorest.Response `json:"-"`
2926
2927 NameAvailable *bool `json:"nameAvailable,omitempty"`
2928
2929 Reason *string `json:"reason,omitempty"`
2930
2931 Message *string `json:"message,omitempty"`
2932 }
2933
2934
2935 type EnvelopeEncryption struct {
2936
2937 EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"`
2938
2939 ClearTracks *[]TrackSelection `json:"clearTracks,omitempty"`
2940
2941 ContentKeys *StreamingPolicyContentKeys `json:"contentKeys,omitempty"`
2942
2943 CustomKeyAcquisitionURLTemplate *string `json:"customKeyAcquisitionUrlTemplate,omitempty"`
2944 }
2945
2946
2947
2948 type Filters struct {
2949
2950 Deinterlace *Deinterlace `json:"deinterlace,omitempty"`
2951
2952 Rotation Rotation `json:"rotation,omitempty"`
2953
2954 Crop *Rectangle `json:"crop,omitempty"`
2955
2956 Overlays *[]BasicOverlay `json:"overlays,omitempty"`
2957 }
2958
2959
2960 func (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
3010 type 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
3023 type Format struct {
3024
3025 FilenamePattern *string `json:"filenamePattern,omitempty"`
3026
3027 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"`
3028 }
3029
3030 func 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 }
3068 func 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
3088 func (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
3101 func (f Format) AsImageFormat() (*ImageFormat, bool) {
3102 return nil, false
3103 }
3104
3105
3106 func (f Format) AsBasicImageFormat() (BasicImageFormat, bool) {
3107 return nil, false
3108 }
3109
3110
3111 func (f Format) AsJpgFormat() (*JpgFormat, bool) {
3112 return nil, false
3113 }
3114
3115
3116 func (f Format) AsPngFormat() (*PngFormat, bool) {
3117 return nil, false
3118 }
3119
3120
3121 func (f Format) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) {
3122 return nil, false
3123 }
3124
3125
3126 func (f Format) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) {
3127 return nil, false
3128 }
3129
3130
3131 func (f Format) AsMp4Format() (*Mp4Format, bool) {
3132 return nil, false
3133 }
3134
3135
3136 func (f Format) AsTransportStreamFormat() (*TransportStreamFormat, bool) {
3137 return nil, false
3138 }
3139
3140
3141 func (f Format) AsFormat() (*Format, bool) {
3142 return &f, true
3143 }
3144
3145
3146 func (f Format) AsBasicFormat() (BasicFormat, bool) {
3147 return &f, true
3148 }
3149
3150
3151
3152 type H264Layer struct {
3153
3154 Profile H264VideoProfile `json:"profile,omitempty"`
3155
3156 Level *string `json:"level,omitempty"`
3157
3158 BufferWindow *string `json:"bufferWindow,omitempty"`
3159
3160 ReferenceFrames *int32 `json:"referenceFrames,omitempty"`
3161
3162 EntropyMode EntropyMode `json:"entropyMode,omitempty"`
3163
3164 Bitrate *int32 `json:"bitrate,omitempty"`
3165
3166 MaxBitrate *int32 `json:"maxBitrate,omitempty"`
3167
3168 BFrames *int32 `json:"bFrames,omitempty"`
3169
3170 FrameRate *string `json:"frameRate,omitempty"`
3171
3172 Slices *int32 `json:"slices,omitempty"`
3173
3174 AdaptiveBFrame *bool `json:"adaptiveBFrame,omitempty"`
3175
3176 Width *string `json:"width,omitempty"`
3177
3178 Height *string `json:"height,omitempty"`
3179
3180 Label *string `json:"label,omitempty"`
3181
3182 OdataType OdataTypeBasicLayer `json:"@odata.type,omitempty"`
3183 }
3184
3185
3186 func (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
3238 func (hl H264Layer) AsVideoLayer() (*VideoLayer, bool) {
3239 return nil, false
3240 }
3241
3242
3243 func (hl H264Layer) AsBasicVideoLayer() (BasicVideoLayer, bool) {
3244 return &hl, true
3245 }
3246
3247
3248 func (hl H264Layer) AsH264Layer() (*H264Layer, bool) {
3249 return &hl, true
3250 }
3251
3252
3253 func (hl H264Layer) AsJpgLayer() (*JpgLayer, bool) {
3254 return nil, false
3255 }
3256
3257
3258 func (hl H264Layer) AsPngLayer() (*PngLayer, bool) {
3259 return nil, false
3260 }
3261
3262
3263 func (hl H264Layer) AsLayer() (*Layer, bool) {
3264 return nil, false
3265 }
3266
3267
3268 func (hl H264Layer) AsBasicLayer() (BasicLayer, bool) {
3269 return &hl, true
3270 }
3271
3272
3273 type H264Video struct {
3274
3275 SceneChangeDetection *bool `json:"sceneChangeDetection,omitempty"`
3276
3277 Complexity H264Complexity `json:"complexity,omitempty"`
3278
3279 Layers *[]H264Layer `json:"layers,omitempty"`
3280
3281 KeyFrameInterval *string `json:"keyFrameInterval,omitempty"`
3282
3283 StretchMode StretchMode `json:"stretchMode,omitempty"`
3284
3285 Label *string `json:"label,omitempty"`
3286
3287 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"`
3288 }
3289
3290
3291 func (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
3319 func (hv H264Video) AsAudio() (*Audio, bool) {
3320 return nil, false
3321 }
3322
3323
3324 func (hv H264Video) AsBasicAudio() (BasicAudio, bool) {
3325 return nil, false
3326 }
3327
3328
3329 func (hv H264Video) AsAacAudio() (*AacAudio, bool) {
3330 return nil, false
3331 }
3332
3333
3334 func (hv H264Video) AsCopyVideo() (*CopyVideo, bool) {
3335 return nil, false
3336 }
3337
3338
3339 func (hv H264Video) AsVideo() (*Video, bool) {
3340 return nil, false
3341 }
3342
3343
3344 func (hv H264Video) AsBasicVideo() (BasicVideo, bool) {
3345 return &hv, true
3346 }
3347
3348
3349 func (hv H264Video) AsImage() (*Image, bool) {
3350 return nil, false
3351 }
3352
3353
3354 func (hv H264Video) AsBasicImage() (BasicImage, bool) {
3355 return nil, false
3356 }
3357
3358
3359 func (hv H264Video) AsCopyAudio() (*CopyAudio, bool) {
3360 return nil, false
3361 }
3362
3363
3364 func (hv H264Video) AsH264Video() (*H264Video, bool) {
3365 return &hv, true
3366 }
3367
3368
3369 func (hv H264Video) AsJpgImage() (*JpgImage, bool) {
3370 return nil, false
3371 }
3372
3373
3374 func (hv H264Video) AsPngImage() (*PngImage, bool) {
3375 return nil, false
3376 }
3377
3378
3379 func (hv H264Video) AsCodec() (*Codec, bool) {
3380 return nil, false
3381 }
3382
3383
3384 func (hv H264Video) AsBasicCodec() (BasicCodec, bool) {
3385 return &hv, true
3386 }
3387
3388
3389 type Hls struct {
3390
3391 FragmentsPerTsSegment *int32 `json:"fragmentsPerTsSegment,omitempty"`
3392 }
3393
3394
3395 type BasicImage interface {
3396 AsJpgImage() (*JpgImage, bool)
3397 AsPngImage() (*PngImage, bool)
3398 AsImage() (*Image, bool)
3399 }
3400
3401
3402 type Image struct {
3403
3404 Start *string `json:"start,omitempty"`
3405
3406 Step *string `json:"step,omitempty"`
3407
3408 Range *string `json:"range,omitempty"`
3409
3410 KeyFrameInterval *string `json:"keyFrameInterval,omitempty"`
3411
3412 StretchMode StretchMode `json:"stretchMode,omitempty"`
3413
3414 Label *string `json:"label,omitempty"`
3415
3416 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"`
3417 }
3418
3419 func 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 }
3441 func 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
3461 func (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
3489 func (i Image) AsAudio() (*Audio, bool) {
3490 return nil, false
3491 }
3492
3493
3494 func (i Image) AsBasicAudio() (BasicAudio, bool) {
3495 return nil, false
3496 }
3497
3498
3499 func (i Image) AsAacAudio() (*AacAudio, bool) {
3500 return nil, false
3501 }
3502
3503
3504 func (i Image) AsCopyVideo() (*CopyVideo, bool) {
3505 return nil, false
3506 }
3507
3508
3509 func (i Image) AsVideo() (*Video, bool) {
3510 return nil, false
3511 }
3512
3513
3514 func (i Image) AsBasicVideo() (BasicVideo, bool) {
3515 return &i, true
3516 }
3517
3518
3519 func (i Image) AsImage() (*Image, bool) {
3520 return &i, true
3521 }
3522
3523
3524 func (i Image) AsBasicImage() (BasicImage, bool) {
3525 return &i, true
3526 }
3527
3528
3529 func (i Image) AsCopyAudio() (*CopyAudio, bool) {
3530 return nil, false
3531 }
3532
3533
3534 func (i Image) AsH264Video() (*H264Video, bool) {
3535 return nil, false
3536 }
3537
3538
3539 func (i Image) AsJpgImage() (*JpgImage, bool) {
3540 return nil, false
3541 }
3542
3543
3544 func (i Image) AsPngImage() (*PngImage, bool) {
3545 return nil, false
3546 }
3547
3548
3549 func (i Image) AsCodec() (*Codec, bool) {
3550 return nil, false
3551 }
3552
3553
3554 func (i Image) AsBasicCodec() (BasicCodec, bool) {
3555 return &i, true
3556 }
3557
3558
3559 type BasicImageFormat interface {
3560 AsJpgFormat() (*JpgFormat, bool)
3561 AsPngFormat() (*PngFormat, bool)
3562 AsImageFormat() (*ImageFormat, bool)
3563 }
3564
3565
3566 type ImageFormat struct {
3567
3568 FilenamePattern *string `json:"filenamePattern,omitempty"`
3569
3570 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"`
3571 }
3572
3573 func 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 }
3595 func 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
3615 func (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
3628 func (ifVar ImageFormat) AsImageFormat() (*ImageFormat, bool) {
3629 return &ifVar, true
3630 }
3631
3632
3633 func (ifVar ImageFormat) AsBasicImageFormat() (BasicImageFormat, bool) {
3634 return &ifVar, true
3635 }
3636
3637
3638 func (ifVar ImageFormat) AsJpgFormat() (*JpgFormat, bool) {
3639 return nil, false
3640 }
3641
3642
3643 func (ifVar ImageFormat) AsPngFormat() (*PngFormat, bool) {
3644 return nil, false
3645 }
3646
3647
3648 func (ifVar ImageFormat) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) {
3649 return nil, false
3650 }
3651
3652
3653 func (ifVar ImageFormat) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) {
3654 return nil, false
3655 }
3656
3657
3658 func (ifVar ImageFormat) AsMp4Format() (*Mp4Format, bool) {
3659 return nil, false
3660 }
3661
3662
3663 func (ifVar ImageFormat) AsTransportStreamFormat() (*TransportStreamFormat, bool) {
3664 return nil, false
3665 }
3666
3667
3668 func (ifVar ImageFormat) AsFormat() (*Format, bool) {
3669 return nil, false
3670 }
3671
3672
3673 func (ifVar ImageFormat) AsBasicFormat() (BasicFormat, bool) {
3674 return &ifVar, true
3675 }
3676
3677
3678 type IPAccessControl struct {
3679
3680 Allow *[]IPRange `json:"allow,omitempty"`
3681 }
3682
3683
3684 type IPRange struct {
3685
3686 Name *string `json:"name,omitempty"`
3687
3688 Address *string `json:"address,omitempty"`
3689
3690 SubnetPrefixLength *int32 `json:"subnetPrefixLength,omitempty"`
3691 }
3692
3693
3694
3695 type Job struct {
3696 autorest.Response `json:"-"`
3697
3698 *JobProperties `json:"properties,omitempty"`
3699
3700 ID *string `json:"id,omitempty"`
3701
3702 Name *string `json:"name,omitempty"`
3703
3704 Type *string `json:"type,omitempty"`
3705 }
3706
3707
3708 func (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
3717 func (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
3768 type JobCollection struct {
3769 autorest.Response `json:"-"`
3770
3771 Value *[]Job `json:"value,omitempty"`
3772
3773 OdataNextLink *string `json:"@odata.nextLink,omitempty"`
3774 }
3775
3776
3777 type JobCollectionIterator struct {
3778 i int
3779 page JobCollectionPage
3780 }
3781
3782
3783
3784 func (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
3809
3810
3811 func (iter *JobCollectionIterator) Next() error {
3812 return iter.NextWithContext(context.Background())
3813 }
3814
3815
3816 func (iter JobCollectionIterator) NotDone() bool {
3817 return iter.page.NotDone() && iter.i < len(iter.page.Values())
3818 }
3819
3820
3821 func (iter JobCollectionIterator) Response() JobCollection {
3822 return iter.page.Response()
3823 }
3824
3825
3826
3827 func (iter JobCollectionIterator) Value() Job {
3828 if !iter.page.NotDone() {
3829 return Job{}
3830 }
3831 return iter.page.Values()[iter.i]
3832 }
3833
3834
3835 func NewJobCollectionIterator(page JobCollectionPage) JobCollectionIterator {
3836 return JobCollectionIterator{page: page}
3837 }
3838
3839
3840 func (jc JobCollection) IsEmpty() bool {
3841 return jc.Value == nil || len(*jc.Value) == 0
3842 }
3843
3844
3845 func (jc JobCollection) hasNextLink() bool {
3846 return jc.OdataNextLink != nil && len(*jc.OdataNextLink) != 0
3847 }
3848
3849
3850
3851 func (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
3862 type JobCollectionPage struct {
3863 fn func(context.Context, JobCollection) (JobCollection, error)
3864 jc JobCollection
3865 }
3866
3867
3868
3869 func (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
3894
3895
3896 func (page *JobCollectionPage) Next() error {
3897 return page.NextWithContext(context.Background())
3898 }
3899
3900
3901 func (page JobCollectionPage) NotDone() bool {
3902 return !page.jc.IsEmpty()
3903 }
3904
3905
3906 func (page JobCollectionPage) Response() JobCollection {
3907 return page.jc
3908 }
3909
3910
3911 func (page JobCollectionPage) Values() []Job {
3912 if page.jc.IsEmpty() {
3913 return nil
3914 }
3915 return *page.jc.Value
3916 }
3917
3918
3919 func NewJobCollectionPage(cur JobCollection, getNextPage func(context.Context, JobCollection) (JobCollection, error)) JobCollectionPage {
3920 return JobCollectionPage{
3921 fn: getNextPage,
3922 jc: cur,
3923 }
3924 }
3925
3926
3927 type JobError struct {
3928
3929 Code JobErrorCode `json:"code,omitempty"`
3930
3931 Message *string `json:"message,omitempty"`
3932
3933 Category JobErrorCategory `json:"category,omitempty"`
3934
3935 Retry JobRetry `json:"retry,omitempty"`
3936
3937 Details *[]JobErrorDetail `json:"details,omitempty"`
3938 }
3939
3940
3941 func (je JobError) MarshalJSON() ([]byte, error) {
3942 objectMap := make(map[string]interface{})
3943 return json.Marshal(objectMap)
3944 }
3945
3946
3947 type JobErrorDetail struct {
3948
3949 Code *string `json:"code,omitempty"`
3950
3951 Message *string `json:"message,omitempty"`
3952 }
3953
3954
3955 func (jed JobErrorDetail) MarshalJSON() ([]byte, error) {
3956 objectMap := make(map[string]interface{})
3957 return json.Marshal(objectMap)
3958 }
3959
3960
3961 type 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
3971 type JobInput struct {
3972
3973 Label *string `json:"label,omitempty"`
3974
3975 OdataType OdataTypeBasicJobInput `json:"@odata.type,omitempty"`
3976 }
3977
3978 func 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 }
4008 func 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
4028 func (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
4041 func (ji JobInput) AsJobInputClip() (*JobInputClip, bool) {
4042 return nil, false
4043 }
4044
4045
4046 func (ji JobInput) AsBasicJobInputClip() (BasicJobInputClip, bool) {
4047 return nil, false
4048 }
4049
4050
4051 func (ji JobInput) AsJobInputs() (*JobInputs, bool) {
4052 return nil, false
4053 }
4054
4055
4056 func (ji JobInput) AsJobInputAsset() (*JobInputAsset, bool) {
4057 return nil, false
4058 }
4059
4060
4061 func (ji JobInput) AsJobInputHTTP() (*JobInputHTTP, bool) {
4062 return nil, false
4063 }
4064
4065
4066 func (ji JobInput) AsJobInput() (*JobInput, bool) {
4067 return &ji, true
4068 }
4069
4070
4071 func (ji JobInput) AsBasicJobInput() (BasicJobInput, bool) {
4072 return &ji, true
4073 }
4074
4075
4076 type JobInputAsset struct {
4077
4078 AssetName *string `json:"assetName,omitempty"`
4079
4080 Files *[]string `json:"files,omitempty"`
4081
4082 Label *string `json:"label,omitempty"`
4083
4084 OdataType OdataTypeBasicJobInput `json:"@odata.type,omitempty"`
4085 }
4086
4087
4088 func (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
4107 func (jia JobInputAsset) AsJobInputClip() (*JobInputClip, bool) {
4108 return nil, false
4109 }
4110
4111
4112 func (jia JobInputAsset) AsBasicJobInputClip() (BasicJobInputClip, bool) {
4113 return &jia, true
4114 }
4115
4116
4117 func (jia JobInputAsset) AsJobInputs() (*JobInputs, bool) {
4118 return nil, false
4119 }
4120
4121
4122 func (jia JobInputAsset) AsJobInputAsset() (*JobInputAsset, bool) {
4123 return &jia, true
4124 }
4125
4126
4127 func (jia JobInputAsset) AsJobInputHTTP() (*JobInputHTTP, bool) {
4128 return nil, false
4129 }
4130
4131
4132 func (jia JobInputAsset) AsJobInput() (*JobInput, bool) {
4133 return nil, false
4134 }
4135
4136
4137 func (jia JobInputAsset) AsBasicJobInput() (BasicJobInput, bool) {
4138 return &jia, true
4139 }
4140
4141
4142 type BasicJobInputClip interface {
4143 AsJobInputAsset() (*JobInputAsset, bool)
4144 AsJobInputHTTP() (*JobInputHTTP, bool)
4145 AsJobInputClip() (*JobInputClip, bool)
4146 }
4147
4148
4149 type JobInputClip struct {
4150
4151 Files *[]string `json:"files,omitempty"`
4152
4153 Label *string `json:"label,omitempty"`
4154
4155 OdataType OdataTypeBasicJobInput `json:"@odata.type,omitempty"`
4156 }
4157
4158 func 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 }
4180 func 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
4200 func (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
4216 func (jic JobInputClip) AsJobInputClip() (*JobInputClip, bool) {
4217 return &jic, true
4218 }
4219
4220
4221 func (jic JobInputClip) AsBasicJobInputClip() (BasicJobInputClip, bool) {
4222 return &jic, true
4223 }
4224
4225
4226 func (jic JobInputClip) AsJobInputs() (*JobInputs, bool) {
4227 return nil, false
4228 }
4229
4230
4231 func (jic JobInputClip) AsJobInputAsset() (*JobInputAsset, bool) {
4232 return nil, false
4233 }
4234
4235
4236 func (jic JobInputClip) AsJobInputHTTP() (*JobInputHTTP, bool) {
4237 return nil, false
4238 }
4239
4240
4241 func (jic JobInputClip) AsJobInput() (*JobInput, bool) {
4242 return nil, false
4243 }
4244
4245
4246 func (jic JobInputClip) AsBasicJobInput() (BasicJobInput, bool) {
4247 return &jic, true
4248 }
4249
4250
4251 type JobInputHTTP struct {
4252
4253 BaseURI *string `json:"baseUri,omitempty"`
4254
4255 Files *[]string `json:"files,omitempty"`
4256
4257 Label *string `json:"label,omitempty"`
4258
4259 OdataType OdataTypeBasicJobInput `json:"@odata.type,omitempty"`
4260 }
4261
4262
4263 func (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
4282 func (jih JobInputHTTP) AsJobInputClip() (*JobInputClip, bool) {
4283 return nil, false
4284 }
4285
4286
4287 func (jih JobInputHTTP) AsBasicJobInputClip() (BasicJobInputClip, bool) {
4288 return &jih, true
4289 }
4290
4291
4292 func (jih JobInputHTTP) AsJobInputs() (*JobInputs, bool) {
4293 return nil, false
4294 }
4295
4296
4297 func (jih JobInputHTTP) AsJobInputAsset() (*JobInputAsset, bool) {
4298 return nil, false
4299 }
4300
4301
4302 func (jih JobInputHTTP) AsJobInputHTTP() (*JobInputHTTP, bool) {
4303 return &jih, true
4304 }
4305
4306
4307 func (jih JobInputHTTP) AsJobInput() (*JobInput, bool) {
4308 return nil, false
4309 }
4310
4311
4312 func (jih JobInputHTTP) AsBasicJobInput() (BasicJobInput, bool) {
4313 return &jih, true
4314 }
4315
4316
4317 type JobInputs struct {
4318
4319 Inputs *[]BasicJobInput `json:"inputs,omitempty"`
4320
4321 Label *string `json:"label,omitempty"`
4322
4323 OdataType OdataTypeBasicJobInput `json:"@odata.type,omitempty"`
4324 }
4325
4326
4327 func (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
4343 func (ji JobInputs) AsJobInputClip() (*JobInputClip, bool) {
4344 return nil, false
4345 }
4346
4347
4348 func (ji JobInputs) AsBasicJobInputClip() (BasicJobInputClip, bool) {
4349 return nil, false
4350 }
4351
4352
4353 func (ji JobInputs) AsJobInputs() (*JobInputs, bool) {
4354 return &ji, true
4355 }
4356
4357
4358 func (ji JobInputs) AsJobInputAsset() (*JobInputAsset, bool) {
4359 return nil, false
4360 }
4361
4362
4363 func (ji JobInputs) AsJobInputHTTP() (*JobInputHTTP, bool) {
4364 return nil, false
4365 }
4366
4367
4368 func (ji JobInputs) AsJobInput() (*JobInput, bool) {
4369 return nil, false
4370 }
4371
4372
4373 func (ji JobInputs) AsBasicJobInput() (BasicJobInput, bool) {
4374 return &ji, true
4375 }
4376
4377
4378 func (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
4419 type BasicJobOutput interface {
4420 AsJobOutputAsset() (*JobOutputAsset, bool)
4421 AsJobOutput() (*JobOutput, bool)
4422 }
4423
4424
4425 type JobOutput struct {
4426
4427 Error *JobError `json:"error,omitempty"`
4428
4429 State JobState `json:"state,omitempty"`
4430
4431 Progress *int32 `json:"progress,omitempty"`
4432
4433 OdataType OdataTypeBasicJobOutput `json:"@odata.type,omitempty"`
4434 }
4435
4436 func 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 }
4454 func 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
4474 func (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
4484 func (jo JobOutput) AsJobOutputAsset() (*JobOutputAsset, bool) {
4485 return nil, false
4486 }
4487
4488
4489 func (jo JobOutput) AsJobOutput() (*JobOutput, bool) {
4490 return &jo, true
4491 }
4492
4493
4494 func (jo JobOutput) AsBasicJobOutput() (BasicJobOutput, bool) {
4495 return &jo, true
4496 }
4497
4498
4499 type JobOutputAsset struct {
4500
4501 AssetName *string `json:"assetName,omitempty"`
4502
4503 Error *JobError `json:"error,omitempty"`
4504
4505 State JobState `json:"state,omitempty"`
4506
4507 Progress *int32 `json:"progress,omitempty"`
4508
4509 OdataType OdataTypeBasicJobOutput `json:"@odata.type,omitempty"`
4510 }
4511
4512
4513 func (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
4526 func (joa JobOutputAsset) AsJobOutputAsset() (*JobOutputAsset, bool) {
4527 return &joa, true
4528 }
4529
4530
4531 func (joa JobOutputAsset) AsJobOutput() (*JobOutput, bool) {
4532 return nil, false
4533 }
4534
4535
4536 func (joa JobOutputAsset) AsBasicJobOutput() (BasicJobOutput, bool) {
4537 return &joa, true
4538 }
4539
4540
4541 type JobProperties struct {
4542
4543 Created *date.Time `json:"created,omitempty"`
4544
4545 State JobState `json:"state,omitempty"`
4546
4547 Description *string `json:"description,omitempty"`
4548
4549 Input BasicJobInput `json:"input,omitempty"`
4550
4551 LastModified *date.Time `json:"lastModified,omitempty"`
4552
4553 Outputs *[]BasicJobOutput `json:"outputs,omitempty"`
4554
4555 Priority Priority `json:"priority,omitempty"`
4556
4557 CorrelationData map[string]*string `json:"correlationData"`
4558 }
4559
4560
4561 func (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
4580 func (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
4665 type JpgFormat struct {
4666
4667 FilenamePattern *string `json:"filenamePattern,omitempty"`
4668
4669 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"`
4670 }
4671
4672
4673 func (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
4686 func (jf JpgFormat) AsImageFormat() (*ImageFormat, bool) {
4687 return nil, false
4688 }
4689
4690
4691 func (jf JpgFormat) AsBasicImageFormat() (BasicImageFormat, bool) {
4692 return &jf, true
4693 }
4694
4695
4696 func (jf JpgFormat) AsJpgFormat() (*JpgFormat, bool) {
4697 return &jf, true
4698 }
4699
4700
4701 func (jf JpgFormat) AsPngFormat() (*PngFormat, bool) {
4702 return nil, false
4703 }
4704
4705
4706 func (jf JpgFormat) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) {
4707 return nil, false
4708 }
4709
4710
4711 func (jf JpgFormat) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) {
4712 return nil, false
4713 }
4714
4715
4716 func (jf JpgFormat) AsMp4Format() (*Mp4Format, bool) {
4717 return nil, false
4718 }
4719
4720
4721 func (jf JpgFormat) AsTransportStreamFormat() (*TransportStreamFormat, bool) {
4722 return nil, false
4723 }
4724
4725
4726 func (jf JpgFormat) AsFormat() (*Format, bool) {
4727 return nil, false
4728 }
4729
4730
4731 func (jf JpgFormat) AsBasicFormat() (BasicFormat, bool) {
4732 return &jf, true
4733 }
4734
4735
4736 type JpgImage struct {
4737
4738 Layers *[]JpgLayer `json:"layers,omitempty"`
4739
4740 Start *string `json:"start,omitempty"`
4741
4742 Step *string `json:"step,omitempty"`
4743
4744 Range *string `json:"range,omitempty"`
4745
4746 KeyFrameInterval *string `json:"keyFrameInterval,omitempty"`
4747
4748 StretchMode StretchMode `json:"stretchMode,omitempty"`
4749
4750 Label *string `json:"label,omitempty"`
4751
4752 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"`
4753 }
4754
4755
4756 func (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
4787 func (ji JpgImage) AsAudio() (*Audio, bool) {
4788 return nil, false
4789 }
4790
4791
4792 func (ji JpgImage) AsBasicAudio() (BasicAudio, bool) {
4793 return nil, false
4794 }
4795
4796
4797 func (ji JpgImage) AsAacAudio() (*AacAudio, bool) {
4798 return nil, false
4799 }
4800
4801
4802 func (ji JpgImage) AsCopyVideo() (*CopyVideo, bool) {
4803 return nil, false
4804 }
4805
4806
4807 func (ji JpgImage) AsVideo() (*Video, bool) {
4808 return nil, false
4809 }
4810
4811
4812 func (ji JpgImage) AsBasicVideo() (BasicVideo, bool) {
4813 return &ji, true
4814 }
4815
4816
4817 func (ji JpgImage) AsImage() (*Image, bool) {
4818 return nil, false
4819 }
4820
4821
4822 func (ji JpgImage) AsBasicImage() (BasicImage, bool) {
4823 return &ji, true
4824 }
4825
4826
4827 func (ji JpgImage) AsCopyAudio() (*CopyAudio, bool) {
4828 return nil, false
4829 }
4830
4831
4832 func (ji JpgImage) AsH264Video() (*H264Video, bool) {
4833 return nil, false
4834 }
4835
4836
4837 func (ji JpgImage) AsJpgImage() (*JpgImage, bool) {
4838 return &ji, true
4839 }
4840
4841
4842 func (ji JpgImage) AsPngImage() (*PngImage, bool) {
4843 return nil, false
4844 }
4845
4846
4847 func (ji JpgImage) AsCodec() (*Codec, bool) {
4848 return nil, false
4849 }
4850
4851
4852 func (ji JpgImage) AsBasicCodec() (BasicCodec, bool) {
4853 return &ji, true
4854 }
4855
4856
4857 type JpgLayer struct {
4858
4859 Quality *int32 `json:"quality,omitempty"`
4860
4861 Width *string `json:"width,omitempty"`
4862
4863 Height *string `json:"height,omitempty"`
4864
4865 Label *string `json:"label,omitempty"`
4866
4867 OdataType OdataTypeBasicLayer `json:"@odata.type,omitempty"`
4868 }
4869
4870
4871 func (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
4893 func (jl JpgLayer) AsVideoLayer() (*VideoLayer, bool) {
4894 return nil, false
4895 }
4896
4897
4898 func (jl JpgLayer) AsBasicVideoLayer() (BasicVideoLayer, bool) {
4899 return nil, false
4900 }
4901
4902
4903 func (jl JpgLayer) AsH264Layer() (*H264Layer, bool) {
4904 return nil, false
4905 }
4906
4907
4908 func (jl JpgLayer) AsJpgLayer() (*JpgLayer, bool) {
4909 return &jl, true
4910 }
4911
4912
4913 func (jl JpgLayer) AsPngLayer() (*PngLayer, bool) {
4914 return nil, false
4915 }
4916
4917
4918 func (jl JpgLayer) AsLayer() (*Layer, bool) {
4919 return nil, false
4920 }
4921
4922
4923 func (jl JpgLayer) AsBasicLayer() (BasicLayer, bool) {
4924 return &jl, true
4925 }
4926
4927
4928
4929
4930 type 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
4940
4941
4942 type Layer struct {
4943
4944 Width *string `json:"width,omitempty"`
4945
4946 Height *string `json:"height,omitempty"`
4947
4948 Label *string `json:"label,omitempty"`
4949
4950 OdataType OdataTypeBasicLayer `json:"@odata.type,omitempty"`
4951 }
4952
4953 func 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 }
4983 func 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
5003 func (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
5022 func (l Layer) AsVideoLayer() (*VideoLayer, bool) {
5023 return nil, false
5024 }
5025
5026
5027 func (l Layer) AsBasicVideoLayer() (BasicVideoLayer, bool) {
5028 return nil, false
5029 }
5030
5031
5032 func (l Layer) AsH264Layer() (*H264Layer, bool) {
5033 return nil, false
5034 }
5035
5036
5037 func (l Layer) AsJpgLayer() (*JpgLayer, bool) {
5038 return nil, false
5039 }
5040
5041
5042 func (l Layer) AsPngLayer() (*PngLayer, bool) {
5043 return nil, false
5044 }
5045
5046
5047 func (l Layer) AsLayer() (*Layer, bool) {
5048 return &l, true
5049 }
5050
5051
5052 func (l Layer) AsBasicLayer() (BasicLayer, bool) {
5053 return &l, true
5054 }
5055
5056
5057 type ListContainerSasInput struct {
5058
5059 Permissions AssetContainerPermission `json:"permissions,omitempty"`
5060
5061 ExpiryTime *date.Time `json:"expiryTime,omitempty"`
5062 }
5063
5064
5065 type ListContentKeysResponse struct {
5066 autorest.Response `json:"-"`
5067
5068 ContentKeys *[]StreamingLocatorContentKey `json:"contentKeys,omitempty"`
5069 }
5070
5071
5072 type ListPathsResponse struct {
5073 autorest.Response `json:"-"`
5074
5075 StreamingPaths *[]StreamingPath `json:"streamingPaths,omitempty"`
5076
5077 DownloadPaths *[]string `json:"downloadPaths,omitempty"`
5078 }
5079
5080
5081 type LiveEvent struct {
5082 autorest.Response `json:"-"`
5083
5084 *LiveEventProperties `json:"properties,omitempty"`
5085
5086 Tags map[string]*string `json:"tags"`
5087
5088 Location *string `json:"location,omitempty"`
5089
5090 ID *string `json:"id,omitempty"`
5091
5092 Name *string `json:"name,omitempty"`
5093
5094 Type *string `json:"type,omitempty"`
5095 }
5096
5097
5098 func (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
5113 func (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
5182 type LiveEventActionInput struct {
5183
5184 RemoveOutputsOnStop *bool `json:"removeOutputsOnStop,omitempty"`
5185 }
5186
5187
5188 type LiveEventEncoding struct {
5189
5190 EncodingType LiveEventEncodingType `json:"encodingType,omitempty"`
5191
5192 PresetName *string `json:"presetName,omitempty"`
5193 }
5194
5195
5196 type LiveEventEndpoint struct {
5197
5198 Protocol *string `json:"protocol,omitempty"`
5199
5200 URL *string `json:"url,omitempty"`
5201 }
5202
5203
5204 type LiveEventInput struct {
5205
5206 StreamingProtocol LiveEventInputProtocol `json:"streamingProtocol,omitempty"`
5207
5208 KeyFrameIntervalDuration *string `json:"keyFrameIntervalDuration,omitempty"`
5209
5210 AccessToken *string `json:"accessToken,omitempty"`
5211
5212 Endpoints *[]LiveEventEndpoint `json:"endpoints,omitempty"`
5213 }
5214
5215
5216 type LiveEventListResult struct {
5217 autorest.Response `json:"-"`
5218
5219 Value *[]LiveEvent `json:"value,omitempty"`
5220
5221 OdataCount *int32 `json:"@odata.count,omitempty"`
5222
5223 OdataNextLink *string `json:"@odata.nextLink,omitempty"`
5224 }
5225
5226
5227 type LiveEventListResultIterator struct {
5228 i int
5229 page LiveEventListResultPage
5230 }
5231
5232
5233
5234 func (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
5259
5260
5261 func (iter *LiveEventListResultIterator) Next() error {
5262 return iter.NextWithContext(context.Background())
5263 }
5264
5265
5266 func (iter LiveEventListResultIterator) NotDone() bool {
5267 return iter.page.NotDone() && iter.i < len(iter.page.Values())
5268 }
5269
5270
5271 func (iter LiveEventListResultIterator) Response() LiveEventListResult {
5272 return iter.page.Response()
5273 }
5274
5275
5276
5277 func (iter LiveEventListResultIterator) Value() LiveEvent {
5278 if !iter.page.NotDone() {
5279 return LiveEvent{}
5280 }
5281 return iter.page.Values()[iter.i]
5282 }
5283
5284
5285 func NewLiveEventListResultIterator(page LiveEventListResultPage) LiveEventListResultIterator {
5286 return LiveEventListResultIterator{page: page}
5287 }
5288
5289
5290 func (lelr LiveEventListResult) IsEmpty() bool {
5291 return lelr.Value == nil || len(*lelr.Value) == 0
5292 }
5293
5294
5295 func (lelr LiveEventListResult) hasNextLink() bool {
5296 return lelr.OdataNextLink != nil && len(*lelr.OdataNextLink) != 0
5297 }
5298
5299
5300
5301 func (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
5312 type LiveEventListResultPage struct {
5313 fn func(context.Context, LiveEventListResult) (LiveEventListResult, error)
5314 lelr LiveEventListResult
5315 }
5316
5317
5318
5319 func (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
5344
5345
5346 func (page *LiveEventListResultPage) Next() error {
5347 return page.NextWithContext(context.Background())
5348 }
5349
5350
5351 func (page LiveEventListResultPage) NotDone() bool {
5352 return !page.lelr.IsEmpty()
5353 }
5354
5355
5356 func (page LiveEventListResultPage) Response() LiveEventListResult {
5357 return page.lelr
5358 }
5359
5360
5361 func (page LiveEventListResultPage) Values() []LiveEvent {
5362 if page.lelr.IsEmpty() {
5363 return nil
5364 }
5365 return *page.lelr.Value
5366 }
5367
5368
5369 func NewLiveEventListResultPage(cur LiveEventListResult, getNextPage func(context.Context, LiveEventListResult) (LiveEventListResult, error)) LiveEventListResultPage {
5370 return LiveEventListResultPage{
5371 fn: getNextPage,
5372 lelr: cur,
5373 }
5374 }
5375
5376
5377 type LiveEventPreview struct {
5378
5379 Endpoints *[]LiveEventEndpoint `json:"endpoints,omitempty"`
5380
5381 AccessControl *LiveEventPreviewAccessControl `json:"accessControl,omitempty"`
5382
5383 PreviewLocator *string `json:"previewLocator,omitempty"`
5384
5385 StreamingPolicyName *string `json:"streamingPolicyName,omitempty"`
5386
5387 AlternativeMediaID *string `json:"alternativeMediaId,omitempty"`
5388 }
5389
5390
5391 type LiveEventPreviewAccessControl struct {
5392
5393 IP *IPAccessControl `json:"ip,omitempty"`
5394 }
5395
5396
5397 type LiveEventProperties struct {
5398
5399 Description *string `json:"description,omitempty"`
5400
5401 Input *LiveEventInput `json:"input,omitempty"`
5402
5403 Preview *LiveEventPreview `json:"preview,omitempty"`
5404
5405 Encoding *LiveEventEncoding `json:"encoding,omitempty"`
5406
5407 ProvisioningState *string `json:"provisioningState,omitempty"`
5408
5409 ResourceState LiveEventResourceState `json:"resourceState,omitempty"`
5410
5411 CrossSiteAccessPolicies *CrossSiteAccessPolicies `json:"crossSiteAccessPolicies,omitempty"`
5412
5413 VanityURL *bool `json:"vanityUrl,omitempty"`
5414
5415 StreamOptions *[]StreamOptionsFlag `json:"streamOptions,omitempty"`
5416
5417 Created *date.Time `json:"created,omitempty"`
5418
5419 LastModified *date.Time `json:"lastModified,omitempty"`
5420 }
5421
5422
5423 func (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
5450
5451 type LiveEventsCreateFuture struct {
5452 azure.FutureAPI
5453
5454
5455 Result func(LiveEventsClient) (LiveEvent, error)
5456 }
5457
5458
5459 func (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
5470 func (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
5493
5494 type LiveEventsDeleteFuture struct {
5495 azure.FutureAPI
5496
5497
5498 Result func(LiveEventsClient) (autorest.Response, error)
5499 }
5500
5501
5502 func (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
5513 func (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
5530
5531 type LiveEventsResetFuture struct {
5532 azure.FutureAPI
5533
5534
5535 Result func(LiveEventsClient) (autorest.Response, error)
5536 }
5537
5538
5539 func (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
5550 func (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
5567
5568 type LiveEventsStartFuture struct {
5569 azure.FutureAPI
5570
5571
5572 Result func(LiveEventsClient) (autorest.Response, error)
5573 }
5574
5575
5576 func (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
5587 func (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
5604
5605 type LiveEventsStopFuture struct {
5606 azure.FutureAPI
5607
5608
5609 Result func(LiveEventsClient) (autorest.Response, error)
5610 }
5611
5612
5613 func (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
5624 func (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
5641
5642 type LiveEventsUpdateFuture struct {
5643 azure.FutureAPI
5644
5645
5646 Result func(LiveEventsClient) (LiveEvent, error)
5647 }
5648
5649
5650 func (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
5661 func (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
5684 type LiveOutput struct {
5685 autorest.Response `json:"-"`
5686
5687 *LiveOutputProperties `json:"properties,omitempty"`
5688
5689 ID *string `json:"id,omitempty"`
5690
5691 Name *string `json:"name,omitempty"`
5692
5693 Type *string `json:"type,omitempty"`
5694 }
5695
5696
5697 func (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
5706 func (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
5757 type LiveOutputListResult struct {
5758 autorest.Response `json:"-"`
5759
5760 Value *[]LiveOutput `json:"value,omitempty"`
5761
5762 OdataCount *int32 `json:"@odata.count,omitempty"`
5763
5764 OdataNextLink *string `json:"@odata.nextLink,omitempty"`
5765 }
5766
5767
5768 type LiveOutputListResultIterator struct {
5769 i int
5770 page LiveOutputListResultPage
5771 }
5772
5773
5774
5775 func (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
5800
5801
5802 func (iter *LiveOutputListResultIterator) Next() error {
5803 return iter.NextWithContext(context.Background())
5804 }
5805
5806
5807 func (iter LiveOutputListResultIterator) NotDone() bool {
5808 return iter.page.NotDone() && iter.i < len(iter.page.Values())
5809 }
5810
5811
5812 func (iter LiveOutputListResultIterator) Response() LiveOutputListResult {
5813 return iter.page.Response()
5814 }
5815
5816
5817
5818 func (iter LiveOutputListResultIterator) Value() LiveOutput {
5819 if !iter.page.NotDone() {
5820 return LiveOutput{}
5821 }
5822 return iter.page.Values()[iter.i]
5823 }
5824
5825
5826 func NewLiveOutputListResultIterator(page LiveOutputListResultPage) LiveOutputListResultIterator {
5827 return LiveOutputListResultIterator{page: page}
5828 }
5829
5830
5831 func (lolr LiveOutputListResult) IsEmpty() bool {
5832 return lolr.Value == nil || len(*lolr.Value) == 0
5833 }
5834
5835
5836 func (lolr LiveOutputListResult) hasNextLink() bool {
5837 return lolr.OdataNextLink != nil && len(*lolr.OdataNextLink) != 0
5838 }
5839
5840
5841
5842 func (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
5853 type LiveOutputListResultPage struct {
5854 fn func(context.Context, LiveOutputListResult) (LiveOutputListResult, error)
5855 lolr LiveOutputListResult
5856 }
5857
5858
5859
5860 func (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
5885
5886
5887 func (page *LiveOutputListResultPage) Next() error {
5888 return page.NextWithContext(context.Background())
5889 }
5890
5891
5892 func (page LiveOutputListResultPage) NotDone() bool {
5893 return !page.lolr.IsEmpty()
5894 }
5895
5896
5897 func (page LiveOutputListResultPage) Response() LiveOutputListResult {
5898 return page.lolr
5899 }
5900
5901
5902 func (page LiveOutputListResultPage) Values() []LiveOutput {
5903 if page.lolr.IsEmpty() {
5904 return nil
5905 }
5906 return *page.lolr.Value
5907 }
5908
5909
5910 func NewLiveOutputListResultPage(cur LiveOutputListResult, getNextPage func(context.Context, LiveOutputListResult) (LiveOutputListResult, error)) LiveOutputListResultPage {
5911 return LiveOutputListResultPage{
5912 fn: getNextPage,
5913 lolr: cur,
5914 }
5915 }
5916
5917
5918 type LiveOutputProperties struct {
5919
5920 Description *string `json:"description,omitempty"`
5921
5922 AssetName *string `json:"assetName,omitempty"`
5923
5924 ArchiveWindowLength *string `json:"archiveWindowLength,omitempty"`
5925
5926 ManifestName *string `json:"manifestName,omitempty"`
5927
5928 Hls *Hls `json:"hls,omitempty"`
5929
5930 OutputSnapTime *int64 `json:"outputSnapTime,omitempty"`
5931
5932 Created *date.Time `json:"created,omitempty"`
5933
5934 LastModified *date.Time `json:"lastModified,omitempty"`
5935
5936 ProvisioningState *string `json:"provisioningState,omitempty"`
5937
5938 ResourceState LiveOutputResourceState `json:"resourceState,omitempty"`
5939 }
5940
5941
5942 func (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
5966
5967 type LiveOutputsCreateFuture struct {
5968 azure.FutureAPI
5969
5970
5971 Result func(LiveOutputsClient) (LiveOutput, error)
5972 }
5973
5974
5975 func (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
5986 func (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
6009
6010 type LiveOutputsDeleteFuture struct {
6011 azure.FutureAPI
6012
6013
6014 Result func(LiveOutputsClient) (autorest.Response, error)
6015 }
6016
6017
6018 func (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
6029 func (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
6046 type Location struct {
6047 Name *string `json:"name,omitempty"`
6048 }
6049
6050
6051 type Mp4Format struct {
6052
6053 OutputFiles *[]OutputFile `json:"outputFiles,omitempty"`
6054
6055 FilenamePattern *string `json:"filenamePattern,omitempty"`
6056
6057 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"`
6058 }
6059
6060
6061 func (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
6077 func (m4f Mp4Format) AsImageFormat() (*ImageFormat, bool) {
6078 return nil, false
6079 }
6080
6081
6082 func (m4f Mp4Format) AsBasicImageFormat() (BasicImageFormat, bool) {
6083 return nil, false
6084 }
6085
6086
6087 func (m4f Mp4Format) AsJpgFormat() (*JpgFormat, bool) {
6088 return nil, false
6089 }
6090
6091
6092 func (m4f Mp4Format) AsPngFormat() (*PngFormat, bool) {
6093 return nil, false
6094 }
6095
6096
6097 func (m4f Mp4Format) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) {
6098 return nil, false
6099 }
6100
6101
6102 func (m4f Mp4Format) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) {
6103 return &m4f, true
6104 }
6105
6106
6107 func (m4f Mp4Format) AsMp4Format() (*Mp4Format, bool) {
6108 return &m4f, true
6109 }
6110
6111
6112 func (m4f Mp4Format) AsTransportStreamFormat() (*TransportStreamFormat, bool) {
6113 return nil, false
6114 }
6115
6116
6117 func (m4f Mp4Format) AsFormat() (*Format, bool) {
6118 return nil, false
6119 }
6120
6121
6122 func (m4f Mp4Format) AsBasicFormat() (BasicFormat, bool) {
6123 return &m4f, true
6124 }
6125
6126
6127
6128
6129 type BasicMultiBitrateFormat interface {
6130 AsMp4Format() (*Mp4Format, bool)
6131 AsTransportStreamFormat() (*TransportStreamFormat, bool)
6132 AsMultiBitrateFormat() (*MultiBitrateFormat, bool)
6133 }
6134
6135
6136
6137
6138 type MultiBitrateFormat struct {
6139
6140 OutputFiles *[]OutputFile `json:"outputFiles,omitempty"`
6141
6142 FilenamePattern *string `json:"filenamePattern,omitempty"`
6143
6144 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"`
6145 }
6146
6147 func 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 }
6169 func 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
6189 func (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
6205 func (mbf MultiBitrateFormat) AsImageFormat() (*ImageFormat, bool) {
6206 return nil, false
6207 }
6208
6209
6210 func (mbf MultiBitrateFormat) AsBasicImageFormat() (BasicImageFormat, bool) {
6211 return nil, false
6212 }
6213
6214
6215 func (mbf MultiBitrateFormat) AsJpgFormat() (*JpgFormat, bool) {
6216 return nil, false
6217 }
6218
6219
6220 func (mbf MultiBitrateFormat) AsPngFormat() (*PngFormat, bool) {
6221 return nil, false
6222 }
6223
6224
6225 func (mbf MultiBitrateFormat) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) {
6226 return &mbf, true
6227 }
6228
6229
6230 func (mbf MultiBitrateFormat) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) {
6231 return &mbf, true
6232 }
6233
6234
6235 func (mbf MultiBitrateFormat) AsMp4Format() (*Mp4Format, bool) {
6236 return nil, false
6237 }
6238
6239
6240 func (mbf MultiBitrateFormat) AsTransportStreamFormat() (*TransportStreamFormat, bool) {
6241 return nil, false
6242 }
6243
6244
6245 func (mbf MultiBitrateFormat) AsFormat() (*Format, bool) {
6246 return nil, false
6247 }
6248
6249
6250 func (mbf MultiBitrateFormat) AsBasicFormat() (BasicFormat, bool) {
6251 return &mbf, true
6252 }
6253
6254
6255 type NoEncryption struct {
6256
6257 EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"`
6258 }
6259
6260
6261 type ODataError struct {
6262
6263 Code *string `json:"code,omitempty"`
6264
6265 Message *string `json:"message,omitempty"`
6266
6267 Target *string `json:"target,omitempty"`
6268
6269 Details *[]ODataError `json:"details,omitempty"`
6270 }
6271
6272
6273 type Operation struct {
6274
6275 Name *string `json:"name,omitempty"`
6276
6277 Display *OperationDisplay `json:"display,omitempty"`
6278 }
6279
6280
6281 type OperationCollection struct {
6282 autorest.Response `json:"-"`
6283
6284 Value *[]Operation `json:"value,omitempty"`
6285
6286 OdataNextLink *string `json:"@odata.nextLink,omitempty"`
6287 }
6288
6289
6290 type OperationCollectionIterator struct {
6291 i int
6292 page OperationCollectionPage
6293 }
6294
6295
6296
6297 func (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
6322
6323
6324 func (iter *OperationCollectionIterator) Next() error {
6325 return iter.NextWithContext(context.Background())
6326 }
6327
6328
6329 func (iter OperationCollectionIterator) NotDone() bool {
6330 return iter.page.NotDone() && iter.i < len(iter.page.Values())
6331 }
6332
6333
6334 func (iter OperationCollectionIterator) Response() OperationCollection {
6335 return iter.page.Response()
6336 }
6337
6338
6339
6340 func (iter OperationCollectionIterator) Value() Operation {
6341 if !iter.page.NotDone() {
6342 return Operation{}
6343 }
6344 return iter.page.Values()[iter.i]
6345 }
6346
6347
6348 func NewOperationCollectionIterator(page OperationCollectionPage) OperationCollectionIterator {
6349 return OperationCollectionIterator{page: page}
6350 }
6351
6352
6353 func (oc OperationCollection) IsEmpty() bool {
6354 return oc.Value == nil || len(*oc.Value) == 0
6355 }
6356
6357
6358 func (oc OperationCollection) hasNextLink() bool {
6359 return oc.OdataNextLink != nil && len(*oc.OdataNextLink) != 0
6360 }
6361
6362
6363
6364 func (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
6375 type OperationCollectionPage struct {
6376 fn func(context.Context, OperationCollection) (OperationCollection, error)
6377 oc OperationCollection
6378 }
6379
6380
6381
6382 func (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
6407
6408
6409 func (page *OperationCollectionPage) Next() error {
6410 return page.NextWithContext(context.Background())
6411 }
6412
6413
6414 func (page OperationCollectionPage) NotDone() bool {
6415 return !page.oc.IsEmpty()
6416 }
6417
6418
6419 func (page OperationCollectionPage) Response() OperationCollection {
6420 return page.oc
6421 }
6422
6423
6424 func (page OperationCollectionPage) Values() []Operation {
6425 if page.oc.IsEmpty() {
6426 return nil
6427 }
6428 return *page.oc.Value
6429 }
6430
6431
6432 func NewOperationCollectionPage(cur OperationCollection, getNextPage func(context.Context, OperationCollection) (OperationCollection, error)) OperationCollectionPage {
6433 return OperationCollectionPage{
6434 fn: getNextPage,
6435 oc: cur,
6436 }
6437 }
6438
6439
6440 type OperationDisplay struct {
6441
6442 Provider *string `json:"provider,omitempty"`
6443
6444 Resource *string `json:"resource,omitempty"`
6445
6446 Operation *string `json:"operation,omitempty"`
6447
6448 Description *string `json:"description,omitempty"`
6449 }
6450
6451
6452 type OutputFile struct {
6453
6454 Labels *[]string `json:"labels,omitempty"`
6455 }
6456
6457
6458 type BasicOverlay interface {
6459 AsAudioOverlay() (*AudioOverlay, bool)
6460 AsVideoOverlay() (*VideoOverlay, bool)
6461 AsOverlay() (*Overlay, bool)
6462 }
6463
6464
6465 type Overlay struct {
6466
6467 InputLabel *string `json:"inputLabel,omitempty"`
6468
6469 Start *string `json:"start,omitempty"`
6470
6471 End *string `json:"end,omitempty"`
6472
6473 FadeInDuration *string `json:"fadeInDuration,omitempty"`
6474
6475 FadeOutDuration *string `json:"fadeOutDuration,omitempty"`
6476
6477 AudioGainLevel *float64 `json:"audioGainLevel,omitempty"`
6478
6479 OdataType OdataTypeBasicOverlay `json:"@odata.type,omitempty"`
6480 }
6481
6482 func 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 }
6504 func 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
6524 func (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
6552 func (o Overlay) AsAudioOverlay() (*AudioOverlay, bool) {
6553 return nil, false
6554 }
6555
6556
6557 func (o Overlay) AsVideoOverlay() (*VideoOverlay, bool) {
6558 return nil, false
6559 }
6560
6561
6562 func (o Overlay) AsOverlay() (*Overlay, bool) {
6563 return &o, true
6564 }
6565
6566
6567 func (o Overlay) AsBasicOverlay() (BasicOverlay, bool) {
6568 return &o, true
6569 }
6570
6571
6572 type PngFormat struct {
6573
6574 FilenamePattern *string `json:"filenamePattern,omitempty"`
6575
6576 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"`
6577 }
6578
6579
6580 func (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
6593 func (pf PngFormat) AsImageFormat() (*ImageFormat, bool) {
6594 return nil, false
6595 }
6596
6597
6598 func (pf PngFormat) AsBasicImageFormat() (BasicImageFormat, bool) {
6599 return &pf, true
6600 }
6601
6602
6603 func (pf PngFormat) AsJpgFormat() (*JpgFormat, bool) {
6604 return nil, false
6605 }
6606
6607
6608 func (pf PngFormat) AsPngFormat() (*PngFormat, bool) {
6609 return &pf, true
6610 }
6611
6612
6613 func (pf PngFormat) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) {
6614 return nil, false
6615 }
6616
6617
6618 func (pf PngFormat) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) {
6619 return nil, false
6620 }
6621
6622
6623 func (pf PngFormat) AsMp4Format() (*Mp4Format, bool) {
6624 return nil, false
6625 }
6626
6627
6628 func (pf PngFormat) AsTransportStreamFormat() (*TransportStreamFormat, bool) {
6629 return nil, false
6630 }
6631
6632
6633 func (pf PngFormat) AsFormat() (*Format, bool) {
6634 return nil, false
6635 }
6636
6637
6638 func (pf PngFormat) AsBasicFormat() (BasicFormat, bool) {
6639 return &pf, true
6640 }
6641
6642
6643 type PngImage struct {
6644
6645 Layers *[]PngLayer `json:"layers,omitempty"`
6646
6647 Start *string `json:"start,omitempty"`
6648
6649 Step *string `json:"step,omitempty"`
6650
6651 Range *string `json:"range,omitempty"`
6652
6653 KeyFrameInterval *string `json:"keyFrameInterval,omitempty"`
6654
6655 StretchMode StretchMode `json:"stretchMode,omitempty"`
6656
6657 Label *string `json:"label,omitempty"`
6658
6659 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"`
6660 }
6661
6662
6663 func (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
6694 func (pi PngImage) AsAudio() (*Audio, bool) {
6695 return nil, false
6696 }
6697
6698
6699 func (pi PngImage) AsBasicAudio() (BasicAudio, bool) {
6700 return nil, false
6701 }
6702
6703
6704 func (pi PngImage) AsAacAudio() (*AacAudio, bool) {
6705 return nil, false
6706 }
6707
6708
6709 func (pi PngImage) AsCopyVideo() (*CopyVideo, bool) {
6710 return nil, false
6711 }
6712
6713
6714 func (pi PngImage) AsVideo() (*Video, bool) {
6715 return nil, false
6716 }
6717
6718
6719 func (pi PngImage) AsBasicVideo() (BasicVideo, bool) {
6720 return &pi, true
6721 }
6722
6723
6724 func (pi PngImage) AsImage() (*Image, bool) {
6725 return nil, false
6726 }
6727
6728
6729 func (pi PngImage) AsBasicImage() (BasicImage, bool) {
6730 return &pi, true
6731 }
6732
6733
6734 func (pi PngImage) AsCopyAudio() (*CopyAudio, bool) {
6735 return nil, false
6736 }
6737
6738
6739 func (pi PngImage) AsH264Video() (*H264Video, bool) {
6740 return nil, false
6741 }
6742
6743
6744 func (pi PngImage) AsJpgImage() (*JpgImage, bool) {
6745 return nil, false
6746 }
6747
6748
6749 func (pi PngImage) AsPngImage() (*PngImage, bool) {
6750 return &pi, true
6751 }
6752
6753
6754 func (pi PngImage) AsCodec() (*Codec, bool) {
6755 return nil, false
6756 }
6757
6758
6759 func (pi PngImage) AsBasicCodec() (BasicCodec, bool) {
6760 return &pi, true
6761 }
6762
6763
6764 type PngLayer struct {
6765
6766 Width *string `json:"width,omitempty"`
6767
6768 Height *string `json:"height,omitempty"`
6769
6770 Label *string `json:"label,omitempty"`
6771
6772 OdataType OdataTypeBasicLayer `json:"@odata.type,omitempty"`
6773 }
6774
6775
6776 func (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
6795 func (pl PngLayer) AsVideoLayer() (*VideoLayer, bool) {
6796 return nil, false
6797 }
6798
6799
6800 func (pl PngLayer) AsBasicVideoLayer() (BasicVideoLayer, bool) {
6801 return nil, false
6802 }
6803
6804
6805 func (pl PngLayer) AsH264Layer() (*H264Layer, bool) {
6806 return nil, false
6807 }
6808
6809
6810 func (pl PngLayer) AsJpgLayer() (*JpgLayer, bool) {
6811 return nil, false
6812 }
6813
6814
6815 func (pl PngLayer) AsPngLayer() (*PngLayer, bool) {
6816 return &pl, true
6817 }
6818
6819
6820 func (pl PngLayer) AsLayer() (*Layer, bool) {
6821 return nil, false
6822 }
6823
6824
6825 func (pl PngLayer) AsBasicLayer() (BasicLayer, bool) {
6826 return &pl, true
6827 }
6828
6829
6830
6831 type 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
6841
6842 type Preset struct {
6843
6844 OdataType OdataTypeBasicPreset `json:"@odata.type,omitempty"`
6845 }
6846
6847 func 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 }
6877 func 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
6897 func (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
6907 func (p Preset) AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) {
6908 return nil, false
6909 }
6910
6911
6912 func (p Preset) AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) {
6913 return nil, false
6914 }
6915
6916
6917 func (p Preset) AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) {
6918 return nil, false
6919 }
6920
6921
6922 func (p Preset) AsStandardEncoderPreset() (*StandardEncoderPreset, bool) {
6923 return nil, false
6924 }
6925
6926
6927 func (p Preset) AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) {
6928 return nil, false
6929 }
6930
6931
6932 func (p Preset) AsPreset() (*Preset, bool) {
6933 return &p, true
6934 }
6935
6936
6937 func (p Preset) AsBasicPreset() (BasicPreset, bool) {
6938 return &p, true
6939 }
6940
6941
6942 type Provider struct {
6943
6944 ProviderName *string `json:"providerName,omitempty"`
6945 }
6946
6947
6948 type ProxyResource struct {
6949
6950 ID *string `json:"id,omitempty"`
6951
6952 Name *string `json:"name,omitempty"`
6953
6954 Type *string `json:"type,omitempty"`
6955 }
6956
6957
6958 func (pr ProxyResource) MarshalJSON() ([]byte, error) {
6959 objectMap := make(map[string]interface{})
6960 return json.Marshal(objectMap)
6961 }
6962
6963
6964
6965 type Rectangle struct {
6966
6967 Left *string `json:"left,omitempty"`
6968
6969 Top *string `json:"top,omitempty"`
6970
6971 Width *string `json:"width,omitempty"`
6972
6973 Height *string `json:"height,omitempty"`
6974 }
6975
6976
6977 type Resource struct {
6978
6979 ID *string `json:"id,omitempty"`
6980
6981 Name *string `json:"name,omitempty"`
6982
6983 Type *string `json:"type,omitempty"`
6984 }
6985
6986
6987 func (r Resource) MarshalJSON() ([]byte, error) {
6988 objectMap := make(map[string]interface{})
6989 return json.Marshal(objectMap)
6990 }
6991
6992
6993 type Service struct {
6994 autorest.Response `json:"-"`
6995
6996 *ServiceProperties `json:"properties,omitempty"`
6997
6998 Tags map[string]*string `json:"tags"`
6999
7000 Location *string `json:"location,omitempty"`
7001
7002 ID *string `json:"id,omitempty"`
7003
7004 Name *string `json:"name,omitempty"`
7005
7006 Type *string `json:"type,omitempty"`
7007 }
7008
7009
7010 func (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
7025 func (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
7094 type ServiceCollection struct {
7095 autorest.Response `json:"-"`
7096
7097 Value *[]Service `json:"value,omitempty"`
7098
7099 OdataNextLink *string `json:"@odata.nextLink,omitempty"`
7100 }
7101
7102
7103 type ServiceCollectionIterator struct {
7104 i int
7105 page ServiceCollectionPage
7106 }
7107
7108
7109
7110 func (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
7135
7136
7137 func (iter *ServiceCollectionIterator) Next() error {
7138 return iter.NextWithContext(context.Background())
7139 }
7140
7141
7142 func (iter ServiceCollectionIterator) NotDone() bool {
7143 return iter.page.NotDone() && iter.i < len(iter.page.Values())
7144 }
7145
7146
7147 func (iter ServiceCollectionIterator) Response() ServiceCollection {
7148 return iter.page.Response()
7149 }
7150
7151
7152
7153 func (iter ServiceCollectionIterator) Value() Service {
7154 if !iter.page.NotDone() {
7155 return Service{}
7156 }
7157 return iter.page.Values()[iter.i]
7158 }
7159
7160
7161 func NewServiceCollectionIterator(page ServiceCollectionPage) ServiceCollectionIterator {
7162 return ServiceCollectionIterator{page: page}
7163 }
7164
7165
7166 func (sc ServiceCollection) IsEmpty() bool {
7167 return sc.Value == nil || len(*sc.Value) == 0
7168 }
7169
7170
7171 func (sc ServiceCollection) hasNextLink() bool {
7172 return sc.OdataNextLink != nil && len(*sc.OdataNextLink) != 0
7173 }
7174
7175
7176
7177 func (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
7188 type ServiceCollectionPage struct {
7189 fn func(context.Context, ServiceCollection) (ServiceCollection, error)
7190 sc ServiceCollection
7191 }
7192
7193
7194
7195 func (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
7220
7221
7222 func (page *ServiceCollectionPage) Next() error {
7223 return page.NextWithContext(context.Background())
7224 }
7225
7226
7227 func (page ServiceCollectionPage) NotDone() bool {
7228 return !page.sc.IsEmpty()
7229 }
7230
7231
7232 func (page ServiceCollectionPage) Response() ServiceCollection {
7233 return page.sc
7234 }
7235
7236
7237 func (page ServiceCollectionPage) Values() []Service {
7238 if page.sc.IsEmpty() {
7239 return nil
7240 }
7241 return *page.sc.Value
7242 }
7243
7244
7245 func NewServiceCollectionPage(cur ServiceCollection, getNextPage func(context.Context, ServiceCollection) (ServiceCollection, error)) ServiceCollectionPage {
7246 return ServiceCollectionPage{
7247 fn: getNextPage,
7248 sc: cur,
7249 }
7250 }
7251
7252
7253 type ServiceProperties struct {
7254
7255 MediaServiceID *uuid.UUID `json:"mediaServiceId,omitempty"`
7256
7257 StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"`
7258 }
7259
7260
7261 func (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
7270
7271 type StandardEncoderPreset struct {
7272
7273 Filters *Filters `json:"filters,omitempty"`
7274
7275 Codecs *[]BasicCodec `json:"codecs,omitempty"`
7276
7277 Formats *[]BasicFormat `json:"formats,omitempty"`
7278
7279 OdataType OdataTypeBasicPreset `json:"@odata.type,omitempty"`
7280 }
7281
7282
7283 func (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
7302 func (sep StandardEncoderPreset) AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) {
7303 return nil, false
7304 }
7305
7306
7307 func (sep StandardEncoderPreset) AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) {
7308 return nil, false
7309 }
7310
7311
7312 func (sep StandardEncoderPreset) AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) {
7313 return nil, false
7314 }
7315
7316
7317 func (sep StandardEncoderPreset) AsStandardEncoderPreset() (*StandardEncoderPreset, bool) {
7318 return &sep, true
7319 }
7320
7321
7322 func (sep StandardEncoderPreset) AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) {
7323 return nil, false
7324 }
7325
7326
7327 func (sep StandardEncoderPreset) AsPreset() (*Preset, bool) {
7328 return nil, false
7329 }
7330
7331
7332 func (sep StandardEncoderPreset) AsBasicPreset() (BasicPreset, bool) {
7333 return &sep, true
7334 }
7335
7336
7337 func (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
7386 type StorageAccount struct {
7387
7388 ID *string `json:"id,omitempty"`
7389
7390 Type StorageAccountType `json:"type,omitempty"`
7391 }
7392
7393
7394 type StreamingEndpoint struct {
7395 autorest.Response `json:"-"`
7396
7397 *StreamingEndpointProperties `json:"properties,omitempty"`
7398
7399 Tags map[string]*string `json:"tags"`
7400
7401 Location *string `json:"location,omitempty"`
7402
7403 ID *string `json:"id,omitempty"`
7404
7405 Name *string `json:"name,omitempty"`
7406
7407 Type *string `json:"type,omitempty"`
7408 }
7409
7410
7411 func (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
7426 func (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
7495 type StreamingEndpointAccessControl struct {
7496
7497 Akamai *AkamaiAccessControl `json:"akamai,omitempty"`
7498
7499 IP *IPAccessControl `json:"ip,omitempty"`
7500 }
7501
7502
7503 type StreamingEndpointListResult struct {
7504 autorest.Response `json:"-"`
7505
7506 Value *[]StreamingEndpoint `json:"value,omitempty"`
7507
7508 OdataCount *int32 `json:"@odata.count,omitempty"`
7509
7510 OdataNextLink *string `json:"@odata.nextLink,omitempty"`
7511 }
7512
7513
7514 type StreamingEndpointListResultIterator struct {
7515 i int
7516 page StreamingEndpointListResultPage
7517 }
7518
7519
7520
7521 func (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
7546
7547
7548 func (iter *StreamingEndpointListResultIterator) Next() error {
7549 return iter.NextWithContext(context.Background())
7550 }
7551
7552
7553 func (iter StreamingEndpointListResultIterator) NotDone() bool {
7554 return iter.page.NotDone() && iter.i < len(iter.page.Values())
7555 }
7556
7557
7558 func (iter StreamingEndpointListResultIterator) Response() StreamingEndpointListResult {
7559 return iter.page.Response()
7560 }
7561
7562
7563
7564 func (iter StreamingEndpointListResultIterator) Value() StreamingEndpoint {
7565 if !iter.page.NotDone() {
7566 return StreamingEndpoint{}
7567 }
7568 return iter.page.Values()[iter.i]
7569 }
7570
7571
7572 func NewStreamingEndpointListResultIterator(page StreamingEndpointListResultPage) StreamingEndpointListResultIterator {
7573 return StreamingEndpointListResultIterator{page: page}
7574 }
7575
7576
7577 func (selr StreamingEndpointListResult) IsEmpty() bool {
7578 return selr.Value == nil || len(*selr.Value) == 0
7579 }
7580
7581
7582 func (selr StreamingEndpointListResult) hasNextLink() bool {
7583 return selr.OdataNextLink != nil && len(*selr.OdataNextLink) != 0
7584 }
7585
7586
7587
7588 func (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
7599 type StreamingEndpointListResultPage struct {
7600 fn func(context.Context, StreamingEndpointListResult) (StreamingEndpointListResult, error)
7601 selr StreamingEndpointListResult
7602 }
7603
7604
7605
7606 func (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
7631
7632
7633 func (page *StreamingEndpointListResultPage) Next() error {
7634 return page.NextWithContext(context.Background())
7635 }
7636
7637
7638 func (page StreamingEndpointListResultPage) NotDone() bool {
7639 return !page.selr.IsEmpty()
7640 }
7641
7642
7643 func (page StreamingEndpointListResultPage) Response() StreamingEndpointListResult {
7644 return page.selr
7645 }
7646
7647
7648 func (page StreamingEndpointListResultPage) Values() []StreamingEndpoint {
7649 if page.selr.IsEmpty() {
7650 return nil
7651 }
7652 return *page.selr.Value
7653 }
7654
7655
7656 func NewStreamingEndpointListResultPage(cur StreamingEndpointListResult, getNextPage func(context.Context, StreamingEndpointListResult) (StreamingEndpointListResult, error)) StreamingEndpointListResultPage {
7657 return StreamingEndpointListResultPage{
7658 fn: getNextPage,
7659 selr: cur,
7660 }
7661 }
7662
7663
7664 type StreamingEndpointProperties struct {
7665
7666 Description *string `json:"description,omitempty"`
7667
7668 ScaleUnits *int32 `json:"scaleUnits,omitempty"`
7669
7670 AvailabilitySetName *string `json:"availabilitySetName,omitempty"`
7671
7672 AccessControl *StreamingEndpointAccessControl `json:"accessControl,omitempty"`
7673
7674 MaxCacheAge *int64 `json:"maxCacheAge,omitempty"`
7675
7676 CustomHostNames *[]string `json:"customHostNames,omitempty"`
7677
7678 HostName *string `json:"hostName,omitempty"`
7679
7680 CdnEnabled *bool `json:"cdnEnabled,omitempty"`
7681
7682 CdnProvider *string `json:"cdnProvider,omitempty"`
7683
7684 CdnProfile *string `json:"cdnProfile,omitempty"`
7685
7686 ProvisioningState *string `json:"provisioningState,omitempty"`
7687
7688 ResourceState StreamingEndpointResourceState `json:"resourceState,omitempty"`
7689
7690 CrossSiteAccessPolicies *CrossSiteAccessPolicies `json:"crossSiteAccessPolicies,omitempty"`
7691
7692 FreeTrialEndTime *date.Time `json:"freeTrialEndTime,omitempty"`
7693
7694 Created *date.Time `json:"created,omitempty"`
7695
7696 LastModified *date.Time `json:"lastModified,omitempty"`
7697 }
7698
7699
7700 func (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
7736
7737 type StreamingEndpointsCreateFuture struct {
7738 azure.FutureAPI
7739
7740
7741 Result func(StreamingEndpointsClient) (StreamingEndpoint, error)
7742 }
7743
7744
7745 func (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
7756 func (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
7779
7780 type StreamingEndpointsDeleteFuture struct {
7781 azure.FutureAPI
7782
7783
7784 Result func(StreamingEndpointsClient) (autorest.Response, error)
7785 }
7786
7787
7788 func (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
7799 func (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
7816
7817 type StreamingEndpointsScaleFuture struct {
7818 azure.FutureAPI
7819
7820
7821 Result func(StreamingEndpointsClient) (autorest.Response, error)
7822 }
7823
7824
7825 func (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
7836 func (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
7853
7854 type StreamingEndpointsStartFuture struct {
7855 azure.FutureAPI
7856
7857
7858 Result func(StreamingEndpointsClient) (autorest.Response, error)
7859 }
7860
7861
7862 func (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
7873 func (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
7890
7891 type StreamingEndpointsStopFuture struct {
7892 azure.FutureAPI
7893
7894
7895 Result func(StreamingEndpointsClient) (autorest.Response, error)
7896 }
7897
7898
7899 func (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
7910 func (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
7927
7928 type StreamingEndpointsUpdateFuture struct {
7929 azure.FutureAPI
7930
7931
7932 Result func(StreamingEndpointsClient) (StreamingEndpoint, error)
7933 }
7934
7935
7936 func (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
7947 func (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
7970 type StreamingEntityScaleUnit struct {
7971
7972 ScaleUnit *int32 `json:"scaleUnit,omitempty"`
7973 }
7974
7975
7976 type StreamingLocator struct {
7977 autorest.Response `json:"-"`
7978 *StreamingLocatorProperties `json:"properties,omitempty"`
7979
7980 ID *string `json:"id,omitempty"`
7981
7982 Name *string `json:"name,omitempty"`
7983
7984 Type *string `json:"type,omitempty"`
7985 }
7986
7987
7988 func (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
7997 func (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
8048 type StreamingLocatorCollection struct {
8049 autorest.Response `json:"-"`
8050
8051 Value *[]StreamingLocator `json:"value,omitempty"`
8052
8053 OdataNextLink *string `json:"@odata.nextLink,omitempty"`
8054 }
8055
8056
8057 type StreamingLocatorCollectionIterator struct {
8058 i int
8059 page StreamingLocatorCollectionPage
8060 }
8061
8062
8063
8064 func (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
8089
8090
8091 func (iter *StreamingLocatorCollectionIterator) Next() error {
8092 return iter.NextWithContext(context.Background())
8093 }
8094
8095
8096 func (iter StreamingLocatorCollectionIterator) NotDone() bool {
8097 return iter.page.NotDone() && iter.i < len(iter.page.Values())
8098 }
8099
8100
8101 func (iter StreamingLocatorCollectionIterator) Response() StreamingLocatorCollection {
8102 return iter.page.Response()
8103 }
8104
8105
8106
8107 func (iter StreamingLocatorCollectionIterator) Value() StreamingLocator {
8108 if !iter.page.NotDone() {
8109 return StreamingLocator{}
8110 }
8111 return iter.page.Values()[iter.i]
8112 }
8113
8114
8115 func NewStreamingLocatorCollectionIterator(page StreamingLocatorCollectionPage) StreamingLocatorCollectionIterator {
8116 return StreamingLocatorCollectionIterator{page: page}
8117 }
8118
8119
8120 func (slc StreamingLocatorCollection) IsEmpty() bool {
8121 return slc.Value == nil || len(*slc.Value) == 0
8122 }
8123
8124
8125 func (slc StreamingLocatorCollection) hasNextLink() bool {
8126 return slc.OdataNextLink != nil && len(*slc.OdataNextLink) != 0
8127 }
8128
8129
8130
8131 func (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
8142 type StreamingLocatorCollectionPage struct {
8143 fn func(context.Context, StreamingLocatorCollection) (StreamingLocatorCollection, error)
8144 slc StreamingLocatorCollection
8145 }
8146
8147
8148
8149 func (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
8174
8175
8176 func (page *StreamingLocatorCollectionPage) Next() error {
8177 return page.NextWithContext(context.Background())
8178 }
8179
8180
8181 func (page StreamingLocatorCollectionPage) NotDone() bool {
8182 return !page.slc.IsEmpty()
8183 }
8184
8185
8186 func (page StreamingLocatorCollectionPage) Response() StreamingLocatorCollection {
8187 return page.slc
8188 }
8189
8190
8191 func (page StreamingLocatorCollectionPage) Values() []StreamingLocator {
8192 if page.slc.IsEmpty() {
8193 return nil
8194 }
8195 return *page.slc.Value
8196 }
8197
8198
8199 func NewStreamingLocatorCollectionPage(cur StreamingLocatorCollection, getNextPage func(context.Context, StreamingLocatorCollection) (StreamingLocatorCollection, error)) StreamingLocatorCollectionPage {
8200 return StreamingLocatorCollectionPage{
8201 fn: getNextPage,
8202 slc: cur,
8203 }
8204 }
8205
8206
8207 type StreamingLocatorContentKey struct {
8208
8209 ID *uuid.UUID `json:"id,omitempty"`
8210
8211 Type StreamingLocatorContentKeyType `json:"type,omitempty"`
8212
8213 Label *string `json:"label,omitempty"`
8214
8215 Value *string `json:"value,omitempty"`
8216
8217 PolicyName *string `json:"policyName,omitempty"`
8218
8219 Tracks *[]TrackSelection `json:"tracks,omitempty"`
8220 }
8221
8222
8223 func (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
8241 type StreamingLocatorProperties struct {
8242
8243 AssetName *string `json:"assetName,omitempty"`
8244
8245 Created *date.Time `json:"created,omitempty"`
8246
8247 StartTime *date.Time `json:"startTime,omitempty"`
8248
8249 EndTime *date.Time `json:"endTime,omitempty"`
8250
8251 StreamingLocatorID *uuid.UUID `json:"streamingLocatorId,omitempty"`
8252
8253 StreamingPolicyName *string `json:"streamingPolicyName,omitempty"`
8254
8255 DefaultContentKeyPolicyName *string `json:"defaultContentKeyPolicyName,omitempty"`
8256
8257 ContentKeys *[]StreamingLocatorContentKey `json:"contentKeys,omitempty"`
8258
8259 AlternativeMediaID *string `json:"alternativeMediaId,omitempty"`
8260 }
8261
8262
8263 func (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
8293 type StreamingPath struct {
8294
8295 StreamingProtocol StreamingPolicyStreamingProtocol `json:"streamingProtocol,omitempty"`
8296
8297 EncryptionScheme EncryptionScheme `json:"encryptionScheme,omitempty"`
8298
8299 Paths *[]string `json:"paths,omitempty"`
8300 }
8301
8302
8303 type StreamingPolicy struct {
8304 autorest.Response `json:"-"`
8305 *StreamingPolicyProperties `json:"properties,omitempty"`
8306
8307 ID *string `json:"id,omitempty"`
8308
8309 Name *string `json:"name,omitempty"`
8310
8311 Type *string `json:"type,omitempty"`
8312 }
8313
8314
8315 func (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
8324 func (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
8375 type StreamingPolicyCollection struct {
8376 autorest.Response `json:"-"`
8377
8378 Value *[]StreamingPolicy `json:"value,omitempty"`
8379
8380 OdataNextLink *string `json:"@odata.nextLink,omitempty"`
8381 }
8382
8383
8384 type StreamingPolicyCollectionIterator struct {
8385 i int
8386 page StreamingPolicyCollectionPage
8387 }
8388
8389
8390
8391 func (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
8416
8417
8418 func (iter *StreamingPolicyCollectionIterator) Next() error {
8419 return iter.NextWithContext(context.Background())
8420 }
8421
8422
8423 func (iter StreamingPolicyCollectionIterator) NotDone() bool {
8424 return iter.page.NotDone() && iter.i < len(iter.page.Values())
8425 }
8426
8427
8428 func (iter StreamingPolicyCollectionIterator) Response() StreamingPolicyCollection {
8429 return iter.page.Response()
8430 }
8431
8432
8433
8434 func (iter StreamingPolicyCollectionIterator) Value() StreamingPolicy {
8435 if !iter.page.NotDone() {
8436 return StreamingPolicy{}
8437 }
8438 return iter.page.Values()[iter.i]
8439 }
8440
8441
8442 func NewStreamingPolicyCollectionIterator(page StreamingPolicyCollectionPage) StreamingPolicyCollectionIterator {
8443 return StreamingPolicyCollectionIterator{page: page}
8444 }
8445
8446
8447 func (spc StreamingPolicyCollection) IsEmpty() bool {
8448 return spc.Value == nil || len(*spc.Value) == 0
8449 }
8450
8451
8452 func (spc StreamingPolicyCollection) hasNextLink() bool {
8453 return spc.OdataNextLink != nil && len(*spc.OdataNextLink) != 0
8454 }
8455
8456
8457
8458 func (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
8469 type StreamingPolicyCollectionPage struct {
8470 fn func(context.Context, StreamingPolicyCollection) (StreamingPolicyCollection, error)
8471 spc StreamingPolicyCollection
8472 }
8473
8474
8475
8476 func (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
8501
8502
8503 func (page *StreamingPolicyCollectionPage) Next() error {
8504 return page.NextWithContext(context.Background())
8505 }
8506
8507
8508 func (page StreamingPolicyCollectionPage) NotDone() bool {
8509 return !page.spc.IsEmpty()
8510 }
8511
8512
8513 func (page StreamingPolicyCollectionPage) Response() StreamingPolicyCollection {
8514 return page.spc
8515 }
8516
8517
8518 func (page StreamingPolicyCollectionPage) Values() []StreamingPolicy {
8519 if page.spc.IsEmpty() {
8520 return nil
8521 }
8522 return *page.spc.Value
8523 }
8524
8525
8526 func NewStreamingPolicyCollectionPage(cur StreamingPolicyCollection, getNextPage func(context.Context, StreamingPolicyCollection) (StreamingPolicyCollection, error)) StreamingPolicyCollectionPage {
8527 return StreamingPolicyCollectionPage{
8528 fn: getNextPage,
8529 spc: cur,
8530 }
8531 }
8532
8533
8534 type StreamingPolicyContentKey struct {
8535
8536 Label *string `json:"label,omitempty"`
8537
8538 PolicyName *string `json:"policyName,omitempty"`
8539
8540 Tracks *[]TrackSelection `json:"tracks,omitempty"`
8541 }
8542
8543
8544 type StreamingPolicyContentKeys struct {
8545
8546 DefaultKey *DefaultKey `json:"defaultKey,omitempty"`
8547
8548 KeyToTrackMappings *[]StreamingPolicyContentKey `json:"keyToTrackMappings,omitempty"`
8549 }
8550
8551
8552 type StreamingPolicyFairPlayConfiguration struct {
8553
8554 CustomLicenseAcquisitionURLTemplate *string `json:"customLicenseAcquisitionUrlTemplate,omitempty"`
8555
8556 AllowPersistentLicense *bool `json:"allowPersistentLicense,omitempty"`
8557 }
8558
8559
8560 type StreamingPolicyPlayReadyConfiguration struct {
8561
8562 CustomLicenseAcquisitionURLTemplate *string `json:"customLicenseAcquisitionUrlTemplate,omitempty"`
8563
8564 PlayReadyCustomAttributes *string `json:"playReadyCustomAttributes,omitempty"`
8565 }
8566
8567
8568 type StreamingPolicyProperties struct {
8569
8570 Created *date.Time `json:"created,omitempty"`
8571
8572 DefaultContentKeyPolicyName *string `json:"defaultContentKeyPolicyName,omitempty"`
8573
8574 EnvelopeEncryption *EnvelopeEncryption `json:"envelopeEncryption,omitempty"`
8575
8576 CommonEncryptionCenc *CommonEncryptionCenc `json:"commonEncryptionCenc,omitempty"`
8577
8578 CommonEncryptionCbcs *CommonEncryptionCbcs `json:"commonEncryptionCbcs,omitempty"`
8579
8580 NoEncryption *NoEncryption `json:"noEncryption,omitempty"`
8581 }
8582
8583
8584 func (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
8605 type StreamingPolicyWidevineConfiguration struct {
8606
8607 CustomLicenseAcquisitionURLTemplate *string `json:"customLicenseAcquisitionUrlTemplate,omitempty"`
8608 }
8609
8610
8611 type SubscriptionMediaService struct {
8612 autorest.Response `json:"-"`
8613
8614 *ServiceProperties `json:"properties,omitempty"`
8615
8616 Tags map[string]*string `json:"tags"`
8617
8618 Location *string `json:"location,omitempty"`
8619
8620 ID *string `json:"id,omitempty"`
8621
8622 Name *string `json:"name,omitempty"`
8623
8624 Type *string `json:"type,omitempty"`
8625 }
8626
8627
8628 func (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
8643 func (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
8712 type SubscriptionMediaServiceCollection struct {
8713 autorest.Response `json:"-"`
8714
8715 Value *[]SubscriptionMediaService `json:"value,omitempty"`
8716
8717 OdataNextLink *string `json:"@odata.nextLink,omitempty"`
8718 }
8719
8720
8721
8722 type SubscriptionMediaServiceCollectionIterator struct {
8723 i int
8724 page SubscriptionMediaServiceCollectionPage
8725 }
8726
8727
8728
8729 func (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
8754
8755
8756 func (iter *SubscriptionMediaServiceCollectionIterator) Next() error {
8757 return iter.NextWithContext(context.Background())
8758 }
8759
8760
8761 func (iter SubscriptionMediaServiceCollectionIterator) NotDone() bool {
8762 return iter.page.NotDone() && iter.i < len(iter.page.Values())
8763 }
8764
8765
8766 func (iter SubscriptionMediaServiceCollectionIterator) Response() SubscriptionMediaServiceCollection {
8767 return iter.page.Response()
8768 }
8769
8770
8771
8772 func (iter SubscriptionMediaServiceCollectionIterator) Value() SubscriptionMediaService {
8773 if !iter.page.NotDone() {
8774 return SubscriptionMediaService{}
8775 }
8776 return iter.page.Values()[iter.i]
8777 }
8778
8779
8780 func NewSubscriptionMediaServiceCollectionIterator(page SubscriptionMediaServiceCollectionPage) SubscriptionMediaServiceCollectionIterator {
8781 return SubscriptionMediaServiceCollectionIterator{page: page}
8782 }
8783
8784
8785 func (smsc SubscriptionMediaServiceCollection) IsEmpty() bool {
8786 return smsc.Value == nil || len(*smsc.Value) == 0
8787 }
8788
8789
8790 func (smsc SubscriptionMediaServiceCollection) hasNextLink() bool {
8791 return smsc.OdataNextLink != nil && len(*smsc.OdataNextLink) != 0
8792 }
8793
8794
8795
8796 func (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
8807 type SubscriptionMediaServiceCollectionPage struct {
8808 fn func(context.Context, SubscriptionMediaServiceCollection) (SubscriptionMediaServiceCollection, error)
8809 smsc SubscriptionMediaServiceCollection
8810 }
8811
8812
8813
8814 func (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
8839
8840
8841 func (page *SubscriptionMediaServiceCollectionPage) Next() error {
8842 return page.NextWithContext(context.Background())
8843 }
8844
8845
8846 func (page SubscriptionMediaServiceCollectionPage) NotDone() bool {
8847 return !page.smsc.IsEmpty()
8848 }
8849
8850
8851 func (page SubscriptionMediaServiceCollectionPage) Response() SubscriptionMediaServiceCollection {
8852 return page.smsc
8853 }
8854
8855
8856 func (page SubscriptionMediaServiceCollectionPage) Values() []SubscriptionMediaService {
8857 if page.smsc.IsEmpty() {
8858 return nil
8859 }
8860 return *page.smsc.Value
8861 }
8862
8863
8864 func NewSubscriptionMediaServiceCollectionPage(cur SubscriptionMediaServiceCollection, getNextPage func(context.Context, SubscriptionMediaServiceCollection) (SubscriptionMediaServiceCollection, error)) SubscriptionMediaServiceCollectionPage {
8865 return SubscriptionMediaServiceCollectionPage{
8866 fn: getNextPage,
8867 smsc: cur,
8868 }
8869 }
8870
8871
8872 type SyncStorageKeysInput struct {
8873
8874 ID *string `json:"id,omitempty"`
8875 }
8876
8877
8878 type TrackedResource struct {
8879
8880 Tags map[string]*string `json:"tags"`
8881
8882 Location *string `json:"location,omitempty"`
8883
8884 ID *string `json:"id,omitempty"`
8885
8886 Name *string `json:"name,omitempty"`
8887
8888 Type *string `json:"type,omitempty"`
8889 }
8890
8891
8892 func (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
8904 type TrackPropertyCondition struct {
8905
8906 Property TrackPropertyType `json:"property,omitempty"`
8907
8908 Operation TrackPropertyCompareOperation `json:"operation,omitempty"`
8909
8910 Value *string `json:"value,omitempty"`
8911 }
8912
8913
8914 type TrackSelection struct {
8915
8916 TrackSelections *[]TrackPropertyCondition `json:"trackSelections,omitempty"`
8917 }
8918
8919
8920
8921
8922 type Transform struct {
8923 autorest.Response `json:"-"`
8924
8925 *TransformProperties `json:"properties,omitempty"`
8926
8927 ID *string `json:"id,omitempty"`
8928
8929 Name *string `json:"name,omitempty"`
8930
8931 Type *string `json:"type,omitempty"`
8932 }
8933
8934
8935 func (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
8944 func (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
8995 type TransformCollection struct {
8996 autorest.Response `json:"-"`
8997
8998 Value *[]Transform `json:"value,omitempty"`
8999
9000 OdataNextLink *string `json:"@odata.nextLink,omitempty"`
9001 }
9002
9003
9004 type TransformCollectionIterator struct {
9005 i int
9006 page TransformCollectionPage
9007 }
9008
9009
9010
9011 func (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
9036
9037
9038 func (iter *TransformCollectionIterator) Next() error {
9039 return iter.NextWithContext(context.Background())
9040 }
9041
9042
9043 func (iter TransformCollectionIterator) NotDone() bool {
9044 return iter.page.NotDone() && iter.i < len(iter.page.Values())
9045 }
9046
9047
9048 func (iter TransformCollectionIterator) Response() TransformCollection {
9049 return iter.page.Response()
9050 }
9051
9052
9053
9054 func (iter TransformCollectionIterator) Value() Transform {
9055 if !iter.page.NotDone() {
9056 return Transform{}
9057 }
9058 return iter.page.Values()[iter.i]
9059 }
9060
9061
9062 func NewTransformCollectionIterator(page TransformCollectionPage) TransformCollectionIterator {
9063 return TransformCollectionIterator{page: page}
9064 }
9065
9066
9067 func (tc TransformCollection) IsEmpty() bool {
9068 return tc.Value == nil || len(*tc.Value) == 0
9069 }
9070
9071
9072 func (tc TransformCollection) hasNextLink() bool {
9073 return tc.OdataNextLink != nil && len(*tc.OdataNextLink) != 0
9074 }
9075
9076
9077
9078 func (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
9089 type TransformCollectionPage struct {
9090 fn func(context.Context, TransformCollection) (TransformCollection, error)
9091 tc TransformCollection
9092 }
9093
9094
9095
9096 func (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
9121
9122
9123 func (page *TransformCollectionPage) Next() error {
9124 return page.NextWithContext(context.Background())
9125 }
9126
9127
9128 func (page TransformCollectionPage) NotDone() bool {
9129 return !page.tc.IsEmpty()
9130 }
9131
9132
9133 func (page TransformCollectionPage) Response() TransformCollection {
9134 return page.tc
9135 }
9136
9137
9138 func (page TransformCollectionPage) Values() []Transform {
9139 if page.tc.IsEmpty() {
9140 return nil
9141 }
9142 return *page.tc.Value
9143 }
9144
9145
9146 func NewTransformCollectionPage(cur TransformCollection, getNextPage func(context.Context, TransformCollection) (TransformCollection, error)) TransformCollectionPage {
9147 return TransformCollectionPage{
9148 fn: getNextPage,
9149 tc: cur,
9150 }
9151 }
9152
9153
9154
9155 type TransformOutput struct {
9156
9157 OnError OnErrorType `json:"onError,omitempty"`
9158
9159 RelativePriority Priority `json:"relativePriority,omitempty"`
9160
9161 Preset BasicPreset `json:"preset,omitempty"`
9162 }
9163
9164
9165 func (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
9206 type TransformProperties struct {
9207
9208 Created *date.Time `json:"created,omitempty"`
9209
9210 Description *string `json:"description,omitempty"`
9211
9212 LastModified *date.Time `json:"lastModified,omitempty"`
9213
9214 Outputs *[]TransformOutput `json:"outputs,omitempty"`
9215 }
9216
9217
9218 func (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
9230
9231 type TransportStreamFormat struct {
9232
9233 OutputFiles *[]OutputFile `json:"outputFiles,omitempty"`
9234
9235 FilenamePattern *string `json:"filenamePattern,omitempty"`
9236
9237 OdataType OdataTypeBasicFormat `json:"@odata.type,omitempty"`
9238 }
9239
9240
9241 func (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
9257 func (tsf TransportStreamFormat) AsImageFormat() (*ImageFormat, bool) {
9258 return nil, false
9259 }
9260
9261
9262 func (tsf TransportStreamFormat) AsBasicImageFormat() (BasicImageFormat, bool) {
9263 return nil, false
9264 }
9265
9266
9267 func (tsf TransportStreamFormat) AsJpgFormat() (*JpgFormat, bool) {
9268 return nil, false
9269 }
9270
9271
9272 func (tsf TransportStreamFormat) AsPngFormat() (*PngFormat, bool) {
9273 return nil, false
9274 }
9275
9276
9277 func (tsf TransportStreamFormat) AsMultiBitrateFormat() (*MultiBitrateFormat, bool) {
9278 return nil, false
9279 }
9280
9281
9282 func (tsf TransportStreamFormat) AsBasicMultiBitrateFormat() (BasicMultiBitrateFormat, bool) {
9283 return &tsf, true
9284 }
9285
9286
9287 func (tsf TransportStreamFormat) AsMp4Format() (*Mp4Format, bool) {
9288 return nil, false
9289 }
9290
9291
9292 func (tsf TransportStreamFormat) AsTransportStreamFormat() (*TransportStreamFormat, bool) {
9293 return &tsf, true
9294 }
9295
9296
9297 func (tsf TransportStreamFormat) AsFormat() (*Format, bool) {
9298 return nil, false
9299 }
9300
9301
9302 func (tsf TransportStreamFormat) AsBasicFormat() (BasicFormat, bool) {
9303 return &tsf, true
9304 }
9305
9306
9307 type 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
9317 type Video struct {
9318
9319 KeyFrameInterval *string `json:"keyFrameInterval,omitempty"`
9320
9321 StretchMode StretchMode `json:"stretchMode,omitempty"`
9322
9323 Label *string `json:"label,omitempty"`
9324
9325 OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"`
9326 }
9327
9328 func 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 }
9358 func 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
9378 func (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
9397 func (vVar Video) AsAudio() (*Audio, bool) {
9398 return nil, false
9399 }
9400
9401
9402 func (vVar Video) AsBasicAudio() (BasicAudio, bool) {
9403 return nil, false
9404 }
9405
9406
9407 func (vVar Video) AsAacAudio() (*AacAudio, bool) {
9408 return nil, false
9409 }
9410
9411
9412 func (vVar Video) AsCopyVideo() (*CopyVideo, bool) {
9413 return nil, false
9414 }
9415
9416
9417 func (vVar Video) AsVideo() (*Video, bool) {
9418 return &vVar, true
9419 }
9420
9421
9422 func (vVar Video) AsBasicVideo() (BasicVideo, bool) {
9423 return &vVar, true
9424 }
9425
9426
9427 func (vVar Video) AsImage() (*Image, bool) {
9428 return nil, false
9429 }
9430
9431
9432 func (vVar Video) AsBasicImage() (BasicImage, bool) {
9433 return nil, false
9434 }
9435
9436
9437 func (vVar Video) AsCopyAudio() (*CopyAudio, bool) {
9438 return nil, false
9439 }
9440
9441
9442 func (vVar Video) AsH264Video() (*H264Video, bool) {
9443 return nil, false
9444 }
9445
9446
9447 func (vVar Video) AsJpgImage() (*JpgImage, bool) {
9448 return nil, false
9449 }
9450
9451
9452 func (vVar Video) AsPngImage() (*PngImage, bool) {
9453 return nil, false
9454 }
9455
9456
9457 func (vVar Video) AsCodec() (*Codec, bool) {
9458 return nil, false
9459 }
9460
9461
9462 func (vVar Video) AsBasicCodec() (BasicCodec, bool) {
9463 return &vVar, true
9464 }
9465
9466
9467
9468 type VideoAnalyzerPreset struct {
9469
9470 AudioInsightsOnly *bool `json:"audioInsightsOnly,omitempty"`
9471
9472 AudioLanguage *string `json:"audioLanguage,omitempty"`
9473
9474 OdataType OdataTypeBasicPreset `json:"@odata.type,omitempty"`
9475 }
9476
9477
9478 func (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
9494 func (vap VideoAnalyzerPreset) AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) {
9495 return nil, false
9496 }
9497
9498
9499 func (vap VideoAnalyzerPreset) AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) {
9500 return &vap, true
9501 }
9502
9503
9504 func (vap VideoAnalyzerPreset) AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) {
9505 return nil, false
9506 }
9507
9508
9509 func (vap VideoAnalyzerPreset) AsStandardEncoderPreset() (*StandardEncoderPreset, bool) {
9510 return nil, false
9511 }
9512
9513
9514 func (vap VideoAnalyzerPreset) AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) {
9515 return &vap, true
9516 }
9517
9518
9519 func (vap VideoAnalyzerPreset) AsPreset() (*Preset, bool) {
9520 return nil, false
9521 }
9522
9523
9524 func (vap VideoAnalyzerPreset) AsBasicPreset() (BasicPreset, bool) {
9525 return &vap, true
9526 }
9527
9528
9529 type BasicVideoLayer interface {
9530 AsH264Layer() (*H264Layer, bool)
9531 AsVideoLayer() (*VideoLayer, bool)
9532 }
9533
9534
9535
9536 type VideoLayer struct {
9537
9538 Bitrate *int32 `json:"bitrate,omitempty"`
9539
9540 MaxBitrate *int32 `json:"maxBitrate,omitempty"`
9541
9542 BFrames *int32 `json:"bFrames,omitempty"`
9543
9544 FrameRate *string `json:"frameRate,omitempty"`
9545
9546 Slices *int32 `json:"slices,omitempty"`
9547
9548 AdaptiveBFrame *bool `json:"adaptiveBFrame,omitempty"`
9549
9550 Width *string `json:"width,omitempty"`
9551
9552 Height *string `json:"height,omitempty"`
9553
9554 Label *string `json:"label,omitempty"`
9555
9556 OdataType OdataTypeBasicLayer `json:"@odata.type,omitempty"`
9557 }
9558
9559 func 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 }
9577 func 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
9597 func (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
9634 func (vl VideoLayer) AsVideoLayer() (*VideoLayer, bool) {
9635 return &vl, true
9636 }
9637
9638
9639 func (vl VideoLayer) AsBasicVideoLayer() (BasicVideoLayer, bool) {
9640 return &vl, true
9641 }
9642
9643
9644 func (vl VideoLayer) AsH264Layer() (*H264Layer, bool) {
9645 return nil, false
9646 }
9647
9648
9649 func (vl VideoLayer) AsJpgLayer() (*JpgLayer, bool) {
9650 return nil, false
9651 }
9652
9653
9654 func (vl VideoLayer) AsPngLayer() (*PngLayer, bool) {
9655 return nil, false
9656 }
9657
9658
9659 func (vl VideoLayer) AsLayer() (*Layer, bool) {
9660 return nil, false
9661 }
9662
9663
9664 func (vl VideoLayer) AsBasicLayer() (BasicLayer, bool) {
9665 return &vl, true
9666 }
9667
9668
9669 type VideoOverlay struct {
9670
9671 Position *Rectangle `json:"position,omitempty"`
9672
9673 Opacity *float64 `json:"opacity,omitempty"`
9674
9675 CropRectangle *Rectangle `json:"cropRectangle,omitempty"`
9676
9677 InputLabel *string `json:"inputLabel,omitempty"`
9678
9679 Start *string `json:"start,omitempty"`
9680
9681 End *string `json:"end,omitempty"`
9682
9683 FadeInDuration *string `json:"fadeInDuration,omitempty"`
9684
9685 FadeOutDuration *string `json:"fadeOutDuration,omitempty"`
9686
9687 AudioGainLevel *float64 `json:"audioGainLevel,omitempty"`
9688
9689 OdataType OdataTypeBasicOverlay `json:"@odata.type,omitempty"`
9690 }
9691
9692
9693 func (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
9730 func (vo VideoOverlay) AsAudioOverlay() (*AudioOverlay, bool) {
9731 return nil, false
9732 }
9733
9734
9735 func (vo VideoOverlay) AsVideoOverlay() (*VideoOverlay, bool) {
9736 return &vo, true
9737 }
9738
9739
9740 func (vo VideoOverlay) AsOverlay() (*Overlay, bool) {
9741 return nil, false
9742 }
9743
9744
9745 func (vo VideoOverlay) AsBasicOverlay() (BasicOverlay, bool) {
9746 return &vo, true
9747 }
9748
View as plain text