1package deploymentmanager 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "encoding/json" 12 "github.com/Azure/go-autorest/autorest" 13 "github.com/Azure/go-autorest/autorest/azure" 14 "github.com/Azure/go-autorest/autorest/date" 15 "net/http" 16) 17 18// The package's fully qualified name. 19const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/deploymentmanager/mgmt/2019-11-01-preview/deploymentmanager" 20 21// APIKeyAuthentication apiKey authentication gives a name and a value that can be included in either the 22// request header or query parameters. 23type APIKeyAuthentication struct { 24 // Name - The key name of the authentication key/value pair. 25 Name *string `json:"name,omitempty"` 26 // In - The location of the authentication key/value pair in the request. Possible values include: 'Query', 'Header' 27 In RestAuthLocation `json:"in,omitempty"` 28 // Value - The value of the authentication key/value pair. 29 Value *string `json:"value,omitempty"` 30 // Type - Possible values include: 'TypeRestRequestAuthentication', 'TypeRolloutIdentity', 'TypeAPIKey' 31 Type TypeBasicRestRequestAuthentication `json:"type,omitempty"` 32} 33 34// MarshalJSON is the custom marshaler for APIKeyAuthentication. 35func (aka APIKeyAuthentication) MarshalJSON() ([]byte, error) { 36 aka.Type = TypeAPIKey 37 objectMap := make(map[string]interface{}) 38 if aka.Name != nil { 39 objectMap["name"] = aka.Name 40 } 41 if aka.In != "" { 42 objectMap["in"] = aka.In 43 } 44 if aka.Value != nil { 45 objectMap["value"] = aka.Value 46 } 47 if aka.Type != "" { 48 objectMap["type"] = aka.Type 49 } 50 return json.Marshal(objectMap) 51} 52 53// AsRolloutIdentityAuthentication is the BasicRestRequestAuthentication implementation for APIKeyAuthentication. 54func (aka APIKeyAuthentication) AsRolloutIdentityAuthentication() (*RolloutIdentityAuthentication, bool) { 55 return nil, false 56} 57 58// AsAPIKeyAuthentication is the BasicRestRequestAuthentication implementation for APIKeyAuthentication. 59func (aka APIKeyAuthentication) AsAPIKeyAuthentication() (*APIKeyAuthentication, bool) { 60 return &aka, true 61} 62 63// AsRestRequestAuthentication is the BasicRestRequestAuthentication implementation for APIKeyAuthentication. 64func (aka APIKeyAuthentication) AsRestRequestAuthentication() (*RestRequestAuthentication, bool) { 65 return nil, false 66} 67 68// AsBasicRestRequestAuthentication is the BasicRestRequestAuthentication implementation for APIKeyAuthentication. 69func (aka APIKeyAuthentication) AsBasicRestRequestAuthentication() (BasicRestRequestAuthentication, bool) { 70 return &aka, true 71} 72 73// ArtifactSource the resource that defines the source location where the artifacts are located. 74type ArtifactSource struct { 75 autorest.Response `json:"-"` 76 // ArtifactSourceProperties - The properties that define the artifact source. 77 *ArtifactSourceProperties `json:"properties,omitempty"` 78 // Tags - Resource tags. 79 Tags map[string]*string `json:"tags"` 80 // Location - The geo-location where the resource lives 81 Location *string `json:"location,omitempty"` 82 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 83 ID *string `json:"id,omitempty"` 84 // Name - READ-ONLY; The name of the resource 85 Name *string `json:"name,omitempty"` 86 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 87 Type *string `json:"type,omitempty"` 88} 89 90// MarshalJSON is the custom marshaler for ArtifactSource. 91func (as ArtifactSource) MarshalJSON() ([]byte, error) { 92 objectMap := make(map[string]interface{}) 93 if as.ArtifactSourceProperties != nil { 94 objectMap["properties"] = as.ArtifactSourceProperties 95 } 96 if as.Tags != nil { 97 objectMap["tags"] = as.Tags 98 } 99 if as.Location != nil { 100 objectMap["location"] = as.Location 101 } 102 return json.Marshal(objectMap) 103} 104 105// UnmarshalJSON is the custom unmarshaler for ArtifactSource struct. 106func (as *ArtifactSource) UnmarshalJSON(body []byte) error { 107 var m map[string]*json.RawMessage 108 err := json.Unmarshal(body, &m) 109 if err != nil { 110 return err 111 } 112 for k, v := range m { 113 switch k { 114 case "properties": 115 if v != nil { 116 var artifactSourceProperties ArtifactSourceProperties 117 err = json.Unmarshal(*v, &artifactSourceProperties) 118 if err != nil { 119 return err 120 } 121 as.ArtifactSourceProperties = &artifactSourceProperties 122 } 123 case "tags": 124 if v != nil { 125 var tags map[string]*string 126 err = json.Unmarshal(*v, &tags) 127 if err != nil { 128 return err 129 } 130 as.Tags = tags 131 } 132 case "location": 133 if v != nil { 134 var location string 135 err = json.Unmarshal(*v, &location) 136 if err != nil { 137 return err 138 } 139 as.Location = &location 140 } 141 case "id": 142 if v != nil { 143 var ID string 144 err = json.Unmarshal(*v, &ID) 145 if err != nil { 146 return err 147 } 148 as.ID = &ID 149 } 150 case "name": 151 if v != nil { 152 var name string 153 err = json.Unmarshal(*v, &name) 154 if err != nil { 155 return err 156 } 157 as.Name = &name 158 } 159 case "type": 160 if v != nil { 161 var typeVar string 162 err = json.Unmarshal(*v, &typeVar) 163 if err != nil { 164 return err 165 } 166 as.Type = &typeVar 167 } 168 } 169 } 170 171 return nil 172} 173 174// ArtifactSourceProperties the properties that define the artifact source. 175type ArtifactSourceProperties struct { 176 // SourceType - The type of artifact source used. 177 SourceType *string `json:"sourceType,omitempty"` 178 // 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. 179 ArtifactRoot *string `json:"artifactRoot,omitempty"` 180 // Authentication - The authentication method to use to access the artifact source. 181 Authentication BasicAuthentication `json:"authentication,omitempty"` 182} 183 184// UnmarshalJSON is the custom unmarshaler for ArtifactSourceProperties struct. 185func (as *ArtifactSourceProperties) UnmarshalJSON(body []byte) error { 186 var m map[string]*json.RawMessage 187 err := json.Unmarshal(body, &m) 188 if err != nil { 189 return err 190 } 191 for k, v := range m { 192 switch k { 193 case "sourceType": 194 if v != nil { 195 var sourceType string 196 err = json.Unmarshal(*v, &sourceType) 197 if err != nil { 198 return err 199 } 200 as.SourceType = &sourceType 201 } 202 case "artifactRoot": 203 if v != nil { 204 var artifactRoot string 205 err = json.Unmarshal(*v, &artifactRoot) 206 if err != nil { 207 return err 208 } 209 as.ArtifactRoot = &artifactRoot 210 } 211 case "authentication": 212 if v != nil { 213 authentication, err := unmarshalBasicAuthentication(*v) 214 if err != nil { 215 return err 216 } 217 as.Authentication = authentication 218 } 219 } 220 } 221 222 return nil 223} 224 225// ArtifactSourcePropertiesModel the properties that define the source location where the artifacts are 226// located. 227type ArtifactSourcePropertiesModel struct { 228 // SourceType - The type of artifact source used. 229 SourceType *string `json:"sourceType,omitempty"` 230 // 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. 231 ArtifactRoot *string `json:"artifactRoot,omitempty"` 232 // Authentication - The authentication method to use to access the artifact source. 233 Authentication BasicAuthentication `json:"authentication,omitempty"` 234} 235 236// UnmarshalJSON is the custom unmarshaler for ArtifactSourcePropertiesModel struct. 237func (aspm *ArtifactSourcePropertiesModel) UnmarshalJSON(body []byte) error { 238 var m map[string]*json.RawMessage 239 err := json.Unmarshal(body, &m) 240 if err != nil { 241 return err 242 } 243 for k, v := range m { 244 switch k { 245 case "sourceType": 246 if v != nil { 247 var sourceType string 248 err = json.Unmarshal(*v, &sourceType) 249 if err != nil { 250 return err 251 } 252 aspm.SourceType = &sourceType 253 } 254 case "artifactRoot": 255 if v != nil { 256 var artifactRoot string 257 err = json.Unmarshal(*v, &artifactRoot) 258 if err != nil { 259 return err 260 } 261 aspm.ArtifactRoot = &artifactRoot 262 } 263 case "authentication": 264 if v != nil { 265 authentication, err := unmarshalBasicAuthentication(*v) 266 if err != nil { 267 return err 268 } 269 aspm.Authentication = authentication 270 } 271 } 272 } 273 274 return nil 275} 276 277// BasicAuthentication defines the authentication method and properties to access the artifacts. 278type BasicAuthentication interface { 279 AsSasAuthentication() (*SasAuthentication, bool) 280 AsAuthentication() (*Authentication, bool) 281} 282 283// Authentication defines the authentication method and properties to access the artifacts. 284type Authentication struct { 285 // Type - Possible values include: 'TypeAuthentication', 'TypeSas' 286 Type Type `json:"type,omitempty"` 287} 288 289func unmarshalBasicAuthentication(body []byte) (BasicAuthentication, error) { 290 var m map[string]interface{} 291 err := json.Unmarshal(body, &m) 292 if err != nil { 293 return nil, err 294 } 295 296 switch m["type"] { 297 case string(TypeSas): 298 var sa SasAuthentication 299 err := json.Unmarshal(body, &sa) 300 return sa, err 301 default: 302 var a Authentication 303 err := json.Unmarshal(body, &a) 304 return a, err 305 } 306} 307func unmarshalBasicAuthenticationArray(body []byte) ([]BasicAuthentication, error) { 308 var rawMessages []*json.RawMessage 309 err := json.Unmarshal(body, &rawMessages) 310 if err != nil { 311 return nil, err 312 } 313 314 aArray := make([]BasicAuthentication, len(rawMessages)) 315 316 for index, rawMessage := range rawMessages { 317 a, err := unmarshalBasicAuthentication(*rawMessage) 318 if err != nil { 319 return nil, err 320 } 321 aArray[index] = a 322 } 323 return aArray, nil 324} 325 326// MarshalJSON is the custom marshaler for Authentication. 327func (a Authentication) MarshalJSON() ([]byte, error) { 328 a.Type = TypeAuthentication 329 objectMap := make(map[string]interface{}) 330 if a.Type != "" { 331 objectMap["type"] = a.Type 332 } 333 return json.Marshal(objectMap) 334} 335 336// AsSasAuthentication is the BasicAuthentication implementation for Authentication. 337func (a Authentication) AsSasAuthentication() (*SasAuthentication, bool) { 338 return nil, false 339} 340 341// AsAuthentication is the BasicAuthentication implementation for Authentication. 342func (a Authentication) AsAuthentication() (*Authentication, bool) { 343 return &a, true 344} 345 346// AsBasicAuthentication is the BasicAuthentication implementation for Authentication. 347func (a Authentication) AsBasicAuthentication() (BasicAuthentication, bool) { 348 return &a, true 349} 350 351// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. 352type AzureEntityResource struct { 353 // Etag - READ-ONLY; Resource Etag. 354 Etag *string `json:"etag,omitempty"` 355 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 356 ID *string `json:"id,omitempty"` 357 // Name - READ-ONLY; The name of the resource 358 Name *string `json:"name,omitempty"` 359 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 360 Type *string `json:"type,omitempty"` 361} 362 363// MarshalJSON is the custom marshaler for AzureEntityResource. 364func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { 365 objectMap := make(map[string]interface{}) 366 return json.Marshal(objectMap) 367} 368 369// CloudError the error information object. 370type CloudError struct { 371 // Error - The properties that define the error. 372 Error *CloudErrorBody `json:"error,omitempty"` 373} 374 375// CloudErrorBody detailed error information of any failure. 376type CloudErrorBody struct { 377 // Code - READ-ONLY; Error code string. 378 Code *string `json:"code,omitempty"` 379 // Message - READ-ONLY; Descriptive error information. 380 Message *string `json:"message,omitempty"` 381 // Target - Error target 382 Target *string `json:"target,omitempty"` 383 // Details - More detailed error information. 384 Details *[]CloudErrorBody `json:"details,omitempty"` 385} 386 387// MarshalJSON is the custom marshaler for CloudErrorBody. 388func (ceb CloudErrorBody) MarshalJSON() ([]byte, error) { 389 objectMap := make(map[string]interface{}) 390 if ceb.Target != nil { 391 objectMap["target"] = ceb.Target 392 } 393 if ceb.Details != nil { 394 objectMap["details"] = ceb.Details 395 } 396 return json.Marshal(objectMap) 397} 398 399// BasicHealthCheckStepAttributes the attributes for the health check step. 400type BasicHealthCheckStepAttributes interface { 401 AsRestHealthCheckStepAttributes() (*RestHealthCheckStepAttributes, bool) 402 AsHealthCheckStepAttributes() (*HealthCheckStepAttributes, bool) 403} 404 405// HealthCheckStepAttributes the attributes for the health check step. 406type HealthCheckStepAttributes struct { 407 // WaitDuration - The duration in ISO 8601 format for which health check waits idly without any checks. 408 WaitDuration *string `json:"waitDuration,omitempty"` 409 // 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. 410 MaxElasticDuration *string `json:"maxElasticDuration,omitempty"` 411 // 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. 412 HealthyStateDuration *string `json:"healthyStateDuration,omitempty"` 413 // Type - Possible values include: 'TypeHealthCheckStepAttributes', 'TypeREST' 414 Type TypeBasicHealthCheckStepAttributes `json:"type,omitempty"` 415} 416 417func unmarshalBasicHealthCheckStepAttributes(body []byte) (BasicHealthCheckStepAttributes, error) { 418 var m map[string]interface{} 419 err := json.Unmarshal(body, &m) 420 if err != nil { 421 return nil, err 422 } 423 424 switch m["type"] { 425 case string(TypeREST): 426 var rhcsa RestHealthCheckStepAttributes 427 err := json.Unmarshal(body, &rhcsa) 428 return rhcsa, err 429 default: 430 var hcsa HealthCheckStepAttributes 431 err := json.Unmarshal(body, &hcsa) 432 return hcsa, err 433 } 434} 435func unmarshalBasicHealthCheckStepAttributesArray(body []byte) ([]BasicHealthCheckStepAttributes, error) { 436 var rawMessages []*json.RawMessage 437 err := json.Unmarshal(body, &rawMessages) 438 if err != nil { 439 return nil, err 440 } 441 442 hcsaArray := make([]BasicHealthCheckStepAttributes, len(rawMessages)) 443 444 for index, rawMessage := range rawMessages { 445 hcsa, err := unmarshalBasicHealthCheckStepAttributes(*rawMessage) 446 if err != nil { 447 return nil, err 448 } 449 hcsaArray[index] = hcsa 450 } 451 return hcsaArray, nil 452} 453 454// MarshalJSON is the custom marshaler for HealthCheckStepAttributes. 455func (hcsa HealthCheckStepAttributes) MarshalJSON() ([]byte, error) { 456 hcsa.Type = TypeHealthCheckStepAttributes 457 objectMap := make(map[string]interface{}) 458 if hcsa.WaitDuration != nil { 459 objectMap["waitDuration"] = hcsa.WaitDuration 460 } 461 if hcsa.MaxElasticDuration != nil { 462 objectMap["maxElasticDuration"] = hcsa.MaxElasticDuration 463 } 464 if hcsa.HealthyStateDuration != nil { 465 objectMap["healthyStateDuration"] = hcsa.HealthyStateDuration 466 } 467 if hcsa.Type != "" { 468 objectMap["type"] = hcsa.Type 469 } 470 return json.Marshal(objectMap) 471} 472 473// AsRestHealthCheckStepAttributes is the BasicHealthCheckStepAttributes implementation for HealthCheckStepAttributes. 474func (hcsa HealthCheckStepAttributes) AsRestHealthCheckStepAttributes() (*RestHealthCheckStepAttributes, bool) { 475 return nil, false 476} 477 478// AsHealthCheckStepAttributes is the BasicHealthCheckStepAttributes implementation for HealthCheckStepAttributes. 479func (hcsa HealthCheckStepAttributes) AsHealthCheckStepAttributes() (*HealthCheckStepAttributes, bool) { 480 return &hcsa, true 481} 482 483// AsBasicHealthCheckStepAttributes is the BasicHealthCheckStepAttributes implementation for HealthCheckStepAttributes. 484func (hcsa HealthCheckStepAttributes) AsBasicHealthCheckStepAttributes() (BasicHealthCheckStepAttributes, bool) { 485 return &hcsa, true 486} 487 488// HealthCheckStepProperties defines the properties of a health check step. 489type HealthCheckStepProperties struct { 490 // Attributes - The health check step attributes 491 Attributes BasicHealthCheckStepAttributes `json:"attributes,omitempty"` 492 // StepType - Possible values include: 'StepTypeStepProperties', 'StepTypeHealthCheck', 'StepTypeWait' 493 StepType StepType `json:"stepType,omitempty"` 494} 495 496// MarshalJSON is the custom marshaler for HealthCheckStepProperties. 497func (hcsp HealthCheckStepProperties) MarshalJSON() ([]byte, error) { 498 hcsp.StepType = StepTypeHealthCheck 499 objectMap := make(map[string]interface{}) 500 objectMap["attributes"] = hcsp.Attributes 501 if hcsp.StepType != "" { 502 objectMap["stepType"] = hcsp.StepType 503 } 504 return json.Marshal(objectMap) 505} 506 507// AsHealthCheckStepProperties is the BasicStepProperties implementation for HealthCheckStepProperties. 508func (hcsp HealthCheckStepProperties) AsHealthCheckStepProperties() (*HealthCheckStepProperties, bool) { 509 return &hcsp, true 510} 511 512// AsWaitStepProperties is the BasicStepProperties implementation for HealthCheckStepProperties. 513func (hcsp HealthCheckStepProperties) AsWaitStepProperties() (*WaitStepProperties, bool) { 514 return nil, false 515} 516 517// AsStepProperties is the BasicStepProperties implementation for HealthCheckStepProperties. 518func (hcsp HealthCheckStepProperties) AsStepProperties() (*StepProperties, bool) { 519 return nil, false 520} 521 522// AsBasicStepProperties is the BasicStepProperties implementation for HealthCheckStepProperties. 523func (hcsp HealthCheckStepProperties) AsBasicStepProperties() (BasicStepProperties, bool) { 524 return &hcsp, true 525} 526 527// UnmarshalJSON is the custom unmarshaler for HealthCheckStepProperties struct. 528func (hcsp *HealthCheckStepProperties) UnmarshalJSON(body []byte) error { 529 var m map[string]*json.RawMessage 530 err := json.Unmarshal(body, &m) 531 if err != nil { 532 return err 533 } 534 for k, v := range m { 535 switch k { 536 case "attributes": 537 if v != nil { 538 attributes, err := unmarshalBasicHealthCheckStepAttributes(*v) 539 if err != nil { 540 return err 541 } 542 hcsp.Attributes = attributes 543 } 544 case "stepType": 545 if v != nil { 546 var stepType StepType 547 err = json.Unmarshal(*v, &stepType) 548 if err != nil { 549 return err 550 } 551 hcsp.StepType = stepType 552 } 553 } 554 } 555 556 return nil 557} 558 559// Identity identity for the resource. 560type Identity struct { 561 // Type - The identity type. 562 Type *string `json:"type,omitempty"` 563 // IdentityIds - The list of identities. 564 IdentityIds *[]string `json:"identityIds,omitempty"` 565} 566 567// ListArtifactSource ... 568type ListArtifactSource struct { 569 autorest.Response `json:"-"` 570 Value *[]ArtifactSource `json:"value,omitempty"` 571} 572 573// ListRollout ... 574type ListRollout struct { 575 autorest.Response `json:"-"` 576 Value *[]Rollout `json:"value,omitempty"` 577} 578 579// ListServiceResource ... 580type ListServiceResource struct { 581 autorest.Response `json:"-"` 582 Value *[]ServiceResource `json:"value,omitempty"` 583} 584 585// ListServiceTopologyResource ... 586type ListServiceTopologyResource struct { 587 autorest.Response `json:"-"` 588 Value *[]ServiceTopologyResource `json:"value,omitempty"` 589} 590 591// ListServiceUnitResource ... 592type ListServiceUnitResource struct { 593 autorest.Response `json:"-"` 594 Value *[]ServiceUnitResource `json:"value,omitempty"` 595} 596 597// ListStepResource ... 598type ListStepResource struct { 599 autorest.Response `json:"-"` 600 Value *[]StepResource `json:"value,omitempty"` 601} 602 603// Message supplementary contextual messages during a rollout. 604type Message struct { 605 // TimeStamp - READ-ONLY; Time in UTC this message was provided. 606 TimeStamp *date.Time `json:"timeStamp,omitempty"` 607 // Message - READ-ONLY; The actual message text. 608 Message *string `json:"message,omitempty"` 609} 610 611// MarshalJSON is the custom marshaler for Message. 612func (mVar Message) MarshalJSON() ([]byte, error) { 613 objectMap := make(map[string]interface{}) 614 return json.Marshal(objectMap) 615} 616 617// Operation represents an operation that can be performed on the service. 618type Operation struct { 619 // Name - The name of the operation. 620 Name *string `json:"name,omitempty"` 621 // Display - The display name of the operation. 622 Display *OperationDetail `json:"display,omitempty"` 623 // Origin - The origin of the operation. 624 Origin *string `json:"origin,omitempty"` 625 // Properties - The properties of the operation. 626 Properties interface{} `json:"properties,omitempty"` 627} 628 629// OperationDetail the detail about an operation. 630type OperationDetail struct { 631 // Provider - The name of the provider that supports the operation. 632 Provider *string `json:"provider,omitempty"` 633 // Resource - The resource type on which this operation can be performed. 634 Resource *string `json:"resource,omitempty"` 635 // Operation - The name of the operation. 636 Operation *string `json:"operation,omitempty"` 637 // Description - The description of the operation. 638 Description *string `json:"description,omitempty"` 639} 640 641// OperationsList the operations response. 642type OperationsList struct { 643 autorest.Response `json:"-"` 644 // Value - The list of supported operations 645 Value *Operation `json:"value,omitempty"` 646} 647 648// PrePostStep the properties that define a step. 649type PrePostStep struct { 650 // StepID - The resource Id of the step to be run. 651 StepID *string `json:"stepId,omitempty"` 652} 653 654// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not 655// have tags and a location 656type ProxyResource struct { 657 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 658 ID *string `json:"id,omitempty"` 659 // Name - READ-ONLY; The name of the resource 660 Name *string `json:"name,omitempty"` 661 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 662 Type *string `json:"type,omitempty"` 663} 664 665// MarshalJSON is the custom marshaler for ProxyResource. 666func (pr ProxyResource) MarshalJSON() ([]byte, error) { 667 objectMap := make(map[string]interface{}) 668 return json.Marshal(objectMap) 669} 670 671// Resource common fields that are returned in the response for all Azure Resource Manager resources 672type Resource struct { 673 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 674 ID *string `json:"id,omitempty"` 675 // Name - READ-ONLY; The name of the resource 676 Name *string `json:"name,omitempty"` 677 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 678 Type *string `json:"type,omitempty"` 679} 680 681// MarshalJSON is the custom marshaler for Resource. 682func (r Resource) MarshalJSON() ([]byte, error) { 683 objectMap := make(map[string]interface{}) 684 return json.Marshal(objectMap) 685} 686 687// ResourceOperation individual resource operation information. 688type ResourceOperation struct { 689 // ResourceName - Name of the resource as specified in the artifacts. For ARM resources, this is the name of the resource specified in the template. 690 ResourceName *string `json:"resourceName,omitempty"` 691 // OperationID - READ-ONLY; Unique identifier of the operation. For ARM resources, this is the operationId obtained from ARM service. 692 OperationID *string `json:"operationId,omitempty"` 693 // ResourceType - Type of the resource as specified in the artifacts. For ARM resources, this is the type of the resource specified in the template. 694 ResourceType *string `json:"resourceType,omitempty"` 695 // ProvisioningState - READ-ONLY; State of the resource deployment. For ARM resources, this is the current provisioning state of the resource. 696 ProvisioningState *string `json:"provisioningState,omitempty"` 697 // StatusMessage - READ-ONLY; Descriptive information of the resource operation. 698 StatusMessage *string `json:"statusMessage,omitempty"` 699 // StatusCode - READ-ONLY; Http status code of the operation. 700 StatusCode *string `json:"statusCode,omitempty"` 701} 702 703// MarshalJSON is the custom marshaler for ResourceOperation. 704func (ro ResourceOperation) MarshalJSON() ([]byte, error) { 705 objectMap := make(map[string]interface{}) 706 if ro.ResourceName != nil { 707 objectMap["resourceName"] = ro.ResourceName 708 } 709 if ro.ResourceType != nil { 710 objectMap["resourceType"] = ro.ResourceType 711 } 712 return json.Marshal(objectMap) 713} 714 715// RestHealthCheck a REST based health check 716type RestHealthCheck struct { 717 // Name - A unique name for this check. 718 Name *string `json:"name,omitempty"` 719 // Request - The request to the health provider. 720 Request *RestRequest `json:"request,omitempty"` 721 // 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. 722 Response *RestResponse `json:"response,omitempty"` 723} 724 725// RestHealthCheckStepAttributes defines the REST health check step properties. 726type RestHealthCheckStepAttributes struct { 727 // RestParameters - The REST health check parameters. 728 *RestParameters `json:"properties,omitempty"` 729 // WaitDuration - The duration in ISO 8601 format for which health check waits idly without any checks. 730 WaitDuration *string `json:"waitDuration,omitempty"` 731 // 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. 732 MaxElasticDuration *string `json:"maxElasticDuration,omitempty"` 733 // 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. 734 HealthyStateDuration *string `json:"healthyStateDuration,omitempty"` 735 // Type - Possible values include: 'TypeHealthCheckStepAttributes', 'TypeREST' 736 Type TypeBasicHealthCheckStepAttributes `json:"type,omitempty"` 737} 738 739// MarshalJSON is the custom marshaler for RestHealthCheckStepAttributes. 740func (rhcsa RestHealthCheckStepAttributes) MarshalJSON() ([]byte, error) { 741 rhcsa.Type = TypeREST 742 objectMap := make(map[string]interface{}) 743 if rhcsa.RestParameters != nil { 744 objectMap["properties"] = rhcsa.RestParameters 745 } 746 if rhcsa.WaitDuration != nil { 747 objectMap["waitDuration"] = rhcsa.WaitDuration 748 } 749 if rhcsa.MaxElasticDuration != nil { 750 objectMap["maxElasticDuration"] = rhcsa.MaxElasticDuration 751 } 752 if rhcsa.HealthyStateDuration != nil { 753 objectMap["healthyStateDuration"] = rhcsa.HealthyStateDuration 754 } 755 if rhcsa.Type != "" { 756 objectMap["type"] = rhcsa.Type 757 } 758 return json.Marshal(objectMap) 759} 760 761// AsRestHealthCheckStepAttributes is the BasicHealthCheckStepAttributes implementation for RestHealthCheckStepAttributes. 762func (rhcsa RestHealthCheckStepAttributes) AsRestHealthCheckStepAttributes() (*RestHealthCheckStepAttributes, bool) { 763 return &rhcsa, true 764} 765 766// AsHealthCheckStepAttributes is the BasicHealthCheckStepAttributes implementation for RestHealthCheckStepAttributes. 767func (rhcsa RestHealthCheckStepAttributes) AsHealthCheckStepAttributes() (*HealthCheckStepAttributes, bool) { 768 return nil, false 769} 770 771// AsBasicHealthCheckStepAttributes is the BasicHealthCheckStepAttributes implementation for RestHealthCheckStepAttributes. 772func (rhcsa RestHealthCheckStepAttributes) AsBasicHealthCheckStepAttributes() (BasicHealthCheckStepAttributes, bool) { 773 return &rhcsa, true 774} 775 776// UnmarshalJSON is the custom unmarshaler for RestHealthCheckStepAttributes struct. 777func (rhcsa *RestHealthCheckStepAttributes) UnmarshalJSON(body []byte) error { 778 var m map[string]*json.RawMessage 779 err := json.Unmarshal(body, &m) 780 if err != nil { 781 return err 782 } 783 for k, v := range m { 784 switch k { 785 case "properties": 786 if v != nil { 787 var restParameters RestParameters 788 err = json.Unmarshal(*v, &restParameters) 789 if err != nil { 790 return err 791 } 792 rhcsa.RestParameters = &restParameters 793 } 794 case "waitDuration": 795 if v != nil { 796 var waitDuration string 797 err = json.Unmarshal(*v, &waitDuration) 798 if err != nil { 799 return err 800 } 801 rhcsa.WaitDuration = &waitDuration 802 } 803 case "maxElasticDuration": 804 if v != nil { 805 var maxElasticDuration string 806 err = json.Unmarshal(*v, &maxElasticDuration) 807 if err != nil { 808 return err 809 } 810 rhcsa.MaxElasticDuration = &maxElasticDuration 811 } 812 case "healthyStateDuration": 813 if v != nil { 814 var healthyStateDuration string 815 err = json.Unmarshal(*v, &healthyStateDuration) 816 if err != nil { 817 return err 818 } 819 rhcsa.HealthyStateDuration = &healthyStateDuration 820 } 821 case "type": 822 if v != nil { 823 var typeVar TypeBasicHealthCheckStepAttributes 824 err = json.Unmarshal(*v, &typeVar) 825 if err != nil { 826 return err 827 } 828 rhcsa.Type = typeVar 829 } 830 } 831 } 832 833 return nil 834} 835 836// RestParameters the parameters for the REST health check. 837type RestParameters struct { 838 // HealthChecks - The list of checks that form the health check step. 839 HealthChecks *[]RestHealthCheck `json:"healthChecks,omitempty"` 840} 841 842// RestRequest the properties that make up a REST request 843type RestRequest struct { 844 // Method - The HTTP method to use for the request. Possible values include: 'GET', 'POST' 845 Method RestRequestMethod `json:"method,omitempty"` 846 // URI - The HTTP URI to use for the request. 847 URI *string `json:"uri,omitempty"` 848 // Authentication - The authentication information required in the request to the health provider. 849 Authentication BasicRestRequestAuthentication `json:"authentication,omitempty"` 850} 851 852// UnmarshalJSON is the custom unmarshaler for RestRequest struct. 853func (rr *RestRequest) UnmarshalJSON(body []byte) error { 854 var m map[string]*json.RawMessage 855 err := json.Unmarshal(body, &m) 856 if err != nil { 857 return err 858 } 859 for k, v := range m { 860 switch k { 861 case "method": 862 if v != nil { 863 var method RestRequestMethod 864 err = json.Unmarshal(*v, &method) 865 if err != nil { 866 return err 867 } 868 rr.Method = method 869 } 870 case "uri": 871 if v != nil { 872 var URI string 873 err = json.Unmarshal(*v, &URI) 874 if err != nil { 875 return err 876 } 877 rr.URI = &URI 878 } 879 case "authentication": 880 if v != nil { 881 authentication, err := unmarshalBasicRestRequestAuthentication(*v) 882 if err != nil { 883 return err 884 } 885 rr.Authentication = authentication 886 } 887 } 888 } 889 890 return nil 891} 892 893// BasicRestRequestAuthentication the authentication information required in the REST health check request to the 894// health provider. 895type BasicRestRequestAuthentication interface { 896 AsRolloutIdentityAuthentication() (*RolloutIdentityAuthentication, bool) 897 AsAPIKeyAuthentication() (*APIKeyAuthentication, bool) 898 AsRestRequestAuthentication() (*RestRequestAuthentication, bool) 899} 900 901// RestRequestAuthentication the authentication information required in the REST health check request to the 902// health provider. 903type RestRequestAuthentication struct { 904 // Type - Possible values include: 'TypeRestRequestAuthentication', 'TypeRolloutIdentity', 'TypeAPIKey' 905 Type TypeBasicRestRequestAuthentication `json:"type,omitempty"` 906} 907 908func unmarshalBasicRestRequestAuthentication(body []byte) (BasicRestRequestAuthentication, error) { 909 var m map[string]interface{} 910 err := json.Unmarshal(body, &m) 911 if err != nil { 912 return nil, err 913 } 914 915 switch m["type"] { 916 case string(TypeRolloutIdentity): 917 var ria RolloutIdentityAuthentication 918 err := json.Unmarshal(body, &ria) 919 return ria, err 920 case string(TypeAPIKey): 921 var aka APIKeyAuthentication 922 err := json.Unmarshal(body, &aka) 923 return aka, err 924 default: 925 var rra RestRequestAuthentication 926 err := json.Unmarshal(body, &rra) 927 return rra, err 928 } 929} 930func unmarshalBasicRestRequestAuthenticationArray(body []byte) ([]BasicRestRequestAuthentication, error) { 931 var rawMessages []*json.RawMessage 932 err := json.Unmarshal(body, &rawMessages) 933 if err != nil { 934 return nil, err 935 } 936 937 rraArray := make([]BasicRestRequestAuthentication, len(rawMessages)) 938 939 for index, rawMessage := range rawMessages { 940 rra, err := unmarshalBasicRestRequestAuthentication(*rawMessage) 941 if err != nil { 942 return nil, err 943 } 944 rraArray[index] = rra 945 } 946 return rraArray, nil 947} 948 949// MarshalJSON is the custom marshaler for RestRequestAuthentication. 950func (rra RestRequestAuthentication) MarshalJSON() ([]byte, error) { 951 rra.Type = TypeRestRequestAuthentication 952 objectMap := make(map[string]interface{}) 953 if rra.Type != "" { 954 objectMap["type"] = rra.Type 955 } 956 return json.Marshal(objectMap) 957} 958 959// AsRolloutIdentityAuthentication is the BasicRestRequestAuthentication implementation for RestRequestAuthentication. 960func (rra RestRequestAuthentication) AsRolloutIdentityAuthentication() (*RolloutIdentityAuthentication, bool) { 961 return nil, false 962} 963 964// AsAPIKeyAuthentication is the BasicRestRequestAuthentication implementation for RestRequestAuthentication. 965func (rra RestRequestAuthentication) AsAPIKeyAuthentication() (*APIKeyAuthentication, bool) { 966 return nil, false 967} 968 969// AsRestRequestAuthentication is the BasicRestRequestAuthentication implementation for RestRequestAuthentication. 970func (rra RestRequestAuthentication) AsRestRequestAuthentication() (*RestRequestAuthentication, bool) { 971 return &rra, true 972} 973 974// AsBasicRestRequestAuthentication is the BasicRestRequestAuthentication implementation for RestRequestAuthentication. 975func (rra RestRequestAuthentication) AsBasicRestRequestAuthentication() (BasicRestRequestAuthentication, bool) { 976 return &rra, true 977} 978 979// RestResponse the properties that make up the expected REST response 980type RestResponse struct { 981 // 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. 982 SuccessStatusCodes *[]string `json:"successStatusCodes,omitempty"` 983 // Regex - The regular expressions to match the response content with. 984 Regex *RestResponseRegex `json:"regex,omitempty"` 985} 986 987// RestResponseRegex the regular expressions to match the response content with. 988type RestResponseRegex struct { 989 // Matches - The list of regular expressions. 990 Matches *[]string `json:"matches,omitempty"` 991 // MatchQuantifier - Indicates whether any or all of the expressions should match with the response content. Possible values include: 'All', 'Any' 992 MatchQuantifier RestMatchQuantifier `json:"matchQuantifier,omitempty"` 993} 994 995// Rollout defines the rollout. 996type Rollout struct { 997 autorest.Response `json:"-"` 998 // Identity - Identity for the resource. 999 Identity *Identity `json:"identity,omitempty"` 1000 // RolloutProperties - The properties that define a rollout. 1001 *RolloutProperties `json:"properties,omitempty"` 1002 // Tags - Resource tags. 1003 Tags map[string]*string `json:"tags"` 1004 // Location - The geo-location where the resource lives 1005 Location *string `json:"location,omitempty"` 1006 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1007 ID *string `json:"id,omitempty"` 1008 // Name - READ-ONLY; The name of the resource 1009 Name *string `json:"name,omitempty"` 1010 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1011 Type *string `json:"type,omitempty"` 1012} 1013 1014// MarshalJSON is the custom marshaler for Rollout. 1015func (r Rollout) MarshalJSON() ([]byte, error) { 1016 objectMap := make(map[string]interface{}) 1017 if r.Identity != nil { 1018 objectMap["identity"] = r.Identity 1019 } 1020 if r.RolloutProperties != nil { 1021 objectMap["properties"] = r.RolloutProperties 1022 } 1023 if r.Tags != nil { 1024 objectMap["tags"] = r.Tags 1025 } 1026 if r.Location != nil { 1027 objectMap["location"] = r.Location 1028 } 1029 return json.Marshal(objectMap) 1030} 1031 1032// UnmarshalJSON is the custom unmarshaler for Rollout struct. 1033func (r *Rollout) UnmarshalJSON(body []byte) error { 1034 var m map[string]*json.RawMessage 1035 err := json.Unmarshal(body, &m) 1036 if err != nil { 1037 return err 1038 } 1039 for k, v := range m { 1040 switch k { 1041 case "identity": 1042 if v != nil { 1043 var identity Identity 1044 err = json.Unmarshal(*v, &identity) 1045 if err != nil { 1046 return err 1047 } 1048 r.Identity = &identity 1049 } 1050 case "properties": 1051 if v != nil { 1052 var rolloutProperties RolloutProperties 1053 err = json.Unmarshal(*v, &rolloutProperties) 1054 if err != nil { 1055 return err 1056 } 1057 r.RolloutProperties = &rolloutProperties 1058 } 1059 case "tags": 1060 if v != nil { 1061 var tags map[string]*string 1062 err = json.Unmarshal(*v, &tags) 1063 if err != nil { 1064 return err 1065 } 1066 r.Tags = tags 1067 } 1068 case "location": 1069 if v != nil { 1070 var location string 1071 err = json.Unmarshal(*v, &location) 1072 if err != nil { 1073 return err 1074 } 1075 r.Location = &location 1076 } 1077 case "id": 1078 if v != nil { 1079 var ID string 1080 err = json.Unmarshal(*v, &ID) 1081 if err != nil { 1082 return err 1083 } 1084 r.ID = &ID 1085 } 1086 case "name": 1087 if v != nil { 1088 var name string 1089 err = json.Unmarshal(*v, &name) 1090 if err != nil { 1091 return err 1092 } 1093 r.Name = &name 1094 } 1095 case "type": 1096 if v != nil { 1097 var typeVar string 1098 err = json.Unmarshal(*v, &typeVar) 1099 if err != nil { 1100 return err 1101 } 1102 r.Type = &typeVar 1103 } 1104 } 1105 } 1106 1107 return nil 1108} 1109 1110// RolloutIdentityAuthentication rolloutIdentity uses the user-assigned managed identity authentication 1111// context specified in the Identity property during rollout creation. 1112type RolloutIdentityAuthentication struct { 1113 // Type - Possible values include: 'TypeRestRequestAuthentication', 'TypeRolloutIdentity', 'TypeAPIKey' 1114 Type TypeBasicRestRequestAuthentication `json:"type,omitempty"` 1115} 1116 1117// MarshalJSON is the custom marshaler for RolloutIdentityAuthentication. 1118func (ria RolloutIdentityAuthentication) MarshalJSON() ([]byte, error) { 1119 ria.Type = TypeRolloutIdentity 1120 objectMap := make(map[string]interface{}) 1121 if ria.Type != "" { 1122 objectMap["type"] = ria.Type 1123 } 1124 return json.Marshal(objectMap) 1125} 1126 1127// AsRolloutIdentityAuthentication is the BasicRestRequestAuthentication implementation for RolloutIdentityAuthentication. 1128func (ria RolloutIdentityAuthentication) AsRolloutIdentityAuthentication() (*RolloutIdentityAuthentication, bool) { 1129 return &ria, true 1130} 1131 1132// AsAPIKeyAuthentication is the BasicRestRequestAuthentication implementation for RolloutIdentityAuthentication. 1133func (ria RolloutIdentityAuthentication) AsAPIKeyAuthentication() (*APIKeyAuthentication, bool) { 1134 return nil, false 1135} 1136 1137// AsRestRequestAuthentication is the BasicRestRequestAuthentication implementation for RolloutIdentityAuthentication. 1138func (ria RolloutIdentityAuthentication) AsRestRequestAuthentication() (*RestRequestAuthentication, bool) { 1139 return nil, false 1140} 1141 1142// AsBasicRestRequestAuthentication is the BasicRestRequestAuthentication implementation for RolloutIdentityAuthentication. 1143func (ria RolloutIdentityAuthentication) AsBasicRestRequestAuthentication() (BasicRestRequestAuthentication, bool) { 1144 return &ria, true 1145} 1146 1147// RolloutOperationInfo detailed runtime information of the rollout. 1148type RolloutOperationInfo struct { 1149 // 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. 1150 RetryAttempt *int32 `json:"retryAttempt,omitempty"` 1151 // 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. 1152 SkipSucceededOnRetry *bool `json:"skipSucceededOnRetry,omitempty"` 1153 // StartTime - READ-ONLY; The start time of the rollout in UTC. 1154 StartTime *date.Time `json:"startTime,omitempty"` 1155 // EndTime - READ-ONLY; The start time of the rollout in UTC. This property will not be set if the rollout has not completed yet. 1156 EndTime *date.Time `json:"endTime,omitempty"` 1157 // Error - READ-ONLY; The detailed error information for any failure. 1158 Error *CloudErrorBody `json:"error,omitempty"` 1159} 1160 1161// MarshalJSON is the custom marshaler for RolloutOperationInfo. 1162func (roi RolloutOperationInfo) MarshalJSON() ([]byte, error) { 1163 objectMap := make(map[string]interface{}) 1164 return json.Marshal(objectMap) 1165} 1166 1167// RolloutProperties the properties that define a rollout. 1168type RolloutProperties struct { 1169 // BuildVersion - The version of the build being deployed. 1170 BuildVersion *string `json:"buildVersion,omitempty"` 1171 // ArtifactSourceID - The reference to the artifact source resource Id where the payload is located. 1172 ArtifactSourceID *string `json:"artifactSourceId,omitempty"` 1173 // TargetServiceTopologyID - The resource Id of the service topology from which service units are being referenced in step groups to be deployed. 1174 TargetServiceTopologyID *string `json:"targetServiceTopologyId,omitempty"` 1175 // StepGroups - The list of step groups that define the orchestration. 1176 StepGroups *[]StepGroup `json:"stepGroups,omitempty"` 1177 // Status - READ-ONLY; The current status of the rollout. 1178 Status *string `json:"status,omitempty"` 1179 // TotalRetryAttempts - READ-ONLY; The cardinal count of total number of retries performed on the rollout at a given time. 1180 TotalRetryAttempts *int32 `json:"totalRetryAttempts,omitempty"` 1181 // OperationInfo - READ-ONLY; Operational information of the rollout. 1182 OperationInfo *RolloutOperationInfo `json:"operationInfo,omitempty"` 1183 // Services - READ-ONLY; The detailed information on the services being deployed. 1184 Services *[]Service `json:"services,omitempty"` 1185} 1186 1187// MarshalJSON is the custom marshaler for RolloutProperties. 1188func (r RolloutProperties) MarshalJSON() ([]byte, error) { 1189 objectMap := make(map[string]interface{}) 1190 if r.BuildVersion != nil { 1191 objectMap["buildVersion"] = r.BuildVersion 1192 } 1193 if r.ArtifactSourceID != nil { 1194 objectMap["artifactSourceId"] = r.ArtifactSourceID 1195 } 1196 if r.TargetServiceTopologyID != nil { 1197 objectMap["targetServiceTopologyId"] = r.TargetServiceTopologyID 1198 } 1199 if r.StepGroups != nil { 1200 objectMap["stepGroups"] = r.StepGroups 1201 } 1202 return json.Marshal(objectMap) 1203} 1204 1205// RolloutPropertiesModel defines the properties of a rollout. 1206type RolloutPropertiesModel struct { 1207 // Status - READ-ONLY; The current status of the rollout. 1208 Status *string `json:"status,omitempty"` 1209 // TotalRetryAttempts - READ-ONLY; The cardinal count of total number of retries performed on the rollout at a given time. 1210 TotalRetryAttempts *int32 `json:"totalRetryAttempts,omitempty"` 1211 // OperationInfo - READ-ONLY; Operational information of the rollout. 1212 OperationInfo *RolloutOperationInfo `json:"operationInfo,omitempty"` 1213 // Services - READ-ONLY; The detailed information on the services being deployed. 1214 Services *[]Service `json:"services,omitempty"` 1215} 1216 1217// MarshalJSON is the custom marshaler for RolloutPropertiesModel. 1218func (rpm RolloutPropertiesModel) MarshalJSON() ([]byte, error) { 1219 objectMap := make(map[string]interface{}) 1220 return json.Marshal(objectMap) 1221} 1222 1223// RolloutRequest defines the PUT rollout request body. 1224type RolloutRequest struct { 1225 autorest.Response `json:"-"` 1226 // Identity - Identity for the resource. 1227 Identity *Identity `json:"identity,omitempty"` 1228 // RolloutRequestProperties - Defines the properties that make up a rollout request. 1229 *RolloutRequestProperties `json:"properties,omitempty"` 1230 // Tags - Resource tags. 1231 Tags map[string]*string `json:"tags"` 1232 // Location - The geo-location where the resource lives 1233 Location *string `json:"location,omitempty"` 1234 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1235 ID *string `json:"id,omitempty"` 1236 // Name - READ-ONLY; The name of the resource 1237 Name *string `json:"name,omitempty"` 1238 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1239 Type *string `json:"type,omitempty"` 1240} 1241 1242// MarshalJSON is the custom marshaler for RolloutRequest. 1243func (rr RolloutRequest) MarshalJSON() ([]byte, error) { 1244 objectMap := make(map[string]interface{}) 1245 if rr.Identity != nil { 1246 objectMap["identity"] = rr.Identity 1247 } 1248 if rr.RolloutRequestProperties != nil { 1249 objectMap["properties"] = rr.RolloutRequestProperties 1250 } 1251 if rr.Tags != nil { 1252 objectMap["tags"] = rr.Tags 1253 } 1254 if rr.Location != nil { 1255 objectMap["location"] = rr.Location 1256 } 1257 return json.Marshal(objectMap) 1258} 1259 1260// UnmarshalJSON is the custom unmarshaler for RolloutRequest struct. 1261func (rr *RolloutRequest) UnmarshalJSON(body []byte) error { 1262 var m map[string]*json.RawMessage 1263 err := json.Unmarshal(body, &m) 1264 if err != nil { 1265 return err 1266 } 1267 for k, v := range m { 1268 switch k { 1269 case "identity": 1270 if v != nil { 1271 var identity Identity 1272 err = json.Unmarshal(*v, &identity) 1273 if err != nil { 1274 return err 1275 } 1276 rr.Identity = &identity 1277 } 1278 case "properties": 1279 if v != nil { 1280 var rolloutRequestProperties RolloutRequestProperties 1281 err = json.Unmarshal(*v, &rolloutRequestProperties) 1282 if err != nil { 1283 return err 1284 } 1285 rr.RolloutRequestProperties = &rolloutRequestProperties 1286 } 1287 case "tags": 1288 if v != nil { 1289 var tags map[string]*string 1290 err = json.Unmarshal(*v, &tags) 1291 if err != nil { 1292 return err 1293 } 1294 rr.Tags = tags 1295 } 1296 case "location": 1297 if v != nil { 1298 var location string 1299 err = json.Unmarshal(*v, &location) 1300 if err != nil { 1301 return err 1302 } 1303 rr.Location = &location 1304 } 1305 case "id": 1306 if v != nil { 1307 var ID string 1308 err = json.Unmarshal(*v, &ID) 1309 if err != nil { 1310 return err 1311 } 1312 rr.ID = &ID 1313 } 1314 case "name": 1315 if v != nil { 1316 var name string 1317 err = json.Unmarshal(*v, &name) 1318 if err != nil { 1319 return err 1320 } 1321 rr.Name = &name 1322 } 1323 case "type": 1324 if v != nil { 1325 var typeVar string 1326 err = json.Unmarshal(*v, &typeVar) 1327 if err != nil { 1328 return err 1329 } 1330 rr.Type = &typeVar 1331 } 1332 } 1333 } 1334 1335 return nil 1336} 1337 1338// RolloutRequestProperties the properties for defining a rollout. 1339type RolloutRequestProperties struct { 1340 // BuildVersion - The version of the build being deployed. 1341 BuildVersion *string `json:"buildVersion,omitempty"` 1342 // ArtifactSourceID - The reference to the artifact source resource Id where the payload is located. 1343 ArtifactSourceID *string `json:"artifactSourceId,omitempty"` 1344 // TargetServiceTopologyID - The resource Id of the service topology from which service units are being referenced in step groups to be deployed. 1345 TargetServiceTopologyID *string `json:"targetServiceTopologyId,omitempty"` 1346 // StepGroups - The list of step groups that define the orchestration. 1347 StepGroups *[]StepGroup `json:"stepGroups,omitempty"` 1348} 1349 1350// RolloutsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 1351// operation. 1352type RolloutsCreateOrUpdateFuture struct { 1353 azure.FutureAPI 1354 // Result returns the result of the asynchronous operation. 1355 // If the operation has not completed it will return an error. 1356 Result func(RolloutsClient) (RolloutRequest, error) 1357} 1358 1359// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1360func (future *RolloutsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1361 var azFuture azure.Future 1362 if err := json.Unmarshal(body, &azFuture); err != nil { 1363 return err 1364 } 1365 future.FutureAPI = &azFuture 1366 future.Result = future.result 1367 return nil 1368} 1369 1370// result is the default implementation for RolloutsCreateOrUpdateFuture.Result. 1371func (future *RolloutsCreateOrUpdateFuture) result(client RolloutsClient) (rr RolloutRequest, err error) { 1372 var done bool 1373 done, err = future.DoneWithContext(context.Background(), client) 1374 if err != nil { 1375 err = autorest.NewErrorWithError(err, "deploymentmanager.RolloutsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1376 return 1377 } 1378 if !done { 1379 rr.Response.Response = future.Response() 1380 err = azure.NewAsyncOpIncompleteError("deploymentmanager.RolloutsCreateOrUpdateFuture") 1381 return 1382 } 1383 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1384 if rr.Response.Response, err = future.GetResult(sender); err == nil && rr.Response.Response.StatusCode != http.StatusNoContent { 1385 rr, err = client.CreateOrUpdateResponder(rr.Response.Response) 1386 if err != nil { 1387 err = autorest.NewErrorWithError(err, "deploymentmanager.RolloutsCreateOrUpdateFuture", "Result", rr.Response.Response, "Failure responding to request") 1388 } 1389 } 1390 return 1391} 1392 1393// RolloutStep defines a specific step on a target service unit. 1394type RolloutStep struct { 1395 // Name - Name of the step. 1396 Name *string `json:"name,omitempty"` 1397 // Status - READ-ONLY; Current state of the step. 1398 Status *string `json:"status,omitempty"` 1399 // StepGroup - The step group the current step is part of. 1400 StepGroup *string `json:"stepGroup,omitempty"` 1401 // OperationInfo - READ-ONLY; Detailed information of specific action execution. 1402 OperationInfo *StepOperationInfo `json:"operationInfo,omitempty"` 1403 // ResourceOperations - READ-ONLY; Set of resource operations that were performed, if any, on an Azure resource. 1404 ResourceOperations *[]ResourceOperation `json:"resourceOperations,omitempty"` 1405 // Messages - READ-ONLY; Supplementary informative messages during rollout. 1406 Messages *[]Message `json:"messages,omitempty"` 1407} 1408 1409// MarshalJSON is the custom marshaler for RolloutStep. 1410func (rs RolloutStep) MarshalJSON() ([]byte, error) { 1411 objectMap := make(map[string]interface{}) 1412 if rs.Name != nil { 1413 objectMap["name"] = rs.Name 1414 } 1415 if rs.StepGroup != nil { 1416 objectMap["stepGroup"] = rs.StepGroup 1417 } 1418 return json.Marshal(objectMap) 1419} 1420 1421// SasAuthentication defines the properties to access the artifacts using an Azure Storage SAS URI. 1422type SasAuthentication struct { 1423 // SasProperties - The SAS properties 1424 *SasProperties `json:"properties,omitempty"` 1425 // Type - Possible values include: 'TypeAuthentication', 'TypeSas' 1426 Type Type `json:"type,omitempty"` 1427} 1428 1429// MarshalJSON is the custom marshaler for SasAuthentication. 1430func (sa SasAuthentication) MarshalJSON() ([]byte, error) { 1431 sa.Type = TypeSas 1432 objectMap := make(map[string]interface{}) 1433 if sa.SasProperties != nil { 1434 objectMap["properties"] = sa.SasProperties 1435 } 1436 if sa.Type != "" { 1437 objectMap["type"] = sa.Type 1438 } 1439 return json.Marshal(objectMap) 1440} 1441 1442// AsSasAuthentication is the BasicAuthentication implementation for SasAuthentication. 1443func (sa SasAuthentication) AsSasAuthentication() (*SasAuthentication, bool) { 1444 return &sa, true 1445} 1446 1447// AsAuthentication is the BasicAuthentication implementation for SasAuthentication. 1448func (sa SasAuthentication) AsAuthentication() (*Authentication, bool) { 1449 return nil, false 1450} 1451 1452// AsBasicAuthentication is the BasicAuthentication implementation for SasAuthentication. 1453func (sa SasAuthentication) AsBasicAuthentication() (BasicAuthentication, bool) { 1454 return &sa, true 1455} 1456 1457// UnmarshalJSON is the custom unmarshaler for SasAuthentication struct. 1458func (sa *SasAuthentication) UnmarshalJSON(body []byte) error { 1459 var m map[string]*json.RawMessage 1460 err := json.Unmarshal(body, &m) 1461 if err != nil { 1462 return err 1463 } 1464 for k, v := range m { 1465 switch k { 1466 case "properties": 1467 if v != nil { 1468 var sasProperties SasProperties 1469 err = json.Unmarshal(*v, &sasProperties) 1470 if err != nil { 1471 return err 1472 } 1473 sa.SasProperties = &sasProperties 1474 } 1475 case "type": 1476 if v != nil { 1477 var typeVar Type 1478 err = json.Unmarshal(*v, &typeVar) 1479 if err != nil { 1480 return err 1481 } 1482 sa.Type = typeVar 1483 } 1484 } 1485 } 1486 1487 return nil 1488} 1489 1490// SasProperties the properties that define SAS authentication. 1491type SasProperties struct { 1492 // 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. 1493 SasURI *string `json:"sasUri,omitempty"` 1494} 1495 1496// Service defines a service. 1497type Service struct { 1498 // Name - Name of the service. 1499 Name *string `json:"name,omitempty"` 1500 // ServiceUnits - The detailed information about the units that make up the service. 1501 ServiceUnits *[]ServiceUnit `json:"serviceUnits,omitempty"` 1502 // TargetLocation - The Azure location to which the resources in the service belong to or should be deployed to. 1503 TargetLocation *string `json:"targetLocation,omitempty"` 1504 // TargetSubscriptionID - The subscription to which the resources in the service belong to or should be deployed to. 1505 TargetSubscriptionID *string `json:"targetSubscriptionId,omitempty"` 1506} 1507 1508// ServiceProperties the properties of a service. 1509type ServiceProperties struct { 1510 // TargetLocation - The Azure location to which the resources in the service belong to or should be deployed to. 1511 TargetLocation *string `json:"targetLocation,omitempty"` 1512 // TargetSubscriptionID - The subscription to which the resources in the service belong to or should be deployed to. 1513 TargetSubscriptionID *string `json:"targetSubscriptionId,omitempty"` 1514} 1515 1516// ServiceResource the resource representation of a service in a service topology. 1517type ServiceResource struct { 1518 autorest.Response `json:"-"` 1519 // ServiceResourceProperties - The properties that define a service in a service topology. 1520 *ServiceResourceProperties `json:"properties,omitempty"` 1521 // Tags - Resource tags. 1522 Tags map[string]*string `json:"tags"` 1523 // Location - The geo-location where the resource lives 1524 Location *string `json:"location,omitempty"` 1525 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1526 ID *string `json:"id,omitempty"` 1527 // Name - READ-ONLY; The name of the resource 1528 Name *string `json:"name,omitempty"` 1529 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1530 Type *string `json:"type,omitempty"` 1531} 1532 1533// MarshalJSON is the custom marshaler for ServiceResource. 1534func (sr ServiceResource) MarshalJSON() ([]byte, error) { 1535 objectMap := make(map[string]interface{}) 1536 if sr.ServiceResourceProperties != nil { 1537 objectMap["properties"] = sr.ServiceResourceProperties 1538 } 1539 if sr.Tags != nil { 1540 objectMap["tags"] = sr.Tags 1541 } 1542 if sr.Location != nil { 1543 objectMap["location"] = sr.Location 1544 } 1545 return json.Marshal(objectMap) 1546} 1547 1548// UnmarshalJSON is the custom unmarshaler for ServiceResource struct. 1549func (sr *ServiceResource) UnmarshalJSON(body []byte) error { 1550 var m map[string]*json.RawMessage 1551 err := json.Unmarshal(body, &m) 1552 if err != nil { 1553 return err 1554 } 1555 for k, v := range m { 1556 switch k { 1557 case "properties": 1558 if v != nil { 1559 var serviceResourceProperties ServiceResourceProperties 1560 err = json.Unmarshal(*v, &serviceResourceProperties) 1561 if err != nil { 1562 return err 1563 } 1564 sr.ServiceResourceProperties = &serviceResourceProperties 1565 } 1566 case "tags": 1567 if v != nil { 1568 var tags map[string]*string 1569 err = json.Unmarshal(*v, &tags) 1570 if err != nil { 1571 return err 1572 } 1573 sr.Tags = tags 1574 } 1575 case "location": 1576 if v != nil { 1577 var location string 1578 err = json.Unmarshal(*v, &location) 1579 if err != nil { 1580 return err 1581 } 1582 sr.Location = &location 1583 } 1584 case "id": 1585 if v != nil { 1586 var ID string 1587 err = json.Unmarshal(*v, &ID) 1588 if err != nil { 1589 return err 1590 } 1591 sr.ID = &ID 1592 } 1593 case "name": 1594 if v != nil { 1595 var name string 1596 err = json.Unmarshal(*v, &name) 1597 if err != nil { 1598 return err 1599 } 1600 sr.Name = &name 1601 } 1602 case "type": 1603 if v != nil { 1604 var typeVar string 1605 err = json.Unmarshal(*v, &typeVar) 1606 if err != nil { 1607 return err 1608 } 1609 sr.Type = &typeVar 1610 } 1611 } 1612 } 1613 1614 return nil 1615} 1616 1617// ServiceResourceProperties the properties that define a service in a service topology. 1618type ServiceResourceProperties struct { 1619 // TargetLocation - The Azure location to which the resources in the service belong to or should be deployed to. 1620 TargetLocation *string `json:"targetLocation,omitempty"` 1621 // TargetSubscriptionID - The subscription to which the resources in the service belong to or should be deployed to. 1622 TargetSubscriptionID *string `json:"targetSubscriptionId,omitempty"` 1623} 1624 1625// ServiceTopologyProperties the properties of a service topology. 1626type ServiceTopologyProperties struct { 1627 // ArtifactSourceID - The resource Id of the artifact source that contains the artifacts that can be referenced in the service units. 1628 ArtifactSourceID *string `json:"artifactSourceId,omitempty"` 1629} 1630 1631// ServiceTopologyResource the resource representation of a service topology. 1632type ServiceTopologyResource struct { 1633 autorest.Response `json:"-"` 1634 // ServiceTopologyResourceProperties - The properties that define the service topology. 1635 *ServiceTopologyResourceProperties `json:"properties,omitempty"` 1636 // Tags - Resource tags. 1637 Tags map[string]*string `json:"tags"` 1638 // Location - The geo-location where the resource lives 1639 Location *string `json:"location,omitempty"` 1640 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1641 ID *string `json:"id,omitempty"` 1642 // Name - READ-ONLY; The name of the resource 1643 Name *string `json:"name,omitempty"` 1644 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1645 Type *string `json:"type,omitempty"` 1646} 1647 1648// MarshalJSON is the custom marshaler for ServiceTopologyResource. 1649func (str ServiceTopologyResource) MarshalJSON() ([]byte, error) { 1650 objectMap := make(map[string]interface{}) 1651 if str.ServiceTopologyResourceProperties != nil { 1652 objectMap["properties"] = str.ServiceTopologyResourceProperties 1653 } 1654 if str.Tags != nil { 1655 objectMap["tags"] = str.Tags 1656 } 1657 if str.Location != nil { 1658 objectMap["location"] = str.Location 1659 } 1660 return json.Marshal(objectMap) 1661} 1662 1663// UnmarshalJSON is the custom unmarshaler for ServiceTopologyResource struct. 1664func (str *ServiceTopologyResource) UnmarshalJSON(body []byte) error { 1665 var m map[string]*json.RawMessage 1666 err := json.Unmarshal(body, &m) 1667 if err != nil { 1668 return err 1669 } 1670 for k, v := range m { 1671 switch k { 1672 case "properties": 1673 if v != nil { 1674 var serviceTopologyResourceProperties ServiceTopologyResourceProperties 1675 err = json.Unmarshal(*v, &serviceTopologyResourceProperties) 1676 if err != nil { 1677 return err 1678 } 1679 str.ServiceTopologyResourceProperties = &serviceTopologyResourceProperties 1680 } 1681 case "tags": 1682 if v != nil { 1683 var tags map[string]*string 1684 err = json.Unmarshal(*v, &tags) 1685 if err != nil { 1686 return err 1687 } 1688 str.Tags = tags 1689 } 1690 case "location": 1691 if v != nil { 1692 var location string 1693 err = json.Unmarshal(*v, &location) 1694 if err != nil { 1695 return err 1696 } 1697 str.Location = &location 1698 } 1699 case "id": 1700 if v != nil { 1701 var ID string 1702 err = json.Unmarshal(*v, &ID) 1703 if err != nil { 1704 return err 1705 } 1706 str.ID = &ID 1707 } 1708 case "name": 1709 if v != nil { 1710 var name string 1711 err = json.Unmarshal(*v, &name) 1712 if err != nil { 1713 return err 1714 } 1715 str.Name = &name 1716 } 1717 case "type": 1718 if v != nil { 1719 var typeVar string 1720 err = json.Unmarshal(*v, &typeVar) 1721 if err != nil { 1722 return err 1723 } 1724 str.Type = &typeVar 1725 } 1726 } 1727 } 1728 1729 return nil 1730} 1731 1732// ServiceTopologyResourceProperties the properties that define the service topology. 1733type ServiceTopologyResourceProperties struct { 1734 // ArtifactSourceID - The resource Id of the artifact source that contains the artifacts that can be referenced in the service units. 1735 ArtifactSourceID *string `json:"artifactSourceId,omitempty"` 1736} 1737 1738// ServiceUnit defines a service unit. 1739type ServiceUnit struct { 1740 // Name - Name of the service unit. 1741 Name *string `json:"name,omitempty"` 1742 // Steps - Detailed step information, if present. 1743 Steps *[]RolloutStep `json:"steps,omitempty"` 1744 // TargetResourceGroup - The Azure Resource Group to which the resources in the service unit belong to or should be deployed to. 1745 TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` 1746 // DeploymentMode - Describes the type of ARM deployment to be performed on the resource. Possible values include: 'Incremental', 'Complete' 1747 DeploymentMode DeploymentMode `json:"deploymentMode,omitempty"` 1748 // Artifacts - The artifacts for the service unit. 1749 Artifacts *ServiceUnitArtifacts `json:"artifacts,omitempty"` 1750} 1751 1752// ServiceUnitArtifacts defines the artifacts of a service unit. 1753type ServiceUnitArtifacts struct { 1754 // TemplateURI - The full URI of the ARM template file with the SAS token. 1755 TemplateURI *string `json:"templateUri,omitempty"` 1756 // ParametersURI - The full URI of the ARM parameters file with the SAS token. 1757 ParametersURI *string `json:"parametersUri,omitempty"` 1758 // TemplateArtifactSourceRelativePath - The path to the ARM template file relative to the artifact source. 1759 TemplateArtifactSourceRelativePath *string `json:"templateArtifactSourceRelativePath,omitempty"` 1760 // ParametersArtifactSourceRelativePath - The path to the ARM parameters file relative to the artifact source. 1761 ParametersArtifactSourceRelativePath *string `json:"parametersArtifactSourceRelativePath,omitempty"` 1762} 1763 1764// ServiceUnitProperties defines the properties of a service unit. 1765type ServiceUnitProperties struct { 1766 // TargetResourceGroup - The Azure Resource Group to which the resources in the service unit belong to or should be deployed to. 1767 TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` 1768 // DeploymentMode - Describes the type of ARM deployment to be performed on the resource. Possible values include: 'Incremental', 'Complete' 1769 DeploymentMode DeploymentMode `json:"deploymentMode,omitempty"` 1770 // Artifacts - The artifacts for the service unit. 1771 Artifacts *ServiceUnitArtifacts `json:"artifacts,omitempty"` 1772} 1773 1774// ServiceUnitResource represents the response of a service unit resource. 1775type ServiceUnitResource struct { 1776 autorest.Response `json:"-"` 1777 // ServiceUnitResourceProperties - The properties that define the service unit. 1778 *ServiceUnitResourceProperties `json:"properties,omitempty"` 1779 // Tags - Resource tags. 1780 Tags map[string]*string `json:"tags"` 1781 // Location - The geo-location where the resource lives 1782 Location *string `json:"location,omitempty"` 1783 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1784 ID *string `json:"id,omitempty"` 1785 // Name - READ-ONLY; The name of the resource 1786 Name *string `json:"name,omitempty"` 1787 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1788 Type *string `json:"type,omitempty"` 1789} 1790 1791// MarshalJSON is the custom marshaler for ServiceUnitResource. 1792func (sur ServiceUnitResource) MarshalJSON() ([]byte, error) { 1793 objectMap := make(map[string]interface{}) 1794 if sur.ServiceUnitResourceProperties != nil { 1795 objectMap["properties"] = sur.ServiceUnitResourceProperties 1796 } 1797 if sur.Tags != nil { 1798 objectMap["tags"] = sur.Tags 1799 } 1800 if sur.Location != nil { 1801 objectMap["location"] = sur.Location 1802 } 1803 return json.Marshal(objectMap) 1804} 1805 1806// UnmarshalJSON is the custom unmarshaler for ServiceUnitResource struct. 1807func (sur *ServiceUnitResource) UnmarshalJSON(body []byte) error { 1808 var m map[string]*json.RawMessage 1809 err := json.Unmarshal(body, &m) 1810 if err != nil { 1811 return err 1812 } 1813 for k, v := range m { 1814 switch k { 1815 case "properties": 1816 if v != nil { 1817 var serviceUnitResourceProperties ServiceUnitResourceProperties 1818 err = json.Unmarshal(*v, &serviceUnitResourceProperties) 1819 if err != nil { 1820 return err 1821 } 1822 sur.ServiceUnitResourceProperties = &serviceUnitResourceProperties 1823 } 1824 case "tags": 1825 if v != nil { 1826 var tags map[string]*string 1827 err = json.Unmarshal(*v, &tags) 1828 if err != nil { 1829 return err 1830 } 1831 sur.Tags = tags 1832 } 1833 case "location": 1834 if v != nil { 1835 var location string 1836 err = json.Unmarshal(*v, &location) 1837 if err != nil { 1838 return err 1839 } 1840 sur.Location = &location 1841 } 1842 case "id": 1843 if v != nil { 1844 var ID string 1845 err = json.Unmarshal(*v, &ID) 1846 if err != nil { 1847 return err 1848 } 1849 sur.ID = &ID 1850 } 1851 case "name": 1852 if v != nil { 1853 var name string 1854 err = json.Unmarshal(*v, &name) 1855 if err != nil { 1856 return err 1857 } 1858 sur.Name = &name 1859 } 1860 case "type": 1861 if v != nil { 1862 var typeVar string 1863 err = json.Unmarshal(*v, &typeVar) 1864 if err != nil { 1865 return err 1866 } 1867 sur.Type = &typeVar 1868 } 1869 } 1870 } 1871 1872 return nil 1873} 1874 1875// ServiceUnitResourceProperties the properties that define the service unit. 1876type ServiceUnitResourceProperties struct { 1877 // TargetResourceGroup - The Azure Resource Group to which the resources in the service unit belong to or should be deployed to. 1878 TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` 1879 // DeploymentMode - Describes the type of ARM deployment to be performed on the resource. Possible values include: 'Incremental', 'Complete' 1880 DeploymentMode DeploymentMode `json:"deploymentMode,omitempty"` 1881 // Artifacts - The artifacts for the service unit. 1882 Artifacts *ServiceUnitArtifacts `json:"artifacts,omitempty"` 1883} 1884 1885// ServiceUnitsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 1886// long-running operation. 1887type ServiceUnitsCreateOrUpdateFuture struct { 1888 azure.FutureAPI 1889 // Result returns the result of the asynchronous operation. 1890 // If the operation has not completed it will return an error. 1891 Result func(ServiceUnitsClient) (ServiceUnitResource, error) 1892} 1893 1894// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1895func (future *ServiceUnitsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1896 var azFuture azure.Future 1897 if err := json.Unmarshal(body, &azFuture); err != nil { 1898 return err 1899 } 1900 future.FutureAPI = &azFuture 1901 future.Result = future.result 1902 return nil 1903} 1904 1905// result is the default implementation for ServiceUnitsCreateOrUpdateFuture.Result. 1906func (future *ServiceUnitsCreateOrUpdateFuture) result(client ServiceUnitsClient) (sur ServiceUnitResource, err error) { 1907 var done bool 1908 done, err = future.DoneWithContext(context.Background(), client) 1909 if err != nil { 1910 err = autorest.NewErrorWithError(err, "deploymentmanager.ServiceUnitsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1911 return 1912 } 1913 if !done { 1914 sur.Response.Response = future.Response() 1915 err = azure.NewAsyncOpIncompleteError("deploymentmanager.ServiceUnitsCreateOrUpdateFuture") 1916 return 1917 } 1918 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1919 if sur.Response.Response, err = future.GetResult(sender); err == nil && sur.Response.Response.StatusCode != http.StatusNoContent { 1920 sur, err = client.CreateOrUpdateResponder(sur.Response.Response) 1921 if err != nil { 1922 err = autorest.NewErrorWithError(err, "deploymentmanager.ServiceUnitsCreateOrUpdateFuture", "Result", sur.Response.Response, "Failure responding to request") 1923 } 1924 } 1925 return 1926} 1927 1928// StepGroup the properties that define a Step group in a rollout. 1929type StepGroup struct { 1930 // Name - The name of the step group. 1931 Name *string `json:"name,omitempty"` 1932 // DependsOnStepGroups - The list of step group names on which this step group depends on. 1933 DependsOnStepGroups *[]string `json:"dependsOnStepGroups,omitempty"` 1934 // PreDeploymentSteps - The list of steps to be run before deploying the target. 1935 PreDeploymentSteps *[]PrePostStep `json:"preDeploymentSteps,omitempty"` 1936 // DeploymentTargetID - The resource Id of service unit to be deployed. The service unit should be from the service topology referenced in targetServiceTopologyId 1937 DeploymentTargetID *string `json:"deploymentTargetId,omitempty"` 1938 // PostDeploymentSteps - The list of steps to be run after deploying the target. 1939 PostDeploymentSteps *[]PrePostStep `json:"postDeploymentSteps,omitempty"` 1940} 1941 1942// StepOperationInfo detailed information of a specific step run. 1943type StepOperationInfo struct { 1944 // DeploymentName - READ-ONLY; The name of the ARM deployment initiated as part of the step. 1945 DeploymentName *string `json:"deploymentName,omitempty"` 1946 // CorrelationID - READ-ONLY; Unique identifier to track the request for ARM-based resources. 1947 CorrelationID *string `json:"correlationId,omitempty"` 1948 // StartTime - READ-ONLY; Start time of the action in UTC. 1949 StartTime *date.Time `json:"startTime,omitempty"` 1950 // EndTime - READ-ONLY; End time of the action in UTC. 1951 EndTime *date.Time `json:"endTime,omitempty"` 1952 // LastUpdatedTime - READ-ONLY; Last time in UTC this operation was updated. 1953 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 1954 // Error - The errors, if any, for the action. 1955 Error *CloudErrorBody `json:"error,omitempty"` 1956} 1957 1958// MarshalJSON is the custom marshaler for StepOperationInfo. 1959func (soi StepOperationInfo) MarshalJSON() ([]byte, error) { 1960 objectMap := make(map[string]interface{}) 1961 if soi.Error != nil { 1962 objectMap["error"] = soi.Error 1963 } 1964 return json.Marshal(objectMap) 1965} 1966 1967// BasicStepProperties the properties of a step resource. 1968type BasicStepProperties interface { 1969 AsHealthCheckStepProperties() (*HealthCheckStepProperties, bool) 1970 AsWaitStepProperties() (*WaitStepProperties, bool) 1971 AsStepProperties() (*StepProperties, bool) 1972} 1973 1974// StepProperties the properties of a step resource. 1975type StepProperties struct { 1976 // StepType - Possible values include: 'StepTypeStepProperties', 'StepTypeHealthCheck', 'StepTypeWait' 1977 StepType StepType `json:"stepType,omitempty"` 1978} 1979 1980func unmarshalBasicStepProperties(body []byte) (BasicStepProperties, error) { 1981 var m map[string]interface{} 1982 err := json.Unmarshal(body, &m) 1983 if err != nil { 1984 return nil, err 1985 } 1986 1987 switch m["stepType"] { 1988 case string(StepTypeHealthCheck): 1989 var hcsp HealthCheckStepProperties 1990 err := json.Unmarshal(body, &hcsp) 1991 return hcsp, err 1992 case string(StepTypeWait): 1993 var wsp WaitStepProperties 1994 err := json.Unmarshal(body, &wsp) 1995 return wsp, err 1996 default: 1997 var sp StepProperties 1998 err := json.Unmarshal(body, &sp) 1999 return sp, err 2000 } 2001} 2002func unmarshalBasicStepPropertiesArray(body []byte) ([]BasicStepProperties, error) { 2003 var rawMessages []*json.RawMessage 2004 err := json.Unmarshal(body, &rawMessages) 2005 if err != nil { 2006 return nil, err 2007 } 2008 2009 spArray := make([]BasicStepProperties, len(rawMessages)) 2010 2011 for index, rawMessage := range rawMessages { 2012 sp, err := unmarshalBasicStepProperties(*rawMessage) 2013 if err != nil { 2014 return nil, err 2015 } 2016 spArray[index] = sp 2017 } 2018 return spArray, nil 2019} 2020 2021// MarshalJSON is the custom marshaler for StepProperties. 2022func (sp StepProperties) MarshalJSON() ([]byte, error) { 2023 sp.StepType = StepTypeStepProperties 2024 objectMap := make(map[string]interface{}) 2025 if sp.StepType != "" { 2026 objectMap["stepType"] = sp.StepType 2027 } 2028 return json.Marshal(objectMap) 2029} 2030 2031// AsHealthCheckStepProperties is the BasicStepProperties implementation for StepProperties. 2032func (sp StepProperties) AsHealthCheckStepProperties() (*HealthCheckStepProperties, bool) { 2033 return nil, false 2034} 2035 2036// AsWaitStepProperties is the BasicStepProperties implementation for StepProperties. 2037func (sp StepProperties) AsWaitStepProperties() (*WaitStepProperties, bool) { 2038 return nil, false 2039} 2040 2041// AsStepProperties is the BasicStepProperties implementation for StepProperties. 2042func (sp StepProperties) AsStepProperties() (*StepProperties, bool) { 2043 return &sp, true 2044} 2045 2046// AsBasicStepProperties is the BasicStepProperties implementation for StepProperties. 2047func (sp StepProperties) AsBasicStepProperties() (BasicStepProperties, bool) { 2048 return &sp, true 2049} 2050 2051// StepResource the resource representation of a rollout step. 2052type StepResource struct { 2053 autorest.Response `json:"-"` 2054 // Properties - The properties that define the step. 2055 Properties BasicStepProperties `json:"properties,omitempty"` 2056 // Tags - Resource tags. 2057 Tags map[string]*string `json:"tags"` 2058 // Location - The geo-location where the resource lives 2059 Location *string `json:"location,omitempty"` 2060 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2061 ID *string `json:"id,omitempty"` 2062 // Name - READ-ONLY; The name of the resource 2063 Name *string `json:"name,omitempty"` 2064 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 2065 Type *string `json:"type,omitempty"` 2066} 2067 2068// MarshalJSON is the custom marshaler for StepResource. 2069func (sr StepResource) MarshalJSON() ([]byte, error) { 2070 objectMap := make(map[string]interface{}) 2071 objectMap["properties"] = sr.Properties 2072 if sr.Tags != nil { 2073 objectMap["tags"] = sr.Tags 2074 } 2075 if sr.Location != nil { 2076 objectMap["location"] = sr.Location 2077 } 2078 return json.Marshal(objectMap) 2079} 2080 2081// UnmarshalJSON is the custom unmarshaler for StepResource struct. 2082func (sr *StepResource) UnmarshalJSON(body []byte) error { 2083 var m map[string]*json.RawMessage 2084 err := json.Unmarshal(body, &m) 2085 if err != nil { 2086 return err 2087 } 2088 for k, v := range m { 2089 switch k { 2090 case "properties": 2091 if v != nil { 2092 properties, err := unmarshalBasicStepProperties(*v) 2093 if err != nil { 2094 return err 2095 } 2096 sr.Properties = properties 2097 } 2098 case "tags": 2099 if v != nil { 2100 var tags map[string]*string 2101 err = json.Unmarshal(*v, &tags) 2102 if err != nil { 2103 return err 2104 } 2105 sr.Tags = tags 2106 } 2107 case "location": 2108 if v != nil { 2109 var location string 2110 err = json.Unmarshal(*v, &location) 2111 if err != nil { 2112 return err 2113 } 2114 sr.Location = &location 2115 } 2116 case "id": 2117 if v != nil { 2118 var ID string 2119 err = json.Unmarshal(*v, &ID) 2120 if err != nil { 2121 return err 2122 } 2123 sr.ID = &ID 2124 } 2125 case "name": 2126 if v != nil { 2127 var name string 2128 err = json.Unmarshal(*v, &name) 2129 if err != nil { 2130 return err 2131 } 2132 sr.Name = &name 2133 } 2134 case "type": 2135 if v != nil { 2136 var typeVar string 2137 err = json.Unmarshal(*v, &typeVar) 2138 if err != nil { 2139 return err 2140 } 2141 sr.Type = &typeVar 2142 } 2143 } 2144 } 2145 2146 return nil 2147} 2148 2149// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource 2150// which has 'tags' and a 'location' 2151type TrackedResource struct { 2152 // Tags - Resource tags. 2153 Tags map[string]*string `json:"tags"` 2154 // Location - The geo-location where the resource lives 2155 Location *string `json:"location,omitempty"` 2156 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2157 ID *string `json:"id,omitempty"` 2158 // Name - READ-ONLY; The name of the resource 2159 Name *string `json:"name,omitempty"` 2160 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 2161 Type *string `json:"type,omitempty"` 2162} 2163 2164// MarshalJSON is the custom marshaler for TrackedResource. 2165func (tr TrackedResource) MarshalJSON() ([]byte, error) { 2166 objectMap := make(map[string]interface{}) 2167 if tr.Tags != nil { 2168 objectMap["tags"] = tr.Tags 2169 } 2170 if tr.Location != nil { 2171 objectMap["location"] = tr.Location 2172 } 2173 return json.Marshal(objectMap) 2174} 2175 2176// WaitStepAttributes the parameters for the wait step. 2177type WaitStepAttributes struct { 2178 // Duration - The duration in ISO 8601 format of how long the wait should be. 2179 Duration *string `json:"duration,omitempty"` 2180} 2181 2182// WaitStepProperties defines the properties of a Wait step. 2183type WaitStepProperties struct { 2184 // Attributes - The Wait attributes 2185 Attributes *WaitStepAttributes `json:"attributes,omitempty"` 2186 // StepType - Possible values include: 'StepTypeStepProperties', 'StepTypeHealthCheck', 'StepTypeWait' 2187 StepType StepType `json:"stepType,omitempty"` 2188} 2189 2190// MarshalJSON is the custom marshaler for WaitStepProperties. 2191func (wsp WaitStepProperties) MarshalJSON() ([]byte, error) { 2192 wsp.StepType = StepTypeWait 2193 objectMap := make(map[string]interface{}) 2194 if wsp.Attributes != nil { 2195 objectMap["attributes"] = wsp.Attributes 2196 } 2197 if wsp.StepType != "" { 2198 objectMap["stepType"] = wsp.StepType 2199 } 2200 return json.Marshal(objectMap) 2201} 2202 2203// AsHealthCheckStepProperties is the BasicStepProperties implementation for WaitStepProperties. 2204func (wsp WaitStepProperties) AsHealthCheckStepProperties() (*HealthCheckStepProperties, bool) { 2205 return nil, false 2206} 2207 2208// AsWaitStepProperties is the BasicStepProperties implementation for WaitStepProperties. 2209func (wsp WaitStepProperties) AsWaitStepProperties() (*WaitStepProperties, bool) { 2210 return &wsp, true 2211} 2212 2213// AsStepProperties is the BasicStepProperties implementation for WaitStepProperties. 2214func (wsp WaitStepProperties) AsStepProperties() (*StepProperties, bool) { 2215 return nil, false 2216} 2217 2218// AsBasicStepProperties is the BasicStepProperties implementation for WaitStepProperties. 2219func (wsp WaitStepProperties) AsBasicStepProperties() (BasicStepProperties, bool) { 2220 return &wsp, true 2221} 2222