1package deploymentmanager
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"context"
22	"encoding/json"
23	"github.com/Azure/go-autorest/autorest"
24	"github.com/Azure/go-autorest/autorest/azure"
25	"github.com/Azure/go-autorest/autorest/date"
26	"net/http"
27)
28
29// The package's fully qualified name.
30const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/deploymentmanager/mgmt/2018-09-01-preview/deploymentmanager"
31
32// DeploymentMode enumerates the values for deployment mode.
33type DeploymentMode string
34
35const (
36	// Complete ...
37	Complete DeploymentMode = "Complete"
38	// Incremental ...
39	Incremental DeploymentMode = "Incremental"
40)
41
42// PossibleDeploymentModeValues returns an array of possible values for the DeploymentMode const type.
43func PossibleDeploymentModeValues() []DeploymentMode {
44	return []DeploymentMode{Complete, Incremental}
45}
46
47// StepType enumerates the values for step type.
48type StepType string
49
50const (
51	// StepTypeStepProperties ...
52	StepTypeStepProperties StepType = "StepProperties"
53	// StepTypeWait ...
54	StepTypeWait StepType = "Wait"
55)
56
57// PossibleStepTypeValues returns an array of possible values for the StepType const type.
58func PossibleStepTypeValues() []StepType {
59	return []StepType{StepTypeStepProperties, StepTypeWait}
60}
61
62// Type enumerates the values for type.
63type Type string
64
65const (
66	// TypeAuthentication ...
67	TypeAuthentication Type = "Authentication"
68	// TypeSas ...
69	TypeSas Type = "Sas"
70)
71
72// PossibleTypeValues returns an array of possible values for the Type const type.
73func PossibleTypeValues() []Type {
74	return []Type{TypeAuthentication, TypeSas}
75}
76
77// ArtifactSource the resource that defines the source location where the artifacts are located.
78type ArtifactSource struct {
79	autorest.Response `json:"-"`
80	// ArtifactSourceProperties - The properties that define the artifact source.
81	*ArtifactSourceProperties `json:"properties,omitempty"`
82	// Tags - Resource tags.
83	Tags map[string]*string `json:"tags"`
84	// Location - The geo-location where the resource lives
85	Location *string `json:"location,omitempty"`
86	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
87	ID *string `json:"id,omitempty"`
88	// Name - READ-ONLY; The name of the resource
89	Name *string `json:"name,omitempty"`
90	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
91	Type *string `json:"type,omitempty"`
92}
93
94// MarshalJSON is the custom marshaler for ArtifactSource.
95func (as ArtifactSource) MarshalJSON() ([]byte, error) {
96	objectMap := make(map[string]interface{})
97	if as.ArtifactSourceProperties != nil {
98		objectMap["properties"] = as.ArtifactSourceProperties
99	}
100	if as.Tags != nil {
101		objectMap["tags"] = as.Tags
102	}
103	if as.Location != nil {
104		objectMap["location"] = as.Location
105	}
106	return json.Marshal(objectMap)
107}
108
109// UnmarshalJSON is the custom unmarshaler for ArtifactSource struct.
110func (as *ArtifactSource) UnmarshalJSON(body []byte) error {
111	var m map[string]*json.RawMessage
112	err := json.Unmarshal(body, &m)
113	if err != nil {
114		return err
115	}
116	for k, v := range m {
117		switch k {
118		case "properties":
119			if v != nil {
120				var artifactSourceProperties ArtifactSourceProperties
121				err = json.Unmarshal(*v, &artifactSourceProperties)
122				if err != nil {
123					return err
124				}
125				as.ArtifactSourceProperties = &artifactSourceProperties
126			}
127		case "tags":
128			if v != nil {
129				var tags map[string]*string
130				err = json.Unmarshal(*v, &tags)
131				if err != nil {
132					return err
133				}
134				as.Tags = tags
135			}
136		case "location":
137			if v != nil {
138				var location string
139				err = json.Unmarshal(*v, &location)
140				if err != nil {
141					return err
142				}
143				as.Location = &location
144			}
145		case "id":
146			if v != nil {
147				var ID string
148				err = json.Unmarshal(*v, &ID)
149				if err != nil {
150					return err
151				}
152				as.ID = &ID
153			}
154		case "name":
155			if v != nil {
156				var name string
157				err = json.Unmarshal(*v, &name)
158				if err != nil {
159					return err
160				}
161				as.Name = &name
162			}
163		case "type":
164			if v != nil {
165				var typeVar string
166				err = json.Unmarshal(*v, &typeVar)
167				if err != nil {
168					return err
169				}
170				as.Type = &typeVar
171			}
172		}
173	}
174
175	return nil
176}
177
178// ArtifactSourceProperties the properties that define the artifact source.
179type ArtifactSourceProperties struct {
180	// SourceType - The type of artifact source used.
181	SourceType *string `json:"sourceType,omitempty"`
182	// 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.
183	ArtifactRoot *string `json:"artifactRoot,omitempty"`
184	// Authentication - The authentication method to use to access the artifact source.
185	Authentication BasicAuthentication `json:"authentication,omitempty"`
186}
187
188// UnmarshalJSON is the custom unmarshaler for ArtifactSourceProperties struct.
189func (as *ArtifactSourceProperties) UnmarshalJSON(body []byte) error {
190	var m map[string]*json.RawMessage
191	err := json.Unmarshal(body, &m)
192	if err != nil {
193		return err
194	}
195	for k, v := range m {
196		switch k {
197		case "sourceType":
198			if v != nil {
199				var sourceType string
200				err = json.Unmarshal(*v, &sourceType)
201				if err != nil {
202					return err
203				}
204				as.SourceType = &sourceType
205			}
206		case "artifactRoot":
207			if v != nil {
208				var artifactRoot string
209				err = json.Unmarshal(*v, &artifactRoot)
210				if err != nil {
211					return err
212				}
213				as.ArtifactRoot = &artifactRoot
214			}
215		case "authentication":
216			if v != nil {
217				authentication, err := unmarshalBasicAuthentication(*v)
218				if err != nil {
219					return err
220				}
221				as.Authentication = authentication
222			}
223		}
224	}
225
226	return nil
227}
228
229// ArtifactSourcePropertiesModel the properties that define the source location where the artifacts are
230// located.
231type ArtifactSourcePropertiesModel struct {
232	// SourceType - The type of artifact source used.
233	SourceType *string `json:"sourceType,omitempty"`
234	// 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.
235	ArtifactRoot *string `json:"artifactRoot,omitempty"`
236	// Authentication - The authentication method to use to access the artifact source.
237	Authentication BasicAuthentication `json:"authentication,omitempty"`
238}
239
240// UnmarshalJSON is the custom unmarshaler for ArtifactSourcePropertiesModel struct.
241func (aspm *ArtifactSourcePropertiesModel) UnmarshalJSON(body []byte) error {
242	var m map[string]*json.RawMessage
243	err := json.Unmarshal(body, &m)
244	if err != nil {
245		return err
246	}
247	for k, v := range m {
248		switch k {
249		case "sourceType":
250			if v != nil {
251				var sourceType string
252				err = json.Unmarshal(*v, &sourceType)
253				if err != nil {
254					return err
255				}
256				aspm.SourceType = &sourceType
257			}
258		case "artifactRoot":
259			if v != nil {
260				var artifactRoot string
261				err = json.Unmarshal(*v, &artifactRoot)
262				if err != nil {
263					return err
264				}
265				aspm.ArtifactRoot = &artifactRoot
266			}
267		case "authentication":
268			if v != nil {
269				authentication, err := unmarshalBasicAuthentication(*v)
270				if err != nil {
271					return err
272				}
273				aspm.Authentication = authentication
274			}
275		}
276	}
277
278	return nil
279}
280
281// BasicAuthentication defines the authentication method and properties to access the artifacts.
282type BasicAuthentication interface {
283	AsSasAuthentication() (*SasAuthentication, bool)
284	AsAuthentication() (*Authentication, bool)
285}
286
287// Authentication defines the authentication method and properties to access the artifacts.
288type Authentication struct {
289	// Type - Possible values include: 'TypeAuthentication', 'TypeSas'
290	Type Type `json:"type,omitempty"`
291}
292
293func unmarshalBasicAuthentication(body []byte) (BasicAuthentication, error) {
294	var m map[string]interface{}
295	err := json.Unmarshal(body, &m)
296	if err != nil {
297		return nil, err
298	}
299
300	switch m["type"] {
301	case string(TypeSas):
302		var sa SasAuthentication
303		err := json.Unmarshal(body, &sa)
304		return sa, err
305	default:
306		var a Authentication
307		err := json.Unmarshal(body, &a)
308		return a, err
309	}
310}
311func unmarshalBasicAuthenticationArray(body []byte) ([]BasicAuthentication, error) {
312	var rawMessages []*json.RawMessage
313	err := json.Unmarshal(body, &rawMessages)
314	if err != nil {
315		return nil, err
316	}
317
318	aArray := make([]BasicAuthentication, len(rawMessages))
319
320	for index, rawMessage := range rawMessages {
321		a, err := unmarshalBasicAuthentication(*rawMessage)
322		if err != nil {
323			return nil, err
324		}
325		aArray[index] = a
326	}
327	return aArray, nil
328}
329
330// MarshalJSON is the custom marshaler for Authentication.
331func (a Authentication) MarshalJSON() ([]byte, error) {
332	a.Type = TypeAuthentication
333	objectMap := make(map[string]interface{})
334	if a.Type != "" {
335		objectMap["type"] = a.Type
336	}
337	return json.Marshal(objectMap)
338}
339
340// AsSasAuthentication is the BasicAuthentication implementation for Authentication.
341func (a Authentication) AsSasAuthentication() (*SasAuthentication, bool) {
342	return nil, false
343}
344
345// AsAuthentication is the BasicAuthentication implementation for Authentication.
346func (a Authentication) AsAuthentication() (*Authentication, bool) {
347	return &a, true
348}
349
350// AsBasicAuthentication is the BasicAuthentication implementation for Authentication.
351func (a Authentication) AsBasicAuthentication() (BasicAuthentication, bool) {
352	return &a, true
353}
354
355// AzureEntityResource the resource model definition for a Azure Resource Manager resource with an etag.
356type AzureEntityResource struct {
357	// Etag - READ-ONLY; Resource Etag.
358	Etag *string `json:"etag,omitempty"`
359	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
360	ID *string `json:"id,omitempty"`
361	// Name - READ-ONLY; The name of the resource
362	Name *string `json:"name,omitempty"`
363	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
364	Type *string `json:"type,omitempty"`
365}
366
367// CloudError the error information object.
368type CloudError struct {
369	// Error - The properties that define the error.
370	Error *CloudErrorBody `json:"error,omitempty"`
371}
372
373// CloudErrorBody detailed error information of any failure.
374type CloudErrorBody struct {
375	// Code - READ-ONLY; Error code string.
376	Code *string `json:"code,omitempty"`
377	// Message - READ-ONLY; Descriptive error information.
378	Message *string `json:"message,omitempty"`
379	// Target - Error target
380	Target *string `json:"target,omitempty"`
381	// Details - More detailed error information.
382	Details *[]CloudErrorBody `json:"details,omitempty"`
383}
384
385// Identity identity for the resource.
386type Identity struct {
387	// Type - The identity type.
388	Type *string `json:"type,omitempty"`
389	// IdentityIds - The list of identities.
390	IdentityIds *[]string `json:"identityIds,omitempty"`
391}
392
393// ListOperation ...
394type ListOperation struct {
395	autorest.Response `json:"-"`
396	Value             *[]Operation `json:"value,omitempty"`
397}
398
399// Message supplementary contextual messages during a rollout.
400type Message struct {
401	// TimeStamp - READ-ONLY; Time in UTC this message was provided.
402	TimeStamp *date.Time `json:"timeStamp,omitempty"`
403	// Message - READ-ONLY; The actual message text.
404	Message *string `json:"message,omitempty"`
405}
406
407// Operation represents an operation that can be performed on the service.
408type Operation struct {
409	// Name - The name of the operation.
410	Name *string `json:"name,omitempty"`
411	// Display - The display name of the operation.
412	Display *OperationDetail `json:"display,omitempty"`
413	// Origin - The origin of the operation.
414	Origin *string `json:"origin,omitempty"`
415	// Properties - The properties of the operation.
416	Properties interface{} `json:"properties,omitempty"`
417}
418
419// OperationDetail the detail about an operation.
420type OperationDetail struct {
421	// Provider - The name of the provider that supports the operation.
422	Provider *string `json:"provider,omitempty"`
423	// Resource - The resource type on which this operation can be performed.
424	Resource *string `json:"resource,omitempty"`
425	// Operation - The name of the operation.
426	Operation *string `json:"operation,omitempty"`
427	// Description - The description of the operation.
428	Description *string `json:"description,omitempty"`
429}
430
431// PrePostStep the properties that define a step.
432type PrePostStep struct {
433	// StepID - The resource Id of the step to be run.
434	StepID *string `json:"stepId,omitempty"`
435}
436
437// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than
438// required location and tags
439type ProxyResource struct {
440	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
441	ID *string `json:"id,omitempty"`
442	// Name - READ-ONLY; The name of the resource
443	Name *string `json:"name,omitempty"`
444	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
445	Type *string `json:"type,omitempty"`
446}
447
448// Resource ...
449type Resource struct {
450	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
451	ID *string `json:"id,omitempty"`
452	// Name - READ-ONLY; The name of the resource
453	Name *string `json:"name,omitempty"`
454	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
455	Type *string `json:"type,omitempty"`
456}
457
458// ResourceOperation individual resource operation information.
459type ResourceOperation struct {
460	// ResourceName - Name of the resource as specified in the artifacts. For ARM resources, this is the name of the resource specified in the template.
461	ResourceName *string `json:"resourceName,omitempty"`
462	// OperationID - READ-ONLY; Unique identifier of the operation. For ARM resources, this is the operationId obtained from ARM service.
463	OperationID *string `json:"operationId,omitempty"`
464	// ResourceType - Type of the resource as specified in the artifacts. For ARM resources, this is the type of the resource specified in the template.
465	ResourceType *string `json:"resourceType,omitempty"`
466	// ProvisioningState - READ-ONLY; State of the resource deployment. For ARM resources, this is the current provisioning state of the resource.
467	ProvisioningState *string `json:"provisioningState,omitempty"`
468	// StatusMessage - READ-ONLY; Descriptive information of the resource operation.
469	StatusMessage *string `json:"statusMessage,omitempty"`
470	// StatusCode - READ-ONLY; Http status code of the operation.
471	StatusCode *string `json:"statusCode,omitempty"`
472}
473
474// Rollout defines the rollout.
475type Rollout struct {
476	autorest.Response `json:"-"`
477	// Identity - Identity for the resource.
478	Identity *Identity `json:"identity,omitempty"`
479	// RolloutProperties - The properties that define a rollout.
480	*RolloutProperties `json:"properties,omitempty"`
481	// Tags - Resource tags.
482	Tags map[string]*string `json:"tags"`
483	// Location - The geo-location where the resource lives
484	Location *string `json:"location,omitempty"`
485	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
486	ID *string `json:"id,omitempty"`
487	// Name - READ-ONLY; The name of the resource
488	Name *string `json:"name,omitempty"`
489	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
490	Type *string `json:"type,omitempty"`
491}
492
493// MarshalJSON is the custom marshaler for Rollout.
494func (r Rollout) MarshalJSON() ([]byte, error) {
495	objectMap := make(map[string]interface{})
496	if r.Identity != nil {
497		objectMap["identity"] = r.Identity
498	}
499	if r.RolloutProperties != nil {
500		objectMap["properties"] = r.RolloutProperties
501	}
502	if r.Tags != nil {
503		objectMap["tags"] = r.Tags
504	}
505	if r.Location != nil {
506		objectMap["location"] = r.Location
507	}
508	return json.Marshal(objectMap)
509}
510
511// UnmarshalJSON is the custom unmarshaler for Rollout struct.
512func (r *Rollout) UnmarshalJSON(body []byte) error {
513	var m map[string]*json.RawMessage
514	err := json.Unmarshal(body, &m)
515	if err != nil {
516		return err
517	}
518	for k, v := range m {
519		switch k {
520		case "identity":
521			if v != nil {
522				var identity Identity
523				err = json.Unmarshal(*v, &identity)
524				if err != nil {
525					return err
526				}
527				r.Identity = &identity
528			}
529		case "properties":
530			if v != nil {
531				var rolloutProperties RolloutProperties
532				err = json.Unmarshal(*v, &rolloutProperties)
533				if err != nil {
534					return err
535				}
536				r.RolloutProperties = &rolloutProperties
537			}
538		case "tags":
539			if v != nil {
540				var tags map[string]*string
541				err = json.Unmarshal(*v, &tags)
542				if err != nil {
543					return err
544				}
545				r.Tags = tags
546			}
547		case "location":
548			if v != nil {
549				var location string
550				err = json.Unmarshal(*v, &location)
551				if err != nil {
552					return err
553				}
554				r.Location = &location
555			}
556		case "id":
557			if v != nil {
558				var ID string
559				err = json.Unmarshal(*v, &ID)
560				if err != nil {
561					return err
562				}
563				r.ID = &ID
564			}
565		case "name":
566			if v != nil {
567				var name string
568				err = json.Unmarshal(*v, &name)
569				if err != nil {
570					return err
571				}
572				r.Name = &name
573			}
574		case "type":
575			if v != nil {
576				var typeVar string
577				err = json.Unmarshal(*v, &typeVar)
578				if err != nil {
579					return err
580				}
581				r.Type = &typeVar
582			}
583		}
584	}
585
586	return nil
587}
588
589// RolloutOperationInfo detailed runtime information of the rollout.
590type RolloutOperationInfo struct {
591	// 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.
592	RetryAttempt *int32 `json:"retryAttempt,omitempty"`
593	// 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.
594	SkipSucceededOnRetry *bool `json:"skipSucceededOnRetry,omitempty"`
595	// StartTime - READ-ONLY; The start time of the rollout in UTC.
596	StartTime *date.Time `json:"startTime,omitempty"`
597	// EndTime - READ-ONLY; The start time of the rollout in UTC. This property will not be set if the rollout has not completed yet.
598	EndTime *date.Time `json:"endTime,omitempty"`
599	// Error - READ-ONLY; The detailed error information for any failure.
600	Error *CloudErrorBody `json:"error,omitempty"`
601}
602
603// RolloutProperties the properties that define a rollout.
604type RolloutProperties struct {
605	// BuildVersion - The version of the build being deployed.
606	BuildVersion *string `json:"buildVersion,omitempty"`
607	// ArtifactSourceID - The reference to the artifact source resource Id where the payload is located.
608	ArtifactSourceID *string `json:"artifactSourceId,omitempty"`
609	// TargetServiceTopologyID - The resource Id of the service topology from which service units are being referenced in step groups to be deployed.
610	TargetServiceTopologyID *string `json:"targetServiceTopologyId,omitempty"`
611	// StepGroups - The list of step groups that define the orchestration.
612	StepGroups *[]Step `json:"stepGroups,omitempty"`
613	// Status - READ-ONLY; The current status of the rollout.
614	Status *string `json:"status,omitempty"`
615	// TotalRetryAttempts - READ-ONLY; The cardinal count of total number of retries performed on the rollout at a given time.
616	TotalRetryAttempts *int32 `json:"totalRetryAttempts,omitempty"`
617	// OperationInfo - READ-ONLY; Operational information of the rollout.
618	OperationInfo *RolloutOperationInfo `json:"operationInfo,omitempty"`
619	// Services - READ-ONLY; The detailed information on the services being deployed.
620	Services *[]Service `json:"services,omitempty"`
621}
622
623// RolloutPropertiesModel defines the properties of a rollout.
624type RolloutPropertiesModel struct {
625	// Status - READ-ONLY; The current status of the rollout.
626	Status *string `json:"status,omitempty"`
627	// TotalRetryAttempts - READ-ONLY; The cardinal count of total number of retries performed on the rollout at a given time.
628	TotalRetryAttempts *int32 `json:"totalRetryAttempts,omitempty"`
629	// OperationInfo - READ-ONLY; Operational information of the rollout.
630	OperationInfo *RolloutOperationInfo `json:"operationInfo,omitempty"`
631	// Services - READ-ONLY; The detailed information on the services being deployed.
632	Services *[]Service `json:"services,omitempty"`
633}
634
635// RolloutRequest defines the PUT rollout request body.
636type RolloutRequest struct {
637	autorest.Response `json:"-"`
638	// Identity - Identity for the resource.
639	Identity *Identity `json:"identity,omitempty"`
640	// RolloutRequestProperties - Defines the properties that make up a rollout request.
641	*RolloutRequestProperties `json:"properties,omitempty"`
642	// Tags - Resource tags.
643	Tags map[string]*string `json:"tags"`
644	// Location - The geo-location where the resource lives
645	Location *string `json:"location,omitempty"`
646	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
647	ID *string `json:"id,omitempty"`
648	// Name - READ-ONLY; The name of the resource
649	Name *string `json:"name,omitempty"`
650	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
651	Type *string `json:"type,omitempty"`
652}
653
654// MarshalJSON is the custom marshaler for RolloutRequest.
655func (rr RolloutRequest) MarshalJSON() ([]byte, error) {
656	objectMap := make(map[string]interface{})
657	if rr.Identity != nil {
658		objectMap["identity"] = rr.Identity
659	}
660	if rr.RolloutRequestProperties != nil {
661		objectMap["properties"] = rr.RolloutRequestProperties
662	}
663	if rr.Tags != nil {
664		objectMap["tags"] = rr.Tags
665	}
666	if rr.Location != nil {
667		objectMap["location"] = rr.Location
668	}
669	return json.Marshal(objectMap)
670}
671
672// UnmarshalJSON is the custom unmarshaler for RolloutRequest struct.
673func (rr *RolloutRequest) UnmarshalJSON(body []byte) error {
674	var m map[string]*json.RawMessage
675	err := json.Unmarshal(body, &m)
676	if err != nil {
677		return err
678	}
679	for k, v := range m {
680		switch k {
681		case "identity":
682			if v != nil {
683				var identity Identity
684				err = json.Unmarshal(*v, &identity)
685				if err != nil {
686					return err
687				}
688				rr.Identity = &identity
689			}
690		case "properties":
691			if v != nil {
692				var rolloutRequestProperties RolloutRequestProperties
693				err = json.Unmarshal(*v, &rolloutRequestProperties)
694				if err != nil {
695					return err
696				}
697				rr.RolloutRequestProperties = &rolloutRequestProperties
698			}
699		case "tags":
700			if v != nil {
701				var tags map[string]*string
702				err = json.Unmarshal(*v, &tags)
703				if err != nil {
704					return err
705				}
706				rr.Tags = tags
707			}
708		case "location":
709			if v != nil {
710				var location string
711				err = json.Unmarshal(*v, &location)
712				if err != nil {
713					return err
714				}
715				rr.Location = &location
716			}
717		case "id":
718			if v != nil {
719				var ID string
720				err = json.Unmarshal(*v, &ID)
721				if err != nil {
722					return err
723				}
724				rr.ID = &ID
725			}
726		case "name":
727			if v != nil {
728				var name string
729				err = json.Unmarshal(*v, &name)
730				if err != nil {
731					return err
732				}
733				rr.Name = &name
734			}
735		case "type":
736			if v != nil {
737				var typeVar string
738				err = json.Unmarshal(*v, &typeVar)
739				if err != nil {
740					return err
741				}
742				rr.Type = &typeVar
743			}
744		}
745	}
746
747	return nil
748}
749
750// RolloutRequestProperties the properties for defining a rollout.
751type RolloutRequestProperties struct {
752	// BuildVersion - The version of the build being deployed.
753	BuildVersion *string `json:"buildVersion,omitempty"`
754	// ArtifactSourceID - The reference to the artifact source resource Id where the payload is located.
755	ArtifactSourceID *string `json:"artifactSourceId,omitempty"`
756	// TargetServiceTopologyID - The resource Id of the service topology from which service units are being referenced in step groups to be deployed.
757	TargetServiceTopologyID *string `json:"targetServiceTopologyId,omitempty"`
758	// StepGroups - The list of step groups that define the orchestration.
759	StepGroups *[]Step `json:"stepGroups,omitempty"`
760}
761
762// RolloutsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
763// operation.
764type RolloutsCreateOrUpdateFuture struct {
765	azure.Future
766}
767
768// Result returns the result of the asynchronous operation.
769// If the operation has not completed it will return an error.
770func (future *RolloutsCreateOrUpdateFuture) Result(client RolloutsClient) (rr RolloutRequest, err error) {
771	var done bool
772	done, err = future.DoneWithContext(context.Background(), client)
773	if err != nil {
774		err = autorest.NewErrorWithError(err, "deploymentmanager.RolloutsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
775		return
776	}
777	if !done {
778		err = azure.NewAsyncOpIncompleteError("deploymentmanager.RolloutsCreateOrUpdateFuture")
779		return
780	}
781	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
782	if rr.Response.Response, err = future.GetResult(sender); err == nil && rr.Response.Response.StatusCode != http.StatusNoContent {
783		rr, err = client.CreateOrUpdateResponder(rr.Response.Response)
784		if err != nil {
785			err = autorest.NewErrorWithError(err, "deploymentmanager.RolloutsCreateOrUpdateFuture", "Result", rr.Response.Response, "Failure responding to request")
786		}
787	}
788	return
789}
790
791// RolloutStep defines a specific step on a target service unit.
792type RolloutStep struct {
793	// Name - Name of the step.
794	Name *string `json:"name,omitempty"`
795	// Status - READ-ONLY; Current state of the step.
796	Status *string `json:"status,omitempty"`
797	// StepGroup - The step group the current step is part of.
798	StepGroup *string `json:"stepGroup,omitempty"`
799	// OperationInfo - READ-ONLY; Detailed information of specific action execution.
800	OperationInfo *StepOperationInfo `json:"operationInfo,omitempty"`
801	// ResourceOperations - READ-ONLY; Set of resource operations that were performed, if any, on an Azure resource.
802	ResourceOperations *[]ResourceOperation `json:"resourceOperations,omitempty"`
803	// Messages - READ-ONLY; Supplementary informative messages during rollout.
804	Messages *[]Message `json:"messages,omitempty"`
805}
806
807// SasAuthentication defines the properties to access the artifacts using an Azure Storage SAS URI.
808type SasAuthentication struct {
809	// SasProperties - The SAS properties
810	*SasProperties `json:"properties,omitempty"`
811	// Type - Possible values include: 'TypeAuthentication', 'TypeSas'
812	Type Type `json:"type,omitempty"`
813}
814
815// MarshalJSON is the custom marshaler for SasAuthentication.
816func (sa SasAuthentication) MarshalJSON() ([]byte, error) {
817	sa.Type = TypeSas
818	objectMap := make(map[string]interface{})
819	if sa.SasProperties != nil {
820		objectMap["properties"] = sa.SasProperties
821	}
822	if sa.Type != "" {
823		objectMap["type"] = sa.Type
824	}
825	return json.Marshal(objectMap)
826}
827
828// AsSasAuthentication is the BasicAuthentication implementation for SasAuthentication.
829func (sa SasAuthentication) AsSasAuthentication() (*SasAuthentication, bool) {
830	return &sa, true
831}
832
833// AsAuthentication is the BasicAuthentication implementation for SasAuthentication.
834func (sa SasAuthentication) AsAuthentication() (*Authentication, bool) {
835	return nil, false
836}
837
838// AsBasicAuthentication is the BasicAuthentication implementation for SasAuthentication.
839func (sa SasAuthentication) AsBasicAuthentication() (BasicAuthentication, bool) {
840	return &sa, true
841}
842
843// UnmarshalJSON is the custom unmarshaler for SasAuthentication struct.
844func (sa *SasAuthentication) UnmarshalJSON(body []byte) error {
845	var m map[string]*json.RawMessage
846	err := json.Unmarshal(body, &m)
847	if err != nil {
848		return err
849	}
850	for k, v := range m {
851		switch k {
852		case "properties":
853			if v != nil {
854				var sasProperties SasProperties
855				err = json.Unmarshal(*v, &sasProperties)
856				if err != nil {
857					return err
858				}
859				sa.SasProperties = &sasProperties
860			}
861		case "type":
862			if v != nil {
863				var typeVar Type
864				err = json.Unmarshal(*v, &typeVar)
865				if err != nil {
866					return err
867				}
868				sa.Type = typeVar
869			}
870		}
871	}
872
873	return nil
874}
875
876// SasProperties the properties that define SAS authentication.
877type SasProperties struct {
878	// 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.
879	SasURI *string `json:"sasUri,omitempty"`
880}
881
882// Service defines a service.
883type Service struct {
884	// Name - Name of the service.
885	Name *string `json:"name,omitempty"`
886	// ServiceUnits - The detailed information about the units that make up the service.
887	ServiceUnits *[]ServiceUnit `json:"serviceUnits,omitempty"`
888	// TargetLocation - The Azure location to which the resources in the service belong to or should be deployed to.
889	TargetLocation *string `json:"targetLocation,omitempty"`
890	// TargetSubscriptionID - The subscription to which the resources in the service belong to or should be deployed to.
891	TargetSubscriptionID *string `json:"targetSubscriptionId,omitempty"`
892}
893
894// ServiceProperties the properties of a service.
895type ServiceProperties struct {
896	// TargetLocation - The Azure location to which the resources in the service belong to or should be deployed to.
897	TargetLocation *string `json:"targetLocation,omitempty"`
898	// TargetSubscriptionID - The subscription to which the resources in the service belong to or should be deployed to.
899	TargetSubscriptionID *string `json:"targetSubscriptionId,omitempty"`
900}
901
902// ServiceResource the resource representation of a service in a service topology.
903type ServiceResource struct {
904	autorest.Response `json:"-"`
905	// ServiceResourceProperties - The properties that define a service in a service topology.
906	*ServiceResourceProperties `json:"properties,omitempty"`
907	// Tags - Resource tags.
908	Tags map[string]*string `json:"tags"`
909	// Location - The geo-location where the resource lives
910	Location *string `json:"location,omitempty"`
911	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
912	ID *string `json:"id,omitempty"`
913	// Name - READ-ONLY; The name of the resource
914	Name *string `json:"name,omitempty"`
915	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
916	Type *string `json:"type,omitempty"`
917}
918
919// MarshalJSON is the custom marshaler for ServiceResource.
920func (sr ServiceResource) MarshalJSON() ([]byte, error) {
921	objectMap := make(map[string]interface{})
922	if sr.ServiceResourceProperties != nil {
923		objectMap["properties"] = sr.ServiceResourceProperties
924	}
925	if sr.Tags != nil {
926		objectMap["tags"] = sr.Tags
927	}
928	if sr.Location != nil {
929		objectMap["location"] = sr.Location
930	}
931	return json.Marshal(objectMap)
932}
933
934// UnmarshalJSON is the custom unmarshaler for ServiceResource struct.
935func (sr *ServiceResource) UnmarshalJSON(body []byte) error {
936	var m map[string]*json.RawMessage
937	err := json.Unmarshal(body, &m)
938	if err != nil {
939		return err
940	}
941	for k, v := range m {
942		switch k {
943		case "properties":
944			if v != nil {
945				var serviceResourceProperties ServiceResourceProperties
946				err = json.Unmarshal(*v, &serviceResourceProperties)
947				if err != nil {
948					return err
949				}
950				sr.ServiceResourceProperties = &serviceResourceProperties
951			}
952		case "tags":
953			if v != nil {
954				var tags map[string]*string
955				err = json.Unmarshal(*v, &tags)
956				if err != nil {
957					return err
958				}
959				sr.Tags = tags
960			}
961		case "location":
962			if v != nil {
963				var location string
964				err = json.Unmarshal(*v, &location)
965				if err != nil {
966					return err
967				}
968				sr.Location = &location
969			}
970		case "id":
971			if v != nil {
972				var ID string
973				err = json.Unmarshal(*v, &ID)
974				if err != nil {
975					return err
976				}
977				sr.ID = &ID
978			}
979		case "name":
980			if v != nil {
981				var name string
982				err = json.Unmarshal(*v, &name)
983				if err != nil {
984					return err
985				}
986				sr.Name = &name
987			}
988		case "type":
989			if v != nil {
990				var typeVar string
991				err = json.Unmarshal(*v, &typeVar)
992				if err != nil {
993					return err
994				}
995				sr.Type = &typeVar
996			}
997		}
998	}
999
1000	return nil
1001}
1002
1003// ServiceResourceProperties the properties that define a service in a service topology.
1004type ServiceResourceProperties struct {
1005	// TargetLocation - The Azure location to which the resources in the service belong to or should be deployed to.
1006	TargetLocation *string `json:"targetLocation,omitempty"`
1007	// TargetSubscriptionID - The subscription to which the resources in the service belong to or should be deployed to.
1008	TargetSubscriptionID *string `json:"targetSubscriptionId,omitempty"`
1009}
1010
1011// ServiceTopologyProperties the properties of a service topology.
1012type ServiceTopologyProperties struct {
1013	// ArtifactSourceID - The resource Id of the artifact source that contains the artifacts that can be referenced in the service units.
1014	ArtifactSourceID *string `json:"artifactSourceId,omitempty"`
1015}
1016
1017// ServiceTopologyResource the resource representation of a service topology.
1018type ServiceTopologyResource struct {
1019	autorest.Response `json:"-"`
1020	// ServiceTopologyResourceProperties - The properties that define the service topology.
1021	*ServiceTopologyResourceProperties `json:"properties,omitempty"`
1022	// Tags - Resource tags.
1023	Tags map[string]*string `json:"tags"`
1024	// Location - The geo-location where the resource lives
1025	Location *string `json:"location,omitempty"`
1026	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1027	ID *string `json:"id,omitempty"`
1028	// Name - READ-ONLY; The name of the resource
1029	Name *string `json:"name,omitempty"`
1030	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
1031	Type *string `json:"type,omitempty"`
1032}
1033
1034// MarshalJSON is the custom marshaler for ServiceTopologyResource.
1035func (str ServiceTopologyResource) MarshalJSON() ([]byte, error) {
1036	objectMap := make(map[string]interface{})
1037	if str.ServiceTopologyResourceProperties != nil {
1038		objectMap["properties"] = str.ServiceTopologyResourceProperties
1039	}
1040	if str.Tags != nil {
1041		objectMap["tags"] = str.Tags
1042	}
1043	if str.Location != nil {
1044		objectMap["location"] = str.Location
1045	}
1046	return json.Marshal(objectMap)
1047}
1048
1049// UnmarshalJSON is the custom unmarshaler for ServiceTopologyResource struct.
1050func (str *ServiceTopologyResource) UnmarshalJSON(body []byte) error {
1051	var m map[string]*json.RawMessage
1052	err := json.Unmarshal(body, &m)
1053	if err != nil {
1054		return err
1055	}
1056	for k, v := range m {
1057		switch k {
1058		case "properties":
1059			if v != nil {
1060				var serviceTopologyResourceProperties ServiceTopologyResourceProperties
1061				err = json.Unmarshal(*v, &serviceTopologyResourceProperties)
1062				if err != nil {
1063					return err
1064				}
1065				str.ServiceTopologyResourceProperties = &serviceTopologyResourceProperties
1066			}
1067		case "tags":
1068			if v != nil {
1069				var tags map[string]*string
1070				err = json.Unmarshal(*v, &tags)
1071				if err != nil {
1072					return err
1073				}
1074				str.Tags = tags
1075			}
1076		case "location":
1077			if v != nil {
1078				var location string
1079				err = json.Unmarshal(*v, &location)
1080				if err != nil {
1081					return err
1082				}
1083				str.Location = &location
1084			}
1085		case "id":
1086			if v != nil {
1087				var ID string
1088				err = json.Unmarshal(*v, &ID)
1089				if err != nil {
1090					return err
1091				}
1092				str.ID = &ID
1093			}
1094		case "name":
1095			if v != nil {
1096				var name string
1097				err = json.Unmarshal(*v, &name)
1098				if err != nil {
1099					return err
1100				}
1101				str.Name = &name
1102			}
1103		case "type":
1104			if v != nil {
1105				var typeVar string
1106				err = json.Unmarshal(*v, &typeVar)
1107				if err != nil {
1108					return err
1109				}
1110				str.Type = &typeVar
1111			}
1112		}
1113	}
1114
1115	return nil
1116}
1117
1118// ServiceTopologyResourceProperties the properties that define the service topology.
1119type ServiceTopologyResourceProperties struct {
1120	// ArtifactSourceID - The resource Id of the artifact source that contains the artifacts that can be referenced in the service units.
1121	ArtifactSourceID *string `json:"artifactSourceId,omitempty"`
1122}
1123
1124// ServiceUnit defines a service unit.
1125type ServiceUnit struct {
1126	// Name - Name of the service unit.
1127	Name *string `json:"name,omitempty"`
1128	// Steps - Detailed step information, if present.
1129	Steps *[]RolloutStep `json:"steps,omitempty"`
1130	// TargetResourceGroup - The Azure Resource Group to which the resources in the service unit belong to or should be deployed to.
1131	TargetResourceGroup *string `json:"targetResourceGroup,omitempty"`
1132	// DeploymentMode - Describes the type of ARM deployment to be performed on the resource. Possible values include: 'Incremental', 'Complete'
1133	DeploymentMode DeploymentMode `json:"deploymentMode,omitempty"`
1134	// Artifacts - The artifacts for the service unit.
1135	Artifacts *ServiceUnitArtifacts `json:"artifacts,omitempty"`
1136}
1137
1138// ServiceUnitArtifacts defines the artifacts of a service unit.
1139type ServiceUnitArtifacts struct {
1140	// TemplateURI - The full URI of the ARM template file with the SAS token.
1141	TemplateURI *string `json:"templateUri,omitempty"`
1142	// ParametersURI - The full URI of the ARM parameters file with the SAS token.
1143	ParametersURI *string `json:"parametersUri,omitempty"`
1144	// TemplateArtifactSourceRelativePath - The path to the ARM template file relative to the artifact source.
1145	TemplateArtifactSourceRelativePath *string `json:"templateArtifactSourceRelativePath,omitempty"`
1146	// ParametersArtifactSourceRelativePath - The path to the ARM parameters file relative to the artifact source.
1147	ParametersArtifactSourceRelativePath *string `json:"parametersArtifactSourceRelativePath,omitempty"`
1148}
1149
1150// ServiceUnitProperties defines the properties of a service unit.
1151type ServiceUnitProperties struct {
1152	// TargetResourceGroup - The Azure Resource Group to which the resources in the service unit belong to or should be deployed to.
1153	TargetResourceGroup *string `json:"targetResourceGroup,omitempty"`
1154	// DeploymentMode - Describes the type of ARM deployment to be performed on the resource. Possible values include: 'Incremental', 'Complete'
1155	DeploymentMode DeploymentMode `json:"deploymentMode,omitempty"`
1156	// Artifacts - The artifacts for the service unit.
1157	Artifacts *ServiceUnitArtifacts `json:"artifacts,omitempty"`
1158}
1159
1160// ServiceUnitResource represents the response of a service unit resource.
1161type ServiceUnitResource struct {
1162	autorest.Response `json:"-"`
1163	// ServiceUnitResourceProperties - The properties that define the service unit.
1164	*ServiceUnitResourceProperties `json:"properties,omitempty"`
1165	// Tags - Resource tags.
1166	Tags map[string]*string `json:"tags"`
1167	// Location - The geo-location where the resource lives
1168	Location *string `json:"location,omitempty"`
1169	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1170	ID *string `json:"id,omitempty"`
1171	// Name - READ-ONLY; The name of the resource
1172	Name *string `json:"name,omitempty"`
1173	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
1174	Type *string `json:"type,omitempty"`
1175}
1176
1177// MarshalJSON is the custom marshaler for ServiceUnitResource.
1178func (sur ServiceUnitResource) MarshalJSON() ([]byte, error) {
1179	objectMap := make(map[string]interface{})
1180	if sur.ServiceUnitResourceProperties != nil {
1181		objectMap["properties"] = sur.ServiceUnitResourceProperties
1182	}
1183	if sur.Tags != nil {
1184		objectMap["tags"] = sur.Tags
1185	}
1186	if sur.Location != nil {
1187		objectMap["location"] = sur.Location
1188	}
1189	return json.Marshal(objectMap)
1190}
1191
1192// UnmarshalJSON is the custom unmarshaler for ServiceUnitResource struct.
1193func (sur *ServiceUnitResource) UnmarshalJSON(body []byte) error {
1194	var m map[string]*json.RawMessage
1195	err := json.Unmarshal(body, &m)
1196	if err != nil {
1197		return err
1198	}
1199	for k, v := range m {
1200		switch k {
1201		case "properties":
1202			if v != nil {
1203				var serviceUnitResourceProperties ServiceUnitResourceProperties
1204				err = json.Unmarshal(*v, &serviceUnitResourceProperties)
1205				if err != nil {
1206					return err
1207				}
1208				sur.ServiceUnitResourceProperties = &serviceUnitResourceProperties
1209			}
1210		case "tags":
1211			if v != nil {
1212				var tags map[string]*string
1213				err = json.Unmarshal(*v, &tags)
1214				if err != nil {
1215					return err
1216				}
1217				sur.Tags = tags
1218			}
1219		case "location":
1220			if v != nil {
1221				var location string
1222				err = json.Unmarshal(*v, &location)
1223				if err != nil {
1224					return err
1225				}
1226				sur.Location = &location
1227			}
1228		case "id":
1229			if v != nil {
1230				var ID string
1231				err = json.Unmarshal(*v, &ID)
1232				if err != nil {
1233					return err
1234				}
1235				sur.ID = &ID
1236			}
1237		case "name":
1238			if v != nil {
1239				var name string
1240				err = json.Unmarshal(*v, &name)
1241				if err != nil {
1242					return err
1243				}
1244				sur.Name = &name
1245			}
1246		case "type":
1247			if v != nil {
1248				var typeVar string
1249				err = json.Unmarshal(*v, &typeVar)
1250				if err != nil {
1251					return err
1252				}
1253				sur.Type = &typeVar
1254			}
1255		}
1256	}
1257
1258	return nil
1259}
1260
1261// ServiceUnitResourceProperties the properties that define the service unit.
1262type ServiceUnitResourceProperties struct {
1263	// TargetResourceGroup - The Azure Resource Group to which the resources in the service unit belong to or should be deployed to.
1264	TargetResourceGroup *string `json:"targetResourceGroup,omitempty"`
1265	// DeploymentMode - Describes the type of ARM deployment to be performed on the resource. Possible values include: 'Incremental', 'Complete'
1266	DeploymentMode DeploymentMode `json:"deploymentMode,omitempty"`
1267	// Artifacts - The artifacts for the service unit.
1268	Artifacts *ServiceUnitArtifacts `json:"artifacts,omitempty"`
1269}
1270
1271// ServiceUnitsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
1272// long-running operation.
1273type ServiceUnitsCreateOrUpdateFuture struct {
1274	azure.Future
1275}
1276
1277// Result returns the result of the asynchronous operation.
1278// If the operation has not completed it will return an error.
1279func (future *ServiceUnitsCreateOrUpdateFuture) Result(client ServiceUnitsClient) (sur ServiceUnitResource, err error) {
1280	var done bool
1281	done, err = future.DoneWithContext(context.Background(), client)
1282	if err != nil {
1283		err = autorest.NewErrorWithError(err, "deploymentmanager.ServiceUnitsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
1284		return
1285	}
1286	if !done {
1287		err = azure.NewAsyncOpIncompleteError("deploymentmanager.ServiceUnitsCreateOrUpdateFuture")
1288		return
1289	}
1290	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1291	if sur.Response.Response, err = future.GetResult(sender); err == nil && sur.Response.Response.StatusCode != http.StatusNoContent {
1292		sur, err = client.CreateOrUpdateResponder(sur.Response.Response)
1293		if err != nil {
1294			err = autorest.NewErrorWithError(err, "deploymentmanager.ServiceUnitsCreateOrUpdateFuture", "Result", sur.Response.Response, "Failure responding to request")
1295		}
1296	}
1297	return
1298}
1299
1300// Step the properties that define an Azure Deployment Manager step.
1301type Step struct {
1302	// Name - The name of the step group.
1303	Name *string `json:"name,omitempty"`
1304	// DependsOnStepGroups - The list of step group names on which this step group depends on.
1305	DependsOnStepGroups *[]string `json:"dependsOnStepGroups,omitempty"`
1306	// PreDeploymentSteps - The list of steps to be run before deploying the target.
1307	PreDeploymentSteps *[]PrePostStep `json:"preDeploymentSteps,omitempty"`
1308	// DeploymentTargetID - The resource Id of service unit to be deployed. The service unit should be from the service topology referenced in targetServiceTopologyId
1309	DeploymentTargetID *string `json:"deploymentTargetId,omitempty"`
1310	// PostDeploymentSteps - The list of steps to be run after deploying the target.
1311	PostDeploymentSteps *[]PrePostStep `json:"postDeploymentSteps,omitempty"`
1312}
1313
1314// StepOperationInfo detailed information of a specific step run.
1315type StepOperationInfo struct {
1316	// DeploymentName - READ-ONLY; The name of the ARM deployment initiated as part of the step.
1317	DeploymentName *string `json:"deploymentName,omitempty"`
1318	// CorrelationID - READ-ONLY; Unique identifier to track the request for ARM-based resources.
1319	CorrelationID *string `json:"correlationId,omitempty"`
1320	// StartTime - READ-ONLY; Start time of the action in UTC.
1321	StartTime *date.Time `json:"startTime,omitempty"`
1322	// EndTime - READ-ONLY; End time of the action in UTC.
1323	EndTime *date.Time `json:"endTime,omitempty"`
1324	// LastUpdatedTime - READ-ONLY; Last time in UTC this operation was updated.
1325	LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"`
1326	// Error - The errors, if any, for the action.
1327	Error *CloudErrorBody `json:"error,omitempty"`
1328}
1329
1330// BasicStepProperties the properties of a step resource.
1331type BasicStepProperties interface {
1332	AsWaitStepProperties() (*WaitStepProperties, bool)
1333	AsStepProperties() (*StepProperties, bool)
1334}
1335
1336// StepProperties the properties of a step resource.
1337type StepProperties struct {
1338	// StepType - Possible values include: 'StepTypeStepProperties', 'StepTypeWait'
1339	StepType StepType `json:"stepType,omitempty"`
1340}
1341
1342func unmarshalBasicStepProperties(body []byte) (BasicStepProperties, error) {
1343	var m map[string]interface{}
1344	err := json.Unmarshal(body, &m)
1345	if err != nil {
1346		return nil, err
1347	}
1348
1349	switch m["stepType"] {
1350	case string(StepTypeWait):
1351		var wsp WaitStepProperties
1352		err := json.Unmarshal(body, &wsp)
1353		return wsp, err
1354	default:
1355		var sp StepProperties
1356		err := json.Unmarshal(body, &sp)
1357		return sp, err
1358	}
1359}
1360func unmarshalBasicStepPropertiesArray(body []byte) ([]BasicStepProperties, error) {
1361	var rawMessages []*json.RawMessage
1362	err := json.Unmarshal(body, &rawMessages)
1363	if err != nil {
1364		return nil, err
1365	}
1366
1367	spArray := make([]BasicStepProperties, len(rawMessages))
1368
1369	for index, rawMessage := range rawMessages {
1370		sp, err := unmarshalBasicStepProperties(*rawMessage)
1371		if err != nil {
1372			return nil, err
1373		}
1374		spArray[index] = sp
1375	}
1376	return spArray, nil
1377}
1378
1379// MarshalJSON is the custom marshaler for StepProperties.
1380func (sp StepProperties) MarshalJSON() ([]byte, error) {
1381	sp.StepType = StepTypeStepProperties
1382	objectMap := make(map[string]interface{})
1383	if sp.StepType != "" {
1384		objectMap["stepType"] = sp.StepType
1385	}
1386	return json.Marshal(objectMap)
1387}
1388
1389// AsWaitStepProperties is the BasicStepProperties implementation for StepProperties.
1390func (sp StepProperties) AsWaitStepProperties() (*WaitStepProperties, bool) {
1391	return nil, false
1392}
1393
1394// AsStepProperties is the BasicStepProperties implementation for StepProperties.
1395func (sp StepProperties) AsStepProperties() (*StepProperties, bool) {
1396	return &sp, true
1397}
1398
1399// AsBasicStepProperties is the BasicStepProperties implementation for StepProperties.
1400func (sp StepProperties) AsBasicStepProperties() (BasicStepProperties, bool) {
1401	return &sp, true
1402}
1403
1404// StepResource the resource representation of a rollout step.
1405type StepResource struct {
1406	autorest.Response `json:"-"`
1407	// Properties - The properties that define the step.
1408	Properties BasicStepProperties `json:"properties,omitempty"`
1409	// Tags - Resource tags.
1410	Tags map[string]*string `json:"tags"`
1411	// Location - The geo-location where the resource lives
1412	Location *string `json:"location,omitempty"`
1413	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1414	ID *string `json:"id,omitempty"`
1415	// Name - READ-ONLY; The name of the resource
1416	Name *string `json:"name,omitempty"`
1417	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
1418	Type *string `json:"type,omitempty"`
1419}
1420
1421// MarshalJSON is the custom marshaler for StepResource.
1422func (sr StepResource) MarshalJSON() ([]byte, error) {
1423	objectMap := make(map[string]interface{})
1424	objectMap["properties"] = sr.Properties
1425	if sr.Tags != nil {
1426		objectMap["tags"] = sr.Tags
1427	}
1428	if sr.Location != nil {
1429		objectMap["location"] = sr.Location
1430	}
1431	return json.Marshal(objectMap)
1432}
1433
1434// UnmarshalJSON is the custom unmarshaler for StepResource struct.
1435func (sr *StepResource) UnmarshalJSON(body []byte) error {
1436	var m map[string]*json.RawMessage
1437	err := json.Unmarshal(body, &m)
1438	if err != nil {
1439		return err
1440	}
1441	for k, v := range m {
1442		switch k {
1443		case "properties":
1444			if v != nil {
1445				properties, err := unmarshalBasicStepProperties(*v)
1446				if err != nil {
1447					return err
1448				}
1449				sr.Properties = properties
1450			}
1451		case "tags":
1452			if v != nil {
1453				var tags map[string]*string
1454				err = json.Unmarshal(*v, &tags)
1455				if err != nil {
1456					return err
1457				}
1458				sr.Tags = tags
1459			}
1460		case "location":
1461			if v != nil {
1462				var location string
1463				err = json.Unmarshal(*v, &location)
1464				if err != nil {
1465					return err
1466				}
1467				sr.Location = &location
1468			}
1469		case "id":
1470			if v != nil {
1471				var ID string
1472				err = json.Unmarshal(*v, &ID)
1473				if err != nil {
1474					return err
1475				}
1476				sr.ID = &ID
1477			}
1478		case "name":
1479			if v != nil {
1480				var name string
1481				err = json.Unmarshal(*v, &name)
1482				if err != nil {
1483					return err
1484				}
1485				sr.Name = &name
1486			}
1487		case "type":
1488			if v != nil {
1489				var typeVar string
1490				err = json.Unmarshal(*v, &typeVar)
1491				if err != nil {
1492					return err
1493				}
1494				sr.Type = &typeVar
1495			}
1496		}
1497	}
1498
1499	return nil
1500}
1501
1502// TrackedResource the resource model definition for a ARM tracked top level resource
1503type TrackedResource struct {
1504	// Tags - Resource tags.
1505	Tags map[string]*string `json:"tags"`
1506	// Location - The geo-location where the resource lives
1507	Location *string `json:"location,omitempty"`
1508	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1509	ID *string `json:"id,omitempty"`
1510	// Name - READ-ONLY; The name of the resource
1511	Name *string `json:"name,omitempty"`
1512	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
1513	Type *string `json:"type,omitempty"`
1514}
1515
1516// MarshalJSON is the custom marshaler for TrackedResource.
1517func (tr TrackedResource) MarshalJSON() ([]byte, error) {
1518	objectMap := make(map[string]interface{})
1519	if tr.Tags != nil {
1520		objectMap["tags"] = tr.Tags
1521	}
1522	if tr.Location != nil {
1523		objectMap["location"] = tr.Location
1524	}
1525	return json.Marshal(objectMap)
1526}
1527
1528// WaitStepAttributes the parameters for the wait step.
1529type WaitStepAttributes struct {
1530	// Duration - The duration in ISO 8601 format of how long the wait should be.
1531	Duration *string `json:"duration,omitempty"`
1532}
1533
1534// WaitStepProperties defines the properties of a Wait step.
1535type WaitStepProperties struct {
1536	// Attributes - The Wait attributes
1537	Attributes *WaitStepAttributes `json:"attributes,omitempty"`
1538	// StepType - Possible values include: 'StepTypeStepProperties', 'StepTypeWait'
1539	StepType StepType `json:"stepType,omitempty"`
1540}
1541
1542// MarshalJSON is the custom marshaler for WaitStepProperties.
1543func (wsp WaitStepProperties) MarshalJSON() ([]byte, error) {
1544	wsp.StepType = StepTypeWait
1545	objectMap := make(map[string]interface{})
1546	if wsp.Attributes != nil {
1547		objectMap["attributes"] = wsp.Attributes
1548	}
1549	if wsp.StepType != "" {
1550		objectMap["stepType"] = wsp.StepType
1551	}
1552	return json.Marshal(objectMap)
1553}
1554
1555// AsWaitStepProperties is the BasicStepProperties implementation for WaitStepProperties.
1556func (wsp WaitStepProperties) AsWaitStepProperties() (*WaitStepProperties, bool) {
1557	return &wsp, true
1558}
1559
1560// AsStepProperties is the BasicStepProperties implementation for WaitStepProperties.
1561func (wsp WaitStepProperties) AsStepProperties() (*StepProperties, bool) {
1562	return nil, false
1563}
1564
1565// AsBasicStepProperties is the BasicStepProperties implementation for WaitStepProperties.
1566func (wsp WaitStepProperties) AsBasicStepProperties() (BasicStepProperties, bool) {
1567	return &wsp, true
1568}
1569