1package resources
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	"encoding/json"
22	"github.com/Azure/go-autorest/autorest"
23	"github.com/Azure/go-autorest/autorest/azure"
24	"github.com/Azure/go-autorest/autorest/date"
25	"github.com/Azure/go-autorest/autorest/to"
26	"net/http"
27)
28
29// DeploymentMode enumerates the values for deployment mode.
30type DeploymentMode string
31
32const (
33	// Complete ...
34	Complete DeploymentMode = "Complete"
35	// Incremental ...
36	Incremental DeploymentMode = "Incremental"
37)
38
39// PossibleDeploymentModeValues returns an array of possible values for the DeploymentMode const type.
40func PossibleDeploymentModeValues() []DeploymentMode {
41	return []DeploymentMode{Complete, Incremental}
42}
43
44// ResourceIdentityType enumerates the values for resource identity type.
45type ResourceIdentityType string
46
47const (
48	// SystemAssigned ...
49	SystemAssigned ResourceIdentityType = "SystemAssigned"
50)
51
52// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type.
53func PossibleResourceIdentityTypeValues() []ResourceIdentityType {
54	return []ResourceIdentityType{SystemAssigned}
55}
56
57// AliasPathType ...
58type AliasPathType struct {
59	// Path - The path of an alias.
60	Path *string `json:"path,omitempty"`
61	// APIVersions - The api versions.
62	APIVersions *[]string `json:"apiVersions,omitempty"`
63}
64
65// AliasType ...
66type AliasType struct {
67	// Name - The alias name.
68	Name *string `json:"name,omitempty"`
69	// Paths - The paths for an alias.
70	Paths *[]AliasPathType `json:"paths,omitempty"`
71}
72
73// BasicDependency deployment dependency information.
74type BasicDependency struct {
75	// ID - The ID of the dependency.
76	ID *string `json:"id,omitempty"`
77	// ResourceType - The dependency resource type.
78	ResourceType *string `json:"resourceType,omitempty"`
79	// ResourceName - The dependency resource name.
80	ResourceName *string `json:"resourceName,omitempty"`
81}
82
83// DebugSetting ...
84type DebugSetting struct {
85	// DetailLevel - The debug detail level.
86	DetailLevel *string `json:"detailLevel,omitempty"`
87}
88
89// Dependency deployment dependency information.
90type Dependency struct {
91	// DependsOn - The list of dependencies.
92	DependsOn *[]BasicDependency `json:"dependsOn,omitempty"`
93	// ID - The ID of the dependency.
94	ID *string `json:"id,omitempty"`
95	// ResourceType - The dependency resource type.
96	ResourceType *string `json:"resourceType,omitempty"`
97	// ResourceName - The dependency resource name.
98	ResourceName *string `json:"resourceName,omitempty"`
99}
100
101// Deployment deployment operation parameters.
102type Deployment struct {
103	// Properties - The deployment properties.
104	Properties *DeploymentProperties `json:"properties,omitempty"`
105}
106
107// DeploymentExportResult ...
108type DeploymentExportResult struct {
109	autorest.Response `json:"-"`
110	// Template - The template content.
111	Template interface{} `json:"template,omitempty"`
112}
113
114// DeploymentExtended deployment information.
115type DeploymentExtended struct {
116	autorest.Response `json:"-"`
117	// ID - The ID of the deployment.
118	ID *string `json:"id,omitempty"`
119	// Name - The name of the deployment.
120	Name *string `json:"name,omitempty"`
121	// Properties - Deployment properties.
122	Properties *DeploymentPropertiesExtended `json:"properties,omitempty"`
123}
124
125// DeploymentExtendedFilter deployment filter.
126type DeploymentExtendedFilter struct {
127	// ProvisioningState - The provisioning state.
128	ProvisioningState *string `json:"provisioningState,omitempty"`
129}
130
131// DeploymentListResult list of deployments.
132type DeploymentListResult struct {
133	autorest.Response `json:"-"`
134	// Value - The list of deployments.
135	Value *[]DeploymentExtended `json:"value,omitempty"`
136	// NextLink - The URL to get the next set of results.
137	NextLink *string `json:"nextLink,omitempty"`
138}
139
140// DeploymentListResultIterator provides access to a complete listing of DeploymentExtended values.
141type DeploymentListResultIterator struct {
142	i    int
143	page DeploymentListResultPage
144}
145
146// Next advances to the next value.  If there was an error making
147// the request the iterator does not advance and the error is returned.
148func (iter *DeploymentListResultIterator) Next() error {
149	iter.i++
150	if iter.i < len(iter.page.Values()) {
151		return nil
152	}
153	err := iter.page.Next()
154	if err != nil {
155		iter.i--
156		return err
157	}
158	iter.i = 0
159	return nil
160}
161
162// NotDone returns true if the enumeration should be started or is not yet complete.
163func (iter DeploymentListResultIterator) NotDone() bool {
164	return iter.page.NotDone() && iter.i < len(iter.page.Values())
165}
166
167// Response returns the raw server response from the last page request.
168func (iter DeploymentListResultIterator) Response() DeploymentListResult {
169	return iter.page.Response()
170}
171
172// Value returns the current value or a zero-initialized value if the
173// iterator has advanced beyond the end of the collection.
174func (iter DeploymentListResultIterator) Value() DeploymentExtended {
175	if !iter.page.NotDone() {
176		return DeploymentExtended{}
177	}
178	return iter.page.Values()[iter.i]
179}
180
181// IsEmpty returns true if the ListResult contains no values.
182func (dlr DeploymentListResult) IsEmpty() bool {
183	return dlr.Value == nil || len(*dlr.Value) == 0
184}
185
186// deploymentListResultPreparer prepares a request to retrieve the next set of results.
187// It returns nil if no more results exist.
188func (dlr DeploymentListResult) deploymentListResultPreparer() (*http.Request, error) {
189	if dlr.NextLink == nil || len(to.String(dlr.NextLink)) < 1 {
190		return nil, nil
191	}
192	return autorest.Prepare(&http.Request{},
193		autorest.AsJSON(),
194		autorest.AsGet(),
195		autorest.WithBaseURL(to.String(dlr.NextLink)))
196}
197
198// DeploymentListResultPage contains a page of DeploymentExtended values.
199type DeploymentListResultPage struct {
200	fn  func(DeploymentListResult) (DeploymentListResult, error)
201	dlr DeploymentListResult
202}
203
204// Next advances to the next page of values.  If there was an error making
205// the request the page does not advance and the error is returned.
206func (page *DeploymentListResultPage) Next() error {
207	next, err := page.fn(page.dlr)
208	if err != nil {
209		return err
210	}
211	page.dlr = next
212	return nil
213}
214
215// NotDone returns true if the page enumeration should be started or is not yet complete.
216func (page DeploymentListResultPage) NotDone() bool {
217	return !page.dlr.IsEmpty()
218}
219
220// Response returns the raw server response from the last page request.
221func (page DeploymentListResultPage) Response() DeploymentListResult {
222	return page.dlr
223}
224
225// Values returns the slice of values for the current page or nil if there are no values.
226func (page DeploymentListResultPage) Values() []DeploymentExtended {
227	if page.dlr.IsEmpty() {
228		return nil
229	}
230	return *page.dlr.Value
231}
232
233// DeploymentOperation deployment operation information.
234type DeploymentOperation struct {
235	autorest.Response `json:"-"`
236	// ID - Full deployment operation id.
237	ID *string `json:"id,omitempty"`
238	// OperationID - Deployment operation id.
239	OperationID *string `json:"operationId,omitempty"`
240	// Properties - Deployment properties.
241	Properties *DeploymentOperationProperties `json:"properties,omitempty"`
242}
243
244// DeploymentOperationProperties deployment operation properties.
245type DeploymentOperationProperties struct {
246	// ProvisioningState - The state of the provisioning.
247	ProvisioningState *string `json:"provisioningState,omitempty"`
248	// Timestamp - The date and time of the operation.
249	Timestamp *date.Time `json:"timestamp,omitempty"`
250	// ServiceRequestID - Deployment operation service request id.
251	ServiceRequestID *string `json:"serviceRequestId,omitempty"`
252	// StatusCode - Operation status code.
253	StatusCode *string `json:"statusCode,omitempty"`
254	// StatusMessage - Operation status message.
255	StatusMessage interface{} `json:"statusMessage,omitempty"`
256	// TargetResource - The target resource.
257	TargetResource *TargetResource `json:"targetResource,omitempty"`
258	// Request - The HTTP request message.
259	Request *HTTPMessage `json:"request,omitempty"`
260	// Response - The HTTP response message.
261	Response *HTTPMessage `json:"response,omitempty"`
262}
263
264// DeploymentOperationsListResult list of deployment operations.
265type DeploymentOperationsListResult struct {
266	autorest.Response `json:"-"`
267	// Value - The list of deployments.
268	Value *[]DeploymentOperation `json:"value,omitempty"`
269	// NextLink - The URL to get the next set of results.
270	NextLink *string `json:"nextLink,omitempty"`
271}
272
273// DeploymentOperationsListResultIterator provides access to a complete listing of DeploymentOperation values.
274type DeploymentOperationsListResultIterator struct {
275	i    int
276	page DeploymentOperationsListResultPage
277}
278
279// Next advances to the next value.  If there was an error making
280// the request the iterator does not advance and the error is returned.
281func (iter *DeploymentOperationsListResultIterator) Next() error {
282	iter.i++
283	if iter.i < len(iter.page.Values()) {
284		return nil
285	}
286	err := iter.page.Next()
287	if err != nil {
288		iter.i--
289		return err
290	}
291	iter.i = 0
292	return nil
293}
294
295// NotDone returns true if the enumeration should be started or is not yet complete.
296func (iter DeploymentOperationsListResultIterator) NotDone() bool {
297	return iter.page.NotDone() && iter.i < len(iter.page.Values())
298}
299
300// Response returns the raw server response from the last page request.
301func (iter DeploymentOperationsListResultIterator) Response() DeploymentOperationsListResult {
302	return iter.page.Response()
303}
304
305// Value returns the current value or a zero-initialized value if the
306// iterator has advanced beyond the end of the collection.
307func (iter DeploymentOperationsListResultIterator) Value() DeploymentOperation {
308	if !iter.page.NotDone() {
309		return DeploymentOperation{}
310	}
311	return iter.page.Values()[iter.i]
312}
313
314// IsEmpty returns true if the ListResult contains no values.
315func (dolr DeploymentOperationsListResult) IsEmpty() bool {
316	return dolr.Value == nil || len(*dolr.Value) == 0
317}
318
319// deploymentOperationsListResultPreparer prepares a request to retrieve the next set of results.
320// It returns nil if no more results exist.
321func (dolr DeploymentOperationsListResult) deploymentOperationsListResultPreparer() (*http.Request, error) {
322	if dolr.NextLink == nil || len(to.String(dolr.NextLink)) < 1 {
323		return nil, nil
324	}
325	return autorest.Prepare(&http.Request{},
326		autorest.AsJSON(),
327		autorest.AsGet(),
328		autorest.WithBaseURL(to.String(dolr.NextLink)))
329}
330
331// DeploymentOperationsListResultPage contains a page of DeploymentOperation values.
332type DeploymentOperationsListResultPage struct {
333	fn   func(DeploymentOperationsListResult) (DeploymentOperationsListResult, error)
334	dolr DeploymentOperationsListResult
335}
336
337// Next advances to the next page of values.  If there was an error making
338// the request the page does not advance and the error is returned.
339func (page *DeploymentOperationsListResultPage) Next() error {
340	next, err := page.fn(page.dolr)
341	if err != nil {
342		return err
343	}
344	page.dolr = next
345	return nil
346}
347
348// NotDone returns true if the page enumeration should be started or is not yet complete.
349func (page DeploymentOperationsListResultPage) NotDone() bool {
350	return !page.dolr.IsEmpty()
351}
352
353// Response returns the raw server response from the last page request.
354func (page DeploymentOperationsListResultPage) Response() DeploymentOperationsListResult {
355	return page.dolr
356}
357
358// Values returns the slice of values for the current page or nil if there are no values.
359func (page DeploymentOperationsListResultPage) Values() []DeploymentOperation {
360	if page.dolr.IsEmpty() {
361		return nil
362	}
363	return *page.dolr.Value
364}
365
366// DeploymentProperties deployment properties.
367type DeploymentProperties struct {
368	// Template - The template content. It can be a JObject or a well formed JSON string. Use only one of Template or TemplateLink.
369	Template interface{} `json:"template,omitempty"`
370	// TemplateLink - The template URI. Use only one of Template or TemplateLink.
371	TemplateLink *TemplateLink `json:"templateLink,omitempty"`
372	// Parameters - Deployment parameters. It can be a JObject or a well formed JSON string. Use only one of Parameters or ParametersLink.
373	Parameters interface{} `json:"parameters,omitempty"`
374	// ParametersLink - The parameters URI. Use only one of Parameters or ParametersLink.
375	ParametersLink *ParametersLink `json:"parametersLink,omitempty"`
376	// Mode - The deployment mode. Possible values include: 'Incremental', 'Complete'
377	Mode DeploymentMode `json:"mode,omitempty"`
378	// DebugSetting - The debug setting of the deployment.
379	DebugSetting *DebugSetting `json:"debugSetting,omitempty"`
380}
381
382// DeploymentPropertiesExtended deployment properties with additional details.
383type DeploymentPropertiesExtended struct {
384	// ProvisioningState - The state of the provisioning.
385	ProvisioningState *string `json:"provisioningState,omitempty"`
386	// CorrelationID - The correlation ID of the deployment.
387	CorrelationID *string `json:"correlationId,omitempty"`
388	// Timestamp - The timestamp of the template deployment.
389	Timestamp *date.Time `json:"timestamp,omitempty"`
390	// Outputs - Key/value pairs that represent deploymentoutput.
391	Outputs interface{} `json:"outputs,omitempty"`
392	// Providers - The list of resource providers needed for the deployment.
393	Providers *[]Provider `json:"providers,omitempty"`
394	// Dependencies - The list of deployment dependencies.
395	Dependencies *[]Dependency `json:"dependencies,omitempty"`
396	// Template - The template content. Use only one of Template or TemplateLink.
397	Template interface{} `json:"template,omitempty"`
398	// TemplateLink - The URI referencing the template. Use only one of Template or TemplateLink.
399	TemplateLink *TemplateLink `json:"templateLink,omitempty"`
400	// Parameters - Deployment parameters. Use only one of Parameters or ParametersLink.
401	Parameters interface{} `json:"parameters,omitempty"`
402	// ParametersLink - The URI referencing the parameters. Use only one of Parameters or ParametersLink.
403	ParametersLink *ParametersLink `json:"parametersLink,omitempty"`
404	// Mode - The deployment mode. Possible values include: 'Incremental', 'Complete'
405	Mode DeploymentMode `json:"mode,omitempty"`
406	// DebugSetting - The debug setting of the deployment.
407	DebugSetting *DebugSetting `json:"debugSetting,omitempty"`
408}
409
410// DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
411// operation.
412type DeploymentsCreateOrUpdateFuture struct {
413	azure.Future
414}
415
416// Result returns the result of the asynchronous operation.
417// If the operation has not completed it will return an error.
418func (future *DeploymentsCreateOrUpdateFuture) Result(client DeploymentsClient) (de DeploymentExtended, err error) {
419	var done bool
420	done, err = future.Done(client)
421	if err != nil {
422		err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
423		return
424	}
425	if !done {
426		err = azure.NewAsyncOpIncompleteError("resources.DeploymentsCreateOrUpdateFuture")
427		return
428	}
429	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
430	if de.Response.Response, err = future.GetResult(sender); err == nil && de.Response.Response.StatusCode != http.StatusNoContent {
431		de, err = client.CreateOrUpdateResponder(de.Response.Response)
432		if err != nil {
433			err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", de.Response.Response, "Failure responding to request")
434		}
435	}
436	return
437}
438
439// DeploymentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
440type DeploymentsDeleteFuture struct {
441	azure.Future
442}
443
444// Result returns the result of the asynchronous operation.
445// If the operation has not completed it will return an error.
446func (future *DeploymentsDeleteFuture) Result(client DeploymentsClient) (ar autorest.Response, err error) {
447	var done bool
448	done, err = future.Done(client)
449	if err != nil {
450		err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteFuture", "Result", future.Response(), "Polling failure")
451		return
452	}
453	if !done {
454		err = azure.NewAsyncOpIncompleteError("resources.DeploymentsDeleteFuture")
455		return
456	}
457	ar.Response = future.Response()
458	return
459}
460
461// DeploymentValidateResult information from validate template deployment response.
462type DeploymentValidateResult struct {
463	autorest.Response `json:"-"`
464	// Error - Validation error.
465	Error *ManagementErrorWithDetails `json:"error,omitempty"`
466	// Properties - The template deployment properties.
467	Properties *DeploymentPropertiesExtended `json:"properties,omitempty"`
468}
469
470// ExportTemplateRequest export resource group template request parameters.
471type ExportTemplateRequest struct {
472	// ResourcesProperty - The ids of the resources. The only supported string currently is '*' (all resources). Future api updates will support exporting specific resources.
473	ResourcesProperty *[]string `json:"resources,omitempty"`
474	// Options - The export template options. Supported values include 'IncludeParameterDefaultValue', 'IncludeComments' or 'IncludeParameterDefaultValue, IncludeComments
475	Options *string `json:"options,omitempty"`
476}
477
478// GenericResource resource information.
479type GenericResource struct {
480	autorest.Response `json:"-"`
481	// Plan - The plan of the resource.
482	Plan *Plan `json:"plan,omitempty"`
483	// Properties - The resource properties.
484	Properties interface{} `json:"properties,omitempty"`
485	// Kind - The kind of the resource.
486	Kind *string `json:"kind,omitempty"`
487	// ManagedBy - Id of the resource that manages this resource.
488	ManagedBy *string `json:"managedBy,omitempty"`
489	// Sku - The sku of the resource.
490	Sku *Sku `json:"sku,omitempty"`
491	// Identity - The identity of the resource.
492	Identity *Identity `json:"identity,omitempty"`
493	// ID - Resource Id
494	ID *string `json:"id,omitempty"`
495	// Name - Resource name
496	Name *string `json:"name,omitempty"`
497	// Type - Resource type
498	Type *string `json:"type,omitempty"`
499	// Location - Resource location
500	Location *string `json:"location,omitempty"`
501	// Tags - Resource tags
502	Tags map[string]*string `json:"tags"`
503}
504
505// MarshalJSON is the custom marshaler for GenericResource.
506func (gr GenericResource) MarshalJSON() ([]byte, error) {
507	objectMap := make(map[string]interface{})
508	if gr.Plan != nil {
509		objectMap["plan"] = gr.Plan
510	}
511	objectMap["properties"] = gr.Properties
512	if gr.Kind != nil {
513		objectMap["kind"] = gr.Kind
514	}
515	if gr.ManagedBy != nil {
516		objectMap["managedBy"] = gr.ManagedBy
517	}
518	if gr.Sku != nil {
519		objectMap["sku"] = gr.Sku
520	}
521	if gr.Identity != nil {
522		objectMap["identity"] = gr.Identity
523	}
524	if gr.ID != nil {
525		objectMap["id"] = gr.ID
526	}
527	if gr.Name != nil {
528		objectMap["name"] = gr.Name
529	}
530	if gr.Type != nil {
531		objectMap["type"] = gr.Type
532	}
533	if gr.Location != nil {
534		objectMap["location"] = gr.Location
535	}
536	if gr.Tags != nil {
537		objectMap["tags"] = gr.Tags
538	}
539	return json.Marshal(objectMap)
540}
541
542// GenericResourceFilter resource filter.
543type GenericResourceFilter struct {
544	// ResourceType - The resource type.
545	ResourceType *string `json:"resourceType,omitempty"`
546	// Tagname - The tag name.
547	Tagname *string `json:"tagname,omitempty"`
548	// Tagvalue - The tag value.
549	Tagvalue *string `json:"tagvalue,omitempty"`
550}
551
552// Group resource group information.
553type Group struct {
554	autorest.Response `json:"-"`
555	// ID - The ID of the resource group.
556	ID *string `json:"id,omitempty"`
557	// Name - The Name of the resource group.
558	Name       *string          `json:"name,omitempty"`
559	Properties *GroupProperties `json:"properties,omitempty"`
560	// Location - The location of the resource group. It cannot be changed after the resource group has been created. Has to be one of the supported Azure Locations, such as West US, East US, West Europe, East Asia, etc.
561	Location *string `json:"location,omitempty"`
562	// Tags - The tags attached to the resource group.
563	Tags map[string]*string `json:"tags"`
564}
565
566// MarshalJSON is the custom marshaler for Group.
567func (g Group) MarshalJSON() ([]byte, error) {
568	objectMap := make(map[string]interface{})
569	if g.ID != nil {
570		objectMap["id"] = g.ID
571	}
572	if g.Name != nil {
573		objectMap["name"] = g.Name
574	}
575	if g.Properties != nil {
576		objectMap["properties"] = g.Properties
577	}
578	if g.Location != nil {
579		objectMap["location"] = g.Location
580	}
581	if g.Tags != nil {
582		objectMap["tags"] = g.Tags
583	}
584	return json.Marshal(objectMap)
585}
586
587// GroupExportResult ...
588type GroupExportResult struct {
589	autorest.Response `json:"-"`
590	// Template - The template content.
591	Template interface{} `json:"template,omitempty"`
592	// Error - The error.
593	Error *ManagementErrorWithDetails `json:"error,omitempty"`
594}
595
596// GroupFilter resource group filter.
597type GroupFilter struct {
598	// TagName - The tag name.
599	TagName *string `json:"tagName,omitempty"`
600	// TagValue - The tag value.
601	TagValue *string `json:"tagValue,omitempty"`
602}
603
604// GroupListResult list of resource groups.
605type GroupListResult struct {
606	autorest.Response `json:"-"`
607	// Value - The list of resource groups.
608	Value *[]Group `json:"value,omitempty"`
609	// NextLink - The URL to get the next set of results.
610	NextLink *string `json:"nextLink,omitempty"`
611}
612
613// GroupListResultIterator provides access to a complete listing of Group values.
614type GroupListResultIterator struct {
615	i    int
616	page GroupListResultPage
617}
618
619// Next advances to the next value.  If there was an error making
620// the request the iterator does not advance and the error is returned.
621func (iter *GroupListResultIterator) Next() error {
622	iter.i++
623	if iter.i < len(iter.page.Values()) {
624		return nil
625	}
626	err := iter.page.Next()
627	if err != nil {
628		iter.i--
629		return err
630	}
631	iter.i = 0
632	return nil
633}
634
635// NotDone returns true if the enumeration should be started or is not yet complete.
636func (iter GroupListResultIterator) NotDone() bool {
637	return iter.page.NotDone() && iter.i < len(iter.page.Values())
638}
639
640// Response returns the raw server response from the last page request.
641func (iter GroupListResultIterator) Response() GroupListResult {
642	return iter.page.Response()
643}
644
645// Value returns the current value or a zero-initialized value if the
646// iterator has advanced beyond the end of the collection.
647func (iter GroupListResultIterator) Value() Group {
648	if !iter.page.NotDone() {
649		return Group{}
650	}
651	return iter.page.Values()[iter.i]
652}
653
654// IsEmpty returns true if the ListResult contains no values.
655func (glr GroupListResult) IsEmpty() bool {
656	return glr.Value == nil || len(*glr.Value) == 0
657}
658
659// groupListResultPreparer prepares a request to retrieve the next set of results.
660// It returns nil if no more results exist.
661func (glr GroupListResult) groupListResultPreparer() (*http.Request, error) {
662	if glr.NextLink == nil || len(to.String(glr.NextLink)) < 1 {
663		return nil, nil
664	}
665	return autorest.Prepare(&http.Request{},
666		autorest.AsJSON(),
667		autorest.AsGet(),
668		autorest.WithBaseURL(to.String(glr.NextLink)))
669}
670
671// GroupListResultPage contains a page of Group values.
672type GroupListResultPage struct {
673	fn  func(GroupListResult) (GroupListResult, error)
674	glr GroupListResult
675}
676
677// Next advances to the next page of values.  If there was an error making
678// the request the page does not advance and the error is returned.
679func (page *GroupListResultPage) Next() error {
680	next, err := page.fn(page.glr)
681	if err != nil {
682		return err
683	}
684	page.glr = next
685	return nil
686}
687
688// NotDone returns true if the page enumeration should be started or is not yet complete.
689func (page GroupListResultPage) NotDone() bool {
690	return !page.glr.IsEmpty()
691}
692
693// Response returns the raw server response from the last page request.
694func (page GroupListResultPage) Response() GroupListResult {
695	return page.glr
696}
697
698// Values returns the slice of values for the current page or nil if there are no values.
699func (page GroupListResultPage) Values() []Group {
700	if page.glr.IsEmpty() {
701		return nil
702	}
703	return *page.glr.Value
704}
705
706// GroupProperties the resource group properties.
707type GroupProperties struct {
708	// ProvisioningState - The provisioning state.
709	ProvisioningState *string `json:"provisioningState,omitempty"`
710}
711
712// GroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
713type GroupsDeleteFuture struct {
714	azure.Future
715}
716
717// Result returns the result of the asynchronous operation.
718// If the operation has not completed it will return an error.
719func (future *GroupsDeleteFuture) Result(client GroupsClient) (ar autorest.Response, err error) {
720	var done bool
721	done, err = future.Done(client)
722	if err != nil {
723		err = autorest.NewErrorWithError(err, "resources.GroupsDeleteFuture", "Result", future.Response(), "Polling failure")
724		return
725	}
726	if !done {
727		err = azure.NewAsyncOpIncompleteError("resources.GroupsDeleteFuture")
728		return
729	}
730	ar.Response = future.Response()
731	return
732}
733
734// HTTPMessage ...
735type HTTPMessage struct {
736	// Content - HTTP message content.
737	Content interface{} `json:"content,omitempty"`
738}
739
740// Identity identity for the resource.
741type Identity struct {
742	// PrincipalID - The principal id of resource identity.
743	PrincipalID *string `json:"principalId,omitempty"`
744	// TenantID - The tenant id of resource.
745	TenantID *string `json:"tenantId,omitempty"`
746	// Type - The identity type. Possible values include: 'SystemAssigned'
747	Type ResourceIdentityType `json:"type,omitempty"`
748}
749
750// ListResult list of resource groups.
751type ListResult struct {
752	autorest.Response `json:"-"`
753	// Value - The list of resources.
754	Value *[]GenericResource `json:"value,omitempty"`
755	// NextLink - The URL to get the next set of results.
756	NextLink *string `json:"nextLink,omitempty"`
757}
758
759// ListResultIterator provides access to a complete listing of GenericResource values.
760type ListResultIterator struct {
761	i    int
762	page ListResultPage
763}
764
765// Next advances to the next value.  If there was an error making
766// the request the iterator does not advance and the error is returned.
767func (iter *ListResultIterator) Next() error {
768	iter.i++
769	if iter.i < len(iter.page.Values()) {
770		return nil
771	}
772	err := iter.page.Next()
773	if err != nil {
774		iter.i--
775		return err
776	}
777	iter.i = 0
778	return nil
779}
780
781// NotDone returns true if the enumeration should be started or is not yet complete.
782func (iter ListResultIterator) NotDone() bool {
783	return iter.page.NotDone() && iter.i < len(iter.page.Values())
784}
785
786// Response returns the raw server response from the last page request.
787func (iter ListResultIterator) Response() ListResult {
788	return iter.page.Response()
789}
790
791// Value returns the current value or a zero-initialized value if the
792// iterator has advanced beyond the end of the collection.
793func (iter ListResultIterator) Value() GenericResource {
794	if !iter.page.NotDone() {
795		return GenericResource{}
796	}
797	return iter.page.Values()[iter.i]
798}
799
800// IsEmpty returns true if the ListResult contains no values.
801func (lr ListResult) IsEmpty() bool {
802	return lr.Value == nil || len(*lr.Value) == 0
803}
804
805// listResultPreparer prepares a request to retrieve the next set of results.
806// It returns nil if no more results exist.
807func (lr ListResult) listResultPreparer() (*http.Request, error) {
808	if lr.NextLink == nil || len(to.String(lr.NextLink)) < 1 {
809		return nil, nil
810	}
811	return autorest.Prepare(&http.Request{},
812		autorest.AsJSON(),
813		autorest.AsGet(),
814		autorest.WithBaseURL(to.String(lr.NextLink)))
815}
816
817// ListResultPage contains a page of GenericResource values.
818type ListResultPage struct {
819	fn func(ListResult) (ListResult, error)
820	lr ListResult
821}
822
823// Next advances to the next page of values.  If there was an error making
824// the request the page does not advance and the error is returned.
825func (page *ListResultPage) Next() error {
826	next, err := page.fn(page.lr)
827	if err != nil {
828		return err
829	}
830	page.lr = next
831	return nil
832}
833
834// NotDone returns true if the page enumeration should be started or is not yet complete.
835func (page ListResultPage) NotDone() bool {
836	return !page.lr.IsEmpty()
837}
838
839// Response returns the raw server response from the last page request.
840func (page ListResultPage) Response() ListResult {
841	return page.lr
842}
843
844// Values returns the slice of values for the current page or nil if there are no values.
845func (page ListResultPage) Values() []GenericResource {
846	if page.lr.IsEmpty() {
847		return nil
848	}
849	return *page.lr.Value
850}
851
852// ManagementErrorWithDetails ...
853type ManagementErrorWithDetails struct {
854	// Code - The error code returned from the server.
855	Code *string `json:"code,omitempty"`
856	// Message - The error message returned from the server.
857	Message *string `json:"message,omitempty"`
858	// Target - The target of the error.
859	Target *string `json:"target,omitempty"`
860	// Details - Validation error.
861	Details *[]ManagementErrorWithDetails `json:"details,omitempty"`
862}
863
864// MoveInfo parameters of move resources.
865type MoveInfo struct {
866	// ResourcesProperty - The ids of the resources.
867	ResourcesProperty *[]string `json:"resources,omitempty"`
868	// TargetResourceGroup - The target resource group.
869	TargetResourceGroup *string `json:"targetResourceGroup,omitempty"`
870}
871
872// MoveResourcesFuture an abstraction for monitoring and retrieving the results of a long-running operation.
873type MoveResourcesFuture struct {
874	azure.Future
875}
876
877// Result returns the result of the asynchronous operation.
878// If the operation has not completed it will return an error.
879func (future *MoveResourcesFuture) Result(client Client) (ar autorest.Response, err error) {
880	var done bool
881	done, err = future.Done(client)
882	if err != nil {
883		err = autorest.NewErrorWithError(err, "resources.MoveResourcesFuture", "Result", future.Response(), "Polling failure")
884		return
885	}
886	if !done {
887		err = azure.NewAsyncOpIncompleteError("resources.MoveResourcesFuture")
888		return
889	}
890	ar.Response = future.Response()
891	return
892}
893
894// ParametersLink entity representing the reference to the deployment paramaters.
895type ParametersLink struct {
896	// URI - URI referencing the template.
897	URI *string `json:"uri,omitempty"`
898	// ContentVersion - If included it must match the ContentVersion in the template.
899	ContentVersion *string `json:"contentVersion,omitempty"`
900}
901
902// Plan plan for the resource.
903type Plan struct {
904	// Name - The plan ID.
905	Name *string `json:"name,omitempty"`
906	// Publisher - The publisher ID.
907	Publisher *string `json:"publisher,omitempty"`
908	// Product - The offer ID.
909	Product *string `json:"product,omitempty"`
910	// PromotionCode - The promotion code.
911	PromotionCode *string `json:"promotionCode,omitempty"`
912}
913
914// Provider resource provider information.
915type Provider struct {
916	autorest.Response `json:"-"`
917	// ID - The provider id.
918	ID *string `json:"id,omitempty"`
919	// Namespace - The namespace of the provider.
920	Namespace *string `json:"namespace,omitempty"`
921	// RegistrationState - The registration state of the provider.
922	RegistrationState *string `json:"registrationState,omitempty"`
923	// ResourceTypes - The collection of provider resource types.
924	ResourceTypes *[]ProviderResourceType `json:"resourceTypes,omitempty"`
925}
926
927// ProviderListResult list of resource providers.
928type ProviderListResult struct {
929	autorest.Response `json:"-"`
930	// Value - The list of resource providers.
931	Value *[]Provider `json:"value,omitempty"`
932	// NextLink - The URL to get the next set of results.
933	NextLink *string `json:"nextLink,omitempty"`
934}
935
936// ProviderListResultIterator provides access to a complete listing of Provider values.
937type ProviderListResultIterator struct {
938	i    int
939	page ProviderListResultPage
940}
941
942// Next advances to the next value.  If there was an error making
943// the request the iterator does not advance and the error is returned.
944func (iter *ProviderListResultIterator) Next() error {
945	iter.i++
946	if iter.i < len(iter.page.Values()) {
947		return nil
948	}
949	err := iter.page.Next()
950	if err != nil {
951		iter.i--
952		return err
953	}
954	iter.i = 0
955	return nil
956}
957
958// NotDone returns true if the enumeration should be started or is not yet complete.
959func (iter ProviderListResultIterator) NotDone() bool {
960	return iter.page.NotDone() && iter.i < len(iter.page.Values())
961}
962
963// Response returns the raw server response from the last page request.
964func (iter ProviderListResultIterator) Response() ProviderListResult {
965	return iter.page.Response()
966}
967
968// Value returns the current value or a zero-initialized value if the
969// iterator has advanced beyond the end of the collection.
970func (iter ProviderListResultIterator) Value() Provider {
971	if !iter.page.NotDone() {
972		return Provider{}
973	}
974	return iter.page.Values()[iter.i]
975}
976
977// IsEmpty returns true if the ListResult contains no values.
978func (plr ProviderListResult) IsEmpty() bool {
979	return plr.Value == nil || len(*plr.Value) == 0
980}
981
982// providerListResultPreparer prepares a request to retrieve the next set of results.
983// It returns nil if no more results exist.
984func (plr ProviderListResult) providerListResultPreparer() (*http.Request, error) {
985	if plr.NextLink == nil || len(to.String(plr.NextLink)) < 1 {
986		return nil, nil
987	}
988	return autorest.Prepare(&http.Request{},
989		autorest.AsJSON(),
990		autorest.AsGet(),
991		autorest.WithBaseURL(to.String(plr.NextLink)))
992}
993
994// ProviderListResultPage contains a page of Provider values.
995type ProviderListResultPage struct {
996	fn  func(ProviderListResult) (ProviderListResult, error)
997	plr ProviderListResult
998}
999
1000// Next advances to the next page of values.  If there was an error making
1001// the request the page does not advance and the error is returned.
1002func (page *ProviderListResultPage) Next() error {
1003	next, err := page.fn(page.plr)
1004	if err != nil {
1005		return err
1006	}
1007	page.plr = next
1008	return nil
1009}
1010
1011// NotDone returns true if the page enumeration should be started or is not yet complete.
1012func (page ProviderListResultPage) NotDone() bool {
1013	return !page.plr.IsEmpty()
1014}
1015
1016// Response returns the raw server response from the last page request.
1017func (page ProviderListResultPage) Response() ProviderListResult {
1018	return page.plr
1019}
1020
1021// Values returns the slice of values for the current page or nil if there are no values.
1022func (page ProviderListResultPage) Values() []Provider {
1023	if page.plr.IsEmpty() {
1024		return nil
1025	}
1026	return *page.plr.Value
1027}
1028
1029// ProviderOperationDisplayProperties resource provider operation's display properties.
1030type ProviderOperationDisplayProperties struct {
1031	// Publisher - Operation description.
1032	Publisher *string `json:"publisher,omitempty"`
1033	// Provider - Operation provider.
1034	Provider *string `json:"provider,omitempty"`
1035	// Resource - Operation resource.
1036	Resource *string `json:"resource,omitempty"`
1037	// Operation - Operation.
1038	Operation *string `json:"operation,omitempty"`
1039	// Description - Operation description.
1040	Description *string `json:"description,omitempty"`
1041}
1042
1043// ProviderResourceType resource type managed by the resource provider.
1044type ProviderResourceType struct {
1045	// ResourceType - The resource type.
1046	ResourceType *string `json:"resourceType,omitempty"`
1047	// Locations - The collection of locations where this resource type can be created in.
1048	Locations *[]string `json:"locations,omitempty"`
1049	// Aliases - The aliases that are supported by this resource type.
1050	Aliases *[]AliasType `json:"aliases,omitempty"`
1051	// APIVersions - The api version.
1052	APIVersions *[]string `json:"apiVersions,omitempty"`
1053	// Properties - The properties.
1054	Properties map[string]*string `json:"properties"`
1055}
1056
1057// MarshalJSON is the custom marshaler for ProviderResourceType.
1058func (prt ProviderResourceType) MarshalJSON() ([]byte, error) {
1059	objectMap := make(map[string]interface{})
1060	if prt.ResourceType != nil {
1061		objectMap["resourceType"] = prt.ResourceType
1062	}
1063	if prt.Locations != nil {
1064		objectMap["locations"] = prt.Locations
1065	}
1066	if prt.Aliases != nil {
1067		objectMap["aliases"] = prt.Aliases
1068	}
1069	if prt.APIVersions != nil {
1070		objectMap["apiVersions"] = prt.APIVersions
1071	}
1072	if prt.Properties != nil {
1073		objectMap["properties"] = prt.Properties
1074	}
1075	return json.Marshal(objectMap)
1076}
1077
1078// Resource ...
1079type Resource struct {
1080	// ID - Resource Id
1081	ID *string `json:"id,omitempty"`
1082	// Name - Resource name
1083	Name *string `json:"name,omitempty"`
1084	// Type - Resource type
1085	Type *string `json:"type,omitempty"`
1086	// Location - Resource location
1087	Location *string `json:"location,omitempty"`
1088	// Tags - Resource tags
1089	Tags map[string]*string `json:"tags"`
1090}
1091
1092// MarshalJSON is the custom marshaler for Resource.
1093func (r Resource) MarshalJSON() ([]byte, error) {
1094	objectMap := make(map[string]interface{})
1095	if r.ID != nil {
1096		objectMap["id"] = r.ID
1097	}
1098	if r.Name != nil {
1099		objectMap["name"] = r.Name
1100	}
1101	if r.Type != nil {
1102		objectMap["type"] = r.Type
1103	}
1104	if r.Location != nil {
1105		objectMap["location"] = r.Location
1106	}
1107	if r.Tags != nil {
1108		objectMap["tags"] = r.Tags
1109	}
1110	return json.Marshal(objectMap)
1111}
1112
1113// Sku sku for the resource.
1114type Sku struct {
1115	// Name - The sku name.
1116	Name *string `json:"name,omitempty"`
1117	// Tier - The sku tier.
1118	Tier *string `json:"tier,omitempty"`
1119	// Size - The sku size.
1120	Size *string `json:"size,omitempty"`
1121	// Family - The sku family.
1122	Family *string `json:"family,omitempty"`
1123	// Model - The sku model.
1124	Model *string `json:"model,omitempty"`
1125	// Capacity - The sku capacity.
1126	Capacity *int32 `json:"capacity,omitempty"`
1127}
1128
1129// SubResource ...
1130type SubResource struct {
1131	// ID - Resource Id
1132	ID *string `json:"id,omitempty"`
1133}
1134
1135// TagCount tag count.
1136type TagCount struct {
1137	// Type - Type of count.
1138	Type *string `json:"type,omitempty"`
1139	// Value - Value of count.
1140	Value *string `json:"value,omitempty"`
1141}
1142
1143// TagDetails tag details.
1144type TagDetails struct {
1145	autorest.Response `json:"-"`
1146	// ID - The tag ID.
1147	ID *string `json:"id,omitempty"`
1148	// TagName - The tag name.
1149	TagName *string `json:"tagName,omitempty"`
1150	// Count - The tag count.
1151	Count *TagCount `json:"count,omitempty"`
1152	// Values - The list of tag values.
1153	Values *[]TagValue `json:"values,omitempty"`
1154}
1155
1156// TagsListResult list of subscription tags.
1157type TagsListResult struct {
1158	autorest.Response `json:"-"`
1159	// Value - The list of tags.
1160	Value *[]TagDetails `json:"value,omitempty"`
1161	// NextLink - The URL to get the next set of results.
1162	NextLink *string `json:"nextLink,omitempty"`
1163}
1164
1165// TagsListResultIterator provides access to a complete listing of TagDetails values.
1166type TagsListResultIterator struct {
1167	i    int
1168	page TagsListResultPage
1169}
1170
1171// Next advances to the next value.  If there was an error making
1172// the request the iterator does not advance and the error is returned.
1173func (iter *TagsListResultIterator) Next() error {
1174	iter.i++
1175	if iter.i < len(iter.page.Values()) {
1176		return nil
1177	}
1178	err := iter.page.Next()
1179	if err != nil {
1180		iter.i--
1181		return err
1182	}
1183	iter.i = 0
1184	return nil
1185}
1186
1187// NotDone returns true if the enumeration should be started or is not yet complete.
1188func (iter TagsListResultIterator) NotDone() bool {
1189	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1190}
1191
1192// Response returns the raw server response from the last page request.
1193func (iter TagsListResultIterator) Response() TagsListResult {
1194	return iter.page.Response()
1195}
1196
1197// Value returns the current value or a zero-initialized value if the
1198// iterator has advanced beyond the end of the collection.
1199func (iter TagsListResultIterator) Value() TagDetails {
1200	if !iter.page.NotDone() {
1201		return TagDetails{}
1202	}
1203	return iter.page.Values()[iter.i]
1204}
1205
1206// IsEmpty returns true if the ListResult contains no values.
1207func (tlr TagsListResult) IsEmpty() bool {
1208	return tlr.Value == nil || len(*tlr.Value) == 0
1209}
1210
1211// tagsListResultPreparer prepares a request to retrieve the next set of results.
1212// It returns nil if no more results exist.
1213func (tlr TagsListResult) tagsListResultPreparer() (*http.Request, error) {
1214	if tlr.NextLink == nil || len(to.String(tlr.NextLink)) < 1 {
1215		return nil, nil
1216	}
1217	return autorest.Prepare(&http.Request{},
1218		autorest.AsJSON(),
1219		autorest.AsGet(),
1220		autorest.WithBaseURL(to.String(tlr.NextLink)))
1221}
1222
1223// TagsListResultPage contains a page of TagDetails values.
1224type TagsListResultPage struct {
1225	fn  func(TagsListResult) (TagsListResult, error)
1226	tlr TagsListResult
1227}
1228
1229// Next advances to the next page of values.  If there was an error making
1230// the request the page does not advance and the error is returned.
1231func (page *TagsListResultPage) Next() error {
1232	next, err := page.fn(page.tlr)
1233	if err != nil {
1234		return err
1235	}
1236	page.tlr = next
1237	return nil
1238}
1239
1240// NotDone returns true if the page enumeration should be started or is not yet complete.
1241func (page TagsListResultPage) NotDone() bool {
1242	return !page.tlr.IsEmpty()
1243}
1244
1245// Response returns the raw server response from the last page request.
1246func (page TagsListResultPage) Response() TagsListResult {
1247	return page.tlr
1248}
1249
1250// Values returns the slice of values for the current page or nil if there are no values.
1251func (page TagsListResultPage) Values() []TagDetails {
1252	if page.tlr.IsEmpty() {
1253		return nil
1254	}
1255	return *page.tlr.Value
1256}
1257
1258// TagValue tag information.
1259type TagValue struct {
1260	autorest.Response `json:"-"`
1261	// ID - The tag ID.
1262	ID *string `json:"id,omitempty"`
1263	// TagValue - The tag value.
1264	TagValue *string `json:"tagValue,omitempty"`
1265	// Count - The tag value count.
1266	Count *TagCount `json:"count,omitempty"`
1267}
1268
1269// TargetResource target resource.
1270type TargetResource struct {
1271	// ID - The ID of the resource.
1272	ID *string `json:"id,omitempty"`
1273	// ResourceName - The name of the resource.
1274	ResourceName *string `json:"resourceName,omitempty"`
1275	// ResourceType - The type of the resource.
1276	ResourceType *string `json:"resourceType,omitempty"`
1277}
1278
1279// TemplateLink entity representing the reference to the template.
1280type TemplateLink struct {
1281	// URI - URI referencing the template.
1282	URI *string `json:"uri,omitempty"`
1283	// ContentVersion - If included it must match the ContentVersion in the template.
1284	ContentVersion *string `json:"contentVersion,omitempty"`
1285}
1286
1287// UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
1288type UpdateFuture struct {
1289	azure.Future
1290}
1291
1292// Result returns the result of the asynchronous operation.
1293// If the operation has not completed it will return an error.
1294func (future *UpdateFuture) Result(client Client) (gr GenericResource, err error) {
1295	var done bool
1296	done, err = future.Done(client)
1297	if err != nil {
1298		err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", future.Response(), "Polling failure")
1299		return
1300	}
1301	if !done {
1302		err = azure.NewAsyncOpIncompleteError("resources.UpdateFuture")
1303		return
1304	}
1305	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1306	if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent {
1307		gr, err = client.UpdateResponder(gr.Response.Response)
1308		if err != nil {
1309			err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", gr.Response.Response, "Failure responding to request")
1310		}
1311	}
1312	return
1313}
1314