forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
2221 lines (2040 loc) · 76 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 deploymentmanager
// 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/azure"
"github.com/Azure/go-autorest/autorest/date"
"net/http"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/deploymentmanager/mgmt/2019-11-01-preview/deploymentmanager"
// APIKeyAuthentication apiKey authentication gives a name and a value that can be included in either the
// request header or query parameters.
type APIKeyAuthentication struct {
// Name - The key name of the authentication key/value pair.
Name *string `json:"name,omitempty"`
// In - The location of the authentication key/value pair in the request. Possible values include: 'Query', 'Header'
In RestAuthLocation `json:"in,omitempty"`
// Value - The value of the authentication key/value pair.
Value *string `json:"value,omitempty"`
// Type - Possible values include: 'TypeRestRequestAuthentication', 'TypeRolloutIdentity', 'TypeAPIKey'
Type TypeBasicRestRequestAuthentication `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for APIKeyAuthentication.
func (aka APIKeyAuthentication) MarshalJSON() ([]byte, error) {
aka.Type = TypeAPIKey
objectMap := make(map[string]interface{})
if aka.Name != nil {
objectMap["name"] = aka.Name
}
if aka.In != "" {
objectMap["in"] = aka.In
}
if aka.Value != nil {
objectMap["value"] = aka.Value
}
if aka.Type != "" {
objectMap["type"] = aka.Type
}
return json.Marshal(objectMap)
}
// AsRolloutIdentityAuthentication is the BasicRestRequestAuthentication implementation for APIKeyAuthentication.
func (aka APIKeyAuthentication) AsRolloutIdentityAuthentication() (*RolloutIdentityAuthentication, bool) {
return nil, false
}
// AsAPIKeyAuthentication is the BasicRestRequestAuthentication implementation for APIKeyAuthentication.
func (aka APIKeyAuthentication) AsAPIKeyAuthentication() (*APIKeyAuthentication, bool) {
return &aka, true
}
// AsRestRequestAuthentication is the BasicRestRequestAuthentication implementation for APIKeyAuthentication.
func (aka APIKeyAuthentication) AsRestRequestAuthentication() (*RestRequestAuthentication, bool) {
return nil, false
}
// AsBasicRestRequestAuthentication is the BasicRestRequestAuthentication implementation for APIKeyAuthentication.
func (aka APIKeyAuthentication) AsBasicRestRequestAuthentication() (BasicRestRequestAuthentication, bool) {
return &aka, true
}
// ArtifactSource the resource that defines the source location where the artifacts are located.
type ArtifactSource struct {
autorest.Response `json:"-"`
// ArtifactSourceProperties - The properties that define the artifact source.
*ArtifactSourceProperties `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 ArtifactSource.
func (as ArtifactSource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if as.ArtifactSourceProperties != nil {
objectMap["properties"] = as.ArtifactSourceProperties
}
if as.Tags != nil {
objectMap["tags"] = as.Tags
}
if as.Location != nil {
objectMap["location"] = as.Location
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ArtifactSource struct.
func (as *ArtifactSource) 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 artifactSourceProperties ArtifactSourceProperties
err = json.Unmarshal(*v, &artifactSourceProperties)
if err != nil {
return err
}
as.ArtifactSourceProperties = &artifactSourceProperties
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
as.Tags = tags
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
as.Location = &location
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
as.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
as.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
as.Type = &typeVar
}
}
}
return nil
}
// ArtifactSourceProperties the properties that define the artifact source.
type ArtifactSourceProperties struct {
// SourceType - The type of artifact source used.
SourceType *string `json:"sourceType,omitempty"`
// ArtifactRoot - The path from the location that the 'authentication' property [say, a SAS URI to the blob container] refers to, to the location of the artifacts. This can be used to differentiate different versions of the artifacts. Or, different types of artifacts like binaries or templates. The location referenced by the authentication property concatenated with this optional artifactRoot path forms the artifact source location where the artifacts are expected to be found.
ArtifactRoot *string `json:"artifactRoot,omitempty"`
// Authentication - The authentication method to use to access the artifact source.
Authentication BasicAuthentication `json:"authentication,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for ArtifactSourceProperties struct.
func (as *ArtifactSourceProperties) 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 "sourceType":
if v != nil {
var sourceType string
err = json.Unmarshal(*v, &sourceType)
if err != nil {
return err
}
as.SourceType = &sourceType
}
case "artifactRoot":
if v != nil {
var artifactRoot string
err = json.Unmarshal(*v, &artifactRoot)
if err != nil {
return err
}
as.ArtifactRoot = &artifactRoot
}
case "authentication":
if v != nil {
authentication, err := unmarshalBasicAuthentication(*v)
if err != nil {
return err
}
as.Authentication = authentication
}
}
}
return nil
}
// ArtifactSourcePropertiesModel the properties that define the source location where the artifacts are
// located.
type ArtifactSourcePropertiesModel struct {
// SourceType - The type of artifact source used.
SourceType *string `json:"sourceType,omitempty"`
// ArtifactRoot - The path from the location that the 'authentication' property [say, a SAS URI to the blob container] refers to, to the location of the artifacts. This can be used to differentiate different versions of the artifacts. Or, different types of artifacts like binaries or templates. The location referenced by the authentication property concatenated with this optional artifactRoot path forms the artifact source location where the artifacts are expected to be found.
ArtifactRoot *string `json:"artifactRoot,omitempty"`
// Authentication - The authentication method to use to access the artifact source.
Authentication BasicAuthentication `json:"authentication,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for ArtifactSourcePropertiesModel struct.
func (aspm *ArtifactSourcePropertiesModel) 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 "sourceType":
if v != nil {
var sourceType string
err = json.Unmarshal(*v, &sourceType)
if err != nil {
return err
}
aspm.SourceType = &sourceType
}
case "artifactRoot":
if v != nil {
var artifactRoot string
err = json.Unmarshal(*v, &artifactRoot)
if err != nil {
return err
}
aspm.ArtifactRoot = &artifactRoot
}
case "authentication":
if v != nil {
authentication, err := unmarshalBasicAuthentication(*v)
if err != nil {
return err
}
aspm.Authentication = authentication
}
}
}
return nil
}
// BasicAuthentication defines the authentication method and properties to access the artifacts.
type BasicAuthentication interface {
AsSasAuthentication() (*SasAuthentication, bool)
AsAuthentication() (*Authentication, bool)
}
// Authentication defines the authentication method and properties to access the artifacts.
type Authentication struct {
// Type - Possible values include: 'TypeAuthentication', 'TypeSas'
Type Type `json:"type,omitempty"`
}
func unmarshalBasicAuthentication(body []byte) (BasicAuthentication, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["type"] {
case string(TypeSas):
var sa SasAuthentication
err := json.Unmarshal(body, &sa)
return sa, err
default:
var a Authentication
err := json.Unmarshal(body, &a)
return a, err
}
}
func unmarshalBasicAuthenticationArray(body []byte) ([]BasicAuthentication, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
aArray := make([]BasicAuthentication, len(rawMessages))
for index, rawMessage := range rawMessages {
a, err := unmarshalBasicAuthentication(*rawMessage)
if err != nil {
return nil, err
}
aArray[index] = a
}
return aArray, nil
}
// MarshalJSON is the custom marshaler for Authentication.
func (a Authentication) MarshalJSON() ([]byte, error) {
a.Type = TypeAuthentication
objectMap := make(map[string]interface{})
if a.Type != "" {
objectMap["type"] = a.Type
}
return json.Marshal(objectMap)
}
// AsSasAuthentication is the BasicAuthentication implementation for Authentication.
func (a Authentication) AsSasAuthentication() (*SasAuthentication, bool) {
return nil, false
}
// AsAuthentication is the BasicAuthentication implementation for Authentication.
func (a Authentication) AsAuthentication() (*Authentication, bool) {
return &a, true
}
// AsBasicAuthentication is the BasicAuthentication implementation for Authentication.
func (a Authentication) AsBasicAuthentication() (BasicAuthentication, bool) {
return &a, true
}
// 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)
}
// CloudError the error information object.
type CloudError struct {
// Error - The properties that define the error.
Error *CloudErrorBody `json:"error,omitempty"`
}
// CloudErrorBody detailed error information of any failure.
type CloudErrorBody struct {
// Code - READ-ONLY; Error code string.
Code *string `json:"code,omitempty"`
// Message - READ-ONLY; Descriptive error information.
Message *string `json:"message,omitempty"`
// Target - Error target
Target *string `json:"target,omitempty"`
// Details - More detailed error information.
Details *[]CloudErrorBody `json:"details,omitempty"`
}
// MarshalJSON is the custom marshaler for CloudErrorBody.
func (ceb CloudErrorBody) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ceb.Target != nil {
objectMap["target"] = ceb.Target
}
if ceb.Details != nil {
objectMap["details"] = ceb.Details
}
return json.Marshal(objectMap)
}
// BasicHealthCheckStepAttributes the attributes for the health check step.
type BasicHealthCheckStepAttributes interface {
AsRestHealthCheckStepAttributes() (*RestHealthCheckStepAttributes, bool)
AsHealthCheckStepAttributes() (*HealthCheckStepAttributes, bool)
}
// HealthCheckStepAttributes the attributes for the health check step.
type HealthCheckStepAttributes struct {
// WaitDuration - The duration in ISO 8601 format for which health check waits idly without any checks.
WaitDuration *string `json:"waitDuration,omitempty"`
// MaxElasticDuration - The duration in ISO 8601 format for which the health check waits for the resource to become healthy. Health check fails if it doesn't. Health check starts to enforce healthyStateDuration once resource becomes healthy.
MaxElasticDuration *string `json:"maxElasticDuration,omitempty"`
// HealthyStateDuration - The duration in ISO 8601 format for which the resource is expected to be continuously healthy. If maxElasticDuration is specified, healthy state duration is enforced after the detection of first healthy signal.
HealthyStateDuration *string `json:"healthyStateDuration,omitempty"`
// Type - Possible values include: 'TypeHealthCheckStepAttributes', 'TypeREST'
Type TypeBasicHealthCheckStepAttributes `json:"type,omitempty"`
}
func unmarshalBasicHealthCheckStepAttributes(body []byte) (BasicHealthCheckStepAttributes, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["type"] {
case string(TypeREST):
var rhcsa RestHealthCheckStepAttributes
err := json.Unmarshal(body, &rhcsa)
return rhcsa, err
default:
var hcsa HealthCheckStepAttributes
err := json.Unmarshal(body, &hcsa)
return hcsa, err
}
}
func unmarshalBasicHealthCheckStepAttributesArray(body []byte) ([]BasicHealthCheckStepAttributes, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
hcsaArray := make([]BasicHealthCheckStepAttributes, len(rawMessages))
for index, rawMessage := range rawMessages {
hcsa, err := unmarshalBasicHealthCheckStepAttributes(*rawMessage)
if err != nil {
return nil, err
}
hcsaArray[index] = hcsa
}
return hcsaArray, nil
}
// MarshalJSON is the custom marshaler for HealthCheckStepAttributes.
func (hcsa HealthCheckStepAttributes) MarshalJSON() ([]byte, error) {
hcsa.Type = TypeHealthCheckStepAttributes
objectMap := make(map[string]interface{})
if hcsa.WaitDuration != nil {
objectMap["waitDuration"] = hcsa.WaitDuration
}
if hcsa.MaxElasticDuration != nil {
objectMap["maxElasticDuration"] = hcsa.MaxElasticDuration
}
if hcsa.HealthyStateDuration != nil {
objectMap["healthyStateDuration"] = hcsa.HealthyStateDuration
}
if hcsa.Type != "" {
objectMap["type"] = hcsa.Type
}
return json.Marshal(objectMap)
}
// AsRestHealthCheckStepAttributes is the BasicHealthCheckStepAttributes implementation for HealthCheckStepAttributes.
func (hcsa HealthCheckStepAttributes) AsRestHealthCheckStepAttributes() (*RestHealthCheckStepAttributes, bool) {
return nil, false
}
// AsHealthCheckStepAttributes is the BasicHealthCheckStepAttributes implementation for HealthCheckStepAttributes.
func (hcsa HealthCheckStepAttributes) AsHealthCheckStepAttributes() (*HealthCheckStepAttributes, bool) {
return &hcsa, true
}
// AsBasicHealthCheckStepAttributes is the BasicHealthCheckStepAttributes implementation for HealthCheckStepAttributes.
func (hcsa HealthCheckStepAttributes) AsBasicHealthCheckStepAttributes() (BasicHealthCheckStepAttributes, bool) {
return &hcsa, true
}
// HealthCheckStepProperties defines the properties of a health check step.
type HealthCheckStepProperties struct {
// Attributes - The health check step attributes
Attributes BasicHealthCheckStepAttributes `json:"attributes,omitempty"`
// StepType - Possible values include: 'StepTypeStepProperties', 'StepTypeHealthCheck', 'StepTypeWait'
StepType StepType `json:"stepType,omitempty"`
}
// MarshalJSON is the custom marshaler for HealthCheckStepProperties.
func (hcsp HealthCheckStepProperties) MarshalJSON() ([]byte, error) {
hcsp.StepType = StepTypeHealthCheck
objectMap := make(map[string]interface{})
objectMap["attributes"] = hcsp.Attributes
if hcsp.StepType != "" {
objectMap["stepType"] = hcsp.StepType
}
return json.Marshal(objectMap)
}
// AsHealthCheckStepProperties is the BasicStepProperties implementation for HealthCheckStepProperties.
func (hcsp HealthCheckStepProperties) AsHealthCheckStepProperties() (*HealthCheckStepProperties, bool) {
return &hcsp, true
}
// AsWaitStepProperties is the BasicStepProperties implementation for HealthCheckStepProperties.
func (hcsp HealthCheckStepProperties) AsWaitStepProperties() (*WaitStepProperties, bool) {
return nil, false
}
// AsStepProperties is the BasicStepProperties implementation for HealthCheckStepProperties.
func (hcsp HealthCheckStepProperties) AsStepProperties() (*StepProperties, bool) {
return nil, false
}
// AsBasicStepProperties is the BasicStepProperties implementation for HealthCheckStepProperties.
func (hcsp HealthCheckStepProperties) AsBasicStepProperties() (BasicStepProperties, bool) {
return &hcsp, true
}
// UnmarshalJSON is the custom unmarshaler for HealthCheckStepProperties struct.
func (hcsp *HealthCheckStepProperties) 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 "attributes":
if v != nil {
attributes, err := unmarshalBasicHealthCheckStepAttributes(*v)
if err != nil {
return err
}
hcsp.Attributes = attributes
}
case "stepType":
if v != nil {
var stepType StepType
err = json.Unmarshal(*v, &stepType)
if err != nil {
return err
}
hcsp.StepType = stepType
}
}
}
return nil
}
// Identity identity for the resource.
type Identity struct {
// Type - The identity type.
Type *string `json:"type,omitempty"`
// IdentityIds - The list of identities.
IdentityIds *[]string `json:"identityIds,omitempty"`
}
// ListArtifactSource ...
type ListArtifactSource struct {
autorest.Response `json:"-"`
Value *[]ArtifactSource `json:"value,omitempty"`
}
// ListRollout ...
type ListRollout struct {
autorest.Response `json:"-"`
Value *[]Rollout `json:"value,omitempty"`
}
// ListServiceResource ...
type ListServiceResource struct {
autorest.Response `json:"-"`
Value *[]ServiceResource `json:"value,omitempty"`
}
// ListServiceTopologyResource ...
type ListServiceTopologyResource struct {
autorest.Response `json:"-"`
Value *[]ServiceTopologyResource `json:"value,omitempty"`
}
// ListServiceUnitResource ...
type ListServiceUnitResource struct {
autorest.Response `json:"-"`
Value *[]ServiceUnitResource `json:"value,omitempty"`
}
// ListStepResource ...
type ListStepResource struct {
autorest.Response `json:"-"`
Value *[]StepResource `json:"value,omitempty"`
}
// Message supplementary contextual messages during a rollout.
type Message struct {
// TimeStamp - READ-ONLY; Time in UTC this message was provided.
TimeStamp *date.Time `json:"timeStamp,omitempty"`
// Message - READ-ONLY; The actual message text.
Message *string `json:"message,omitempty"`
}
// MarshalJSON is the custom marshaler for Message.
func (mVar Message) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// Operation represents an operation that can be performed on the service.
type Operation struct {
// Name - The name of the operation.
Name *string `json:"name,omitempty"`
// Display - The display name of the operation.
Display *OperationDetail `json:"display,omitempty"`
// Origin - The origin of the operation.
Origin *string `json:"origin,omitempty"`
// Properties - The properties of the operation.
Properties interface{} `json:"properties,omitempty"`
}
// OperationDetail the detail about an operation.
type OperationDetail struct {
// Provider - The name of the provider that supports the operation.
Provider *string `json:"provider,omitempty"`
// Resource - The resource type on which this operation can be performed.
Resource *string `json:"resource,omitempty"`
// Operation - The name of the operation.
Operation *string `json:"operation,omitempty"`
// Description - The description of the operation.
Description *string `json:"description,omitempty"`
}
// OperationsList the operations response.
type OperationsList struct {
autorest.Response `json:"-"`
// Value - The list of supported operations
Value *Operation `json:"value,omitempty"`
}
// PrePostStep the properties that define a step.
type PrePostStep struct {
// StepID - The resource Id of the step to be run.
StepID *string `json:"stepId,omitempty"`
}
// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not
// have tags and a location
type ProxyResource struct {
// 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 ProxyResource.
func (pr ProxyResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// Resource common fields that are returned in the response for all Azure Resource Manager resources
type Resource struct {
// 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 Resource.
func (r Resource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// ResourceOperation individual resource operation information.
type ResourceOperation struct {
// ResourceName - Name of the resource as specified in the artifacts. For ARM resources, this is the name of the resource specified in the template.
ResourceName *string `json:"resourceName,omitempty"`
// OperationID - READ-ONLY; Unique identifier of the operation. For ARM resources, this is the operationId obtained from ARM service.
OperationID *string `json:"operationId,omitempty"`
// ResourceType - Type of the resource as specified in the artifacts. For ARM resources, this is the type of the resource specified in the template.
ResourceType *string `json:"resourceType,omitempty"`
// ProvisioningState - READ-ONLY; State of the resource deployment. For ARM resources, this is the current provisioning state of the resource.
ProvisioningState *string `json:"provisioningState,omitempty"`
// StatusMessage - READ-ONLY; Descriptive information of the resource operation.
StatusMessage *string `json:"statusMessage,omitempty"`
// StatusCode - READ-ONLY; Http status code of the operation.
StatusCode *string `json:"statusCode,omitempty"`
}
// MarshalJSON is the custom marshaler for ResourceOperation.
func (ro ResourceOperation) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ro.ResourceName != nil {
objectMap["resourceName"] = ro.ResourceName
}
if ro.ResourceType != nil {
objectMap["resourceType"] = ro.ResourceType
}
return json.Marshal(objectMap)
}
// RestHealthCheck a REST based health check
type RestHealthCheck struct {
// Name - A unique name for this check.
Name *string `json:"name,omitempty"`
// Request - The request to the health provider.
Request *RestRequest `json:"request,omitempty"`
// Response - The expected response from the health provider. If no expected response is provided, the default is to expect the received response to have an HTTP status code of 200 OK.
Response *RestResponse `json:"response,omitempty"`
}
// RestHealthCheckStepAttributes defines the REST health check step properties.
type RestHealthCheckStepAttributes struct {
// RestParameters - The REST health check parameters.
*RestParameters `json:"properties,omitempty"`
// WaitDuration - The duration in ISO 8601 format for which health check waits idly without any checks.
WaitDuration *string `json:"waitDuration,omitempty"`
// MaxElasticDuration - The duration in ISO 8601 format for which the health check waits for the resource to become healthy. Health check fails if it doesn't. Health check starts to enforce healthyStateDuration once resource becomes healthy.
MaxElasticDuration *string `json:"maxElasticDuration,omitempty"`
// HealthyStateDuration - The duration in ISO 8601 format for which the resource is expected to be continuously healthy. If maxElasticDuration is specified, healthy state duration is enforced after the detection of first healthy signal.
HealthyStateDuration *string `json:"healthyStateDuration,omitempty"`
// Type - Possible values include: 'TypeHealthCheckStepAttributes', 'TypeREST'
Type TypeBasicHealthCheckStepAttributes `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for RestHealthCheckStepAttributes.
func (rhcsa RestHealthCheckStepAttributes) MarshalJSON() ([]byte, error) {
rhcsa.Type = TypeREST
objectMap := make(map[string]interface{})
if rhcsa.RestParameters != nil {
objectMap["properties"] = rhcsa.RestParameters
}
if rhcsa.WaitDuration != nil {
objectMap["waitDuration"] = rhcsa.WaitDuration
}
if rhcsa.MaxElasticDuration != nil {
objectMap["maxElasticDuration"] = rhcsa.MaxElasticDuration
}
if rhcsa.HealthyStateDuration != nil {
objectMap["healthyStateDuration"] = rhcsa.HealthyStateDuration
}
if rhcsa.Type != "" {
objectMap["type"] = rhcsa.Type
}
return json.Marshal(objectMap)
}
// AsRestHealthCheckStepAttributes is the BasicHealthCheckStepAttributes implementation for RestHealthCheckStepAttributes.
func (rhcsa RestHealthCheckStepAttributes) AsRestHealthCheckStepAttributes() (*RestHealthCheckStepAttributes, bool) {
return &rhcsa, true
}
// AsHealthCheckStepAttributes is the BasicHealthCheckStepAttributes implementation for RestHealthCheckStepAttributes.
func (rhcsa RestHealthCheckStepAttributes) AsHealthCheckStepAttributes() (*HealthCheckStepAttributes, bool) {
return nil, false
}
// AsBasicHealthCheckStepAttributes is the BasicHealthCheckStepAttributes implementation for RestHealthCheckStepAttributes.
func (rhcsa RestHealthCheckStepAttributes) AsBasicHealthCheckStepAttributes() (BasicHealthCheckStepAttributes, bool) {
return &rhcsa, true
}
// UnmarshalJSON is the custom unmarshaler for RestHealthCheckStepAttributes struct.
func (rhcsa *RestHealthCheckStepAttributes) 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 restParameters RestParameters
err = json.Unmarshal(*v, &restParameters)
if err != nil {
return err
}
rhcsa.RestParameters = &restParameters
}
case "waitDuration":
if v != nil {
var waitDuration string
err = json.Unmarshal(*v, &waitDuration)
if err != nil {
return err
}
rhcsa.WaitDuration = &waitDuration
}
case "maxElasticDuration":
if v != nil {
var maxElasticDuration string
err = json.Unmarshal(*v, &maxElasticDuration)
if err != nil {
return err
}
rhcsa.MaxElasticDuration = &maxElasticDuration
}
case "healthyStateDuration":
if v != nil {
var healthyStateDuration string
err = json.Unmarshal(*v, &healthyStateDuration)
if err != nil {
return err
}
rhcsa.HealthyStateDuration = &healthyStateDuration
}
case "type":
if v != nil {
var typeVar TypeBasicHealthCheckStepAttributes
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
rhcsa.Type = typeVar
}
}
}
return nil
}
// RestParameters the parameters for the REST health check.
type RestParameters struct {
// HealthChecks - The list of checks that form the health check step.
HealthChecks *[]RestHealthCheck `json:"healthChecks,omitempty"`
}
// RestRequest the properties that make up a REST request
type RestRequest struct {
// Method - The HTTP method to use for the request. Possible values include: 'GET', 'POST'
Method RestRequestMethod `json:"method,omitempty"`
// URI - The HTTP URI to use for the request.
URI *string `json:"uri,omitempty"`
// Authentication - The authentication information required in the request to the health provider.
Authentication BasicRestRequestAuthentication `json:"authentication,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for RestRequest struct.
func (rr *RestRequest) 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 "method":
if v != nil {
var method RestRequestMethod
err = json.Unmarshal(*v, &method)
if err != nil {
return err
}
rr.Method = method
}
case "uri":
if v != nil {
var URI string
err = json.Unmarshal(*v, &URI)
if err != nil {
return err
}
rr.URI = &URI
}
case "authentication":
if v != nil {
authentication, err := unmarshalBasicRestRequestAuthentication(*v)
if err != nil {
return err
}
rr.Authentication = authentication
}
}
}
return nil
}
// BasicRestRequestAuthentication the authentication information required in the REST health check request to the
// health provider.
type BasicRestRequestAuthentication interface {
AsRolloutIdentityAuthentication() (*RolloutIdentityAuthentication, bool)
AsAPIKeyAuthentication() (*APIKeyAuthentication, bool)
AsRestRequestAuthentication() (*RestRequestAuthentication, bool)
}
// RestRequestAuthentication the authentication information required in the REST health check request to the
// health provider.
type RestRequestAuthentication struct {
// Type - Possible values include: 'TypeRestRequestAuthentication', 'TypeRolloutIdentity', 'TypeAPIKey'
Type TypeBasicRestRequestAuthentication `json:"type,omitempty"`
}
func unmarshalBasicRestRequestAuthentication(body []byte) (BasicRestRequestAuthentication, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["type"] {
case string(TypeRolloutIdentity):
var ria RolloutIdentityAuthentication
err := json.Unmarshal(body, &ria)
return ria, err
case string(TypeAPIKey):
var aka APIKeyAuthentication
err := json.Unmarshal(body, &aka)
return aka, err
default:
var rra RestRequestAuthentication
err := json.Unmarshal(body, &rra)
return rra, err
}
}
func unmarshalBasicRestRequestAuthenticationArray(body []byte) ([]BasicRestRequestAuthentication, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
rraArray := make([]BasicRestRequestAuthentication, len(rawMessages))
for index, rawMessage := range rawMessages {
rra, err := unmarshalBasicRestRequestAuthentication(*rawMessage)
if err != nil {
return nil, err
}
rraArray[index] = rra
}
return rraArray, nil
}
// MarshalJSON is the custom marshaler for RestRequestAuthentication.
func (rra RestRequestAuthentication) MarshalJSON() ([]byte, error) {
rra.Type = TypeRestRequestAuthentication
objectMap := make(map[string]interface{})
if rra.Type != "" {
objectMap["type"] = rra.Type
}
return json.Marshal(objectMap)
}
// AsRolloutIdentityAuthentication is the BasicRestRequestAuthentication implementation for RestRequestAuthentication.
func (rra RestRequestAuthentication) AsRolloutIdentityAuthentication() (*RolloutIdentityAuthentication, bool) {
return nil, false
}
// AsAPIKeyAuthentication is the BasicRestRequestAuthentication implementation for RestRequestAuthentication.
func (rra RestRequestAuthentication) AsAPIKeyAuthentication() (*APIKeyAuthentication, bool) {
return nil, false
}
// AsRestRequestAuthentication is the BasicRestRequestAuthentication implementation for RestRequestAuthentication.
func (rra RestRequestAuthentication) AsRestRequestAuthentication() (*RestRequestAuthentication, bool) {
return &rra, true
}
// AsBasicRestRequestAuthentication is the BasicRestRequestAuthentication implementation for RestRequestAuthentication.
func (rra RestRequestAuthentication) AsBasicRestRequestAuthentication() (BasicRestRequestAuthentication, bool) {
return &rra, true
}
// RestResponse the properties that make up the expected REST response
type RestResponse struct {
// SuccessStatusCodes - The HTTP status codes expected in a successful health check response. The response is expected to match one of the given status codes. If no expected status codes are provided, default expected status code is 200 OK.
SuccessStatusCodes *[]string `json:"successStatusCodes,omitempty"`
// Regex - The regular expressions to match the response content with.
Regex *RestResponseRegex `json:"regex,omitempty"`
}
// RestResponseRegex the regular expressions to match the response content with.
type RestResponseRegex struct {
// Matches - The list of regular expressions.
Matches *[]string `json:"matches,omitempty"`
// MatchQuantifier - Indicates whether any or all of the expressions should match with the response content. Possible values include: 'All', 'Any'
MatchQuantifier RestMatchQuantifier `json:"matchQuantifier,omitempty"`
}
// Rollout defines the rollout.
type Rollout struct {
autorest.Response `json:"-"`
// Identity - Identity for the resource.
Identity *Identity `json:"identity,omitempty"`
// RolloutProperties - The properties that define a rollout.