forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.go
9284 lines (8277 loc) · 345 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package media
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"encoding/json"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/tracing"
"github.com/satori/go.uuid"
"net/http"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/mediaservices/mgmt/2018-03-30-preview/media"
// AacAudio describes Advanced Audio Codec (AAC) audio encoding settings.
type AacAudio struct {
// Profile - The encoding profile to be used when encoding audio with AAC. Possible values include: 'AacLc', 'HeAacV1', 'HeAacV2'
Profile AacAudioProfile `json:"profile,omitempty"`
// Channels - The number of channels in the audio.
Channels *int32 `json:"channels,omitempty"`
// SamplingRate - The sampling rate to use for encoding in hertz.
SamplingRate *int32 `json:"samplingRate,omitempty"`
// Bitrate - The bitrate, in bits per second, of the output encoded audio.
Bitrate *int32 `json:"bitrate,omitempty"`
// Label - An optional label for the codec. The label can be used to control muxing behavior.
Label *string `json:"label,omitempty"`
// OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage'
OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"`
}
// MarshalJSON is the custom marshaler for AacAudio.
func (aa AacAudio) MarshalJSON() ([]byte, error) {
aa.OdataType = OdataTypeMicrosoftMediaAacAudio
objectMap := make(map[string]interface{})
if aa.Profile != "" {
objectMap["profile"] = aa.Profile
}
if aa.Channels != nil {
objectMap["channels"] = aa.Channels
}
if aa.SamplingRate != nil {
objectMap["samplingRate"] = aa.SamplingRate
}
if aa.Bitrate != nil {
objectMap["bitrate"] = aa.Bitrate
}
if aa.Label != nil {
objectMap["label"] = aa.Label
}
if aa.OdataType != "" {
objectMap["@odata.type"] = aa.OdataType
}
return json.Marshal(objectMap)
}
// AsAudio is the BasicCodec implementation for AacAudio.
func (aa AacAudio) AsAudio() (*Audio, bool) {
return nil, false
}
// AsBasicAudio is the BasicCodec implementation for AacAudio.
func (aa AacAudio) AsBasicAudio() (BasicAudio, bool) {
return &aa, true
}
// AsAacAudio is the BasicCodec implementation for AacAudio.
func (aa AacAudio) AsAacAudio() (*AacAudio, bool) {
return &aa, true
}
// AsCopyVideo is the BasicCodec implementation for AacAudio.
func (aa AacAudio) AsCopyVideo() (*CopyVideo, bool) {
return nil, false
}
// AsVideo is the BasicCodec implementation for AacAudio.
func (aa AacAudio) AsVideo() (*Video, bool) {
return nil, false
}
// AsBasicVideo is the BasicCodec implementation for AacAudio.
func (aa AacAudio) AsBasicVideo() (BasicVideo, bool) {
return nil, false
}
// AsImage is the BasicCodec implementation for AacAudio.
func (aa AacAudio) AsImage() (*Image, bool) {
return nil, false
}
// AsBasicImage is the BasicCodec implementation for AacAudio.
func (aa AacAudio) AsBasicImage() (BasicImage, bool) {
return nil, false
}
// AsCopyAudio is the BasicCodec implementation for AacAudio.
func (aa AacAudio) AsCopyAudio() (*CopyAudio, bool) {
return nil, false
}
// AsH264Video is the BasicCodec implementation for AacAudio.
func (aa AacAudio) AsH264Video() (*H264Video, bool) {
return nil, false
}
// AsJpgImage is the BasicCodec implementation for AacAudio.
func (aa AacAudio) AsJpgImage() (*JpgImage, bool) {
return nil, false
}
// AsPngImage is the BasicCodec implementation for AacAudio.
func (aa AacAudio) AsPngImage() (*PngImage, bool) {
return nil, false
}
// AsCodec is the BasicCodec implementation for AacAudio.
func (aa AacAudio) AsCodec() (*Codec, bool) {
return nil, false
}
// AsBasicCodec is the BasicCodec implementation for AacAudio.
func (aa AacAudio) AsBasicCodec() (BasicCodec, bool) {
return &aa, true
}
// AkamaiAccessControl akamai access control
type AkamaiAccessControl struct {
// AkamaiSignatureHeaderAuthenticationKeyList - authentication key list
AkamaiSignatureHeaderAuthenticationKeyList *[]AkamaiSignatureHeaderAuthenticationKey `json:"akamaiSignatureHeaderAuthenticationKeyList,omitempty"`
}
// AkamaiSignatureHeaderAuthenticationKey akamai Signature Header authentication key.
type AkamaiSignatureHeaderAuthenticationKey struct {
// Identifier - identifier of the key
Identifier *string `json:"identifier,omitempty"`
// Base64Key - authentication key
Base64Key *string `json:"base64Key,omitempty"`
// Expiration - The exact time the authentication key.
Expiration *date.Time `json:"expiration,omitempty"`
}
// APIError the API error.
type APIError struct {
// Error - The error properties.
Error *ODataError `json:"error,omitempty"`
}
// Asset an Asset.
type Asset struct {
autorest.Response `json:"-"`
// AssetProperties - The resource properties.
*AssetProperties `json:"properties,omitempty"`
// ID - READ-ONLY; Fully qualified resource ID for the resource.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; The name of the resource.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; The type of the resource.
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for Asset.
func (a Asset) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if a.AssetProperties != nil {
objectMap["properties"] = a.AssetProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Asset struct.
func (a *Asset) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "properties":
if v != nil {
var assetProperties AssetProperties
err = json.Unmarshal(*v, &assetProperties)
if err != nil {
return err
}
a.AssetProperties = &assetProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
a.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
a.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
a.Type = &typeVar
}
}
}
return nil
}
// AssetCollection a collection of Asset items.
type AssetCollection struct {
autorest.Response `json:"-"`
// Value - A collection of Asset items.
Value *[]Asset `json:"value,omitempty"`
// OdataNextLink - A link to the next page of the collection (when the collection contains too many results to return in one response).
OdataNextLink *string `json:"@odata.nextLink,omitempty"`
}
// AssetCollectionIterator provides access to a complete listing of Asset values.
type AssetCollectionIterator struct {
i int
page AssetCollectionPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *AssetCollectionIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/AssetCollectionIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *AssetCollectionIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter AssetCollectionIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter AssetCollectionIterator) Response() AssetCollection {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter AssetCollectionIterator) Value() Asset {
if !iter.page.NotDone() {
return Asset{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the AssetCollectionIterator type.
func NewAssetCollectionIterator(page AssetCollectionPage) AssetCollectionIterator {
return AssetCollectionIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (ac AssetCollection) IsEmpty() bool {
return ac.Value == nil || len(*ac.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (ac AssetCollection) hasNextLink() bool {
return ac.OdataNextLink != nil && len(*ac.OdataNextLink) != 0
}
// assetCollectionPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (ac AssetCollection) assetCollectionPreparer(ctx context.Context) (*http.Request, error) {
if !ac.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(ac.OdataNextLink)))
}
// AssetCollectionPage contains a page of Asset values.
type AssetCollectionPage struct {
fn func(context.Context, AssetCollection) (AssetCollection, error)
ac AssetCollection
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *AssetCollectionPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/AssetCollectionPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
for {
next, err := page.fn(ctx, page.ac)
if err != nil {
return err
}
page.ac = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
return nil
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (page *AssetCollectionPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page AssetCollectionPage) NotDone() bool {
return !page.ac.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page AssetCollectionPage) Response() AssetCollection {
return page.ac
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page AssetCollectionPage) Values() []Asset {
if page.ac.IsEmpty() {
return nil
}
return *page.ac.Value
}
// Creates a new instance of the AssetCollectionPage type.
func NewAssetCollectionPage(cur AssetCollection, getNextPage func(context.Context, AssetCollection) (AssetCollection, error)) AssetCollectionPage {
return AssetCollectionPage{
fn: getNextPage,
ac: cur,
}
}
// AssetContainerSas the Asset Storage container SAS URLs.
type AssetContainerSas struct {
autorest.Response `json:"-"`
// AssetContainerSasUrls - The list of Asset container SAS URLs.
AssetContainerSasUrls *[]string `json:"assetContainerSasUrls,omitempty"`
}
// AssetProperties the Asset properties.
type AssetProperties struct {
// AssetID - READ-ONLY; The Asset ID.
AssetID *uuid.UUID `json:"assetId,omitempty"`
// Created - READ-ONLY; The creation date of the Asset.
Created *date.Time `json:"created,omitempty"`
// LastModified - READ-ONLY; The last modified date of the Asset.
LastModified *date.Time `json:"lastModified,omitempty"`
// AlternateID - The alternate ID of the Asset.
AlternateID *string `json:"alternateId,omitempty"`
// Description - The Asset description.
Description *string `json:"description,omitempty"`
// Container - The name of the asset blob container.
Container *string `json:"container,omitempty"`
// StorageAccountName - The name of the storage account.
StorageAccountName *string `json:"storageAccountName,omitempty"`
// StorageEncryptionFormat - READ-ONLY; The Asset encryption format. One of None or MediaStorageEncryption. Possible values include: 'None', 'MediaStorageClientEncryption'
StorageEncryptionFormat AssetStorageEncryptionFormat `json:"storageEncryptionFormat,omitempty"`
}
// MarshalJSON is the custom marshaler for AssetProperties.
func (ap AssetProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ap.AlternateID != nil {
objectMap["alternateId"] = ap.AlternateID
}
if ap.Description != nil {
objectMap["description"] = ap.Description
}
if ap.Container != nil {
objectMap["container"] = ap.Container
}
if ap.StorageAccountName != nil {
objectMap["storageAccountName"] = ap.StorageAccountName
}
return json.Marshal(objectMap)
}
// AssetStorageEncryptionKey the Asset Storage encryption key.
type AssetStorageEncryptionKey struct {
autorest.Response `json:"-"`
// StorageEncryptionKey - The Asset storage encryption key.
StorageEncryptionKey *string `json:"storageEncryptionKey,omitempty"`
}
// BasicAudio defines the common properties for all audio codecs.
type BasicAudio interface {
AsAacAudio() (*AacAudio, bool)
AsAudio() (*Audio, bool)
}
// Audio defines the common properties for all audio codecs.
type Audio struct {
// Channels - The number of channels in the audio.
Channels *int32 `json:"channels,omitempty"`
// SamplingRate - The sampling rate to use for encoding in hertz.
SamplingRate *int32 `json:"samplingRate,omitempty"`
// Bitrate - The bitrate, in bits per second, of the output encoded audio.
Bitrate *int32 `json:"bitrate,omitempty"`
// Label - An optional label for the codec. The label can be used to control muxing behavior.
Label *string `json:"label,omitempty"`
// OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage'
OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"`
}
func unmarshalBasicAudio(body []byte) (BasicAudio, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["@odata.type"] {
case string(OdataTypeMicrosoftMediaAacAudio):
var aa AacAudio
err := json.Unmarshal(body, &aa)
return aa, err
default:
var a Audio
err := json.Unmarshal(body, &a)
return a, err
}
}
func unmarshalBasicAudioArray(body []byte) ([]BasicAudio, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
aArray := make([]BasicAudio, len(rawMessages))
for index, rawMessage := range rawMessages {
a, err := unmarshalBasicAudio(*rawMessage)
if err != nil {
return nil, err
}
aArray[index] = a
}
return aArray, nil
}
// MarshalJSON is the custom marshaler for Audio.
func (a Audio) MarshalJSON() ([]byte, error) {
a.OdataType = OdataTypeMicrosoftMediaAudio
objectMap := make(map[string]interface{})
if a.Channels != nil {
objectMap["channels"] = a.Channels
}
if a.SamplingRate != nil {
objectMap["samplingRate"] = a.SamplingRate
}
if a.Bitrate != nil {
objectMap["bitrate"] = a.Bitrate
}
if a.Label != nil {
objectMap["label"] = a.Label
}
if a.OdataType != "" {
objectMap["@odata.type"] = a.OdataType
}
return json.Marshal(objectMap)
}
// AsAudio is the BasicCodec implementation for Audio.
func (a Audio) AsAudio() (*Audio, bool) {
return &a, true
}
// AsBasicAudio is the BasicCodec implementation for Audio.
func (a Audio) AsBasicAudio() (BasicAudio, bool) {
return &a, true
}
// AsAacAudio is the BasicCodec implementation for Audio.
func (a Audio) AsAacAudio() (*AacAudio, bool) {
return nil, false
}
// AsCopyVideo is the BasicCodec implementation for Audio.
func (a Audio) AsCopyVideo() (*CopyVideo, bool) {
return nil, false
}
// AsVideo is the BasicCodec implementation for Audio.
func (a Audio) AsVideo() (*Video, bool) {
return nil, false
}
// AsBasicVideo is the BasicCodec implementation for Audio.
func (a Audio) AsBasicVideo() (BasicVideo, bool) {
return nil, false
}
// AsImage is the BasicCodec implementation for Audio.
func (a Audio) AsImage() (*Image, bool) {
return nil, false
}
// AsBasicImage is the BasicCodec implementation for Audio.
func (a Audio) AsBasicImage() (BasicImage, bool) {
return nil, false
}
// AsCopyAudio is the BasicCodec implementation for Audio.
func (a Audio) AsCopyAudio() (*CopyAudio, bool) {
return nil, false
}
// AsH264Video is the BasicCodec implementation for Audio.
func (a Audio) AsH264Video() (*H264Video, bool) {
return nil, false
}
// AsJpgImage is the BasicCodec implementation for Audio.
func (a Audio) AsJpgImage() (*JpgImage, bool) {
return nil, false
}
// AsPngImage is the BasicCodec implementation for Audio.
func (a Audio) AsPngImage() (*PngImage, bool) {
return nil, false
}
// AsCodec is the BasicCodec implementation for Audio.
func (a Audio) AsCodec() (*Codec, bool) {
return nil, false
}
// AsBasicCodec is the BasicCodec implementation for Audio.
func (a Audio) AsBasicCodec() (BasicCodec, bool) {
return &a, true
}
// BasicAudioAnalyzerPreset the Audio Analyzer preset applies a pre-defined set of AI-based analysis operations,
// including speech transcription. Currently, the preset supports processing of content with a single audio track.
type BasicAudioAnalyzerPreset interface {
AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool)
AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool)
}
// AudioAnalyzerPreset the Audio Analyzer preset applies a pre-defined set of AI-based analysis operations,
// including speech transcription. Currently, the preset supports processing of content with a single audio
// track.
type AudioAnalyzerPreset struct {
// AudioLanguage - The language for the audio payload in the input using the BCP-47 format of 'language tag-region' (e.g: 'en-US'). The list of supported languages are, 'en-US', 'en-GB', 'es-ES', 'es-MX', 'fr-FR', 'it-IT', 'ja-JP', 'pt-BR', 'zh-CN'.
AudioLanguage *string `json:"audioLanguage,omitempty"`
// OdataType - Possible values include: 'OdataTypePreset', 'OdataTypeMicrosoftMediaAudioAnalyzerPreset', 'OdataTypeMicrosoftMediaBuiltInStandardEncoderPreset', 'OdataTypeMicrosoftMediaStandardEncoderPreset', 'OdataTypeMicrosoftMediaVideoAnalyzerPreset'
OdataType OdataTypeBasicPreset `json:"@odata.type,omitempty"`
}
func unmarshalBasicAudioAnalyzerPreset(body []byte) (BasicAudioAnalyzerPreset, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["@odata.type"] {
case string(OdataTypeMicrosoftMediaVideoAnalyzerPreset):
var vap VideoAnalyzerPreset
err := json.Unmarshal(body, &vap)
return vap, err
default:
var aap AudioAnalyzerPreset
err := json.Unmarshal(body, &aap)
return aap, err
}
}
func unmarshalBasicAudioAnalyzerPresetArray(body []byte) ([]BasicAudioAnalyzerPreset, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
aapArray := make([]BasicAudioAnalyzerPreset, len(rawMessages))
for index, rawMessage := range rawMessages {
aap, err := unmarshalBasicAudioAnalyzerPreset(*rawMessage)
if err != nil {
return nil, err
}
aapArray[index] = aap
}
return aapArray, nil
}
// MarshalJSON is the custom marshaler for AudioAnalyzerPreset.
func (aap AudioAnalyzerPreset) MarshalJSON() ([]byte, error) {
aap.OdataType = OdataTypeMicrosoftMediaAudioAnalyzerPreset
objectMap := make(map[string]interface{})
if aap.AudioLanguage != nil {
objectMap["audioLanguage"] = aap.AudioLanguage
}
if aap.OdataType != "" {
objectMap["@odata.type"] = aap.OdataType
}
return json.Marshal(objectMap)
}
// AsAudioAnalyzerPreset is the BasicPreset implementation for AudioAnalyzerPreset.
func (aap AudioAnalyzerPreset) AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) {
return &aap, true
}
// AsBasicAudioAnalyzerPreset is the BasicPreset implementation for AudioAnalyzerPreset.
func (aap AudioAnalyzerPreset) AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) {
return &aap, true
}
// AsBuiltInStandardEncoderPreset is the BasicPreset implementation for AudioAnalyzerPreset.
func (aap AudioAnalyzerPreset) AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) {
return nil, false
}
// AsStandardEncoderPreset is the BasicPreset implementation for AudioAnalyzerPreset.
func (aap AudioAnalyzerPreset) AsStandardEncoderPreset() (*StandardEncoderPreset, bool) {
return nil, false
}
// AsVideoAnalyzerPreset is the BasicPreset implementation for AudioAnalyzerPreset.
func (aap AudioAnalyzerPreset) AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) {
return nil, false
}
// AsPreset is the BasicPreset implementation for AudioAnalyzerPreset.
func (aap AudioAnalyzerPreset) AsPreset() (*Preset, bool) {
return nil, false
}
// AsBasicPreset is the BasicPreset implementation for AudioAnalyzerPreset.
func (aap AudioAnalyzerPreset) AsBasicPreset() (BasicPreset, bool) {
return &aap, true
}
// AudioOverlay describes the properties of an audio overlay.
type AudioOverlay struct {
// InputLabel - The label of the job input which is to be used as an overlay. The Input must specify exactly one file. You can specify an image file in JPG or PNG formats, or an audio file (such as a WAV, MP3, WMA or M4A file), or a video file. See https://aka.ms/mesformats for the complete list of supported audio and video file formats.
InputLabel *string `json:"inputLabel,omitempty"`
// Start - The start position, with reference to the input video, at which the overlay starts. The value should be in ISO 8601 format. For example, PT05S to start the overlay at 5 seconds in to the input video. If not specified the overlay starts from the beginning of the input video.
Start *string `json:"start,omitempty"`
// End - The position in the input video at which the overlay ends. The value should be in ISO 8601 duration format. For example, PT30S to end the overlay at 30 seconds in to the input video. If not specified the overlay will be applied until the end of the input video if inputLoop is true. Else, if inputLoop is false, then overlay will last as long as the duration of the overlay media.
End *string `json:"end,omitempty"`
// FadeInDuration - The duration over which the overlay fades in onto the input video. The value should be in ISO 8601 duration format. If not specified the default behavior is to have no fade in (same as PT0S).
FadeInDuration *string `json:"fadeInDuration,omitempty"`
// FadeOutDuration - The duration over which the overlay fades out of the input video. The value should be in ISO 8601 duration format. If not specified the default behavior is to have no fade out (same as PT0S).
FadeOutDuration *string `json:"fadeOutDuration,omitempty"`
// AudioGainLevel - The gain level of audio in the overlay. The value should be in the range [0, 1.0]. The default is 1.0.
AudioGainLevel *float64 `json:"audioGainLevel,omitempty"`
// OdataType - Possible values include: 'OdataTypeOverlay', 'OdataTypeMicrosoftMediaAudioOverlay', 'OdataTypeMicrosoftMediaVideoOverlay'
OdataType OdataTypeBasicOverlay `json:"@odata.type,omitempty"`
}
// MarshalJSON is the custom marshaler for AudioOverlay.
func (ao AudioOverlay) MarshalJSON() ([]byte, error) {
ao.OdataType = OdataTypeMicrosoftMediaAudioOverlay
objectMap := make(map[string]interface{})
if ao.InputLabel != nil {
objectMap["inputLabel"] = ao.InputLabel
}
if ao.Start != nil {
objectMap["start"] = ao.Start
}
if ao.End != nil {
objectMap["end"] = ao.End
}
if ao.FadeInDuration != nil {
objectMap["fadeInDuration"] = ao.FadeInDuration
}
if ao.FadeOutDuration != nil {
objectMap["fadeOutDuration"] = ao.FadeOutDuration
}
if ao.AudioGainLevel != nil {
objectMap["audioGainLevel"] = ao.AudioGainLevel
}
if ao.OdataType != "" {
objectMap["@odata.type"] = ao.OdataType
}
return json.Marshal(objectMap)
}
// AsAudioOverlay is the BasicOverlay implementation for AudioOverlay.
func (ao AudioOverlay) AsAudioOverlay() (*AudioOverlay, bool) {
return &ao, true
}
// AsVideoOverlay is the BasicOverlay implementation for AudioOverlay.
func (ao AudioOverlay) AsVideoOverlay() (*VideoOverlay, bool) {
return nil, false
}
// AsOverlay is the BasicOverlay implementation for AudioOverlay.
func (ao AudioOverlay) AsOverlay() (*Overlay, bool) {
return nil, false
}
// AsBasicOverlay is the BasicOverlay implementation for AudioOverlay.
func (ao AudioOverlay) AsBasicOverlay() (BasicOverlay, bool) {
return &ao, true
}
// BuiltInStandardEncoderPreset describes a built-in preset for encoding the input video with the Standard
// Encoder.
type BuiltInStandardEncoderPreset struct {
// PresetName - The built-in preset to be used for encoding videos. Possible values include: 'AdaptiveStreaming', 'AACGoodQualityAudio', 'H264MultipleBitrate1080p', 'H264MultipleBitrate720p', 'H264MultipleBitrateSD'
PresetName EncoderNamedPreset `json:"presetName,omitempty"`
// OdataType - Possible values include: 'OdataTypePreset', 'OdataTypeMicrosoftMediaAudioAnalyzerPreset', 'OdataTypeMicrosoftMediaBuiltInStandardEncoderPreset', 'OdataTypeMicrosoftMediaStandardEncoderPreset', 'OdataTypeMicrosoftMediaVideoAnalyzerPreset'
OdataType OdataTypeBasicPreset `json:"@odata.type,omitempty"`
}
// MarshalJSON is the custom marshaler for BuiltInStandardEncoderPreset.
func (bisep BuiltInStandardEncoderPreset) MarshalJSON() ([]byte, error) {
bisep.OdataType = OdataTypeMicrosoftMediaBuiltInStandardEncoderPreset
objectMap := make(map[string]interface{})
if bisep.PresetName != "" {
objectMap["presetName"] = bisep.PresetName
}
if bisep.OdataType != "" {
objectMap["@odata.type"] = bisep.OdataType
}
return json.Marshal(objectMap)
}
// AsAudioAnalyzerPreset is the BasicPreset implementation for BuiltInStandardEncoderPreset.
func (bisep BuiltInStandardEncoderPreset) AsAudioAnalyzerPreset() (*AudioAnalyzerPreset, bool) {
return nil, false
}
// AsBasicAudioAnalyzerPreset is the BasicPreset implementation for BuiltInStandardEncoderPreset.
func (bisep BuiltInStandardEncoderPreset) AsBasicAudioAnalyzerPreset() (BasicAudioAnalyzerPreset, bool) {
return nil, false
}
// AsBuiltInStandardEncoderPreset is the BasicPreset implementation for BuiltInStandardEncoderPreset.
func (bisep BuiltInStandardEncoderPreset) AsBuiltInStandardEncoderPreset() (*BuiltInStandardEncoderPreset, bool) {
return &bisep, true
}
// AsStandardEncoderPreset is the BasicPreset implementation for BuiltInStandardEncoderPreset.
func (bisep BuiltInStandardEncoderPreset) AsStandardEncoderPreset() (*StandardEncoderPreset, bool) {
return nil, false
}
// AsVideoAnalyzerPreset is the BasicPreset implementation for BuiltInStandardEncoderPreset.
func (bisep BuiltInStandardEncoderPreset) AsVideoAnalyzerPreset() (*VideoAnalyzerPreset, bool) {
return nil, false
}
// AsPreset is the BasicPreset implementation for BuiltInStandardEncoderPreset.
func (bisep BuiltInStandardEncoderPreset) AsPreset() (*Preset, bool) {
return nil, false
}
// AsBasicPreset is the BasicPreset implementation for BuiltInStandardEncoderPreset.
func (bisep BuiltInStandardEncoderPreset) AsBasicPreset() (BasicPreset, bool) {
return &bisep, true
}
// CbcsDrmConfiguration class to specify drm configurations of CommonEncryptionCbcs scheme in Streaming
// Policy
type CbcsDrmConfiguration struct {
// FairPlay - Fairplay configurations
FairPlay *StreamingPolicyFairPlayConfiguration `json:"fairPlay,omitempty"`
// PlayReady - PlayReady configurations
PlayReady *StreamingPolicyPlayReadyConfiguration `json:"playReady,omitempty"`
// Widevine - Widevine configurations
Widevine *StreamingPolicyWidevineConfiguration `json:"widevine,omitempty"`
}
// CencDrmConfiguration class to specify drm configurations of CommonEncryptionCenc scheme in Streaming
// Policy
type CencDrmConfiguration struct {
// PlayReady - PlayReady configurations
PlayReady *StreamingPolicyPlayReadyConfiguration `json:"playReady,omitempty"`
// Widevine - Widevine configurations
Widevine *StreamingPolicyWidevineConfiguration `json:"widevine,omitempty"`
}
// CheckNameAvailabilityInput the input to the check name availability request.
type CheckNameAvailabilityInput struct {
// Name - The account name.
Name *string `json:"name,omitempty"`
// Type - The account type. For a Media Services account, this should be 'MediaServices'.
Type *string `json:"type,omitempty"`
}
// BasicCodec describes the basic properties of all codecs.
type BasicCodec interface {
AsAudio() (*Audio, bool)
AsBasicAudio() (BasicAudio, bool)
AsAacAudio() (*AacAudio, bool)
AsCopyVideo() (*CopyVideo, bool)
AsVideo() (*Video, bool)
AsBasicVideo() (BasicVideo, bool)
AsImage() (*Image, bool)
AsBasicImage() (BasicImage, bool)
AsCopyAudio() (*CopyAudio, bool)
AsH264Video() (*H264Video, bool)
AsJpgImage() (*JpgImage, bool)
AsPngImage() (*PngImage, bool)
AsCodec() (*Codec, bool)
}
// Codec describes the basic properties of all codecs.
type Codec struct {
// Label - An optional label for the codec. The label can be used to control muxing behavior.
Label *string `json:"label,omitempty"`
// OdataType - Possible values include: 'OdataTypeCodec', 'OdataTypeMicrosoftMediaAudio', 'OdataTypeMicrosoftMediaAacAudio', 'OdataTypeMicrosoftMediaCopyVideo', 'OdataTypeMicrosoftMediaVideo', 'OdataTypeMicrosoftMediaImage', 'OdataTypeMicrosoftMediaCopyAudio', 'OdataTypeMicrosoftMediaH264Video', 'OdataTypeMicrosoftMediaJpgImage', 'OdataTypeMicrosoftMediaPngImage'
OdataType OdataTypeBasicCodec `json:"@odata.type,omitempty"`
}
func unmarshalBasicCodec(body []byte) (BasicCodec, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["@odata.type"] {
case string(OdataTypeMicrosoftMediaAudio):
var a Audio
err := json.Unmarshal(body, &a)
return a, err
case string(OdataTypeMicrosoftMediaAacAudio):
var aa AacAudio
err := json.Unmarshal(body, &aa)
return aa, err
case string(OdataTypeMicrosoftMediaCopyVideo):
var cv CopyVideo
err := json.Unmarshal(body, &cv)
return cv, err
case string(OdataTypeMicrosoftMediaVideo):
var vVar Video
err := json.Unmarshal(body, &vVar)
return vVar, err
case string(OdataTypeMicrosoftMediaImage):
var i Image
err := json.Unmarshal(body, &i)
return i, err
case string(OdataTypeMicrosoftMediaCopyAudio):
var ca CopyAudio
err := json.Unmarshal(body, &ca)
return ca, err
case string(OdataTypeMicrosoftMediaH264Video):
var hv H264Video
err := json.Unmarshal(body, &hv)
return hv, err
case string(OdataTypeMicrosoftMediaJpgImage):
var ji JpgImage
err := json.Unmarshal(body, &ji)
return ji, err
case string(OdataTypeMicrosoftMediaPngImage):
var pi PngImage
err := json.Unmarshal(body, &pi)
return pi, err
default:
var c Codec
err := json.Unmarshal(body, &c)
return c, err
}
}
func unmarshalBasicCodecArray(body []byte) ([]BasicCodec, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
cArray := make([]BasicCodec, len(rawMessages))
for index, rawMessage := range rawMessages {
c, err := unmarshalBasicCodec(*rawMessage)
if err != nil {
return nil, err
}
cArray[index] = c
}
return cArray, nil
}
// MarshalJSON is the custom marshaler for Codec.
func (c Codec) MarshalJSON() ([]byte, error) {
c.OdataType = OdataTypeCodec
objectMap := make(map[string]interface{})
if c.Label != nil {
objectMap["label"] = c.Label
}
if c.OdataType != "" {
objectMap["@odata.type"] = c.OdataType
}
return json.Marshal(objectMap)
}
// AsAudio is the BasicCodec implementation for Codec.
func (c Codec) AsAudio() (*Audio, bool) {
return nil, false
}
// AsBasicAudio is the BasicCodec implementation for Codec.
func (c Codec) AsBasicAudio() (BasicAudio, bool) {
return nil, false
}
// AsAacAudio is the BasicCodec implementation for Codec.
func (c Codec) AsAacAudio() (*AacAudio, bool) {
return nil, false
}
// AsCopyVideo is the BasicCodec implementation for Codec.
func (c Codec) AsCopyVideo() (*CopyVideo, bool) {
return nil, false
}
// AsVideo is the BasicCodec implementation for Codec.
func (c Codec) AsVideo() (*Video, bool) {
return nil, false
}
// AsBasicVideo is the BasicCodec implementation for Codec.
func (c Codec) AsBasicVideo() (BasicVideo, bool) {
return nil, false
}
// AsImage is the BasicCodec implementation for Codec.
func (c Codec) AsImage() (*Image, bool) {
return nil, false
}
// AsBasicImage is the BasicCodec implementation for Codec.
func (c Codec) AsBasicImage() (BasicImage, bool) {
return nil, false
}