forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
1101 lines (997 loc) · 36.5 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 maps
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// 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/date"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/tracing"
"net/http"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps"
// Account an Azure resource which represents access to a suite of Maps REST APIs.
type Account struct {
autorest.Response `json:"-"`
// Sku - The SKU of this account.
Sku *Sku `json:"sku,omitempty"`
// Kind - Get or Set Kind property. Possible values include: 'KindGen1', 'KindGen2'
Kind Kind `json:"kind,omitempty"`
// SystemData - READ-ONLY; The system meta data relating to this resource.
SystemData *SystemData `json:"systemData,omitempty"`
// Properties - The map account properties.
Properties *AccountProperties `json:"properties,omitempty"`
// Tags - Resource tags.
Tags map[string]*string `json:"tags"`
// Location - The geo-location where the resource lives
Location *string `json:"location,omitempty"`
// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for Account.
func (a Account) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if a.Sku != nil {
objectMap["sku"] = a.Sku
}
if a.Kind != "" {
objectMap["kind"] = a.Kind
}
if a.Properties != nil {
objectMap["properties"] = a.Properties
}
if a.Tags != nil {
objectMap["tags"] = a.Tags
}
if a.Location != nil {
objectMap["location"] = a.Location
}
return json.Marshal(objectMap)
}
// AccountKeys the set of keys which can be used to access the Maps REST APIs. Two keys are provided for
// key rotation without interruption.
type AccountKeys struct {
autorest.Response `json:"-"`
// PrimaryKeyLastUpdated - READ-ONLY; The last updated date and time of the primary key.
PrimaryKeyLastUpdated *string `json:"primaryKeyLastUpdated,omitempty"`
// PrimaryKey - READ-ONLY; The primary key for accessing the Maps REST APIs.
PrimaryKey *string `json:"primaryKey,omitempty"`
// SecondaryKey - READ-ONLY; The secondary key for accessing the Maps REST APIs.
SecondaryKey *string `json:"secondaryKey,omitempty"`
// SecondaryKeyLastUpdated - READ-ONLY; The last updated date and time of the secondary key.
SecondaryKeyLastUpdated *string `json:"secondaryKeyLastUpdated,omitempty"`
}
// MarshalJSON is the custom marshaler for AccountKeys.
func (ak AccountKeys) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// AccountProperties additional Map account properties
type AccountProperties struct {
// UniqueID - READ-ONLY; A unique identifier for the maps account
UniqueID *string `json:"uniqueId,omitempty"`
// DisableLocalAuth - Allows toggle functionality on Azure Policy to disable Azure Maps local authentication support. This will disable Shared Keys authentication from any usage.
DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"`
// ProvisioningState - READ-ONLY; the state of the provisioning.
ProvisioningState *string `json:"provisioningState,omitempty"`
}
// MarshalJSON is the custom marshaler for AccountProperties.
func (ap AccountProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ap.DisableLocalAuth != nil {
objectMap["disableLocalAuth"] = ap.DisableLocalAuth
}
return json.Marshal(objectMap)
}
// Accounts a list of Maps Accounts.
type Accounts struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; a Maps Account.
Value *[]Account `json:"value,omitempty"`
// NextLink - URL client should use to fetch the next page (per server side paging).
// It's null for now, added for future use.
NextLink *string `json:"nextLink,omitempty"`
}
// MarshalJSON is the custom marshaler for Accounts.
func (a Accounts) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if a.NextLink != nil {
objectMap["nextLink"] = a.NextLink
}
return json.Marshal(objectMap)
}
// AccountsIterator provides access to a complete listing of Account values.
type AccountsIterator struct {
i int
page AccountsPage
}
// 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 *AccountsIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/AccountsIterator.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 *AccountsIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter AccountsIterator) 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 AccountsIterator) Response() Accounts {
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 AccountsIterator) Value() Account {
if !iter.page.NotDone() {
return Account{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the AccountsIterator type.
func NewAccountsIterator(page AccountsPage) AccountsIterator {
return AccountsIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (a Accounts) IsEmpty() bool {
return a.Value == nil || len(*a.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (a Accounts) hasNextLink() bool {
return a.NextLink != nil && len(*a.NextLink) != 0
}
// accountsPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (a Accounts) accountsPreparer(ctx context.Context) (*http.Request, error) {
if !a.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(a.NextLink)))
}
// AccountsPage contains a page of Account values.
type AccountsPage struct {
fn func(context.Context, Accounts) (Accounts, error)
a Accounts
}
// 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 *AccountsPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/AccountsPage.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.a)
if err != nil {
return err
}
page.a = 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 *AccountsPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page AccountsPage) NotDone() bool {
return !page.a.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page AccountsPage) Response() Accounts {
return page.a
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page AccountsPage) Values() []Account {
if page.a.IsEmpty() {
return nil
}
return *page.a.Value
}
// Creates a new instance of the AccountsPage type.
func NewAccountsPage(cur Accounts, getNextPage func(context.Context, Accounts) (Accounts, error)) AccountsPage {
return AccountsPage{
fn: getNextPage,
a: cur,
}
}
// AccountUpdateParameters parameters used to update an existing Maps Account.
type AccountUpdateParameters struct {
// Tags - Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters.
Tags map[string]*string `json:"tags"`
// Kind - Get or Set Kind property. Possible values include: 'KindGen1', 'KindGen2'
Kind Kind `json:"kind,omitempty"`
// Sku - The SKU of this account.
Sku *Sku `json:"sku,omitempty"`
// AccountProperties - The map account properties.
*AccountProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for AccountUpdateParameters.
func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if aup.Tags != nil {
objectMap["tags"] = aup.Tags
}
if aup.Kind != "" {
objectMap["kind"] = aup.Kind
}
if aup.Sku != nil {
objectMap["sku"] = aup.Sku
}
if aup.AccountProperties != nil {
objectMap["properties"] = aup.AccountProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for AccountUpdateParameters struct.
func (aup *AccountUpdateParameters) 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 "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
aup.Tags = tags
}
case "kind":
if v != nil {
var kind Kind
err = json.Unmarshal(*v, &kind)
if err != nil {
return err
}
aup.Kind = kind
}
case "sku":
if v != nil {
var sku Sku
err = json.Unmarshal(*v, &sku)
if err != nil {
return err
}
aup.Sku = &sku
}
case "properties":
if v != nil {
var accountProperties AccountProperties
err = json.Unmarshal(*v, &accountProperties)
if err != nil {
return err
}
aup.AccountProperties = &accountProperties
}
}
}
return nil
}
// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag.
type AzureEntityResource struct {
// Etag - READ-ONLY; Resource Etag.
Etag *string `json:"etag,omitempty"`
// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for AzureEntityResource.
func (aer AzureEntityResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// Creator an Azure resource which represents Maps Creator product and provides ability to manage private
// location data.
type Creator struct {
autorest.Response `json:"-"`
// Properties - The Creator resource properties.
Properties *CreatorProperties `json:"properties,omitempty"`
// Tags - Resource tags.
Tags map[string]*string `json:"tags"`
// Location - The geo-location where the resource lives
Location *string `json:"location,omitempty"`
// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for Creator.
func (c Creator) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if c.Properties != nil {
objectMap["properties"] = c.Properties
}
if c.Tags != nil {
objectMap["tags"] = c.Tags
}
if c.Location != nil {
objectMap["location"] = c.Location
}
return json.Marshal(objectMap)
}
// CreatorList a list of Creator resources.
type CreatorList struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; a Creator account.
Value *[]Creator `json:"value,omitempty"`
// NextLink - URL client should use to fetch the next page (per server side paging).
// It's null for now, added for future use.
NextLink *string `json:"nextLink,omitempty"`
}
// MarshalJSON is the custom marshaler for CreatorList.
func (cl CreatorList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if cl.NextLink != nil {
objectMap["nextLink"] = cl.NextLink
}
return json.Marshal(objectMap)
}
// CreatorListIterator provides access to a complete listing of Creator values.
type CreatorListIterator struct {
i int
page CreatorListPage
}
// 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 *CreatorListIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CreatorListIterator.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 *CreatorListIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter CreatorListIterator) 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 CreatorListIterator) Response() CreatorList {
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 CreatorListIterator) Value() Creator {
if !iter.page.NotDone() {
return Creator{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the CreatorListIterator type.
func NewCreatorListIterator(page CreatorListPage) CreatorListIterator {
return CreatorListIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (cl CreatorList) IsEmpty() bool {
return cl.Value == nil || len(*cl.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (cl CreatorList) hasNextLink() bool {
return cl.NextLink != nil && len(*cl.NextLink) != 0
}
// creatorListPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (cl CreatorList) creatorListPreparer(ctx context.Context) (*http.Request, error) {
if !cl.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(cl.NextLink)))
}
// CreatorListPage contains a page of Creator values.
type CreatorListPage struct {
fn func(context.Context, CreatorList) (CreatorList, error)
cl CreatorList
}
// 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 *CreatorListPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CreatorListPage.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.cl)
if err != nil {
return err
}
page.cl = 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 *CreatorListPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page CreatorListPage) NotDone() bool {
return !page.cl.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page CreatorListPage) Response() CreatorList {
return page.cl
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page CreatorListPage) Values() []Creator {
if page.cl.IsEmpty() {
return nil
}
return *page.cl.Value
}
// Creates a new instance of the CreatorListPage type.
func NewCreatorListPage(cur CreatorList, getNextPage func(context.Context, CreatorList) (CreatorList, error)) CreatorListPage {
return CreatorListPage{
fn: getNextPage,
cl: cur,
}
}
// CreatorProperties creator resource properties
type CreatorProperties struct {
// ProvisioningState - READ-ONLY; The state of the resource provisioning, terminal states: Succeeded, Failed, Canceled
ProvisioningState *string `json:"provisioningState,omitempty"`
// StorageUnits - The storage units to be allocated. Integer values from 1 to 100, inclusive.
StorageUnits *int32 `json:"storageUnits,omitempty"`
}
// MarshalJSON is the custom marshaler for CreatorProperties.
func (cp CreatorProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if cp.StorageUnits != nil {
objectMap["storageUnits"] = cp.StorageUnits
}
return json.Marshal(objectMap)
}
// CreatorUpdateParameters parameters used to update an existing Creator resource.
type CreatorUpdateParameters struct {
// Tags - Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters.
Tags map[string]*string `json:"tags"`
// CreatorProperties - Creator resource properties.
*CreatorProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for CreatorUpdateParameters.
func (cup CreatorUpdateParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if cup.Tags != nil {
objectMap["tags"] = cup.Tags
}
if cup.CreatorProperties != nil {
objectMap["properties"] = cup.CreatorProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for CreatorUpdateParameters struct.
func (cup *CreatorUpdateParameters) 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 "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
cup.Tags = tags
}
case "properties":
if v != nil {
var creatorProperties CreatorProperties
err = json.Unmarshal(*v, &creatorProperties)
if err != nil {
return err
}
cup.CreatorProperties = &creatorProperties
}
}
}
return nil
}
// Dimension dimension of map account, for example API Category, Api Name, Result Type, and Response Code.
type Dimension struct {
// Name - Display name of dimension.
Name *string `json:"name,omitempty"`
// DisplayName - Display name of dimension.
DisplayName *string `json:"displayName,omitempty"`
}
// ErrorAdditionalInfo the resource management error additional info.
type ErrorAdditionalInfo struct {
// Type - READ-ONLY; The additional info type.
Type *string `json:"type,omitempty"`
// Info - READ-ONLY; The additional info.
Info interface{} `json:"info,omitempty"`
}
// MarshalJSON is the custom marshaler for ErrorAdditionalInfo.
func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// ErrorDetail the error detail.
type ErrorDetail struct {
// Code - READ-ONLY; The error code.
Code *string `json:"code,omitempty"`
// Message - READ-ONLY; The error message.
Message *string `json:"message,omitempty"`
// Target - READ-ONLY; The error target.
Target *string `json:"target,omitempty"`
// Details - READ-ONLY; The error details.
Details *[]ErrorDetail `json:"details,omitempty"`
// AdditionalInfo - READ-ONLY; The error additional info.
AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
}
// MarshalJSON is the custom marshaler for ErrorDetail.
func (ed ErrorDetail) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for
// failed operations. (This also follows the OData error response format.).
type ErrorResponse struct {
// Error - The error object.
Error *ErrorDetail `json:"error,omitempty"`
}
// KeySpecification whether the operation refers to the primary or secondary key.
type KeySpecification struct {
// KeyType - Whether the operation refers to the primary or secondary key. Possible values include: 'KeyTypePrimary', 'KeyTypeSecondary'
KeyType KeyType `json:"keyType,omitempty"`
}
// MetricSpecification metric specification of operation.
type MetricSpecification struct {
// Name - Name of metric specification.
Name *string `json:"name,omitempty"`
// DisplayName - Display name of metric specification.
DisplayName *string `json:"displayName,omitempty"`
// DisplayDescription - Display description of metric specification.
DisplayDescription *string `json:"displayDescription,omitempty"`
// Unit - Unit could be Count.
Unit *string `json:"unit,omitempty"`
// Dimensions - Dimensions of map account.
Dimensions *[]Dimension `json:"dimensions,omitempty"`
// AggregationType - Aggregation type could be Average.
AggregationType *string `json:"aggregationType,omitempty"`
// FillGapWithZero - The property to decide fill gap with zero or not.
FillGapWithZero *bool `json:"fillGapWithZero,omitempty"`
// Category - The category this metric specification belong to, could be Capacity.
Category *string `json:"category,omitempty"`
// ResourceIDDimensionNameOverride - Account Resource Id.
ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"`
}
// OperationDetail operation detail payload
type OperationDetail struct {
// Name - Name of the operation
Name *string `json:"name,omitempty"`
// IsDataAction - Indicates whether the operation is a data action
IsDataAction *bool `json:"isDataAction,omitempty"`
// Display - Display of the operation
Display *OperationDisplay `json:"display,omitempty"`
// Origin - Origin of the operation
Origin *string `json:"origin,omitempty"`
// OperationProperties - Properties of the operation
*OperationProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for OperationDetail.
func (od OperationDetail) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if od.Name != nil {
objectMap["name"] = od.Name
}
if od.IsDataAction != nil {
objectMap["isDataAction"] = od.IsDataAction
}
if od.Display != nil {
objectMap["display"] = od.Display
}
if od.Origin != nil {
objectMap["origin"] = od.Origin
}
if od.OperationProperties != nil {
objectMap["properties"] = od.OperationProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for OperationDetail struct.
func (od *OperationDetail) 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 "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
od.Name = &name
}
case "isDataAction":
if v != nil {
var isDataAction bool
err = json.Unmarshal(*v, &isDataAction)
if err != nil {
return err
}
od.IsDataAction = &isDataAction
}
case "display":
if v != nil {
var display OperationDisplay
err = json.Unmarshal(*v, &display)
if err != nil {
return err
}
od.Display = &display
}
case "origin":
if v != nil {
var origin string
err = json.Unmarshal(*v, &origin)
if err != nil {
return err
}
od.Origin = &origin
}
case "properties":
if v != nil {
var operationProperties OperationProperties
err = json.Unmarshal(*v, &operationProperties)
if err != nil {
return err
}
od.OperationProperties = &operationProperties
}
}
}
return nil
}
// OperationDisplay operation display payload
type OperationDisplay struct {
// Provider - Resource provider of the operation
Provider *string `json:"provider,omitempty"`
// Resource - Resource of the operation
Resource *string `json:"resource,omitempty"`
// Operation - Localized friendly name for the operation
Operation *string `json:"operation,omitempty"`
// Description - Localized friendly description for the operation
Description *string `json:"description,omitempty"`
}
// OperationProperties properties of operation, include metric specifications.
type OperationProperties struct {
// ServiceSpecification - One property of operation, include metric specifications.
ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"`
}
// Operations the set of operations available for Maps.
type Operations struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; An operation available for Maps.
Value *[]OperationDetail `json:"value,omitempty"`
// NextLink - URL client should use to fetch the next page (per server side paging).
// It's null for now, added for future use.
NextLink *string `json:"nextLink,omitempty"`
}
// MarshalJSON is the custom marshaler for Operations.
func (o Operations) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if o.NextLink != nil {
objectMap["nextLink"] = o.NextLink
}
return json.Marshal(objectMap)
}
// OperationsIterator provides access to a complete listing of OperationDetail values.
type OperationsIterator struct {
i int
page OperationsPage
}
// 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 *OperationsIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/OperationsIterator.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 *OperationsIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter OperationsIterator) 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 OperationsIterator) Response() Operations {
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 OperationsIterator) Value() OperationDetail {
if !iter.page.NotDone() {
return OperationDetail{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the OperationsIterator type.
func NewOperationsIterator(page OperationsPage) OperationsIterator {
return OperationsIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (o Operations) IsEmpty() bool {
return o.Value == nil || len(*o.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (o Operations) hasNextLink() bool {
return o.NextLink != nil && len(*o.NextLink) != 0
}
// operationsPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (o Operations) operationsPreparer(ctx context.Context) (*http.Request, error) {
if !o.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(o.NextLink)))
}
// OperationsPage contains a page of OperationDetail values.
type OperationsPage struct {
fn func(context.Context, Operations) (Operations, error)
o Operations
}
// 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 *OperationsPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/OperationsPage.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.o)
if err != nil {
return err
}
page.o = 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 *OperationsPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page OperationsPage) NotDone() bool {
return !page.o.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page OperationsPage) Response() Operations {
return page.o
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page OperationsPage) Values() []OperationDetail {
if page.o.IsEmpty() {
return nil
}
return *page.o.Value
}
// Creates a new instance of the OperationsPage type.
func NewOperationsPage(cur Operations, getNextPage func(context.Context, Operations) (Operations, error)) OperationsPage {
return OperationsPage{
fn: getNextPage,
o: cur,