/
models.go
1604 lines (1492 loc) · 53.9 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/2018-09-01-preview/deploymentmanager"
// 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"`
}
// 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)
}
// 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"`
}
// ListOperation ...
type ListOperation struct {
autorest.Response `json:"-"`
Value *[]Operation `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"`
}
// 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"`
}
// 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"`
}
// 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"`
}
// 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)
}
// 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.
*RolloutProperties `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 Rollout.
func (r Rollout) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if r.Identity != nil {
objectMap["identity"] = r.Identity
}
if r.RolloutProperties != nil {
objectMap["properties"] = r.RolloutProperties
}
if r.Tags != nil {
objectMap["tags"] = r.Tags
}
if r.Location != nil {
objectMap["location"] = r.Location
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Rollout struct.
func (r *Rollout) 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 "identity":
if v != nil {
var identity Identity
err = json.Unmarshal(*v, &identity)
if err != nil {
return err
}
r.Identity = &identity
}
case "properties":
if v != nil {
var rolloutProperties RolloutProperties
err = json.Unmarshal(*v, &rolloutProperties)
if err != nil {
return err
}
r.RolloutProperties = &rolloutProperties
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
r.Tags = tags
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
r.Location = &location
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
r.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
r.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
r.Type = &typeVar
}
}
}
return nil
}
// RolloutOperationInfo detailed runtime information of the rollout.
type RolloutOperationInfo struct {
// RetryAttempt - READ-ONLY; The ordinal count of the number of retry attempts on a rollout. 0 if no retries of the rollout have been performed. If the rollout is updated with a PUT, this count is reset to 0.
RetryAttempt *int32 `json:"retryAttempt,omitempty"`
// SkipSucceededOnRetry - READ-ONLY; True, if all steps that succeeded on the previous run/attempt were chosen to be skipped in this retry attempt. False, otherwise.
SkipSucceededOnRetry *bool `json:"skipSucceededOnRetry,omitempty"`
// StartTime - READ-ONLY; The start time of the rollout in UTC.
StartTime *date.Time `json:"startTime,omitempty"`
// EndTime - READ-ONLY; The start time of the rollout in UTC. This property will not be set if the rollout has not completed yet.
EndTime *date.Time `json:"endTime,omitempty"`
// Error - READ-ONLY; The detailed error information for any failure.
Error *CloudErrorBody `json:"error,omitempty"`
}
// RolloutProperties the properties that define a rollout.
type RolloutProperties struct {
// BuildVersion - The version of the build being deployed.
BuildVersion *string `json:"buildVersion,omitempty"`
// ArtifactSourceID - The reference to the artifact source resource Id where the payload is located.
ArtifactSourceID *string `json:"artifactSourceId,omitempty"`
// TargetServiceTopologyID - The resource Id of the service topology from which service units are being referenced in step groups to be deployed.
TargetServiceTopologyID *string `json:"targetServiceTopologyId,omitempty"`
// StepGroups - The list of step groups that define the orchestration.
StepGroups *[]Step `json:"stepGroups,omitempty"`
// Status - READ-ONLY; The current status of the rollout.
Status *string `json:"status,omitempty"`
// TotalRetryAttempts - READ-ONLY; The cardinal count of total number of retries performed on the rollout at a given time.
TotalRetryAttempts *int32 `json:"totalRetryAttempts,omitempty"`
// OperationInfo - READ-ONLY; Operational information of the rollout.
OperationInfo *RolloutOperationInfo `json:"operationInfo,omitempty"`
// Services - READ-ONLY; The detailed information on the services being deployed.
Services *[]Service `json:"services,omitempty"`
}
// MarshalJSON is the custom marshaler for RolloutProperties.
func (r RolloutProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if r.BuildVersion != nil {
objectMap["buildVersion"] = r.BuildVersion
}
if r.ArtifactSourceID != nil {
objectMap["artifactSourceId"] = r.ArtifactSourceID
}
if r.TargetServiceTopologyID != nil {
objectMap["targetServiceTopologyId"] = r.TargetServiceTopologyID
}
if r.StepGroups != nil {
objectMap["stepGroups"] = r.StepGroups
}
return json.Marshal(objectMap)
}
// RolloutPropertiesModel defines the properties of a rollout.
type RolloutPropertiesModel struct {
// Status - READ-ONLY; The current status of the rollout.
Status *string `json:"status,omitempty"`
// TotalRetryAttempts - READ-ONLY; The cardinal count of total number of retries performed on the rollout at a given time.
TotalRetryAttempts *int32 `json:"totalRetryAttempts,omitempty"`
// OperationInfo - READ-ONLY; Operational information of the rollout.
OperationInfo *RolloutOperationInfo `json:"operationInfo,omitempty"`
// Services - READ-ONLY; The detailed information on the services being deployed.
Services *[]Service `json:"services,omitempty"`
}
// RolloutRequest defines the PUT rollout request body.
type RolloutRequest struct {
autorest.Response `json:"-"`
// Identity - Identity for the resource.
Identity *Identity `json:"identity,omitempty"`
// RolloutRequestProperties - Defines the properties that make up a rollout request.
*RolloutRequestProperties `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 RolloutRequest.
func (rr RolloutRequest) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if rr.Identity != nil {
objectMap["identity"] = rr.Identity
}
if rr.RolloutRequestProperties != nil {
objectMap["properties"] = rr.RolloutRequestProperties
}
if rr.Tags != nil {
objectMap["tags"] = rr.Tags
}
if rr.Location != nil {
objectMap["location"] = rr.Location
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for RolloutRequest struct.
func (rr *RolloutRequest) 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 "identity":
if v != nil {
var identity Identity
err = json.Unmarshal(*v, &identity)
if err != nil {
return err
}
rr.Identity = &identity
}
case "properties":
if v != nil {
var rolloutRequestProperties RolloutRequestProperties
err = json.Unmarshal(*v, &rolloutRequestProperties)
if err != nil {
return err
}
rr.RolloutRequestProperties = &rolloutRequestProperties
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
rr.Tags = tags
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
rr.Location = &location
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
rr.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
rr.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
rr.Type = &typeVar
}
}
}
return nil
}
// RolloutRequestProperties the properties for defining a rollout.
type RolloutRequestProperties struct {
// BuildVersion - The version of the build being deployed.
BuildVersion *string `json:"buildVersion,omitempty"`
// ArtifactSourceID - The reference to the artifact source resource Id where the payload is located.
ArtifactSourceID *string `json:"artifactSourceId,omitempty"`
// TargetServiceTopologyID - The resource Id of the service topology from which service units are being referenced in step groups to be deployed.
TargetServiceTopologyID *string `json:"targetServiceTopologyId,omitempty"`
// StepGroups - The list of step groups that define the orchestration.
StepGroups *[]Step `json:"stepGroups,omitempty"`
}
// RolloutsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type RolloutsCreateOrUpdateFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(RolloutsClient) (RolloutRequest, error)
}
// UnmarshalJSON is the custom unmarshaller for CreateFuture.
func (future *RolloutsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
var azFuture azure.Future
if err := json.Unmarshal(body, &azFuture); err != nil {
return err
}
future.FutureAPI = &azFuture
future.Result = future.result
return nil
}
// result is the default implementation for RolloutsCreateOrUpdateFuture.Result.
func (future *RolloutsCreateOrUpdateFuture) result(client RolloutsClient) (rr RolloutRequest, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "deploymentmanager.RolloutsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
rr.Response.Response = future.Response()
err = azure.NewAsyncOpIncompleteError("deploymentmanager.RolloutsCreateOrUpdateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if rr.Response.Response, err = future.GetResult(sender); err == nil && rr.Response.Response.StatusCode != http.StatusNoContent {
rr, err = client.CreateOrUpdateResponder(rr.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "deploymentmanager.RolloutsCreateOrUpdateFuture", "Result", rr.Response.Response, "Failure responding to request")
}
}
return
}
// RolloutStep defines a specific step on a target service unit.
type RolloutStep struct {
// Name - Name of the step.
Name *string `json:"name,omitempty"`
// Status - READ-ONLY; Current state of the step.
Status *string `json:"status,omitempty"`
// StepGroup - The step group the current step is part of.
StepGroup *string `json:"stepGroup,omitempty"`
// OperationInfo - READ-ONLY; Detailed information of specific action execution.
OperationInfo *StepOperationInfo `json:"operationInfo,omitempty"`
// ResourceOperations - READ-ONLY; Set of resource operations that were performed, if any, on an Azure resource.
ResourceOperations *[]ResourceOperation `json:"resourceOperations,omitempty"`
// Messages - READ-ONLY; Supplementary informative messages during rollout.
Messages *[]Message `json:"messages,omitempty"`
}
// MarshalJSON is the custom marshaler for RolloutStep.
func (rs RolloutStep) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if rs.Name != nil {
objectMap["name"] = rs.Name
}
if rs.StepGroup != nil {
objectMap["stepGroup"] = rs.StepGroup
}
return json.Marshal(objectMap)
}
// SasAuthentication defines the properties to access the artifacts using an Azure Storage SAS URI.
type SasAuthentication struct {
// SasProperties - The SAS properties
*SasProperties `json:"properties,omitempty"`
// Type - Possible values include: 'TypeAuthentication', 'TypeSas'
Type Type `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for SasAuthentication.
func (sa SasAuthentication) MarshalJSON() ([]byte, error) {
sa.Type = TypeSas
objectMap := make(map[string]interface{})
if sa.SasProperties != nil {
objectMap["properties"] = sa.SasProperties
}
if sa.Type != "" {
objectMap["type"] = sa.Type
}
return json.Marshal(objectMap)
}
// AsSasAuthentication is the BasicAuthentication implementation for SasAuthentication.
func (sa SasAuthentication) AsSasAuthentication() (*SasAuthentication, bool) {
return &sa, true
}
// AsAuthentication is the BasicAuthentication implementation for SasAuthentication.
func (sa SasAuthentication) AsAuthentication() (*Authentication, bool) {
return nil, false
}
// AsBasicAuthentication is the BasicAuthentication implementation for SasAuthentication.
func (sa SasAuthentication) AsBasicAuthentication() (BasicAuthentication, bool) {
return &sa, true
}
// UnmarshalJSON is the custom unmarshaler for SasAuthentication struct.
func (sa *SasAuthentication) 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 sasProperties SasProperties
err = json.Unmarshal(*v, &sasProperties)
if err != nil {
return err
}
sa.SasProperties = &sasProperties
}
case "type":
if v != nil {
var typeVar Type
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
sa.Type = typeVar
}
}
}
return nil
}
// SasProperties the properties that define SAS authentication.
type SasProperties struct {
// SasURI - The SAS URI to the Azure Storage blob container. Any offset from the root of the container to where the artifacts are located can be defined in the artifactRoot.
SasURI *string `json:"sasUri,omitempty"`
}
// Service defines a service.
type Service struct {
// Name - Name of the service.
Name *string `json:"name,omitempty"`
// ServiceUnits - The detailed information about the units that make up the service.
ServiceUnits *[]ServiceUnit `json:"serviceUnits,omitempty"`
// TargetLocation - The Azure location to which the resources in the service belong to or should be deployed to.
TargetLocation *string `json:"targetLocation,omitempty"`
// TargetSubscriptionID - The subscription to which the resources in the service belong to or should be deployed to.
TargetSubscriptionID *string `json:"targetSubscriptionId,omitempty"`
}
// ServiceProperties the properties of a service.
type ServiceProperties struct {
// TargetLocation - The Azure location to which the resources in the service belong to or should be deployed to.
TargetLocation *string `json:"targetLocation,omitempty"`
// TargetSubscriptionID - The subscription to which the resources in the service belong to or should be deployed to.
TargetSubscriptionID *string `json:"targetSubscriptionId,omitempty"`
}
// ServiceResource the resource representation of a service in a service topology.
type ServiceResource struct {
autorest.Response `json:"-"`
// ServiceResourceProperties - The properties that define a service in a service topology.
*ServiceResourceProperties `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 ServiceResource.
func (sr ServiceResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if sr.ServiceResourceProperties != nil {
objectMap["properties"] = sr.ServiceResourceProperties
}
if sr.Tags != nil {
objectMap["tags"] = sr.Tags
}
if sr.Location != nil {
objectMap["location"] = sr.Location
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ServiceResource struct.
func (sr *ServiceResource) 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 serviceResourceProperties ServiceResourceProperties
err = json.Unmarshal(*v, &serviceResourceProperties)
if err != nil {
return err
}
sr.ServiceResourceProperties = &serviceResourceProperties
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
sr.Tags = tags
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
sr.Location = &location
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
sr.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
sr.Name = &name
}
case "type":