diff --git a/services/preview/resources/mgmt/2015-10-01-preview/policy/CHANGELOG.md b/services/preview/resources/mgmt/2015-10-01-preview/policy/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/resources/mgmt/2015-10-01-preview/policy/CHANGELOG.md +++ b/services/preview/resources/mgmt/2015-10-01-preview/policy/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/resources/mgmt/2015-10-01-preview/policy/_meta.json b/services/preview/resources/mgmt/2015-10-01-preview/policy/_meta.json index cb6d3ea1531d..0f76474a37c8 100644 --- a/services/preview/resources/mgmt/2015-10-01-preview/policy/_meta.json +++ b/services/preview/resources/mgmt/2015-10-01-preview/policy/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-policy-2015-10", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/resources/mgmt/2016-09-01-preview/managedapplications/CHANGELOG.md b/services/preview/resources/mgmt/2016-09-01-preview/managedapplications/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/resources/mgmt/2016-09-01-preview/managedapplications/CHANGELOG.md +++ b/services/preview/resources/mgmt/2016-09-01-preview/managedapplications/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/resources/mgmt/2016-09-01-preview/managedapplications/_meta.json b/services/preview/resources/mgmt/2016-09-01-preview/managedapplications/_meta.json index 376af6b08021..c456069f07bd 100644 --- a/services/preview/resources/mgmt/2016-09-01-preview/managedapplications/_meta.json +++ b/services/preview/resources/mgmt/2016-09-01-preview/managedapplications/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-managedapplications-2016-09", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/resources/mgmt/2017-06-01-preview/policy/CHANGELOG.md b/services/preview/resources/mgmt/2017-06-01-preview/policy/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/resources/mgmt/2017-06-01-preview/policy/CHANGELOG.md +++ b/services/preview/resources/mgmt/2017-06-01-preview/policy/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/resources/mgmt/2017-06-01-preview/policy/_meta.json b/services/preview/resources/mgmt/2017-06-01-preview/policy/_meta.json index 1c70523239d1..49e098f22a8d 100644 --- a/services/preview/resources/mgmt/2017-06-01-preview/policy/_meta.json +++ b/services/preview/resources/mgmt/2017-06-01-preview/policy/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-policy-2017-06", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/resources/mgmt/2019-06-01-preview/templatespecs/CHANGELOG.md b/services/preview/resources/mgmt/2019-06-01-preview/templatespecs/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/resources/mgmt/2019-06-01-preview/templatespecs/CHANGELOG.md +++ b/services/preview/resources/mgmt/2019-06-01-preview/templatespecs/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/resources/mgmt/2019-06-01-preview/templatespecs/_meta.json b/services/preview/resources/mgmt/2019-06-01-preview/templatespecs/_meta.json index 8c828ad74396..5c55c7abb67a 100644 --- a/services/preview/resources/mgmt/2019-06-01-preview/templatespecs/_meta.json +++ b/services/preview/resources/mgmt/2019-06-01-preview/templatespecs/_meta.json @@ -1,5 +1,5 @@ { - "commit": "b08824e05817297a4b2874d8db5e6fc8c29349c9", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-templatespecs-2019-06-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/resources/mgmt/2019-06-01-preview/templatespecs/models.go b/services/preview/resources/mgmt/2019-06-01-preview/templatespecs/models.go index 7c58d7d02004..ea8317148d77 100644 --- a/services/preview/resources/mgmt/2019-06-01-preview/templatespecs/models.go +++ b/services/preview/resources/mgmt/2019-06-01-preview/templatespecs/models.go @@ -358,7 +358,7 @@ type SystemData struct { LastModifiedBy *string `json:"lastModifiedBy,omitempty"` // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The type of identity that last modified the resource. + // LastModifiedAt - The timestamp of resource last modification (UTC) LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` } diff --git a/services/preview/resources/mgmt/2020-03-01-preview/policy/CHANGELOG.md b/services/preview/resources/mgmt/2020-03-01-preview/policy/CHANGELOG.md index 52911e4cc5e4..3f480aea57df 100644 --- a/services/preview/resources/mgmt/2020-03-01-preview/policy/CHANGELOG.md +++ b/services/preview/resources/mgmt/2020-03-01-preview/policy/CHANGELOG.md @@ -1,2 +1,238 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Funcs + +1. AzureEntityResource.MarshalJSON() ([]byte, error) +1. ErrorDetail.MarshalJSON() ([]byte, error) +1. ProxyResource.MarshalJSON() ([]byte, error) +1. Resource.MarshalJSON() ([]byte, error) +1. TrackedResource.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### Removed Structs + +1. AzureEntityResource +1. ErrorDetail +1. ProxyResource +1. Resource +1. TrackedResource + +### Signature Changes + +#### Funcs + +1. AssignmentsClient.List + - Params + - From: context.Context, string, string, *int32 + - To: context.Context, string, *int32 +1. AssignmentsClient.ListComplete + - Params + - From: context.Context, string, string, *int32 + - To: context.Context, string, *int32 +1. AssignmentsClient.ListForResource + - Params + - From: context.Context, string, string, string, string, string, string, string, *int32 + - To: context.Context, string, string, string, string, string, string, *int32 +1. AssignmentsClient.ListForResourceComplete + - Params + - From: context.Context, string, string, string, string, string, string, string, *int32 + - To: context.Context, string, string, string, string, string, string, *int32 +1. AssignmentsClient.ListForResourceGroup + - Params + - From: context.Context, string, string, string, *int32 + - To: context.Context, string, string, *int32 +1. AssignmentsClient.ListForResourceGroupComplete + - Params + - From: context.Context, string, string, string, *int32 + - To: context.Context, string, string, *int32 +1. AssignmentsClient.ListForResourceGroupPreparer + - Params + - From: context.Context, string, string, string, *int32 + - To: context.Context, string, string, *int32 +1. AssignmentsClient.ListForResourcePreparer + - Params + - From: context.Context, string, string, string, string, string, string, string, *int32 + - To: context.Context, string, string, string, string, string, string, *int32 +1. AssignmentsClient.ListPreparer + - Params + - From: context.Context, string, string, *int32 + - To: context.Context, string, *int32 +1. DefinitionsClient.CreateOrUpdate + - Params + - From: context.Context, string, Definition, string + - To: context.Context, string, Definition +1. DefinitionsClient.CreateOrUpdatePreparer + - Params + - From: context.Context, string, Definition, string + - To: context.Context, string, Definition +1. DefinitionsClient.Delete + - Params + - From: context.Context, string, string + - To: context.Context, string +1. DefinitionsClient.DeletePreparer + - Params + - From: context.Context, string, string + - To: context.Context, string +1. DefinitionsClient.Get + - Params + - From: context.Context, string, string + - To: context.Context, string +1. DefinitionsClient.GetPreparer + - Params + - From: context.Context, string, string + - To: context.Context, string +1. DefinitionsClient.List + - Params + - From: context.Context, string, string, *int32 + - To: context.Context, string, *int32 +1. DefinitionsClient.ListComplete + - Params + - From: context.Context, string, string, *int32 + - To: context.Context, string, *int32 +1. DefinitionsClient.ListPreparer + - Params + - From: context.Context, string, string, *int32 + - To: context.Context, string, *int32 +1. ExemptionsClient.CreateOrUpdate + - Params + - From: context.Context, Exemption, string, string + - To: context.Context, string, string, Exemption +1. ExemptionsClient.CreateOrUpdatePreparer + - Params + - From: context.Context, Exemption, string, string + - To: context.Context, string, string, Exemption +1. ExemptionsClient.List + - Params + - From: context.Context, string, string + - To: context.Context, string +1. ExemptionsClient.ListComplete + - Params + - From: context.Context, string, string + - To: context.Context, string +1. ExemptionsClient.ListForResource + - Params + - From: context.Context, string, string, string, string, string, string, string + - To: context.Context, string, string, string, string, string, string +1. ExemptionsClient.ListForResourceComplete + - Params + - From: context.Context, string, string, string, string, string, string, string + - To: context.Context, string, string, string, string, string, string +1. ExemptionsClient.ListForResourceGroup + - Params + - From: context.Context, string, string, string + - To: context.Context, string, string +1. ExemptionsClient.ListForResourceGroupComplete + - Params + - From: context.Context, string, string, string + - To: context.Context, string, string +1. ExemptionsClient.ListForResourceGroupPreparer + - Params + - From: context.Context, string, string, string + - To: context.Context, string, string +1. ExemptionsClient.ListForResourcePreparer + - Params + - From: context.Context, string, string, string, string, string, string, string + - To: context.Context, string, string, string, string, string, string +1. ExemptionsClient.ListPreparer + - Params + - From: context.Context, string, string + - To: context.Context, string +1. New + - Params + - From: + - To: string +1. NewAssignmentsClient + - Params + - From: + - To: string +1. NewAssignmentsClientWithBaseURI + - Params + - From: string + - To: string, string +1. NewDefinitionsClient + - Params + - From: + - To: string +1. NewDefinitionsClientWithBaseURI + - Params + - From: string + - To: string, string +1. NewExemptionsClient + - Params + - From: + - To: string +1. NewExemptionsClientWithBaseURI + - Params + - From: string + - To: string, string +1. NewSetDefinitionsClient + - Params + - From: + - To: string +1. NewSetDefinitionsClientWithBaseURI + - Params + - From: string + - To: string, string +1. NewWithBaseURI + - Params + - From: string + - To: string, string +1. SetDefinitionsClient.CreateOrUpdate + - Params + - From: context.Context, string, SetDefinition, string + - To: context.Context, string, SetDefinition +1. SetDefinitionsClient.CreateOrUpdatePreparer + - Params + - From: context.Context, string, SetDefinition, string + - To: context.Context, string, SetDefinition +1. SetDefinitionsClient.Delete + - Params + - From: context.Context, string, string + - To: context.Context, string +1. SetDefinitionsClient.DeletePreparer + - Params + - From: context.Context, string, string + - To: context.Context, string +1. SetDefinitionsClient.Get + - Params + - From: context.Context, string, string + - To: context.Context, string +1. SetDefinitionsClient.GetPreparer + - Params + - From: context.Context, string, string + - To: context.Context, string +1. SetDefinitionsClient.List + - Params + - From: context.Context, string, string, *int32 + - To: context.Context, string, *int32 +1. SetDefinitionsClient.ListComplete + - Params + - From: context.Context, string, string, *int32 + - To: context.Context, string, *int32 +1. SetDefinitionsClient.ListPreparer + - Params + - From: context.Context, string, string, *int32 + - To: context.Context, string, *int32 + +#### Struct Fields + +1. CloudError.Error changed type from *ErrorDetail to *ErrorResponse + +## Additive Changes + +### New Funcs + +1. ErrorResponse.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. ErrorResponse + +#### New Struct Fields + +1. BaseClient.SubscriptionID diff --git a/services/preview/resources/mgmt/2020-03-01-preview/policy/_meta.json b/services/preview/resources/mgmt/2020-03-01-preview/policy/_meta.json index 8c55d4256495..9574233ace8e 100644 --- a/services/preview/resources/mgmt/2020-03-01-preview/policy/_meta.json +++ b/services/preview/resources/mgmt/2020-03-01-preview/policy/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-policy-2020-03", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/resources/mgmt/2020-03-01-preview/policy/assignments.go b/services/preview/resources/mgmt/2020-03-01-preview/policy/assignments.go index 837e45b36b10..365dea99c63e 100644 --- a/services/preview/resources/mgmt/2020-03-01-preview/policy/assignments.go +++ b/services/preview/resources/mgmt/2020-03-01-preview/policy/assignments.go @@ -21,14 +21,14 @@ type AssignmentsClient struct { } // NewAssignmentsClient creates an instance of the AssignmentsClient client. -func NewAssignmentsClient() AssignmentsClient { - return NewAssignmentsClientWithBaseURI(DefaultBaseURI) +func NewAssignmentsClient(subscriptionID string) AssignmentsClient { + return NewAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewAssignmentsClientWithBaseURI creates an instance of the AssignmentsClient client using a custom endpoint. Use // this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAssignmentsClientWithBaseURI(baseURI string) AssignmentsClient { - return AssignmentsClient{NewWithBaseURI(baseURI)} +func NewAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) AssignmentsClient { + return AssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} } // Create this operation creates or updates a policy assignment with the given scope and name. Policy assignments apply @@ -549,7 +549,6 @@ func (client AssignmentsClient) GetByIDResponder(resp *http.Response) (result As // '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is // {value}. // Parameters: -// subscriptionID - the ID of the target subscription. // filter - the filter to apply on the operation. Valid values for $filter are: 'atScope()', 'atExactScope()' // or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. If // $filter=atScope() is provided, the returned list only includes all policy assignments that apply to the @@ -558,7 +557,7 @@ func (client AssignmentsClient) GetByIDResponder(resp *http.Response) (result As // that at the given scope. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes // all policy assignments of the policy definition whose id is {value}. // top - maximum number of records to return. When the $top filter is not provided, it will return 500 records. -func (client AssignmentsClient) List(ctx context.Context, subscriptionID string, filter string, top *int32) (result AssignmentListResultPage, err error) { +func (client AssignmentsClient) List(ctx context.Context, filter string, top *int32) (result AssignmentListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsClient.List") defer func() { @@ -579,7 +578,7 @@ func (client AssignmentsClient) List(ctx context.Context, subscriptionID string, } result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, subscriptionID, filter, top) + req, err := client.ListPreparer(ctx, filter, top) if err != nil { err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "List", nil, "Failure preparing request") return @@ -606,9 +605,9 @@ func (client AssignmentsClient) List(ctx context.Context, subscriptionID string, } // ListPreparer prepares the List request. -func (client AssignmentsClient) ListPreparer(ctx context.Context, subscriptionID string, filter string, top *int32) (*http.Request, error) { +func (client AssignmentsClient) ListPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", subscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2020-03-01" @@ -670,7 +669,7 @@ func (client AssignmentsClient) listNextResults(ctx context.Context, lastResults } // ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client AssignmentsClient) ListComplete(ctx context.Context, subscriptionID string, filter string, top *int32) (result AssignmentListResultIterator, err error) { +func (client AssignmentsClient) ListComplete(ctx context.Context, filter string, top *int32) (result AssignmentListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsClient.List") defer func() { @@ -681,7 +680,7 @@ func (client AssignmentsClient) ListComplete(ctx context.Context, subscriptionID tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.List(ctx, subscriptionID, filter, top) + result.page, err = client.List(ctx, filter, top) return } @@ -856,7 +855,6 @@ func (client AssignmentsClient) ListForManagementGroupComplete(ctx context.Conte // resourceType - the resource type name. For example the type name of a web app is 'sites' (from // Microsoft.Web/sites). // resourceName - the name of the resource. -// subscriptionID - the ID of the target subscription. // filter - the filter to apply on the operation. Valid values for $filter are: 'atScope()', 'atExactScope()' // or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. If // $filter=atScope() is provided, the returned list only includes all policy assignments that apply to the @@ -865,7 +863,7 @@ func (client AssignmentsClient) ListForManagementGroupComplete(ctx context.Conte // that at the given scope. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes // all policy assignments of the policy definition whose id is {value}. // top - maximum number of records to return. When the $top filter is not provided, it will return 500 records. -func (client AssignmentsClient) ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, subscriptionID string, filter string, top *int32) (result AssignmentListResultPage, err error) { +func (client AssignmentsClient) ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string, top *int32) (result AssignmentListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsClient.ListForResource") defer func() { @@ -890,7 +888,7 @@ func (client AssignmentsClient) ListForResource(ctx context.Context, resourceGro } result.fn = client.listForResourceNextResults - req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, subscriptionID, filter, top) + req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter, top) if err != nil { err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResource", nil, "Failure preparing request") return @@ -917,14 +915,14 @@ func (client AssignmentsClient) ListForResource(ctx context.Context, resourceGro } // ListForResourcePreparer prepares the ListForResource request. -func (client AssignmentsClient) ListForResourcePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, subscriptionID string, filter string, top *int32) (*http.Request, error) { +func (client AssignmentsClient) ListForResourcePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string, top *int32) (*http.Request, error) { pathParameters := map[string]interface{}{ "parentResourcePath": parentResourcePath, "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", subscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2020-03-01" @@ -986,7 +984,7 @@ func (client AssignmentsClient) listForResourceNextResults(ctx context.Context, } // ListForResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client AssignmentsClient) ListForResourceComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, subscriptionID string, filter string, top *int32) (result AssignmentListResultIterator, err error) { +func (client AssignmentsClient) ListForResourceComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string, top *int32) (result AssignmentListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsClient.ListForResource") defer func() { @@ -997,7 +995,7 @@ func (client AssignmentsClient) ListForResourceComplete(ctx context.Context, res tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.ListForResource(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, subscriptionID, filter, top) + result.page, err = client.ListForResource(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter, top) return } @@ -1013,7 +1011,6 @@ func (client AssignmentsClient) ListForResourceComplete(ctx context.Context, res // definition whose id is {value} that apply to the resource group. // Parameters: // resourceGroupName - the name of the resource group that contains policy assignments. -// subscriptionID - the ID of the target subscription. // filter - the filter to apply on the operation. Valid values for $filter are: 'atScope()', 'atExactScope()' // or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. If // $filter=atScope() is provided, the returned list only includes all policy assignments that apply to the @@ -1022,7 +1019,7 @@ func (client AssignmentsClient) ListForResourceComplete(ctx context.Context, res // that at the given scope. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes // all policy assignments of the policy definition whose id is {value}. // top - maximum number of records to return. When the $top filter is not provided, it will return 500 records. -func (client AssignmentsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string, subscriptionID string, filter string, top *int32) (result AssignmentListResultPage, err error) { +func (client AssignmentsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result AssignmentListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsClient.ListForResourceGroup") defer func() { @@ -1047,7 +1044,7 @@ func (client AssignmentsClient) ListForResourceGroup(ctx context.Context, resour } result.fn = client.listForResourceGroupNextResults - req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName, subscriptionID, filter, top) + req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName, filter, top) if err != nil { err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResourceGroup", nil, "Failure preparing request") return @@ -1074,10 +1071,10 @@ func (client AssignmentsClient) ListForResourceGroup(ctx context.Context, resour } // ListForResourceGroupPreparer prepares the ListForResourceGroup request. -func (client AssignmentsClient) ListForResourceGroupPreparer(ctx context.Context, resourceGroupName string, subscriptionID string, filter string, top *int32) (*http.Request, error) { +func (client AssignmentsClient) ListForResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", subscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2020-03-01" @@ -1139,7 +1136,7 @@ func (client AssignmentsClient) listForResourceGroupNextResults(ctx context.Cont } // ListForResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AssignmentsClient) ListForResourceGroupComplete(ctx context.Context, resourceGroupName string, subscriptionID string, filter string, top *int32) (result AssignmentListResultIterator, err error) { +func (client AssignmentsClient) ListForResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result AssignmentListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsClient.ListForResourceGroup") defer func() { @@ -1150,6 +1147,6 @@ func (client AssignmentsClient) ListForResourceGroupComplete(ctx context.Context tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.ListForResourceGroup(ctx, resourceGroupName, subscriptionID, filter, top) + result.page, err = client.ListForResourceGroup(ctx, resourceGroupName, filter, top) return } diff --git a/services/preview/resources/mgmt/2020-03-01-preview/policy/client.go b/services/preview/resources/mgmt/2020-03-01-preview/policy/client.go index 848d45b030c9..803dd72e4c87 100644 --- a/services/preview/resources/mgmt/2020-03-01-preview/policy/client.go +++ b/services/preview/resources/mgmt/2020-03-01-preview/policy/client.go @@ -21,19 +21,21 @@ const ( // BaseClient is the base client for Policy. type BaseClient struct { autorest.Client - BaseURI string + BaseURI string + SubscriptionID string } // New creates an instance of the BaseClient client. -func New() BaseClient { - return NewWithBaseURI(DefaultBaseURI) +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) } // NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with // an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string) BaseClient { +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, } } diff --git a/services/preview/resources/mgmt/2020-03-01-preview/policy/definitions.go b/services/preview/resources/mgmt/2020-03-01-preview/policy/definitions.go index 9f7b6a36eca9..87ebd935833f 100644 --- a/services/preview/resources/mgmt/2020-03-01-preview/policy/definitions.go +++ b/services/preview/resources/mgmt/2020-03-01-preview/policy/definitions.go @@ -21,22 +21,21 @@ type DefinitionsClient struct { } // NewDefinitionsClient creates an instance of the DefinitionsClient client. -func NewDefinitionsClient() DefinitionsClient { - return NewDefinitionsClientWithBaseURI(DefaultBaseURI) +func NewDefinitionsClient(subscriptionID string) DefinitionsClient { + return NewDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewDefinitionsClientWithBaseURI creates an instance of the DefinitionsClient client using a custom endpoint. Use // this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDefinitionsClientWithBaseURI(baseURI string) DefinitionsClient { - return DefinitionsClient{NewWithBaseURI(baseURI)} +func NewDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) DefinitionsClient { + return DefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} } // CreateOrUpdate this operation creates or updates a policy definition in the given subscription with the given name. // Parameters: // policyDefinitionName - the name of the policy definition to create. // parameters - the policy definition properties. -// subscriptionID - the ID of the target subscription. -func (client DefinitionsClient) CreateOrUpdate(ctx context.Context, policyDefinitionName string, parameters Definition, subscriptionID string) (result Definition, err error) { +func (client DefinitionsClient) CreateOrUpdate(ctx context.Context, policyDefinitionName string, parameters Definition) (result Definition, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/DefinitionsClient.CreateOrUpdate") defer func() { @@ -47,7 +46,7 @@ func (client DefinitionsClient) CreateOrUpdate(ctx context.Context, policyDefini tracing.EndSpan(ctx, sc, err) }() } - req, err := client.CreateOrUpdatePreparer(ctx, policyDefinitionName, parameters, subscriptionID) + req, err := client.CreateOrUpdatePreparer(ctx, policyDefinitionName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request") return @@ -70,10 +69,10 @@ func (client DefinitionsClient) CreateOrUpdate(ctx context.Context, policyDefini } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DefinitionsClient) CreateOrUpdatePreparer(ctx context.Context, policyDefinitionName string, parameters Definition, subscriptionID string) (*http.Request, error) { +func (client DefinitionsClient) CreateOrUpdatePreparer(ctx context.Context, policyDefinitionName string, parameters Definition) (*http.Request, error) { pathParameters := map[string]interface{}{ "policyDefinitionName": autorest.Encode("path", policyDefinitionName), - "subscriptionId": autorest.Encode("path", subscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2020-03-01" @@ -197,8 +196,7 @@ func (client DefinitionsClient) CreateOrUpdateAtManagementGroupResponder(resp *h // Delete this operation deletes the policy definition in the given subscription with the given name. // Parameters: // policyDefinitionName - the name of the policy definition to delete. -// subscriptionID - the ID of the target subscription. -func (client DefinitionsClient) Delete(ctx context.Context, policyDefinitionName string, subscriptionID string) (result autorest.Response, err error) { +func (client DefinitionsClient) Delete(ctx context.Context, policyDefinitionName string) (result autorest.Response, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/DefinitionsClient.Delete") defer func() { @@ -209,7 +207,7 @@ func (client DefinitionsClient) Delete(ctx context.Context, policyDefinitionName tracing.EndSpan(ctx, sc, err) }() } - req, err := client.DeletePreparer(ctx, policyDefinitionName, subscriptionID) + req, err := client.DeletePreparer(ctx, policyDefinitionName) if err != nil { err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "Delete", nil, "Failure preparing request") return @@ -232,10 +230,10 @@ func (client DefinitionsClient) Delete(ctx context.Context, policyDefinitionName } // DeletePreparer prepares the Delete request. -func (client DefinitionsClient) DeletePreparer(ctx context.Context, policyDefinitionName string, subscriptionID string) (*http.Request, error) { +func (client DefinitionsClient) DeletePreparer(ctx context.Context, policyDefinitionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "policyDefinitionName": autorest.Encode("path", policyDefinitionName), - "subscriptionId": autorest.Encode("path", subscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2020-03-01" @@ -346,8 +344,7 @@ func (client DefinitionsClient) DeleteAtManagementGroupResponder(resp *http.Resp // Get this operation retrieves the policy definition in the given subscription with the given name. // Parameters: // policyDefinitionName - the name of the policy definition to get. -// subscriptionID - the ID of the target subscription. -func (client DefinitionsClient) Get(ctx context.Context, policyDefinitionName string, subscriptionID string) (result Definition, err error) { +func (client DefinitionsClient) Get(ctx context.Context, policyDefinitionName string) (result Definition, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/DefinitionsClient.Get") defer func() { @@ -358,7 +355,7 @@ func (client DefinitionsClient) Get(ctx context.Context, policyDefinitionName st tracing.EndSpan(ctx, sc, err) }() } - req, err := client.GetPreparer(ctx, policyDefinitionName, subscriptionID) + req, err := client.GetPreparer(ctx, policyDefinitionName) if err != nil { err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "Get", nil, "Failure preparing request") return @@ -381,10 +378,10 @@ func (client DefinitionsClient) Get(ctx context.Context, policyDefinitionName st } // GetPreparer prepares the Get request. -func (client DefinitionsClient) GetPreparer(ctx context.Context, policyDefinitionName string, subscriptionID string) (*http.Request, error) { +func (client DefinitionsClient) GetPreparer(ctx context.Context, policyDefinitionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "policyDefinitionName": autorest.Encode("path", policyDefinitionName), - "subscriptionId": autorest.Encode("path", subscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2020-03-01" @@ -577,7 +574,6 @@ func (client DefinitionsClient) GetBuiltInResponder(resp *http.Response) (result // If $filter='category -eq {value}' is provided, the returned list only includes all policy definitions whose category // match the {value}. // Parameters: -// subscriptionID - the ID of the target subscription. // filter - the filter to apply on the operation. Valid values for $filter are: 'atExactScope()', 'policyType // -eq {value}' or 'category eq '{value}''. If $filter is not provided, no filtering is performed. If // $filter=atExactScope() is provided, the returned list only includes all policy definitions that at the given @@ -586,7 +582,7 @@ func (client DefinitionsClient) GetBuiltInResponder(resp *http.Response) (result // Static. If $filter='category -eq {value}' is provided, the returned list only includes all policy // definitions whose category match the {value}. // top - maximum number of records to return. When the $top filter is not provided, it will return 500 records. -func (client DefinitionsClient) List(ctx context.Context, subscriptionID string, filter string, top *int32) (result DefinitionListResultPage, err error) { +func (client DefinitionsClient) List(ctx context.Context, filter string, top *int32) (result DefinitionListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/DefinitionsClient.List") defer func() { @@ -607,7 +603,7 @@ func (client DefinitionsClient) List(ctx context.Context, subscriptionID string, } result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, subscriptionID, filter, top) + req, err := client.ListPreparer(ctx, filter, top) if err != nil { err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "List", nil, "Failure preparing request") return @@ -634,9 +630,9 @@ func (client DefinitionsClient) List(ctx context.Context, subscriptionID string, } // ListPreparer prepares the List request. -func (client DefinitionsClient) ListPreparer(ctx context.Context, subscriptionID string, filter string, top *int32) (*http.Request, error) { +func (client DefinitionsClient) ListPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", subscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2020-03-01" @@ -698,7 +694,7 @@ func (client DefinitionsClient) listNextResults(ctx context.Context, lastResults } // ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client DefinitionsClient) ListComplete(ctx context.Context, subscriptionID string, filter string, top *int32) (result DefinitionListResultIterator, err error) { +func (client DefinitionsClient) ListComplete(ctx context.Context, filter string, top *int32) (result DefinitionListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/DefinitionsClient.List") defer func() { @@ -709,7 +705,7 @@ func (client DefinitionsClient) ListComplete(ctx context.Context, subscriptionID tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.List(ctx, subscriptionID, filter, top) + result.page, err = client.List(ctx, filter, top) return } diff --git a/services/preview/resources/mgmt/2020-03-01-preview/policy/exemptions.go b/services/preview/resources/mgmt/2020-03-01-preview/policy/exemptions.go index d90f85452e96..1c2298e236e4 100644 --- a/services/preview/resources/mgmt/2020-03-01-preview/policy/exemptions.go +++ b/services/preview/resources/mgmt/2020-03-01-preview/policy/exemptions.go @@ -21,14 +21,14 @@ type ExemptionsClient struct { } // NewExemptionsClient creates an instance of the ExemptionsClient client. -func NewExemptionsClient() ExemptionsClient { - return NewExemptionsClientWithBaseURI(DefaultBaseURI) +func NewExemptionsClient(subscriptionID string) ExemptionsClient { + return NewExemptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewExemptionsClientWithBaseURI creates an instance of the ExemptionsClient client using a custom endpoint. Use this // when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewExemptionsClientWithBaseURI(baseURI string) ExemptionsClient { - return ExemptionsClient{NewWithBaseURI(baseURI)} +func NewExemptionsClientWithBaseURI(baseURI string, subscriptionID string) ExemptionsClient { + return ExemptionsClient{NewWithBaseURI(baseURI, subscriptionID)} } // CreateOrUpdate this operation creates or updates a policy exemption with the given scope and name. Policy exemptions @@ -36,14 +36,14 @@ func NewExemptionsClientWithBaseURI(baseURI string) ExemptionsClient { // group scope for a policy assignment at the same or above level, the exemption exempts to all applicable resources in // the resource group. // Parameters: -// parameters - parameters for the policy exemption. // scope - the scope of the policy exemption. Valid scopes are: management group (format: // '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: // '/subscriptions/{subscriptionId}'), resource group (format: // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' // policyExemptionName - the name of the policy exemption to delete. -func (client ExemptionsClient) CreateOrUpdate(ctx context.Context, parameters Exemption, scope string, policyExemptionName string) (result Exemption, err error) { +// parameters - parameters for the policy exemption. +func (client ExemptionsClient) CreateOrUpdate(ctx context.Context, scope string, policyExemptionName string, parameters Exemption) (result Exemption, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ExemptionsClient.CreateOrUpdate") defer func() { @@ -61,7 +61,7 @@ func (client ExemptionsClient) CreateOrUpdate(ctx context.Context, parameters Ex return result, validation.NewError("policy.ExemptionsClient", "CreateOrUpdate", err.Error()) } - req, err := client.CreateOrUpdatePreparer(ctx, parameters, scope, policyExemptionName) + req, err := client.CreateOrUpdatePreparer(ctx, scope, policyExemptionName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "policy.ExemptionsClient", "CreateOrUpdate", nil, "Failure preparing request") return @@ -84,7 +84,7 @@ func (client ExemptionsClient) CreateOrUpdate(ctx context.Context, parameters Ex } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ExemptionsClient) CreateOrUpdatePreparer(ctx context.Context, parameters Exemption, scope string, policyExemptionName string) (*http.Request, error) { +func (client ExemptionsClient) CreateOrUpdatePreparer(ctx context.Context, scope string, policyExemptionName string, parameters Exemption) (*http.Request, error) { pathParameters := map[string]interface{}{ "policyExemptionName": autorest.Encode("path", policyExemptionName), "scope": scope, @@ -96,6 +96,9 @@ func (client ExemptionsClient) CreateOrUpdatePreparer(ctx context.Context, param } parameters.SystemData = nil + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), @@ -289,7 +292,6 @@ func (client ExemptionsClient) GetResponder(resp *http.Response) (result Exempti // associated with the subscription, including those that apply directly or from management groups that contain the // given subscription, as well as any applied to objects contained within the subscription. // Parameters: -// subscriptionID - the ID of the target subscription. // filter - the filter to apply on the operation. Valid values for $filter are: 'atScope()', 'atExactScope()', // 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not provided, no filtering is // performed. If $filter is not provided, the unfiltered list includes all policy exemptions associated with @@ -301,7 +303,7 @@ func (client ExemptionsClient) GetResponder(resp *http.Response) (result Exempti // either haven't expired or didn't set expiration date. If $filter=policyAssignmentId eq '{value}' is // provided. the returned list only includes all policy exemptions that are associated with the give // policyAssignmentId. -func (client ExemptionsClient) List(ctx context.Context, subscriptionID string, filter string) (result ExemptionListResultPage, err error) { +func (client ExemptionsClient) List(ctx context.Context, filter string) (result ExemptionListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ExemptionsClient.List") defer func() { @@ -313,7 +315,7 @@ func (client ExemptionsClient) List(ctx context.Context, subscriptionID string, }() } result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, subscriptionID, filter) + req, err := client.ListPreparer(ctx, filter) if err != nil { err = autorest.NewErrorWithError(err, "policy.ExemptionsClient", "List", nil, "Failure preparing request") return @@ -340,9 +342,9 @@ func (client ExemptionsClient) List(ctx context.Context, subscriptionID string, } // ListPreparer prepares the List request. -func (client ExemptionsClient) ListPreparer(ctx context.Context, subscriptionID string, filter string) (*http.Request, error) { +func (client ExemptionsClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", subscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2020-07-01-preview" @@ -401,7 +403,7 @@ func (client ExemptionsClient) listNextResults(ctx context.Context, lastResults } // ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ExemptionsClient) ListComplete(ctx context.Context, subscriptionID string, filter string) (result ExemptionListResultIterator, err error) { +func (client ExemptionsClient) ListComplete(ctx context.Context, filter string) (result ExemptionListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ExemptionsClient.List") defer func() { @@ -412,7 +414,7 @@ func (client ExemptionsClient) ListComplete(ctx context.Context, subscriptionID tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.List(ctx, subscriptionID, filter) + result.page, err = client.List(ctx, filter) return } @@ -563,7 +565,6 @@ func (client ExemptionsClient) ListForManagementGroupComplete(ctx context.Contex // to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == // '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). // Parameters: -// subscriptionID - the ID of the target subscription. // resourceGroupName - the name of the resource group containing the resource. // resourceProviderNamespace - the namespace of the resource provider. For example, the namespace of a virtual // machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) @@ -582,7 +583,7 @@ func (client ExemptionsClient) ListForManagementGroupComplete(ctx context.Contex // either haven't expired or didn't set expiration date. If $filter=policyAssignmentId eq '{value}' is // provided. the returned list only includes all policy exemptions that are associated with the give // policyAssignmentId. -func (client ExemptionsClient) ListForResource(ctx context.Context, subscriptionID string, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result ExemptionListResultPage, err error) { +func (client ExemptionsClient) ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result ExemptionListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ExemptionsClient.ListForResource") defer func() { @@ -602,7 +603,7 @@ func (client ExemptionsClient) ListForResource(ctx context.Context, subscription } result.fn = client.listForResourceNextResults - req, err := client.ListForResourcePreparer(ctx, subscriptionID, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) + req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) if err != nil { err = autorest.NewErrorWithError(err, "policy.ExemptionsClient", "ListForResource", nil, "Failure preparing request") return @@ -629,14 +630,14 @@ func (client ExemptionsClient) ListForResource(ctx context.Context, subscription } // ListForResourcePreparer prepares the ListForResource request. -func (client ExemptionsClient) ListForResourcePreparer(ctx context.Context, subscriptionID string, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (*http.Request, error) { +func (client ExemptionsClient) ListForResourcePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (*http.Request, error) { pathParameters := map[string]interface{}{ "parentResourcePath": parentResourcePath, "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", subscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2020-07-01-preview" @@ -695,7 +696,7 @@ func (client ExemptionsClient) listForResourceNextResults(ctx context.Context, l } // ListForResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ExemptionsClient) ListForResourceComplete(ctx context.Context, subscriptionID string, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result ExemptionListResultIterator, err error) { +func (client ExemptionsClient) ListForResourceComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result ExemptionListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ExemptionsClient.ListForResource") defer func() { @@ -706,7 +707,7 @@ func (client ExemptionsClient) ListForResourceComplete(ctx context.Context, subs tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.ListForResource(ctx, subscriptionID, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) + result.page, err = client.ListForResource(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) return } @@ -716,7 +717,6 @@ func (client ExemptionsClient) ListForResourceComplete(ctx context.Context, subs // unfiltered list includes all policy exemptions associated with the resource group, including those that apply // directly or apply from containing scopes, as well as any applied to resources contained within the resource group. // Parameters: -// subscriptionID - the ID of the target subscription. // resourceGroupName - the name of the resource group containing the resource. // filter - the filter to apply on the operation. Valid values for $filter are: 'atScope()', 'atExactScope()', // 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not provided, no filtering is @@ -729,7 +729,7 @@ func (client ExemptionsClient) ListForResourceComplete(ctx context.Context, subs // either haven't expired or didn't set expiration date. If $filter=policyAssignmentId eq '{value}' is // provided. the returned list only includes all policy exemptions that are associated with the give // policyAssignmentId. -func (client ExemptionsClient) ListForResourceGroup(ctx context.Context, subscriptionID string, resourceGroupName string, filter string) (result ExemptionListResultPage, err error) { +func (client ExemptionsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result ExemptionListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ExemptionsClient.ListForResourceGroup") defer func() { @@ -749,7 +749,7 @@ func (client ExemptionsClient) ListForResourceGroup(ctx context.Context, subscri } result.fn = client.listForResourceGroupNextResults - req, err := client.ListForResourceGroupPreparer(ctx, subscriptionID, resourceGroupName, filter) + req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName, filter) if err != nil { err = autorest.NewErrorWithError(err, "policy.ExemptionsClient", "ListForResourceGroup", nil, "Failure preparing request") return @@ -776,10 +776,10 @@ func (client ExemptionsClient) ListForResourceGroup(ctx context.Context, subscri } // ListForResourceGroupPreparer prepares the ListForResourceGroup request. -func (client ExemptionsClient) ListForResourceGroupPreparer(ctx context.Context, subscriptionID string, resourceGroupName string, filter string) (*http.Request, error) { +func (client ExemptionsClient) ListForResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", subscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2020-07-01-preview" @@ -838,7 +838,7 @@ func (client ExemptionsClient) listForResourceGroupNextResults(ctx context.Conte } // ListForResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ExemptionsClient) ListForResourceGroupComplete(ctx context.Context, subscriptionID string, resourceGroupName string, filter string) (result ExemptionListResultIterator, err error) { +func (client ExemptionsClient) ListForResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string) (result ExemptionListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ExemptionsClient.ListForResourceGroup") defer func() { @@ -849,6 +849,6 @@ func (client ExemptionsClient) ListForResourceGroupComplete(ctx context.Context, tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.ListForResourceGroup(ctx, subscriptionID, resourceGroupName, filter) + result.page, err = client.ListForResourceGroup(ctx, resourceGroupName, filter) return } diff --git a/services/preview/resources/mgmt/2020-03-01-preview/policy/models.go b/services/preview/resources/mgmt/2020-03-01-preview/policy/models.go index a63b42d8fd07..bb734a6b7497 100644 --- a/services/preview/resources/mgmt/2020-03-01-preview/policy/models.go +++ b/services/preview/resources/mgmt/2020-03-01-preview/policy/models.go @@ -343,29 +343,9 @@ func (ap AssignmentProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CloudError common error response for all Azure Resource Manager APIs to return error details for failed -// operations. (This also follows the OData error response format.). +// CloudError an error response from a policy operation. type CloudError struct { - // Error - The error object. - Error *ErrorDetail `json:"error,omitempty"` + Error *ErrorResponse `json:"error,omitempty"` } // Definition the policy definition. @@ -703,8 +683,9 @@ func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// ErrorDetail the error detail. -type ErrorDetail struct { +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.) +type ErrorResponse struct { // Code - READ-ONLY; The error code. Code *string `json:"code,omitempty"` // Message - READ-ONLY; The error message. @@ -712,13 +693,13 @@ type ErrorDetail struct { // Target - READ-ONLY; The error target. Target *string `json:"target,omitempty"` // Details - READ-ONLY; The error details. - Details *[]ErrorDetail `json:"details,omitempty"` + Details *[]ErrorResponse `json:"details,omitempty"` // AdditionalInfo - READ-ONLY; The error additional info. AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` } -// MarshalJSON is the custom marshaler for ErrorDetail. -func (ed ErrorDetail) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ErrorResponse. +func (er ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } @@ -730,11 +711,11 @@ type Exemption struct { *ExemptionProperties `json:"properties,omitempty"` // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // ID - READ-ONLY; The ID of the policy exemption. ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource + // Name - READ-ONLY; The name of the policy exemption. Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + // Type - READ-ONLY; The type of the resource (Microsoft.Authorization/policyExemptions). Type *string `json:"type,omitempty"` } @@ -1100,39 +1081,6 @@ type ParameterValuesValue struct { Value interface{} `json:"value,omitempty"` } -// ProxyResource the resource model definition for an Azure Resource Manager proxy resource. It will have -// everything other than required location and tags -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - // SetDefinition the policy set definition. type SetDefinition struct { autorest.Response `json:"-"` @@ -1430,32 +1378,6 @@ type SystemData struct { LastModifiedBy *string `json:"lastModifiedBy,omitempty"` // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The type of identity that last modified the resource. + // LastModifiedAt - The timestamp of resource last modification (UTC) LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` } - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} diff --git a/services/preview/resources/mgmt/2020-03-01-preview/policy/policyapi/interfaces.go b/services/preview/resources/mgmt/2020-03-01-preview/policy/policyapi/interfaces.go index 93682413bf25..d031b8f6505f 100644 --- a/services/preview/resources/mgmt/2020-03-01-preview/policy/policyapi/interfaces.go +++ b/services/preview/resources/mgmt/2020-03-01-preview/policy/policyapi/interfaces.go @@ -20,29 +20,29 @@ type AssignmentsClientAPI interface { DeleteByID(ctx context.Context, policyAssignmentID string) (result policy.Assignment, err error) Get(ctx context.Context, scope string, policyAssignmentName string) (result policy.Assignment, err error) GetByID(ctx context.Context, policyAssignmentID string) (result policy.Assignment, err error) - List(ctx context.Context, subscriptionID string, filter string, top *int32) (result policy.AssignmentListResultPage, err error) - ListComplete(ctx context.Context, subscriptionID string, filter string, top *int32) (result policy.AssignmentListResultIterator, err error) + List(ctx context.Context, filter string, top *int32) (result policy.AssignmentListResultPage, err error) + ListComplete(ctx context.Context, filter string, top *int32) (result policy.AssignmentListResultIterator, err error) ListForManagementGroup(ctx context.Context, managementGroupID string, filter string, top *int32) (result policy.AssignmentListResultPage, err error) ListForManagementGroupComplete(ctx context.Context, managementGroupID string, filter string, top *int32) (result policy.AssignmentListResultIterator, err error) - ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, subscriptionID string, filter string, top *int32) (result policy.AssignmentListResultPage, err error) - ListForResourceComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, subscriptionID string, filter string, top *int32) (result policy.AssignmentListResultIterator, err error) - ListForResourceGroup(ctx context.Context, resourceGroupName string, subscriptionID string, filter string, top *int32) (result policy.AssignmentListResultPage, err error) - ListForResourceGroupComplete(ctx context.Context, resourceGroupName string, subscriptionID string, filter string, top *int32) (result policy.AssignmentListResultIterator, err error) + ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string, top *int32) (result policy.AssignmentListResultPage, err error) + ListForResourceComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string, top *int32) (result policy.AssignmentListResultIterator, err error) + ListForResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result policy.AssignmentListResultPage, err error) + ListForResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result policy.AssignmentListResultIterator, err error) } var _ AssignmentsClientAPI = (*policy.AssignmentsClient)(nil) // DefinitionsClientAPI contains the set of methods on the DefinitionsClient type. type DefinitionsClientAPI interface { - CreateOrUpdate(ctx context.Context, policyDefinitionName string, parameters policy.Definition, subscriptionID string) (result policy.Definition, err error) + CreateOrUpdate(ctx context.Context, policyDefinitionName string, parameters policy.Definition) (result policy.Definition, err error) CreateOrUpdateAtManagementGroup(ctx context.Context, policyDefinitionName string, parameters policy.Definition, managementGroupID string) (result policy.Definition, err error) - Delete(ctx context.Context, policyDefinitionName string, subscriptionID string) (result autorest.Response, err error) + Delete(ctx context.Context, policyDefinitionName string) (result autorest.Response, err error) DeleteAtManagementGroup(ctx context.Context, policyDefinitionName string, managementGroupID string) (result autorest.Response, err error) - Get(ctx context.Context, policyDefinitionName string, subscriptionID string) (result policy.Definition, err error) + Get(ctx context.Context, policyDefinitionName string) (result policy.Definition, err error) GetAtManagementGroup(ctx context.Context, policyDefinitionName string, managementGroupID string) (result policy.Definition, err error) GetBuiltIn(ctx context.Context, policyDefinitionName string) (result policy.Definition, err error) - List(ctx context.Context, subscriptionID string, filter string, top *int32) (result policy.DefinitionListResultPage, err error) - ListComplete(ctx context.Context, subscriptionID string, filter string, top *int32) (result policy.DefinitionListResultIterator, err error) + List(ctx context.Context, filter string, top *int32) (result policy.DefinitionListResultPage, err error) + ListComplete(ctx context.Context, filter string, top *int32) (result policy.DefinitionListResultIterator, err error) ListBuiltIn(ctx context.Context, filter string, top *int32) (result policy.DefinitionListResultPage, err error) ListBuiltInComplete(ctx context.Context, filter string, top *int32) (result policy.DefinitionListResultIterator, err error) ListByManagementGroup(ctx context.Context, managementGroupID string, filter string, top *int32) (result policy.DefinitionListResultPage, err error) @@ -53,15 +53,15 @@ var _ DefinitionsClientAPI = (*policy.DefinitionsClient)(nil) // SetDefinitionsClientAPI contains the set of methods on the SetDefinitionsClient type. type SetDefinitionsClientAPI interface { - CreateOrUpdate(ctx context.Context, policySetDefinitionName string, parameters policy.SetDefinition, subscriptionID string) (result policy.SetDefinition, err error) + CreateOrUpdate(ctx context.Context, policySetDefinitionName string, parameters policy.SetDefinition) (result policy.SetDefinition, err error) CreateOrUpdateAtManagementGroup(ctx context.Context, policySetDefinitionName string, parameters policy.SetDefinition, managementGroupID string) (result policy.SetDefinition, err error) - Delete(ctx context.Context, policySetDefinitionName string, subscriptionID string) (result autorest.Response, err error) + Delete(ctx context.Context, policySetDefinitionName string) (result autorest.Response, err error) DeleteAtManagementGroup(ctx context.Context, policySetDefinitionName string, managementGroupID string) (result autorest.Response, err error) - Get(ctx context.Context, policySetDefinitionName string, subscriptionID string) (result policy.SetDefinition, err error) + Get(ctx context.Context, policySetDefinitionName string) (result policy.SetDefinition, err error) GetAtManagementGroup(ctx context.Context, policySetDefinitionName string, managementGroupID string) (result policy.SetDefinition, err error) GetBuiltIn(ctx context.Context, policySetDefinitionName string) (result policy.SetDefinition, err error) - List(ctx context.Context, subscriptionID string, filter string, top *int32) (result policy.SetDefinitionListResultPage, err error) - ListComplete(ctx context.Context, subscriptionID string, filter string, top *int32) (result policy.SetDefinitionListResultIterator, err error) + List(ctx context.Context, filter string, top *int32) (result policy.SetDefinitionListResultPage, err error) + ListComplete(ctx context.Context, filter string, top *int32) (result policy.SetDefinitionListResultIterator, err error) ListBuiltIn(ctx context.Context, filter string, top *int32) (result policy.SetDefinitionListResultPage, err error) ListBuiltInComplete(ctx context.Context, filter string, top *int32) (result policy.SetDefinitionListResultIterator, err error) ListByManagementGroup(ctx context.Context, managementGroupID string, filter string, top *int32) (result policy.SetDefinitionListResultPage, err error) @@ -72,17 +72,17 @@ var _ SetDefinitionsClientAPI = (*policy.SetDefinitionsClient)(nil) // ExemptionsClientAPI contains the set of methods on the ExemptionsClient type. type ExemptionsClientAPI interface { - CreateOrUpdate(ctx context.Context, parameters policy.Exemption, scope string, policyExemptionName string) (result policy.Exemption, err error) + CreateOrUpdate(ctx context.Context, scope string, policyExemptionName string, parameters policy.Exemption) (result policy.Exemption, err error) Delete(ctx context.Context, scope string, policyExemptionName string) (result autorest.Response, err error) Get(ctx context.Context, scope string, policyExemptionName string) (result policy.Exemption, err error) - List(ctx context.Context, subscriptionID string, filter string) (result policy.ExemptionListResultPage, err error) - ListComplete(ctx context.Context, subscriptionID string, filter string) (result policy.ExemptionListResultIterator, err error) + List(ctx context.Context, filter string) (result policy.ExemptionListResultPage, err error) + ListComplete(ctx context.Context, filter string) (result policy.ExemptionListResultIterator, err error) ListForManagementGroup(ctx context.Context, managementGroupID string, filter string) (result policy.ExemptionListResultPage, err error) ListForManagementGroupComplete(ctx context.Context, managementGroupID string, filter string) (result policy.ExemptionListResultIterator, err error) - ListForResource(ctx context.Context, subscriptionID string, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result policy.ExemptionListResultPage, err error) - ListForResourceComplete(ctx context.Context, subscriptionID string, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result policy.ExemptionListResultIterator, err error) - ListForResourceGroup(ctx context.Context, subscriptionID string, resourceGroupName string, filter string) (result policy.ExemptionListResultPage, err error) - ListForResourceGroupComplete(ctx context.Context, subscriptionID string, resourceGroupName string, filter string) (result policy.ExemptionListResultIterator, err error) + ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result policy.ExemptionListResultPage, err error) + ListForResourceComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result policy.ExemptionListResultIterator, err error) + ListForResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result policy.ExemptionListResultPage, err error) + ListForResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string) (result policy.ExemptionListResultIterator, err error) } var _ ExemptionsClientAPI = (*policy.ExemptionsClient)(nil) diff --git a/services/preview/resources/mgmt/2020-03-01-preview/policy/setdefinitions.go b/services/preview/resources/mgmt/2020-03-01-preview/policy/setdefinitions.go index b41841c4e80b..713551be9508 100644 --- a/services/preview/resources/mgmt/2020-03-01-preview/policy/setdefinitions.go +++ b/services/preview/resources/mgmt/2020-03-01-preview/policy/setdefinitions.go @@ -21,14 +21,14 @@ type SetDefinitionsClient struct { } // NewSetDefinitionsClient creates an instance of the SetDefinitionsClient client. -func NewSetDefinitionsClient() SetDefinitionsClient { - return NewSetDefinitionsClientWithBaseURI(DefaultBaseURI) +func NewSetDefinitionsClient(subscriptionID string) SetDefinitionsClient { + return NewSetDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewSetDefinitionsClientWithBaseURI creates an instance of the SetDefinitionsClient client using a custom endpoint. // Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSetDefinitionsClientWithBaseURI(baseURI string) SetDefinitionsClient { - return SetDefinitionsClient{NewWithBaseURI(baseURI)} +func NewSetDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) SetDefinitionsClient { + return SetDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} } // CreateOrUpdate this operation creates or updates a policy set definition in the given subscription with the given @@ -36,8 +36,7 @@ func NewSetDefinitionsClientWithBaseURI(baseURI string) SetDefinitionsClient { // Parameters: // policySetDefinitionName - the name of the policy set definition to create. // parameters - the policy set definition properties. -// subscriptionID - the ID of the target subscription. -func (client SetDefinitionsClient) CreateOrUpdate(ctx context.Context, policySetDefinitionName string, parameters SetDefinition, subscriptionID string) (result SetDefinition, err error) { +func (client SetDefinitionsClient) CreateOrUpdate(ctx context.Context, policySetDefinitionName string, parameters SetDefinition) (result SetDefinition, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/SetDefinitionsClient.CreateOrUpdate") defer func() { @@ -55,7 +54,7 @@ func (client SetDefinitionsClient) CreateOrUpdate(ctx context.Context, policySet return result, validation.NewError("policy.SetDefinitionsClient", "CreateOrUpdate", err.Error()) } - req, err := client.CreateOrUpdatePreparer(ctx, policySetDefinitionName, parameters, subscriptionID) + req, err := client.CreateOrUpdatePreparer(ctx, policySetDefinitionName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "policy.SetDefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request") return @@ -78,10 +77,10 @@ func (client SetDefinitionsClient) CreateOrUpdate(ctx context.Context, policySet } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SetDefinitionsClient) CreateOrUpdatePreparer(ctx context.Context, policySetDefinitionName string, parameters SetDefinition, subscriptionID string) (*http.Request, error) { +func (client SetDefinitionsClient) CreateOrUpdatePreparer(ctx context.Context, policySetDefinitionName string, parameters SetDefinition) (*http.Request, error) { pathParameters := map[string]interface{}{ "policySetDefinitionName": autorest.Encode("path", policySetDefinitionName), - "subscriptionId": autorest.Encode("path", subscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2020-03-01" @@ -212,8 +211,7 @@ func (client SetDefinitionsClient) CreateOrUpdateAtManagementGroupResponder(resp // Delete this operation deletes the policy set definition in the given subscription with the given name. // Parameters: // policySetDefinitionName - the name of the policy set definition to delete. -// subscriptionID - the ID of the target subscription. -func (client SetDefinitionsClient) Delete(ctx context.Context, policySetDefinitionName string, subscriptionID string) (result autorest.Response, err error) { +func (client SetDefinitionsClient) Delete(ctx context.Context, policySetDefinitionName string) (result autorest.Response, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/SetDefinitionsClient.Delete") defer func() { @@ -224,7 +222,7 @@ func (client SetDefinitionsClient) Delete(ctx context.Context, policySetDefiniti tracing.EndSpan(ctx, sc, err) }() } - req, err := client.DeletePreparer(ctx, policySetDefinitionName, subscriptionID) + req, err := client.DeletePreparer(ctx, policySetDefinitionName) if err != nil { err = autorest.NewErrorWithError(err, "policy.SetDefinitionsClient", "Delete", nil, "Failure preparing request") return @@ -247,10 +245,10 @@ func (client SetDefinitionsClient) Delete(ctx context.Context, policySetDefiniti } // DeletePreparer prepares the Delete request. -func (client SetDefinitionsClient) DeletePreparer(ctx context.Context, policySetDefinitionName string, subscriptionID string) (*http.Request, error) { +func (client SetDefinitionsClient) DeletePreparer(ctx context.Context, policySetDefinitionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "policySetDefinitionName": autorest.Encode("path", policySetDefinitionName), - "subscriptionId": autorest.Encode("path", subscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2020-03-01" @@ -361,8 +359,7 @@ func (client SetDefinitionsClient) DeleteAtManagementGroupResponder(resp *http.R // Get this operation retrieves the policy set definition in the given subscription with the given name. // Parameters: // policySetDefinitionName - the name of the policy set definition to get. -// subscriptionID - the ID of the target subscription. -func (client SetDefinitionsClient) Get(ctx context.Context, policySetDefinitionName string, subscriptionID string) (result SetDefinition, err error) { +func (client SetDefinitionsClient) Get(ctx context.Context, policySetDefinitionName string) (result SetDefinition, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/SetDefinitionsClient.Get") defer func() { @@ -373,7 +370,7 @@ func (client SetDefinitionsClient) Get(ctx context.Context, policySetDefinitionN tracing.EndSpan(ctx, sc, err) }() } - req, err := client.GetPreparer(ctx, policySetDefinitionName, subscriptionID) + req, err := client.GetPreparer(ctx, policySetDefinitionName) if err != nil { err = autorest.NewErrorWithError(err, "policy.SetDefinitionsClient", "Get", nil, "Failure preparing request") return @@ -396,10 +393,10 @@ func (client SetDefinitionsClient) Get(ctx context.Context, policySetDefinitionN } // GetPreparer prepares the Get request. -func (client SetDefinitionsClient) GetPreparer(ctx context.Context, policySetDefinitionName string, subscriptionID string) (*http.Request, error) { +func (client SetDefinitionsClient) GetPreparer(ctx context.Context, policySetDefinitionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "policySetDefinitionName": autorest.Encode("path", policySetDefinitionName), - "subscriptionId": autorest.Encode("path", subscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2020-03-01" @@ -592,7 +589,6 @@ func (client SetDefinitionsClient) GetBuiltInResponder(resp *http.Response) (res // $filter='category -eq {value}' is provided, the returned list only includes all policy set definitions whose // category match the {value}. // Parameters: -// subscriptionID - the ID of the target subscription. // filter - the filter to apply on the operation. Valid values for $filter are: 'atExactScope()', 'policyType // -eq {value}' or 'category eq '{value}''. If $filter is not provided, no filtering is performed. If // $filter=atExactScope() is provided, the returned list only includes all policy set definitions that at the @@ -601,7 +597,7 @@ func (client SetDefinitionsClient) GetBuiltInResponder(resp *http.Response) (res // Static. If $filter='category -eq {value}' is provided, the returned list only includes all policy set // definitions whose category match the {value}. // top - maximum number of records to return. When the $top filter is not provided, it will return 500 records. -func (client SetDefinitionsClient) List(ctx context.Context, subscriptionID string, filter string, top *int32) (result SetDefinitionListResultPage, err error) { +func (client SetDefinitionsClient) List(ctx context.Context, filter string, top *int32) (result SetDefinitionListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/SetDefinitionsClient.List") defer func() { @@ -622,7 +618,7 @@ func (client SetDefinitionsClient) List(ctx context.Context, subscriptionID stri } result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, subscriptionID, filter, top) + req, err := client.ListPreparer(ctx, filter, top) if err != nil { err = autorest.NewErrorWithError(err, "policy.SetDefinitionsClient", "List", nil, "Failure preparing request") return @@ -649,9 +645,9 @@ func (client SetDefinitionsClient) List(ctx context.Context, subscriptionID stri } // ListPreparer prepares the List request. -func (client SetDefinitionsClient) ListPreparer(ctx context.Context, subscriptionID string, filter string, top *int32) (*http.Request, error) { +func (client SetDefinitionsClient) ListPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", subscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2020-03-01" @@ -713,7 +709,7 @@ func (client SetDefinitionsClient) listNextResults(ctx context.Context, lastResu } // ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SetDefinitionsClient) ListComplete(ctx context.Context, subscriptionID string, filter string, top *int32) (result SetDefinitionListResultIterator, err error) { +func (client SetDefinitionsClient) ListComplete(ctx context.Context, filter string, top *int32) (result SetDefinitionListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/SetDefinitionsClient.List") defer func() { @@ -724,7 +720,7 @@ func (client SetDefinitionsClient) ListComplete(ctx context.Context, subscriptio tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.List(ctx, subscriptionID, filter, top) + result.page, err = client.List(ctx, filter, top) return } diff --git a/services/preview/resources/mgmt/2020-09-01-preview/policy/CHANGELOG.md b/services/preview/resources/mgmt/2020-09-01-preview/policy/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/resources/mgmt/2020-09-01-preview/policy/CHANGELOG.md +++ b/services/preview/resources/mgmt/2020-09-01-preview/policy/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/resources/mgmt/2020-09-01-preview/policy/_meta.json b/services/preview/resources/mgmt/2020-09-01-preview/policy/_meta.json index 3da4ae9e2dc3..c17e7d58c637 100644 --- a/services/preview/resources/mgmt/2020-09-01-preview/policy/_meta.json +++ b/services/preview/resources/mgmt/2020-09-01-preview/policy/_meta.json @@ -1,5 +1,5 @@ { - "commit": "6300f518091891b00c993e538dc2d282c9b814de", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-policy-2020-09", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/resources/mgmt/2021-06-01-preview/policy/CHANGELOG.md b/services/preview/resources/mgmt/2021-06-01-preview/policy/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/resources/mgmt/2021-06-01-preview/policy/CHANGELOG.md +++ b/services/preview/resources/mgmt/2021-06-01-preview/policy/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/resources/mgmt/2021-06-01-preview/policy/_meta.json b/services/preview/resources/mgmt/2021-06-01-preview/policy/_meta.json index 800548d65e81..6a1f9fb81831 100644 --- a/services/preview/resources/mgmt/2021-06-01-preview/policy/_meta.json +++ b/services/preview/resources/mgmt/2021-06-01-preview/policy/_meta.json @@ -1,5 +1,5 @@ { - "commit": "41bc4891ee06e2225365cb153e88a5749330da99", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-policy-2021-06", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2015-01-01/locks/CHANGELOG.md b/services/resources/mgmt/2015-01-01/locks/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/resources/mgmt/2015-01-01/locks/CHANGELOG.md +++ b/services/resources/mgmt/2015-01-01/locks/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/resources/mgmt/2015-01-01/locks/_meta.json b/services/resources/mgmt/2015-01-01/locks/_meta.json index 7e7d6137159b..cba656ee799f 100644 --- a/services/resources/mgmt/2015-01-01/locks/_meta.json +++ b/services/resources/mgmt/2015-01-01/locks/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-locks-2015-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2015-11-01/resources/CHANGELOG.md b/services/resources/mgmt/2015-11-01/resources/CHANGELOG.md index 52911e4cc5e4..40b82040ae3f 100644 --- a/services/resources/mgmt/2015-11-01/resources/CHANGELOG.md +++ b/services/resources/mgmt/2015-11-01/resources/CHANGELOG.md @@ -1,2 +1,13 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. DeploymentPropertiesExtended.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Struct Fields + +1. DeploymentPropertiesExtended.Error diff --git a/services/resources/mgmt/2015-11-01/resources/_meta.json b/services/resources/mgmt/2015-11-01/resources/_meta.json index 811cf3d45a12..4a93462b7409 100644 --- a/services/resources/mgmt/2015-11-01/resources/_meta.json +++ b/services/resources/mgmt/2015-11-01/resources/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-resources-2015-11", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2015-11-01/resources/models.go b/services/resources/mgmt/2015-11-01/resources/models.go index 53a12c940975..d316cdcae297 100644 --- a/services/resources/mgmt/2015-11-01/resources/models.go +++ b/services/resources/mgmt/2015-11-01/resources/models.go @@ -464,6 +464,47 @@ type DeploymentPropertiesExtended struct { ParametersLink *ParametersLink `json:"parametersLink,omitempty"` // Mode - Gets or sets the deployment mode. Possible values include: 'Incremental', 'Complete' Mode DeploymentMode `json:"mode,omitempty"` + // Error - READ-ONLY; The deployment error. + Error *ErrorResponse `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentPropertiesExtended. +func (dpe DeploymentPropertiesExtended) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dpe.ProvisioningState != nil { + objectMap["provisioningState"] = dpe.ProvisioningState + } + if dpe.CorrelationID != nil { + objectMap["correlationId"] = dpe.CorrelationID + } + if dpe.Timestamp != nil { + objectMap["timestamp"] = dpe.Timestamp + } + if dpe.Outputs != nil { + objectMap["outputs"] = dpe.Outputs + } + if dpe.Providers != nil { + objectMap["providers"] = dpe.Providers + } + if dpe.Dependencies != nil { + objectMap["dependencies"] = dpe.Dependencies + } + if dpe.Template != nil { + objectMap["template"] = dpe.Template + } + if dpe.TemplateLink != nil { + objectMap["templateLink"] = dpe.TemplateLink + } + if dpe.Parameters != nil { + objectMap["parameters"] = dpe.Parameters + } + if dpe.ParametersLink != nil { + objectMap["parametersLink"] = dpe.ParametersLink + } + if dpe.Mode != "" { + objectMap["mode"] = dpe.Mode + } + return json.Marshal(objectMap) } // DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a diff --git a/services/resources/mgmt/2015-11-01/resources/resources.go b/services/resources/mgmt/2015-11-01/resources/resources.go index 17ae057877d6..26f5f6589cd2 100644 --- a/services/resources/mgmt/2015-11-01/resources/resources.go +++ b/services/resources/mgmt/2015-11-01/resources/resources.go @@ -393,7 +393,7 @@ func (client Client) GetResponder(resp *http.Response) (result GenericResource, // filter - the filter to apply on the operation. // expand - comma-separated list of additional properties to be included in the response. Valid values include // `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. -// top - query parameters. If null is passed returns all resource groups. +// top - the number of results to return. If null is passed, returns all resources. func (client Client) List(ctx context.Context, filter string, expand string, top *int32) (result ListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") diff --git a/services/resources/mgmt/2015-11-01/subscriptions/CHANGELOG.md b/services/resources/mgmt/2015-11-01/subscriptions/CHANGELOG.md index 52911e4cc5e4..f1bd42c15475 100644 --- a/services/resources/mgmt/2015-11-01/subscriptions/CHANGELOG.md +++ b/services/resources/mgmt/2015-11-01/subscriptions/CHANGELOG.md @@ -1,2 +1,22 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. AvailabilityZonePeers.MarshalJSON() ([]byte, error) +1. CheckZonePeersResult.MarshalJSON() ([]byte, error) +1. Client.CheckZonePeers(context.Context, string, CheckZonePeersRequest) (CheckZonePeersResult, error) +1. Client.CheckZonePeersPreparer(context.Context, string, CheckZonePeersRequest) (*http.Request, error) +1. Client.CheckZonePeersResponder(*http.Response) (CheckZonePeersResult, error) +1. Client.CheckZonePeersSender(*http.Request) (*http.Response, error) +1. Peers.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. AvailabilityZonePeers +1. CheckZonePeersRequest +1. CheckZonePeersResult +1. Peers diff --git a/services/resources/mgmt/2015-11-01/subscriptions/_meta.json b/services/resources/mgmt/2015-11-01/subscriptions/_meta.json index b2ccbd009a4c..0f2175c49c7f 100644 --- a/services/resources/mgmt/2015-11-01/subscriptions/_meta.json +++ b/services/resources/mgmt/2015-11-01/subscriptions/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-subscriptions-2015-11", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2015-11-01/subscriptions/models.go b/services/resources/mgmt/2015-11-01/subscriptions/models.go index ff1640f673eb..3bfa9d604b72 100644 --- a/services/resources/mgmt/2015-11-01/subscriptions/models.go +++ b/services/resources/mgmt/2015-11-01/subscriptions/models.go @@ -8,6 +8,7 @@ package subscriptions import ( "context" + "encoding/json" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/tracing" @@ -17,6 +18,23 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2015-11-01/subscriptions" +// AvailabilityZonePeers list of availability zones shared by the subscriptions. +type AvailabilityZonePeers struct { + // AvailabilityZone - READ-ONLY; The availabilityZone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` + // Peers - Details of shared availability zone. + Peers *[]Peers `json:"peers,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvailabilityZonePeers. +func (azp AvailabilityZonePeers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if azp.Peers != nil { + objectMap["peers"] = azp.Peers + } + return json.Marshal(objectMap) +} + // CheckResourceNameResult resource Name valid if not a reserved word, does not contain a reserved word and // does not start with a reserved word type CheckResourceNameResult struct { @@ -29,6 +47,37 @@ type CheckResourceNameResult struct { Status ResourceNameStatus `json:"status,omitempty"` } +// CheckZonePeersRequest check zone peers request parameters. +type CheckZonePeersRequest struct { + // Location - The Microsoft location. + Location *string `json:"location,omitempty"` + // SubscriptionIds - The peer Microsoft Azure subscription ID. + SubscriptionIds *[]string `json:"subscriptionIds,omitempty"` +} + +// CheckZonePeersResult result of the Check zone peers operation. +type CheckZonePeersResult struct { + autorest.Response `json:"-"` + // SubscriptionID - READ-ONLY; The subscription ID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // Location - the location of the subscription. + Location *string `json:"location,omitempty"` + // AvailabilityZonePeers - The Availability Zones shared by the subscriptions. + AvailabilityZonePeers *[]AvailabilityZonePeers `json:"availabilityZonePeers,omitempty"` +} + +// MarshalJSON is the custom marshaler for CheckZonePeersResult. +func (czpr CheckZonePeersResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if czpr.Location != nil { + objectMap["location"] = czpr.Location + } + if czpr.AvailabilityZonePeers != nil { + objectMap["availabilityZonePeers"] = czpr.AvailabilityZonePeers + } + return json.Marshal(objectMap) +} + // ErrorDefinition error description and code explaining why resource name is invalid. type ErrorDefinition struct { // Message - Description of the error. @@ -225,6 +274,20 @@ type LocationListResult struct { Value *[]Location `json:"value,omitempty"` } +// Peers information about shared availability zone. +type Peers struct { + // SubscriptionID - READ-ONLY; The subscription ID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // AvailabilityZone - READ-ONLY; The availabilityZone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` +} + +// MarshalJSON is the custom marshaler for Peers. +func (p Peers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // Policies subscription policies. type Policies struct { // LocationPlacementID - Gets or sets the subscription location placement Id. diff --git a/services/resources/mgmt/2015-11-01/subscriptions/subscriptions.go b/services/resources/mgmt/2015-11-01/subscriptions/subscriptions.go index 31f32d4f4974..3fa06d7ef964 100644 --- a/services/resources/mgmt/2015-11-01/subscriptions/subscriptions.go +++ b/services/resources/mgmt/2015-11-01/subscriptions/subscriptions.go @@ -30,6 +30,82 @@ func NewClientWithBaseURI(baseURI string) Client { return Client{NewWithBaseURI(baseURI)} } +// CheckZonePeers compares a subscriptions logical zone mapping +// Parameters: +// subscriptionID - the ID of the target subscription. +// parameters - parameters for checking zone peers. +func (client Client) CheckZonePeers(ctx context.Context, subscriptionID string, parameters CheckZonePeersRequest) (result CheckZonePeersResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckZonePeers") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CheckZonePeersPreparer(ctx, subscriptionID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", nil, "Failure preparing request") + return + } + + resp, err := client.CheckZonePeersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", resp, "Failure sending request") + return + } + + result, err = client.CheckZonePeersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", resp, "Failure responding to request") + return + } + + return +} + +// CheckZonePeersPreparer prepares the CheckZonePeers request. +func (client Client) CheckZonePeersPreparer(ctx context.Context, subscriptionID string, parameters CheckZonePeersRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", subscriptionID), + } + + const APIVersion = "2015-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/checkZonePeers/", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckZonePeersSender sends the CheckZonePeers request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CheckZonePeersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckZonePeersResponder handles the response to the CheckZonePeers request. The method always +// closes the http.Response Body. +func (client Client) CheckZonePeersResponder(resp *http.Response) (result CheckZonePeersResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Get gets details about particular subscription. // Parameters: // subscriptionID - id of the subscription. diff --git a/services/resources/mgmt/2015-11-01/subscriptions/subscriptionsapi/interfaces.go b/services/resources/mgmt/2015-11-01/subscriptions/subscriptionsapi/interfaces.go index 0c5c98755262..702c7b45d949 100644 --- a/services/resources/mgmt/2015-11-01/subscriptions/subscriptionsapi/interfaces.go +++ b/services/resources/mgmt/2015-11-01/subscriptions/subscriptionsapi/interfaces.go @@ -20,6 +20,7 @@ var _ BaseClientAPI = (*subscriptions.BaseClient)(nil) // ClientAPI contains the set of methods on the Client type. type ClientAPI interface { + CheckZonePeers(ctx context.Context, subscriptionID string, parameters subscriptions.CheckZonePeersRequest) (result subscriptions.CheckZonePeersResult, err error) Get(ctx context.Context, subscriptionID string) (result subscriptions.Subscription, err error) List(ctx context.Context) (result subscriptions.ListResultPage, err error) ListComplete(ctx context.Context) (result subscriptions.ListResultIterator, err error) diff --git a/services/resources/mgmt/2015-12-01/features/CHANGELOG.md b/services/resources/mgmt/2015-12-01/features/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/resources/mgmt/2015-12-01/features/CHANGELOG.md +++ b/services/resources/mgmt/2015-12-01/features/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/resources/mgmt/2015-12-01/features/_meta.json b/services/resources/mgmt/2015-12-01/features/_meta.json index 0c20b36e4e18..bf554f35ffb7 100644 --- a/services/resources/mgmt/2015-12-01/features/_meta.json +++ b/services/resources/mgmt/2015-12-01/features/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-features-2015-12", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2016-02-01/resources/CHANGELOG.md b/services/resources/mgmt/2016-02-01/resources/CHANGELOG.md index 52911e4cc5e4..40b82040ae3f 100644 --- a/services/resources/mgmt/2016-02-01/resources/CHANGELOG.md +++ b/services/resources/mgmt/2016-02-01/resources/CHANGELOG.md @@ -1,2 +1,13 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. DeploymentPropertiesExtended.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Struct Fields + +1. DeploymentPropertiesExtended.Error diff --git a/services/resources/mgmt/2016-02-01/resources/_meta.json b/services/resources/mgmt/2016-02-01/resources/_meta.json index 118e460b7c96..d67357ed1a8d 100644 --- a/services/resources/mgmt/2016-02-01/resources/_meta.json +++ b/services/resources/mgmt/2016-02-01/resources/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-resources-2016-02", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2016-02-01/resources/models.go b/services/resources/mgmt/2016-02-01/resources/models.go index c45dbf0557c1..295d6e428d85 100644 --- a/services/resources/mgmt/2016-02-01/resources/models.go +++ b/services/resources/mgmt/2016-02-01/resources/models.go @@ -503,6 +503,50 @@ type DeploymentPropertiesExtended struct { Mode DeploymentMode `json:"mode,omitempty"` // DebugSetting - The debug setting of the deployment. DebugSetting *DebugSetting `json:"debugSetting,omitempty"` + // Error - READ-ONLY; The deployment error. + Error *ErrorResponse `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentPropertiesExtended. +func (dpe DeploymentPropertiesExtended) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dpe.ProvisioningState != nil { + objectMap["provisioningState"] = dpe.ProvisioningState + } + if dpe.CorrelationID != nil { + objectMap["correlationId"] = dpe.CorrelationID + } + if dpe.Timestamp != nil { + objectMap["timestamp"] = dpe.Timestamp + } + if dpe.Outputs != nil { + objectMap["outputs"] = dpe.Outputs + } + if dpe.Providers != nil { + objectMap["providers"] = dpe.Providers + } + if dpe.Dependencies != nil { + objectMap["dependencies"] = dpe.Dependencies + } + if dpe.Template != nil { + objectMap["template"] = dpe.Template + } + if dpe.TemplateLink != nil { + objectMap["templateLink"] = dpe.TemplateLink + } + if dpe.Parameters != nil { + objectMap["parameters"] = dpe.Parameters + } + if dpe.ParametersLink != nil { + objectMap["parametersLink"] = dpe.ParametersLink + } + if dpe.Mode != "" { + objectMap["mode"] = dpe.Mode + } + if dpe.DebugSetting != nil { + objectMap["debugSetting"] = dpe.DebugSetting + } + return json.Marshal(objectMap) } // DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a diff --git a/services/resources/mgmt/2016-02-01/resources/resources.go b/services/resources/mgmt/2016-02-01/resources/resources.go index a243d6bac8c2..7dd8beaec6dc 100644 --- a/services/resources/mgmt/2016-02-01/resources/resources.go +++ b/services/resources/mgmt/2016-02-01/resources/resources.go @@ -393,7 +393,7 @@ func (client Client) GetResponder(resp *http.Response) (result GenericResource, // filter - the filter to apply on the operation. // expand - comma-separated list of additional properties to be included in the response. Valid values include // `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. -// top - query parameters. If null is passed returns all resource groups. +// top - the number of results to return. If null is passed, returns all resources. func (client Client) List(ctx context.Context, filter string, expand string, top *int32) (result ListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") diff --git a/services/resources/mgmt/2016-04-01/policy/CHANGELOG.md b/services/resources/mgmt/2016-04-01/policy/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/resources/mgmt/2016-04-01/policy/CHANGELOG.md +++ b/services/resources/mgmt/2016-04-01/policy/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/resources/mgmt/2016-04-01/policy/_meta.json b/services/resources/mgmt/2016-04-01/policy/_meta.json index 138ccb17b38e..cb80868dbf98 100644 --- a/services/resources/mgmt/2016-04-01/policy/_meta.json +++ b/services/resources/mgmt/2016-04-01/policy/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-policy-2016-04", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2016-06-01/subscriptions/CHANGELOG.md b/services/resources/mgmt/2016-06-01/subscriptions/CHANGELOG.md index 52911e4cc5e4..f1bd42c15475 100644 --- a/services/resources/mgmt/2016-06-01/subscriptions/CHANGELOG.md +++ b/services/resources/mgmt/2016-06-01/subscriptions/CHANGELOG.md @@ -1,2 +1,22 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. AvailabilityZonePeers.MarshalJSON() ([]byte, error) +1. CheckZonePeersResult.MarshalJSON() ([]byte, error) +1. Client.CheckZonePeers(context.Context, string, CheckZonePeersRequest) (CheckZonePeersResult, error) +1. Client.CheckZonePeersPreparer(context.Context, string, CheckZonePeersRequest) (*http.Request, error) +1. Client.CheckZonePeersResponder(*http.Response) (CheckZonePeersResult, error) +1. Client.CheckZonePeersSender(*http.Request) (*http.Response, error) +1. Peers.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. AvailabilityZonePeers +1. CheckZonePeersRequest +1. CheckZonePeersResult +1. Peers diff --git a/services/resources/mgmt/2016-06-01/subscriptions/_meta.json b/services/resources/mgmt/2016-06-01/subscriptions/_meta.json index 975a5b6ec781..ddb74b92d160 100644 --- a/services/resources/mgmt/2016-06-01/subscriptions/_meta.json +++ b/services/resources/mgmt/2016-06-01/subscriptions/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-subscriptions-2016-06", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2016-06-01/subscriptions/models.go b/services/resources/mgmt/2016-06-01/subscriptions/models.go index b680c647a747..d122263ba557 100644 --- a/services/resources/mgmt/2016-06-01/subscriptions/models.go +++ b/services/resources/mgmt/2016-06-01/subscriptions/models.go @@ -18,6 +18,23 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions" +// AvailabilityZonePeers list of availability zones shared by the subscriptions. +type AvailabilityZonePeers struct { + // AvailabilityZone - READ-ONLY; The availabilityZone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` + // Peers - Details of shared availability zone. + Peers *[]Peers `json:"peers,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvailabilityZonePeers. +func (azp AvailabilityZonePeers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if azp.Peers != nil { + objectMap["peers"] = azp.Peers + } + return json.Marshal(objectMap) +} + // CheckResourceNameResult resource Name valid if not a reserved word, does not contain a reserved word and // does not start with a reserved word type CheckResourceNameResult struct { @@ -30,6 +47,37 @@ type CheckResourceNameResult struct { Status ResourceNameStatus `json:"status,omitempty"` } +// CheckZonePeersRequest check zone peers request parameters. +type CheckZonePeersRequest struct { + // Location - The Microsoft location. + Location *string `json:"location,omitempty"` + // SubscriptionIds - The peer Microsoft Azure subscription ID. + SubscriptionIds *[]string `json:"subscriptionIds,omitempty"` +} + +// CheckZonePeersResult result of the Check zone peers operation. +type CheckZonePeersResult struct { + autorest.Response `json:"-"` + // SubscriptionID - READ-ONLY; The subscription ID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // Location - the location of the subscription. + Location *string `json:"location,omitempty"` + // AvailabilityZonePeers - The Availability Zones shared by the subscriptions. + AvailabilityZonePeers *[]AvailabilityZonePeers `json:"availabilityZonePeers,omitempty"` +} + +// MarshalJSON is the custom marshaler for CheckZonePeersResult. +func (czpr CheckZonePeersResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if czpr.Location != nil { + objectMap["location"] = czpr.Location + } + if czpr.AvailabilityZonePeers != nil { + objectMap["availabilityZonePeers"] = czpr.AvailabilityZonePeers + } + return json.Marshal(objectMap) +} + // ErrorDefinition error description and code explaining why resource name is invalid. type ErrorDefinition struct { // Message - Description of the error. @@ -412,6 +460,20 @@ func NewOperationListResultPage(cur OperationListResult, getNextPage func(contex } } +// Peers information about shared availability zone. +type Peers struct { + // SubscriptionID - READ-ONLY; The subscription ID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // AvailabilityZone - READ-ONLY; The availabilityZone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` +} + +// MarshalJSON is the custom marshaler for Peers. +func (p Peers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // Policies subscription policies. type Policies struct { // LocationPlacementID - READ-ONLY; The subscription location placement ID. The ID indicates which regions are visible for a subscription. For example, a subscription with a location placement Id of Public_2014-09-01 has access to Azure public regions. diff --git a/services/resources/mgmt/2016-06-01/subscriptions/subscriptions.go b/services/resources/mgmt/2016-06-01/subscriptions/subscriptions.go index 7234bf3af4c1..6c654387f8f7 100644 --- a/services/resources/mgmt/2016-06-01/subscriptions/subscriptions.go +++ b/services/resources/mgmt/2016-06-01/subscriptions/subscriptions.go @@ -32,6 +32,82 @@ func NewClientWithBaseURI(baseURI string) Client { return Client{NewWithBaseURI(baseURI)} } +// CheckZonePeers compares a subscriptions logical zone mapping +// Parameters: +// subscriptionID - the ID of the target subscription. +// parameters - parameters for checking zone peers. +func (client Client) CheckZonePeers(ctx context.Context, subscriptionID string, parameters CheckZonePeersRequest) (result CheckZonePeersResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckZonePeers") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CheckZonePeersPreparer(ctx, subscriptionID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", nil, "Failure preparing request") + return + } + + resp, err := client.CheckZonePeersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", resp, "Failure sending request") + return + } + + result, err = client.CheckZonePeersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", resp, "Failure responding to request") + return + } + + return +} + +// CheckZonePeersPreparer prepares the CheckZonePeers request. +func (client Client) CheckZonePeersPreparer(ctx context.Context, subscriptionID string, parameters CheckZonePeersRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", subscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/checkZonePeers/", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckZonePeersSender sends the CheckZonePeers request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CheckZonePeersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckZonePeersResponder handles the response to the CheckZonePeers request. The method always +// closes the http.Response Body. +func (client Client) CheckZonePeersResponder(resp *http.Response) (result CheckZonePeersResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Get gets details about a specified subscription. // Parameters: // subscriptionID - the ID of the target subscription. diff --git a/services/resources/mgmt/2016-06-01/subscriptions/subscriptionsapi/interfaces.go b/services/resources/mgmt/2016-06-01/subscriptions/subscriptionsapi/interfaces.go index 532a3c68766c..3015ba0c8c4d 100644 --- a/services/resources/mgmt/2016-06-01/subscriptions/subscriptionsapi/interfaces.go +++ b/services/resources/mgmt/2016-06-01/subscriptions/subscriptionsapi/interfaces.go @@ -28,6 +28,7 @@ var _ OperationsClientAPI = (*subscriptions.OperationsClient)(nil) // ClientAPI contains the set of methods on the Client type. type ClientAPI interface { + CheckZonePeers(ctx context.Context, subscriptionID string, parameters subscriptions.CheckZonePeersRequest) (result subscriptions.CheckZonePeersResult, err error) Get(ctx context.Context, subscriptionID string) (result subscriptions.Subscription, err error) List(ctx context.Context) (result subscriptions.ListResultPage, err error) ListComplete(ctx context.Context) (result subscriptions.ListResultIterator, err error) diff --git a/services/resources/mgmt/2016-07-01/resources/CHANGELOG.md b/services/resources/mgmt/2016-07-01/resources/CHANGELOG.md index 52911e4cc5e4..ffb6c24a900d 100644 --- a/services/resources/mgmt/2016-07-01/resources/CHANGELOG.md +++ b/services/resources/mgmt/2016-07-01/resources/CHANGELOG.md @@ -1,2 +1,18 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. DeploymentPropertiesExtended.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. ZoneMapping + +#### New Struct Fields + +1. DeploymentPropertiesExtended.Error +1. ProviderResourceType.ZoneMappings diff --git a/services/resources/mgmt/2016-07-01/resources/_meta.json b/services/resources/mgmt/2016-07-01/resources/_meta.json index 10ab4f319f6b..f0359fd675d2 100644 --- a/services/resources/mgmt/2016-07-01/resources/_meta.json +++ b/services/resources/mgmt/2016-07-01/resources/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-resources-2016-07", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2016-07-01/resources/models.go b/services/resources/mgmt/2016-07-01/resources/models.go index a7d8a4f63a7f..a698104da45a 100644 --- a/services/resources/mgmt/2016-07-01/resources/models.go +++ b/services/resources/mgmt/2016-07-01/resources/models.go @@ -503,6 +503,50 @@ type DeploymentPropertiesExtended struct { Mode DeploymentMode `json:"mode,omitempty"` // DebugSetting - The debug setting of the deployment. DebugSetting *DebugSetting `json:"debugSetting,omitempty"` + // Error - READ-ONLY; The deployment error. + Error *ErrorResponse `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentPropertiesExtended. +func (dpe DeploymentPropertiesExtended) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dpe.ProvisioningState != nil { + objectMap["provisioningState"] = dpe.ProvisioningState + } + if dpe.CorrelationID != nil { + objectMap["correlationId"] = dpe.CorrelationID + } + if dpe.Timestamp != nil { + objectMap["timestamp"] = dpe.Timestamp + } + if dpe.Outputs != nil { + objectMap["outputs"] = dpe.Outputs + } + if dpe.Providers != nil { + objectMap["providers"] = dpe.Providers + } + if dpe.Dependencies != nil { + objectMap["dependencies"] = dpe.Dependencies + } + if dpe.Template != nil { + objectMap["template"] = dpe.Template + } + if dpe.TemplateLink != nil { + objectMap["templateLink"] = dpe.TemplateLink + } + if dpe.Parameters != nil { + objectMap["parameters"] = dpe.Parameters + } + if dpe.ParametersLink != nil { + objectMap["parametersLink"] = dpe.ParametersLink + } + if dpe.Mode != "" { + objectMap["mode"] = dpe.Mode + } + if dpe.DebugSetting != nil { + objectMap["debugSetting"] = dpe.DebugSetting + } + return json.Marshal(objectMap) } // DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a @@ -1478,7 +1522,8 @@ type ProviderResourceType struct { // Aliases - The aliases that are supported by this resource type. Aliases *[]AliasType `json:"aliases,omitempty"` // APIVersions - The api version. - APIVersions *[]string `json:"apiVersions,omitempty"` + APIVersions *[]string `json:"apiVersions,omitempty"` + ZoneMappings *[]ZoneMapping `json:"zoneMappings,omitempty"` // Properties - The properties. Properties map[string]*string `json:"properties"` } @@ -1498,6 +1543,9 @@ func (prt ProviderResourceType) MarshalJSON() ([]byte, error) { if prt.APIVersions != nil { objectMap["apiVersions"] = prt.APIVersions } + if prt.ZoneMappings != nil { + objectMap["zoneMappings"] = prt.ZoneMappings + } if prt.Properties != nil { objectMap["properties"] = prt.Properties } @@ -1839,3 +1887,10 @@ func (future *UpdateFuture) result(client Client) (gr GenericResource, err error } return } + +// ZoneMapping ... +type ZoneMapping struct { + // Location - The location of the zone mapping. + Location *string `json:"location,omitempty"` + Zones *[]string `json:"zones,omitempty"` +} diff --git a/services/resources/mgmt/2016-07-01/resources/resources.go b/services/resources/mgmt/2016-07-01/resources/resources.go index 1846ddbf9450..0382596e1c59 100644 --- a/services/resources/mgmt/2016-07-01/resources/resources.go +++ b/services/resources/mgmt/2016-07-01/resources/resources.go @@ -397,7 +397,7 @@ func (client Client) GetResponder(resp *http.Response) (result GenericResource, // filter - the filter to apply on the operation. // expand - comma-separated list of additional properties to be included in the response. Valid values include // `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. -// top - query parameters. If null is passed returns all resource groups. +// top - the number of results to return. If null is passed, returns all resources. func (client Client) List(ctx context.Context, filter string, expand string, top *int32) (result ListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") diff --git a/services/resources/mgmt/2016-09-01/links/CHANGELOG.md b/services/resources/mgmt/2016-09-01/links/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/resources/mgmt/2016-09-01/links/CHANGELOG.md +++ b/services/resources/mgmt/2016-09-01/links/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/resources/mgmt/2016-09-01/links/_meta.json b/services/resources/mgmt/2016-09-01/links/_meta.json index c14646f5c43c..00a6224f0572 100644 --- a/services/resources/mgmt/2016-09-01/links/_meta.json +++ b/services/resources/mgmt/2016-09-01/links/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-links-2016-09", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2016-09-01/locks/CHANGELOG.md b/services/resources/mgmt/2016-09-01/locks/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/resources/mgmt/2016-09-01/locks/CHANGELOG.md +++ b/services/resources/mgmt/2016-09-01/locks/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/resources/mgmt/2016-09-01/locks/_meta.json b/services/resources/mgmt/2016-09-01/locks/_meta.json index 961e9e652911..7695ff6681d1 100644 --- a/services/resources/mgmt/2016-09-01/locks/_meta.json +++ b/services/resources/mgmt/2016-09-01/locks/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-locks-2016-09", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2016-09-01/resources/CHANGELOG.md b/services/resources/mgmt/2016-09-01/resources/CHANGELOG.md index 52911e4cc5e4..5529dc3fe034 100644 --- a/services/resources/mgmt/2016-09-01/resources/CHANGELOG.md +++ b/services/resources/mgmt/2016-09-01/resources/CHANGELOG.md @@ -1,2 +1,14 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Structs + +1. ZoneMapping + +#### New Struct Fields + +1. DeploymentPropertiesExtended.Error +1. ProviderResourceType.ZoneMappings diff --git a/services/resources/mgmt/2016-09-01/resources/_meta.json b/services/resources/mgmt/2016-09-01/resources/_meta.json index ff6ce58e2e4a..7498a0a01d2e 100644 --- a/services/resources/mgmt/2016-09-01/resources/_meta.json +++ b/services/resources/mgmt/2016-09-01/resources/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-resources-2016-09", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2016-09-01/resources/models.go b/services/resources/mgmt/2016-09-01/resources/models.go index a8abc105c7ab..9600eea3f04f 100644 --- a/services/resources/mgmt/2016-09-01/resources/models.go +++ b/services/resources/mgmt/2016-09-01/resources/models.go @@ -694,6 +694,8 @@ type DeploymentPropertiesExtended struct { Mode DeploymentMode `json:"mode,omitempty"` // DebugSetting - The debug setting of the deployment. DebugSetting *DebugSetting `json:"debugSetting,omitempty"` + // Error - READ-ONLY; The deployment error. + Error *ErrorResponse `json:"error,omitempty"` } // MarshalJSON is the custom marshaler for DeploymentPropertiesExtended. @@ -1749,7 +1751,8 @@ type ProviderResourceType struct { // Aliases - The aliases that are supported by this resource type. Aliases *[]AliasType `json:"aliases,omitempty"` // APIVersions - The API version. - APIVersions *[]string `json:"apiVersions,omitempty"` + APIVersions *[]string `json:"apiVersions,omitempty"` + ZoneMappings *[]ZoneMapping `json:"zoneMappings,omitempty"` // Properties - The properties. Properties map[string]*string `json:"properties"` } @@ -1769,6 +1772,9 @@ func (prt ProviderResourceType) MarshalJSON() ([]byte, error) { if prt.APIVersions != nil { objectMap["apiVersions"] = prt.APIVersions } + if prt.ZoneMappings != nil { + objectMap["zoneMappings"] = prt.ZoneMappings + } if prt.Properties != nil { objectMap["properties"] = prt.Properties } @@ -2161,3 +2167,10 @@ func (future *UpdateFuture) result(client Client) (gr GenericResource, err error } return } + +// ZoneMapping ... +type ZoneMapping struct { + // Location - The location of the zone mapping. + Location *string `json:"location,omitempty"` + Zones *[]string `json:"zones,omitempty"` +} diff --git a/services/resources/mgmt/2016-09-01/resources/resources.go b/services/resources/mgmt/2016-09-01/resources/resources.go index 5f5a936ff5ec..b461f08a2cf2 100644 --- a/services/resources/mgmt/2016-09-01/resources/resources.go +++ b/services/resources/mgmt/2016-09-01/resources/resources.go @@ -723,7 +723,7 @@ func (client Client) GetByIDResponder(resp *http.Response) (result GenericResour // filter - the filter to apply on the operation. // expand - comma-separated list of additional properties to be included in the response. Valid values include // `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. -// top - the number of results to return. If null is passed, returns all resource groups. +// top - the number of results to return. If null is passed, returns all resources. func (client Client) List(ctx context.Context, filter string, expand string, top *int32) (result ListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") diff --git a/services/resources/mgmt/2016-12-01/policy/CHANGELOG.md b/services/resources/mgmt/2016-12-01/policy/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/resources/mgmt/2016-12-01/policy/CHANGELOG.md +++ b/services/resources/mgmt/2016-12-01/policy/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/resources/mgmt/2016-12-01/policy/_meta.json b/services/resources/mgmt/2016-12-01/policy/_meta.json index 9862d68bc9a0..f62df6c6893b 100644 --- a/services/resources/mgmt/2016-12-01/policy/_meta.json +++ b/services/resources/mgmt/2016-12-01/policy/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-policy-2016-12", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2017-05-10/resources/CHANGELOG.md b/services/resources/mgmt/2017-05-10/resources/CHANGELOG.md index 52911e4cc5e4..5529dc3fe034 100644 --- a/services/resources/mgmt/2017-05-10/resources/CHANGELOG.md +++ b/services/resources/mgmt/2017-05-10/resources/CHANGELOG.md @@ -1,2 +1,14 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Structs + +1. ZoneMapping + +#### New Struct Fields + +1. DeploymentPropertiesExtended.Error +1. ProviderResourceType.ZoneMappings diff --git a/services/resources/mgmt/2017-05-10/resources/_meta.json b/services/resources/mgmt/2017-05-10/resources/_meta.json index a8b691021c24..04b652196a24 100644 --- a/services/resources/mgmt/2017-05-10/resources/_meta.json +++ b/services/resources/mgmt/2017-05-10/resources/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-resources-2017-05", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2017-05-10/resources/models.go b/services/resources/mgmt/2017-05-10/resources/models.go index 8e3362fcb178..b1fc625ae48f 100644 --- a/services/resources/mgmt/2017-05-10/resources/models.go +++ b/services/resources/mgmt/2017-05-10/resources/models.go @@ -694,6 +694,8 @@ type DeploymentPropertiesExtended struct { Mode DeploymentMode `json:"mode,omitempty"` // DebugSetting - The debug setting of the deployment. DebugSetting *DebugSetting `json:"debugSetting,omitempty"` + // Error - READ-ONLY; The deployment error. + Error *ErrorResponse `json:"error,omitempty"` } // MarshalJSON is the custom marshaler for DeploymentPropertiesExtended. @@ -1780,7 +1782,8 @@ type ProviderResourceType struct { // Aliases - The aliases that are supported by this resource type. Aliases *[]AliasType `json:"aliases,omitempty"` // APIVersions - The API version. - APIVersions *[]string `json:"apiVersions,omitempty"` + APIVersions *[]string `json:"apiVersions,omitempty"` + ZoneMappings *[]ZoneMapping `json:"zoneMappings,omitempty"` // Properties - The properties. Properties map[string]*string `json:"properties"` } @@ -1800,6 +1803,9 @@ func (prt ProviderResourceType) MarshalJSON() ([]byte, error) { if prt.APIVersions != nil { objectMap["apiVersions"] = prt.APIVersions } + if prt.ZoneMappings != nil { + objectMap["zoneMappings"] = prt.ZoneMappings + } if prt.Properties != nil { objectMap["properties"] = prt.Properties } @@ -2229,3 +2235,10 @@ func (future *ValidateMoveResourcesFuture) result(client Client) (ar autorest.Re ar.Response = future.Response() return } + +// ZoneMapping ... +type ZoneMapping struct { + // Location - The location of the zone mapping. + Location *string `json:"location,omitempty"` + Zones *[]string `json:"zones,omitempty"` +} diff --git a/services/resources/mgmt/2017-05-10/resources/resources.go b/services/resources/mgmt/2017-05-10/resources/resources.go index da0d1f493d6e..d5f0abbe334d 100644 --- a/services/resources/mgmt/2017-05-10/resources/resources.go +++ b/services/resources/mgmt/2017-05-10/resources/resources.go @@ -723,7 +723,7 @@ func (client Client) GetByIDResponder(resp *http.Response) (result GenericResour // filter - the filter to apply on the operation. // expand - comma-separated list of additional properties to be included in the response. Valid values include // `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. -// top - the number of results to return. If null is passed, returns all resource groups. +// top - the number of results to return. If null is passed, returns all resources. func (client Client) List(ctx context.Context, filter string, expand string, top *int32) (result ListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") diff --git a/services/resources/mgmt/2017-09-01/managedapplications/CHANGELOG.md b/services/resources/mgmt/2017-09-01/managedapplications/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/resources/mgmt/2017-09-01/managedapplications/CHANGELOG.md +++ b/services/resources/mgmt/2017-09-01/managedapplications/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/resources/mgmt/2017-09-01/managedapplications/_meta.json b/services/resources/mgmt/2017-09-01/managedapplications/_meta.json index 0540a6d5d981..59b4766458ee 100644 --- a/services/resources/mgmt/2017-09-01/managedapplications/_meta.json +++ b/services/resources/mgmt/2017-09-01/managedapplications/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-managedapplications-2017-09", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2018-02-01/resources/CHANGELOG.md b/services/resources/mgmt/2018-02-01/resources/CHANGELOG.md index 52911e4cc5e4..5529dc3fe034 100644 --- a/services/resources/mgmt/2018-02-01/resources/CHANGELOG.md +++ b/services/resources/mgmt/2018-02-01/resources/CHANGELOG.md @@ -1,2 +1,14 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Structs + +1. ZoneMapping + +#### New Struct Fields + +1. DeploymentPropertiesExtended.Error +1. ProviderResourceType.ZoneMappings diff --git a/services/resources/mgmt/2018-02-01/resources/_meta.json b/services/resources/mgmt/2018-02-01/resources/_meta.json index 44a402b64653..8f7020c3177c 100644 --- a/services/resources/mgmt/2018-02-01/resources/_meta.json +++ b/services/resources/mgmt/2018-02-01/resources/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-resources-2018-02", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2018-02-01/resources/models.go b/services/resources/mgmt/2018-02-01/resources/models.go index 8c8e6979ba32..4223a8233b57 100644 --- a/services/resources/mgmt/2018-02-01/resources/models.go +++ b/services/resources/mgmt/2018-02-01/resources/models.go @@ -698,6 +698,8 @@ type DeploymentPropertiesExtended struct { DebugSetting *DebugSetting `json:"debugSetting,omitempty"` // OnErrorDeployment - The deployment on error behavior. OnErrorDeployment *OnErrorDeploymentExtended `json:"onErrorDeployment,omitempty"` + // Error - READ-ONLY; The deployment error. + Error *ErrorResponse `json:"error,omitempty"` } // MarshalJSON is the custom marshaler for DeploymentPropertiesExtended. @@ -1817,7 +1819,8 @@ type ProviderResourceType struct { // Aliases - The aliases that are supported by this resource type. Aliases *[]AliasType `json:"aliases,omitempty"` // APIVersions - The API version. - APIVersions *[]string `json:"apiVersions,omitempty"` + APIVersions *[]string `json:"apiVersions,omitempty"` + ZoneMappings *[]ZoneMapping `json:"zoneMappings,omitempty"` // Properties - The properties. Properties map[string]*string `json:"properties"` } @@ -1837,6 +1840,9 @@ func (prt ProviderResourceType) MarshalJSON() ([]byte, error) { if prt.APIVersions != nil { objectMap["apiVersions"] = prt.APIVersions } + if prt.ZoneMappings != nil { + objectMap["zoneMappings"] = prt.ZoneMappings + } if prt.Properties != nil { objectMap["properties"] = prt.Properties } @@ -2266,3 +2272,10 @@ func (future *ValidateMoveResourcesFuture) result(client Client) (ar autorest.Re ar.Response = future.Response() return } + +// ZoneMapping ... +type ZoneMapping struct { + // Location - The location of the zone mapping. + Location *string `json:"location,omitempty"` + Zones *[]string `json:"zones,omitempty"` +} diff --git a/services/resources/mgmt/2018-02-01/resources/resources.go b/services/resources/mgmt/2018-02-01/resources/resources.go index 22adfe5084f0..b588547d59d4 100644 --- a/services/resources/mgmt/2018-02-01/resources/resources.go +++ b/services/resources/mgmt/2018-02-01/resources/resources.go @@ -722,7 +722,7 @@ func (client Client) GetByIDResponder(resp *http.Response) (result GenericResour // Parameters: // filter - the filter to apply on the operation. // expand - the $expand query parameter. -// top - the number of results to return. If null is passed, returns all resource groups. +// top - the number of results to return. If null is passed, returns all resources. func (client Client) List(ctx context.Context, filter string, expand string, top *int32) (result ListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") diff --git a/services/resources/mgmt/2018-03-01/policy/CHANGELOG.md b/services/resources/mgmt/2018-03-01/policy/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/resources/mgmt/2018-03-01/policy/CHANGELOG.md +++ b/services/resources/mgmt/2018-03-01/policy/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/resources/mgmt/2018-03-01/policy/_meta.json b/services/resources/mgmt/2018-03-01/policy/_meta.json index ffadef182f83..425f2c98f032 100644 --- a/services/resources/mgmt/2018-03-01/policy/_meta.json +++ b/services/resources/mgmt/2018-03-01/policy/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-policy-2018-03", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2018-05-01/policy/CHANGELOG.md b/services/resources/mgmt/2018-05-01/policy/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/resources/mgmt/2018-05-01/policy/CHANGELOG.md +++ b/services/resources/mgmt/2018-05-01/policy/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/resources/mgmt/2018-05-01/policy/_meta.json b/services/resources/mgmt/2018-05-01/policy/_meta.json index 1297fe7eb64e..c5811058efa4 100644 --- a/services/resources/mgmt/2018-05-01/policy/_meta.json +++ b/services/resources/mgmt/2018-05-01/policy/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-policy-2018-05", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2018-05-01/resources/CHANGELOG.md b/services/resources/mgmt/2018-05-01/resources/CHANGELOG.md index 52911e4cc5e4..5529dc3fe034 100644 --- a/services/resources/mgmt/2018-05-01/resources/CHANGELOG.md +++ b/services/resources/mgmt/2018-05-01/resources/CHANGELOG.md @@ -1,2 +1,14 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Structs + +1. ZoneMapping + +#### New Struct Fields + +1. DeploymentPropertiesExtended.Error +1. ProviderResourceType.ZoneMappings diff --git a/services/resources/mgmt/2018-05-01/resources/_meta.json b/services/resources/mgmt/2018-05-01/resources/_meta.json index d93378dba183..a48d95ee567d 100644 --- a/services/resources/mgmt/2018-05-01/resources/_meta.json +++ b/services/resources/mgmt/2018-05-01/resources/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-resources-2018-05", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2018-05-01/resources/models.go b/services/resources/mgmt/2018-05-01/resources/models.go index 1de7478600bb..29b75c30861f 100644 --- a/services/resources/mgmt/2018-05-01/resources/models.go +++ b/services/resources/mgmt/2018-05-01/resources/models.go @@ -704,6 +704,8 @@ type DeploymentPropertiesExtended struct { DebugSetting *DebugSetting `json:"debugSetting,omitempty"` // OnErrorDeployment - The deployment on error behavior. OnErrorDeployment *OnErrorDeploymentExtended `json:"onErrorDeployment,omitempty"` + // Error - READ-ONLY; The deployment error. + Error *ErrorResponse `json:"error,omitempty"` } // MarshalJSON is the custom marshaler for DeploymentPropertiesExtended. @@ -2101,7 +2103,8 @@ type ProviderResourceType struct { // Aliases - The aliases that are supported by this resource type. Aliases *[]AliasType `json:"aliases,omitempty"` // APIVersions - The API version. - APIVersions *[]string `json:"apiVersions,omitempty"` + APIVersions *[]string `json:"apiVersions,omitempty"` + ZoneMappings *[]ZoneMapping `json:"zoneMappings,omitempty"` // Properties - The properties. Properties map[string]*string `json:"properties"` } @@ -2121,6 +2124,9 @@ func (prt ProviderResourceType) MarshalJSON() ([]byte, error) { if prt.APIVersions != nil { objectMap["apiVersions"] = prt.APIVersions } + if prt.ZoneMappings != nil { + objectMap["zoneMappings"] = prt.ZoneMappings + } if prt.Properties != nil { objectMap["properties"] = prt.Properties } @@ -2550,3 +2556,10 @@ func (future *ValidateMoveResourcesFuture) result(client Client) (ar autorest.Re ar.Response = future.Response() return } + +// ZoneMapping ... +type ZoneMapping struct { + // Location - The location of the zone mapping. + Location *string `json:"location,omitempty"` + Zones *[]string `json:"zones,omitempty"` +} diff --git a/services/resources/mgmt/2018-05-01/resources/resources.go b/services/resources/mgmt/2018-05-01/resources/resources.go index 0edce8e6444c..3071fcc91c85 100644 --- a/services/resources/mgmt/2018-05-01/resources/resources.go +++ b/services/resources/mgmt/2018-05-01/resources/resources.go @@ -733,7 +733,7 @@ func (client Client) GetByIDResponder(resp *http.Response) (result GenericResour // plan/name, identity and identity/principalId. // expand - comma-separated list of additional properties to be included in the response. Valid values include // `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. -// top - the number of results to return. If null is passed, returns all resource groups. +// top - the number of results to return. If null is passed, returns all resources. func (client Client) List(ctx context.Context, filter string, expand string, top *int32) (result ListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") diff --git a/services/resources/mgmt/2018-06-01/managedapplications/CHANGELOG.md b/services/resources/mgmt/2018-06-01/managedapplications/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/resources/mgmt/2018-06-01/managedapplications/CHANGELOG.md +++ b/services/resources/mgmt/2018-06-01/managedapplications/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/resources/mgmt/2018-06-01/managedapplications/_meta.json b/services/resources/mgmt/2018-06-01/managedapplications/_meta.json index d7778529f39f..45942ba5e2a7 100644 --- a/services/resources/mgmt/2018-06-01/managedapplications/_meta.json +++ b/services/resources/mgmt/2018-06-01/managedapplications/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-managedapplications-2018-06", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2018-06-01/subscriptions/CHANGELOG.md b/services/resources/mgmt/2018-06-01/subscriptions/CHANGELOG.md index 52911e4cc5e4..f1bd42c15475 100644 --- a/services/resources/mgmt/2018-06-01/subscriptions/CHANGELOG.md +++ b/services/resources/mgmt/2018-06-01/subscriptions/CHANGELOG.md @@ -1,2 +1,22 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. AvailabilityZonePeers.MarshalJSON() ([]byte, error) +1. CheckZonePeersResult.MarshalJSON() ([]byte, error) +1. Client.CheckZonePeers(context.Context, string, CheckZonePeersRequest) (CheckZonePeersResult, error) +1. Client.CheckZonePeersPreparer(context.Context, string, CheckZonePeersRequest) (*http.Request, error) +1. Client.CheckZonePeersResponder(*http.Response) (CheckZonePeersResult, error) +1. Client.CheckZonePeersSender(*http.Request) (*http.Response, error) +1. Peers.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. AvailabilityZonePeers +1. CheckZonePeersRequest +1. CheckZonePeersResult +1. Peers diff --git a/services/resources/mgmt/2018-06-01/subscriptions/_meta.json b/services/resources/mgmt/2018-06-01/subscriptions/_meta.json index 7c50bbd13ac7..e1c7b8cbfe8c 100644 --- a/services/resources/mgmt/2018-06-01/subscriptions/_meta.json +++ b/services/resources/mgmt/2018-06-01/subscriptions/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-subscriptions-2018-06", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2018-06-01/subscriptions/models.go b/services/resources/mgmt/2018-06-01/subscriptions/models.go index f208562725ea..453bebd34bce 100644 --- a/services/resources/mgmt/2018-06-01/subscriptions/models.go +++ b/services/resources/mgmt/2018-06-01/subscriptions/models.go @@ -18,6 +18,23 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions" +// AvailabilityZonePeers list of availability zones shared by the subscriptions. +type AvailabilityZonePeers struct { + // AvailabilityZone - READ-ONLY; The availabilityZone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` + // Peers - Details of shared availability zone. + Peers *[]Peers `json:"peers,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvailabilityZonePeers. +func (azp AvailabilityZonePeers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if azp.Peers != nil { + objectMap["peers"] = azp.Peers + } + return json.Marshal(objectMap) +} + // CheckResourceNameResult resource Name valid if not a reserved word, does not contain a reserved word and // does not start with a reserved word type CheckResourceNameResult struct { @@ -30,6 +47,37 @@ type CheckResourceNameResult struct { Status ResourceNameStatus `json:"status,omitempty"` } +// CheckZonePeersRequest check zone peers request parameters. +type CheckZonePeersRequest struct { + // Location - The Microsoft location. + Location *string `json:"location,omitempty"` + // SubscriptionIds - The peer Microsoft Azure subscription ID. + SubscriptionIds *[]string `json:"subscriptionIds,omitempty"` +} + +// CheckZonePeersResult result of the Check zone peers operation. +type CheckZonePeersResult struct { + autorest.Response `json:"-"` + // SubscriptionID - READ-ONLY; The subscription ID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // Location - the location of the subscription. + Location *string `json:"location,omitempty"` + // AvailabilityZonePeers - The Availability Zones shared by the subscriptions. + AvailabilityZonePeers *[]AvailabilityZonePeers `json:"availabilityZonePeers,omitempty"` +} + +// MarshalJSON is the custom marshaler for CheckZonePeersResult. +func (czpr CheckZonePeersResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if czpr.Location != nil { + objectMap["location"] = czpr.Location + } + if czpr.AvailabilityZonePeers != nil { + objectMap["availabilityZonePeers"] = czpr.AvailabilityZonePeers + } + return json.Marshal(objectMap) +} + // ErrorDefinition error description and code explaining why resource name is invalid. type ErrorDefinition struct { // Message - Description of the error. @@ -412,6 +460,20 @@ func NewOperationListResultPage(cur OperationListResult, getNextPage func(contex } } +// Peers information about shared availability zone. +type Peers struct { + // SubscriptionID - READ-ONLY; The subscription ID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // AvailabilityZone - READ-ONLY; The availabilityZone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` +} + +// MarshalJSON is the custom marshaler for Peers. +func (p Peers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // Policies subscription policies. type Policies struct { // LocationPlacementID - READ-ONLY; The subscription location placement ID. The ID indicates which regions are visible for a subscription. For example, a subscription with a location placement Id of Public_2014-09-01 has access to Azure public regions. diff --git a/services/resources/mgmt/2018-06-01/subscriptions/subscriptions.go b/services/resources/mgmt/2018-06-01/subscriptions/subscriptions.go index 6ff80e20e0cc..f76b4dd1b14b 100644 --- a/services/resources/mgmt/2018-06-01/subscriptions/subscriptions.go +++ b/services/resources/mgmt/2018-06-01/subscriptions/subscriptions.go @@ -32,6 +32,82 @@ func NewClientWithBaseURI(baseURI string) Client { return Client{NewWithBaseURI(baseURI)} } +// CheckZonePeers compares a subscriptions logical zone mapping +// Parameters: +// subscriptionID - the ID of the target subscription. +// parameters - parameters for checking zone peers. +func (client Client) CheckZonePeers(ctx context.Context, subscriptionID string, parameters CheckZonePeersRequest) (result CheckZonePeersResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckZonePeers") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CheckZonePeersPreparer(ctx, subscriptionID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", nil, "Failure preparing request") + return + } + + resp, err := client.CheckZonePeersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", resp, "Failure sending request") + return + } + + result, err = client.CheckZonePeersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", resp, "Failure responding to request") + return + } + + return +} + +// CheckZonePeersPreparer prepares the CheckZonePeers request. +func (client Client) CheckZonePeersPreparer(ctx context.Context, subscriptionID string, parameters CheckZonePeersRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", subscriptionID), + } + + const APIVersion = "2018-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/checkZonePeers/", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckZonePeersSender sends the CheckZonePeers request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CheckZonePeersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckZonePeersResponder handles the response to the CheckZonePeers request. The method always +// closes the http.Response Body. +func (client Client) CheckZonePeersResponder(resp *http.Response) (result CheckZonePeersResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Get gets details about a specified subscription. // Parameters: // subscriptionID - the ID of the target subscription. diff --git a/services/resources/mgmt/2018-06-01/subscriptions/subscriptionsapi/interfaces.go b/services/resources/mgmt/2018-06-01/subscriptions/subscriptionsapi/interfaces.go index cb019e0ad20e..4af51056e029 100644 --- a/services/resources/mgmt/2018-06-01/subscriptions/subscriptionsapi/interfaces.go +++ b/services/resources/mgmt/2018-06-01/subscriptions/subscriptionsapi/interfaces.go @@ -28,6 +28,7 @@ var _ OperationsClientAPI = (*subscriptions.OperationsClient)(nil) // ClientAPI contains the set of methods on the Client type. type ClientAPI interface { + CheckZonePeers(ctx context.Context, subscriptionID string, parameters subscriptions.CheckZonePeersRequest) (result subscriptions.CheckZonePeersResult, err error) Get(ctx context.Context, subscriptionID string) (result subscriptions.Subscription, err error) List(ctx context.Context) (result subscriptions.ListResultPage, err error) ListComplete(ctx context.Context) (result subscriptions.ListResultIterator, err error) diff --git a/services/resources/mgmt/2019-01-01/policy/CHANGELOG.md b/services/resources/mgmt/2019-01-01/policy/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/resources/mgmt/2019-01-01/policy/CHANGELOG.md +++ b/services/resources/mgmt/2019-01-01/policy/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/resources/mgmt/2019-01-01/policy/_meta.json b/services/resources/mgmt/2019-01-01/policy/_meta.json index dd76a7a32750..457d64535fbe 100644 --- a/services/resources/mgmt/2019-01-01/policy/_meta.json +++ b/services/resources/mgmt/2019-01-01/policy/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-policy-2019-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2019-03-01/resources/CHANGELOG.md b/services/resources/mgmt/2019-03-01/resources/CHANGELOG.md index 52911e4cc5e4..5529dc3fe034 100644 --- a/services/resources/mgmt/2019-03-01/resources/CHANGELOG.md +++ b/services/resources/mgmt/2019-03-01/resources/CHANGELOG.md @@ -1,2 +1,14 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Structs + +1. ZoneMapping + +#### New Struct Fields + +1. DeploymentPropertiesExtended.Error +1. ProviderResourceType.ZoneMappings diff --git a/services/resources/mgmt/2019-03-01/resources/_meta.json b/services/resources/mgmt/2019-03-01/resources/_meta.json index 97e879386be6..efc1b97ef4fd 100644 --- a/services/resources/mgmt/2019-03-01/resources/_meta.json +++ b/services/resources/mgmt/2019-03-01/resources/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-resources-2019-03", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2019-03-01/resources/models.go b/services/resources/mgmt/2019-03-01/resources/models.go index 54eb7e61a2d7..bd27eabf3c6e 100644 --- a/services/resources/mgmt/2019-03-01/resources/models.go +++ b/services/resources/mgmt/2019-03-01/resources/models.go @@ -704,6 +704,8 @@ type DeploymentPropertiesExtended struct { DebugSetting *DebugSetting `json:"debugSetting,omitempty"` // OnErrorDeployment - The deployment on error behavior. OnErrorDeployment *OnErrorDeploymentExtended `json:"onErrorDeployment,omitempty"` + // Error - READ-ONLY; The deployment error. + Error *ErrorResponse `json:"error,omitempty"` } // MarshalJSON is the custom marshaler for DeploymentPropertiesExtended. @@ -2103,7 +2105,8 @@ type ProviderResourceType struct { // Aliases - The aliases that are supported by this resource type. Aliases *[]AliasType `json:"aliases,omitempty"` // APIVersions - The API version. - APIVersions *[]string `json:"apiVersions,omitempty"` + APIVersions *[]string `json:"apiVersions,omitempty"` + ZoneMappings *[]ZoneMapping `json:"zoneMappings,omitempty"` // Capabilities - The additional capabilities offered by this resource type. Capabilities *string `json:"capabilities,omitempty"` // Properties - The properties. @@ -2125,6 +2128,9 @@ func (prt ProviderResourceType) MarshalJSON() ([]byte, error) { if prt.APIVersions != nil { objectMap["apiVersions"] = prt.APIVersions } + if prt.ZoneMappings != nil { + objectMap["zoneMappings"] = prt.ZoneMappings + } if prt.Capabilities != nil { objectMap["capabilities"] = prt.Capabilities } @@ -2557,3 +2563,10 @@ func (future *ValidateMoveResourcesFuture) result(client Client) (ar autorest.Re ar.Response = future.Response() return } + +// ZoneMapping ... +type ZoneMapping struct { + // Location - The location of the zone mapping. + Location *string `json:"location,omitempty"` + Zones *[]string `json:"zones,omitempty"` +} diff --git a/services/resources/mgmt/2019-03-01/resources/resources.go b/services/resources/mgmt/2019-03-01/resources/resources.go index 542cd324c902..69aae514890b 100644 --- a/services/resources/mgmt/2019-03-01/resources/resources.go +++ b/services/resources/mgmt/2019-03-01/resources/resources.go @@ -733,7 +733,7 @@ func (client Client) GetByIDResponder(resp *http.Response) (result GenericResour // plan/name, identity and identity/principalId. // expand - comma-separated list of additional properties to be included in the response. Valid values include // `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. -// top - the number of results to return. If null is passed, returns all resource groups. +// top - the number of results to return. If null is passed, returns all resources. func (client Client) List(ctx context.Context, filter string, expand string, top *int32) (result ListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") diff --git a/services/resources/mgmt/2019-05-01/resources/CHANGELOG.md b/services/resources/mgmt/2019-05-01/resources/CHANGELOG.md index 52911e4cc5e4..5529dc3fe034 100644 --- a/services/resources/mgmt/2019-05-01/resources/CHANGELOG.md +++ b/services/resources/mgmt/2019-05-01/resources/CHANGELOG.md @@ -1,2 +1,14 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Structs + +1. ZoneMapping + +#### New Struct Fields + +1. DeploymentPropertiesExtended.Error +1. ProviderResourceType.ZoneMappings diff --git a/services/resources/mgmt/2019-05-01/resources/_meta.json b/services/resources/mgmt/2019-05-01/resources/_meta.json index 15fe63f8ce44..e0363dbb873f 100644 --- a/services/resources/mgmt/2019-05-01/resources/_meta.json +++ b/services/resources/mgmt/2019-05-01/resources/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-resources-2019-05", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2019-05-01/resources/models.go b/services/resources/mgmt/2019-05-01/resources/models.go index 15973ee3a93a..9f681bb9e110 100644 --- a/services/resources/mgmt/2019-05-01/resources/models.go +++ b/services/resources/mgmt/2019-05-01/resources/models.go @@ -708,6 +708,8 @@ type DeploymentPropertiesExtended struct { DebugSetting *DebugSetting `json:"debugSetting,omitempty"` // OnErrorDeployment - The deployment on error behavior. OnErrorDeployment *OnErrorDeploymentExtended `json:"onErrorDeployment,omitempty"` + // Error - READ-ONLY; The deployment error. + Error *ErrorResponse `json:"error,omitempty"` } // MarshalJSON is the custom marshaler for DeploymentPropertiesExtended. @@ -2189,7 +2191,8 @@ type ProviderResourceType struct { // Aliases - The aliases that are supported by this resource type. Aliases *[]AliasType `json:"aliases,omitempty"` // APIVersions - The API version. - APIVersions *[]string `json:"apiVersions,omitempty"` + APIVersions *[]string `json:"apiVersions,omitempty"` + ZoneMappings *[]ZoneMapping `json:"zoneMappings,omitempty"` // Capabilities - The additional capabilities offered by this resource type. Capabilities *string `json:"capabilities,omitempty"` // Properties - The properties. @@ -2211,6 +2214,9 @@ func (prt ProviderResourceType) MarshalJSON() ([]byte, error) { if prt.APIVersions != nil { objectMap["apiVersions"] = prt.APIVersions } + if prt.ZoneMappings != nil { + objectMap["zoneMappings"] = prt.ZoneMappings + } if prt.Capabilities != nil { objectMap["capabilities"] = prt.Capabilities } @@ -2643,3 +2649,10 @@ func (future *ValidateMoveResourcesFuture) result(client Client) (ar autorest.Re ar.Response = future.Response() return } + +// ZoneMapping ... +type ZoneMapping struct { + // Location - The location of the zone mapping. + Location *string `json:"location,omitempty"` + Zones *[]string `json:"zones,omitempty"` +} diff --git a/services/resources/mgmt/2019-05-01/resources/resources.go b/services/resources/mgmt/2019-05-01/resources/resources.go index 2f3dd09f64a0..79f186fbed23 100644 --- a/services/resources/mgmt/2019-05-01/resources/resources.go +++ b/services/resources/mgmt/2019-05-01/resources/resources.go @@ -733,7 +733,7 @@ func (client Client) GetByIDResponder(resp *http.Response) (result GenericResour // plan/name, identity and identity/principalId. // expand - comma-separated list of additional properties to be included in the response. Valid values include // `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. -// top - the number of results to return. If null is passed, returns all resource groups. +// top - the number of results to return. If null is passed, returns all resources. func (client Client) List(ctx context.Context, filter string, expand string, top *int32) (result ListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") diff --git a/services/resources/mgmt/2019-06-01/policy/CHANGELOG.md b/services/resources/mgmt/2019-06-01/policy/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/resources/mgmt/2019-06-01/policy/CHANGELOG.md +++ b/services/resources/mgmt/2019-06-01/policy/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/resources/mgmt/2019-06-01/policy/_meta.json b/services/resources/mgmt/2019-06-01/policy/_meta.json index 298a7b3bc547..d37542c398f4 100644 --- a/services/resources/mgmt/2019-06-01/policy/_meta.json +++ b/services/resources/mgmt/2019-06-01/policy/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-policy-2019-06", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2019-06-01/subscriptions/CHANGELOG.md b/services/resources/mgmt/2019-06-01/subscriptions/CHANGELOG.md index 52911e4cc5e4..f1bd42c15475 100644 --- a/services/resources/mgmt/2019-06-01/subscriptions/CHANGELOG.md +++ b/services/resources/mgmt/2019-06-01/subscriptions/CHANGELOG.md @@ -1,2 +1,22 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. AvailabilityZonePeers.MarshalJSON() ([]byte, error) +1. CheckZonePeersResult.MarshalJSON() ([]byte, error) +1. Client.CheckZonePeers(context.Context, string, CheckZonePeersRequest) (CheckZonePeersResult, error) +1. Client.CheckZonePeersPreparer(context.Context, string, CheckZonePeersRequest) (*http.Request, error) +1. Client.CheckZonePeersResponder(*http.Response) (CheckZonePeersResult, error) +1. Client.CheckZonePeersSender(*http.Request) (*http.Response, error) +1. Peers.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. AvailabilityZonePeers +1. CheckZonePeersRequest +1. CheckZonePeersResult +1. Peers diff --git a/services/resources/mgmt/2019-06-01/subscriptions/_meta.json b/services/resources/mgmt/2019-06-01/subscriptions/_meta.json index e9a67940d1c6..c3aa066f0e97 100644 --- a/services/resources/mgmt/2019-06-01/subscriptions/_meta.json +++ b/services/resources/mgmt/2019-06-01/subscriptions/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-subscriptions-2019-06", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2019-06-01/subscriptions/models.go b/services/resources/mgmt/2019-06-01/subscriptions/models.go index 2581c9f03424..4d2dbb6a22c6 100644 --- a/services/resources/mgmt/2019-06-01/subscriptions/models.go +++ b/services/resources/mgmt/2019-06-01/subscriptions/models.go @@ -18,6 +18,23 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-06-01/subscriptions" +// AvailabilityZonePeers list of availability zones shared by the subscriptions. +type AvailabilityZonePeers struct { + // AvailabilityZone - READ-ONLY; The availabilityZone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` + // Peers - Details of shared availability zone. + Peers *[]Peers `json:"peers,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvailabilityZonePeers. +func (azp AvailabilityZonePeers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if azp.Peers != nil { + objectMap["peers"] = azp.Peers + } + return json.Marshal(objectMap) +} + // CheckResourceNameResult resource Name valid if not a reserved word, does not contain a reserved word and // does not start with a reserved word type CheckResourceNameResult struct { @@ -30,6 +47,37 @@ type CheckResourceNameResult struct { Status ResourceNameStatus `json:"status,omitempty"` } +// CheckZonePeersRequest check zone peers request parameters. +type CheckZonePeersRequest struct { + // Location - The Microsoft location. + Location *string `json:"location,omitempty"` + // SubscriptionIds - The peer Microsoft Azure subscription ID. + SubscriptionIds *[]string `json:"subscriptionIds,omitempty"` +} + +// CheckZonePeersResult result of the Check zone peers operation. +type CheckZonePeersResult struct { + autorest.Response `json:"-"` + // SubscriptionID - READ-ONLY; The subscription ID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // Location - the location of the subscription. + Location *string `json:"location,omitempty"` + // AvailabilityZonePeers - The Availability Zones shared by the subscriptions. + AvailabilityZonePeers *[]AvailabilityZonePeers `json:"availabilityZonePeers,omitempty"` +} + +// MarshalJSON is the custom marshaler for CheckZonePeersResult. +func (czpr CheckZonePeersResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if czpr.Location != nil { + objectMap["location"] = czpr.Location + } + if czpr.AvailabilityZonePeers != nil { + objectMap["availabilityZonePeers"] = czpr.AvailabilityZonePeers + } + return json.Marshal(objectMap) +} + // ErrorDefinition error description and code explaining why resource name is invalid. type ErrorDefinition struct { // Message - Description of the error. @@ -424,6 +472,20 @@ func NewOperationListResultPage(cur OperationListResult, getNextPage func(contex } } +// Peers information about shared availability zone. +type Peers struct { + // SubscriptionID - READ-ONLY; The subscription ID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // AvailabilityZone - READ-ONLY; The availabilityZone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` +} + +// MarshalJSON is the custom marshaler for Peers. +func (p Peers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // Policies subscription policies. type Policies struct { // LocationPlacementID - READ-ONLY; The subscription location placement ID. The ID indicates which regions are visible for a subscription. For example, a subscription with a location placement Id of Public_2014-09-01 has access to Azure public regions. diff --git a/services/resources/mgmt/2019-06-01/subscriptions/subscriptions.go b/services/resources/mgmt/2019-06-01/subscriptions/subscriptions.go index 2b565826c5aa..6246d1477cc4 100644 --- a/services/resources/mgmt/2019-06-01/subscriptions/subscriptions.go +++ b/services/resources/mgmt/2019-06-01/subscriptions/subscriptions.go @@ -32,6 +32,82 @@ func NewClientWithBaseURI(baseURI string) Client { return Client{NewWithBaseURI(baseURI)} } +// CheckZonePeers compares a subscriptions logical zone mapping +// Parameters: +// subscriptionID - the ID of the target subscription. +// parameters - parameters for checking zone peers. +func (client Client) CheckZonePeers(ctx context.Context, subscriptionID string, parameters CheckZonePeersRequest) (result CheckZonePeersResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckZonePeers") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CheckZonePeersPreparer(ctx, subscriptionID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", nil, "Failure preparing request") + return + } + + resp, err := client.CheckZonePeersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", resp, "Failure sending request") + return + } + + result, err = client.CheckZonePeersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", resp, "Failure responding to request") + return + } + + return +} + +// CheckZonePeersPreparer prepares the CheckZonePeers request. +func (client Client) CheckZonePeersPreparer(ctx context.Context, subscriptionID string, parameters CheckZonePeersRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", subscriptionID), + } + + const APIVersion = "2019-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/checkZonePeers/", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckZonePeersSender sends the CheckZonePeers request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CheckZonePeersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckZonePeersResponder handles the response to the CheckZonePeers request. The method always +// closes the http.Response Body. +func (client Client) CheckZonePeersResponder(resp *http.Response) (result CheckZonePeersResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Get gets details about a specified subscription. // Parameters: // subscriptionID - the ID of the target subscription. diff --git a/services/resources/mgmt/2019-06-01/subscriptions/subscriptionsapi/interfaces.go b/services/resources/mgmt/2019-06-01/subscriptions/subscriptionsapi/interfaces.go index 5d2d6fa23f64..bc6c7ce84245 100644 --- a/services/resources/mgmt/2019-06-01/subscriptions/subscriptionsapi/interfaces.go +++ b/services/resources/mgmt/2019-06-01/subscriptions/subscriptionsapi/interfaces.go @@ -28,6 +28,7 @@ var _ OperationsClientAPI = (*subscriptions.OperationsClient)(nil) // ClientAPI contains the set of methods on the Client type. type ClientAPI interface { + CheckZonePeers(ctx context.Context, subscriptionID string, parameters subscriptions.CheckZonePeersRequest) (result subscriptions.CheckZonePeersResult, err error) Get(ctx context.Context, subscriptionID string) (result subscriptions.Subscription, err error) List(ctx context.Context) (result subscriptions.ListResultPage, err error) ListComplete(ctx context.Context) (result subscriptions.ListResultIterator, err error) diff --git a/services/resources/mgmt/2019-07-01/features/CHANGELOG.md b/services/resources/mgmt/2019-07-01/features/CHANGELOG.md index 52911e4cc5e4..5529dc3fe034 100644 --- a/services/resources/mgmt/2019-07-01/features/CHANGELOG.md +++ b/services/resources/mgmt/2019-07-01/features/CHANGELOG.md @@ -1,2 +1,14 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Structs + +1. ZoneMapping + +#### New Struct Fields + +1. DeploymentPropertiesExtended.Error +1. ProviderResourceType.ZoneMappings diff --git a/services/resources/mgmt/2019-07-01/features/_meta.json b/services/resources/mgmt/2019-07-01/features/_meta.json index 09f65e968c84..f43c9fbbf5c0 100644 --- a/services/resources/mgmt/2019-07-01/features/_meta.json +++ b/services/resources/mgmt/2019-07-01/features/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-resources-2019-07", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2019-07-01/features/models.go b/services/resources/mgmt/2019-07-01/features/models.go index 73831e3ed1dd..f7db63dedf29 100644 --- a/services/resources/mgmt/2019-07-01/features/models.go +++ b/services/resources/mgmt/2019-07-01/features/models.go @@ -550,6 +550,8 @@ type DeploymentPropertiesExtended struct { DebugSetting *DebugSetting `json:"debugSetting,omitempty"` // OnErrorDeployment - The deployment on error behavior. OnErrorDeployment *OnErrorDeploymentExtended `json:"onErrorDeployment,omitempty"` + // Error - READ-ONLY; The deployment error. + Error *ErrorResponse `json:"error,omitempty"` } // MarshalJSON is the custom marshaler for DeploymentPropertiesExtended. @@ -1766,7 +1768,8 @@ type ProviderResourceType struct { // Aliases - The aliases that are supported by this resource type. Aliases *[]AliasType `json:"aliases,omitempty"` // APIVersions - The API version. - APIVersions *[]string `json:"apiVersions,omitempty"` + APIVersions *[]string `json:"apiVersions,omitempty"` + ZoneMappings *[]ZoneMapping `json:"zoneMappings,omitempty"` // Capabilities - The additional capabilities offered by this resource type. Capabilities *string `json:"capabilities,omitempty"` // Properties - The properties. @@ -1788,6 +1791,9 @@ func (prt ProviderResourceType) MarshalJSON() ([]byte, error) { if prt.APIVersions != nil { objectMap["apiVersions"] = prt.APIVersions } + if prt.ZoneMappings != nil { + objectMap["zoneMappings"] = prt.ZoneMappings + } if prt.Capabilities != nil { objectMap["capabilities"] = prt.Capabilities } @@ -3013,3 +3019,10 @@ type WhatIfPropertyChange struct { // Children - Nested property changes. Children *[]WhatIfPropertyChange `json:"children,omitempty"` } + +// ZoneMapping ... +type ZoneMapping struct { + // Location - The location of the zone mapping. + Location *string `json:"location,omitempty"` + Zones *[]string `json:"zones,omitempty"` +} diff --git a/services/resources/mgmt/2019-07-01/features/resources.go b/services/resources/mgmt/2019-07-01/features/resources.go index 6a37c27844bf..2e6acfc6c63a 100644 --- a/services/resources/mgmt/2019-07-01/features/resources.go +++ b/services/resources/mgmt/2019-07-01/features/resources.go @@ -733,7 +733,7 @@ func (client ResourcesClient) GetByIDResponder(resp *http.Response) (result Gene // plan/name, identity and identity/principalId. // expand - comma-separated list of additional properties to be included in the response. Valid values include // `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. -// top - the number of results to return. If null is passed, returns all resource groups. +// top - the number of results to return. If null is passed, returns all resources. func (client ResourcesClient) List(ctx context.Context, filter string, expand string, top *int32) (result ResourceListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ResourcesClient.List") diff --git a/services/resources/mgmt/2019-07-01/managedapplications/CHANGELOG.md b/services/resources/mgmt/2019-07-01/managedapplications/CHANGELOG.md index 52911e4cc5e4..d0b8b929bbba 100644 --- a/services/resources/mgmt/2019-07-01/managedapplications/CHANGELOG.md +++ b/services/resources/mgmt/2019-07-01/managedapplications/CHANGELOG.md @@ -1,2 +1,31 @@ -# Change History +# Unreleased +## Breaking Changes + +### Struct Changes + +#### Removed Struct Fields + +1. ErrorResponse.ErrorCode +1. ErrorResponse.ErrorMessage +1. ErrorResponse.HTTPStatus + +## Additive Changes + +### New Funcs + +1. ErrorAdditionalInfo.MarshalJSON() ([]byte, error) +1. ErrorDetail.MarshalJSON() ([]byte, error) +1. OperationListResult.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. ErrorAdditionalInfo +1. ErrorDetail + +#### New Struct Fields + +1. ApplicationPackageLockingPolicyDefinition.AllowedDataActions +1. ErrorResponse.Error diff --git a/services/resources/mgmt/2019-07-01/managedapplications/_meta.json b/services/resources/mgmt/2019-07-01/managedapplications/_meta.json index acafe2d52017..84abb182bb30 100644 --- a/services/resources/mgmt/2019-07-01/managedapplications/_meta.json +++ b/services/resources/mgmt/2019-07-01/managedapplications/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-managedapplications-2019-07", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2019-07-01/managedapplications/applications.go b/services/resources/mgmt/2019-07-01/managedapplications/applications.go index 91d33b5e2534..519a47dfbacb 100644 --- a/services/resources/mgmt/2019-07-01/managedapplications/applications.go +++ b/services/resources/mgmt/2019-07-01/managedapplications/applications.go @@ -983,7 +983,7 @@ func (client ApplicationsClient) UpdateSender(req *http.Request) (*http.Response func (client ApplicationsClient) UpdateResponder(resp *http.Response) (result Application, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/services/resources/mgmt/2019-07-01/managedapplications/models.go b/services/resources/mgmt/2019-07-01/managedapplications/models.go index e575e0711cc0..381c77e45f00 100644 --- a/services/resources/mgmt/2019-07-01/managedapplications/models.go +++ b/services/resources/mgmt/2019-07-01/managedapplications/models.go @@ -926,6 +926,8 @@ type ApplicationPackageContact struct { type ApplicationPackageLockingPolicyDefinition struct { // AllowedActions - The deny assignment excluded actions. AllowedActions *[]string `json:"allowedActions,omitempty"` + // AllowedDataActions - The deny assignment excluded data actions. + AllowedDataActions *[]string `json:"allowedDataActions,omitempty"` } // ApplicationPackageSupportUrls the appliance package support URLs. @@ -1394,15 +1396,45 @@ func (future *ApplicationsRefreshPermissionsFuture) result(client ApplicationsCl return } -// ErrorResponse error response indicates managed application is not able to process the incoming request. -// The reason is provided in the error message. +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). type ErrorResponse struct { - // HTTPStatus - Http status code. - HTTPStatus *string `json:"httpStatus,omitempty"` - // ErrorCode - Error code. - ErrorCode *string `json:"errorCode,omitempty"` - // ErrorMessage - Error message indicating why the operation failed. - ErrorMessage *string `json:"errorMessage,omitempty"` + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` } // GenericResource resource information. @@ -1713,16 +1745,22 @@ type OperationDisplay struct { Operation *string `json:"operation,omitempty"` } -// OperationListResult result of the request to list Microsoft.Solutions operations. It contains a list of -// operations and a URL link to get the next set of results. +// OperationListResult a list of REST API operations supported by an Azure Resource Provider. It contains +// an URL link to get the next set of results. type OperationListResult struct { autorest.Response `json:"-"` - // Value - List of Microsoft.Solutions operations. + // Value - READ-ONLY; List of operations supported by the resource provider Value *[]Operation `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. + // NextLink - READ-ONLY; URL to get the next set of operation list results (if there are any). NextLink *string `json:"nextLink,omitempty"` } +// MarshalJSON is the custom marshaler for OperationListResult. +func (olr OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // OperationListResultIterator provides access to a complete listing of Operation values. type OperationListResultIterator struct { i int diff --git a/services/resources/mgmt/2019-09-01/policy/CHANGELOG.md b/services/resources/mgmt/2019-09-01/policy/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/resources/mgmt/2019-09-01/policy/CHANGELOG.md +++ b/services/resources/mgmt/2019-09-01/policy/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/resources/mgmt/2019-09-01/policy/_meta.json b/services/resources/mgmt/2019-09-01/policy/_meta.json index 7b5ca7cda601..c5807a474a7b 100644 --- a/services/resources/mgmt/2019-09-01/policy/_meta.json +++ b/services/resources/mgmt/2019-09-01/policy/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-policy-2019-09", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2019-10-01/resources/CHANGELOG.md b/services/resources/mgmt/2019-10-01/resources/CHANGELOG.md index 52911e4cc5e4..e9725b6984b2 100644 --- a/services/resources/mgmt/2019-10-01/resources/CHANGELOG.md +++ b/services/resources/mgmt/2019-10-01/resources/CHANGELOG.md @@ -1,2 +1,13 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Structs + +1. ZoneMapping + +#### New Struct Fields + +1. ProviderResourceType.ZoneMappings diff --git a/services/resources/mgmt/2019-10-01/resources/_meta.json b/services/resources/mgmt/2019-10-01/resources/_meta.json index 0b71dd00ce9b..e792bec2c981 100644 --- a/services/resources/mgmt/2019-10-01/resources/_meta.json +++ b/services/resources/mgmt/2019-10-01/resources/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-resources-2019-10", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2019-10-01/resources/groups.go b/services/resources/mgmt/2019-10-01/resources/groups.go index 5a7b2b7d9be4..c2a1b216ff6e 100644 --- a/services/resources/mgmt/2019-10-01/resources/groups.go +++ b/services/resources/mgmt/2019-10-01/resources/groups.go @@ -307,8 +307,7 @@ func (client GroupsClient) ExportTemplate(ctx context.Context, resourceGroupName if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("resources.GroupsClient", "ExportTemplate", err.Error()) } diff --git a/services/resources/mgmt/2019-10-01/resources/models.go b/services/resources/mgmt/2019-10-01/resources/models.go index a8ff88548ed3..f9013dbd9094 100644 --- a/services/resources/mgmt/2019-10-01/resources/models.go +++ b/services/resources/mgmt/2019-10-01/resources/models.go @@ -2822,7 +2822,8 @@ type ProviderResourceType struct { // Aliases - The aliases that are supported by this resource type. Aliases *[]Alias `json:"aliases,omitempty"` // APIVersions - The API version. - APIVersions *[]string `json:"apiVersions,omitempty"` + APIVersions *[]string `json:"apiVersions,omitempty"` + ZoneMappings *[]ZoneMapping `json:"zoneMappings,omitempty"` // Capabilities - The additional capabilities offered by this resource type. Capabilities *string `json:"capabilities,omitempty"` // Properties - The properties. @@ -2844,6 +2845,9 @@ func (prt ProviderResourceType) MarshalJSON() ([]byte, error) { if prt.APIVersions != nil { objectMap["apiVersions"] = prt.APIVersions } + if prt.ZoneMappings != nil { + objectMap["zoneMappings"] = prt.ZoneMappings + } if prt.Capabilities != nil { objectMap["capabilities"] = prt.Capabilities } @@ -3468,3 +3472,10 @@ type WhatIfPropertyChange struct { // Children - Nested property changes. Children *[]WhatIfPropertyChange `json:"children,omitempty"` } + +// ZoneMapping ... +type ZoneMapping struct { + // Location - The location of the zone mapping. + Location *string `json:"location,omitempty"` + Zones *[]string `json:"zones,omitempty"` +} diff --git a/services/resources/mgmt/2019-10-01/resources/resources.go b/services/resources/mgmt/2019-10-01/resources/resources.go index d98764ea4069..e4d96001913a 100644 --- a/services/resources/mgmt/2019-10-01/resources/resources.go +++ b/services/resources/mgmt/2019-10-01/resources/resources.go @@ -734,7 +734,7 @@ func (client Client) GetByIDResponder(resp *http.Response) (result GenericResour // plan/name, identity and identity/principalId. // expand - comma-separated list of additional properties to be included in the response. Valid values include // `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. -// top - the number of results to return. If null is passed, returns all resource groups. +// top - the number of results to return. If null is passed, returns all resources. func (client Client) List(ctx context.Context, filter string, expand string, top *int32) (result ListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") diff --git a/services/resources/mgmt/2019-11-01/subscriptions/CHANGELOG.md b/services/resources/mgmt/2019-11-01/subscriptions/CHANGELOG.md index 52911e4cc5e4..f1bd42c15475 100644 --- a/services/resources/mgmt/2019-11-01/subscriptions/CHANGELOG.md +++ b/services/resources/mgmt/2019-11-01/subscriptions/CHANGELOG.md @@ -1,2 +1,22 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. AvailabilityZonePeers.MarshalJSON() ([]byte, error) +1. CheckZonePeersResult.MarshalJSON() ([]byte, error) +1. Client.CheckZonePeers(context.Context, string, CheckZonePeersRequest) (CheckZonePeersResult, error) +1. Client.CheckZonePeersPreparer(context.Context, string, CheckZonePeersRequest) (*http.Request, error) +1. Client.CheckZonePeersResponder(*http.Response) (CheckZonePeersResult, error) +1. Client.CheckZonePeersSender(*http.Request) (*http.Response, error) +1. Peers.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. AvailabilityZonePeers +1. CheckZonePeersRequest +1. CheckZonePeersResult +1. Peers diff --git a/services/resources/mgmt/2019-11-01/subscriptions/_meta.json b/services/resources/mgmt/2019-11-01/subscriptions/_meta.json index 6719c92b2b24..69d7bfa200d9 100644 --- a/services/resources/mgmt/2019-11-01/subscriptions/_meta.json +++ b/services/resources/mgmt/2019-11-01/subscriptions/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-subscriptions-2019-11", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2019-11-01/subscriptions/models.go b/services/resources/mgmt/2019-11-01/subscriptions/models.go index 7c96596d4244..a96ad9823b10 100644 --- a/services/resources/mgmt/2019-11-01/subscriptions/models.go +++ b/services/resources/mgmt/2019-11-01/subscriptions/models.go @@ -18,6 +18,23 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-11-01/subscriptions" +// AvailabilityZonePeers list of availability zones shared by the subscriptions. +type AvailabilityZonePeers struct { + // AvailabilityZone - READ-ONLY; The availabilityZone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` + // Peers - Details of shared availability zone. + Peers *[]Peers `json:"peers,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvailabilityZonePeers. +func (azp AvailabilityZonePeers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if azp.Peers != nil { + objectMap["peers"] = azp.Peers + } + return json.Marshal(objectMap) +} + // CheckResourceNameResult resource Name valid if not a reserved word, does not contain a reserved word and // does not start with a reserved word type CheckResourceNameResult struct { @@ -30,6 +47,37 @@ type CheckResourceNameResult struct { Status ResourceNameStatus `json:"status,omitempty"` } +// CheckZonePeersRequest check zone peers request parameters. +type CheckZonePeersRequest struct { + // Location - The Microsoft location. + Location *string `json:"location,omitempty"` + // SubscriptionIds - The peer Microsoft Azure subscription ID. + SubscriptionIds *[]string `json:"subscriptionIds,omitempty"` +} + +// CheckZonePeersResult result of the Check zone peers operation. +type CheckZonePeersResult struct { + autorest.Response `json:"-"` + // SubscriptionID - READ-ONLY; The subscription ID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // Location - the location of the subscription. + Location *string `json:"location,omitempty"` + // AvailabilityZonePeers - The Availability Zones shared by the subscriptions. + AvailabilityZonePeers *[]AvailabilityZonePeers `json:"availabilityZonePeers,omitempty"` +} + +// MarshalJSON is the custom marshaler for CheckZonePeersResult. +func (czpr CheckZonePeersResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if czpr.Location != nil { + objectMap["location"] = czpr.Location + } + if czpr.AvailabilityZonePeers != nil { + objectMap["availabilityZonePeers"] = czpr.AvailabilityZonePeers + } + return json.Marshal(objectMap) +} + // ErrorDefinition error description and code explaining why resource name is invalid. type ErrorDefinition struct { // Message - Description of the error. @@ -470,6 +518,20 @@ func (pr PairedRegion) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// Peers information about shared availability zone. +type Peers struct { + // SubscriptionID - READ-ONLY; The subscription ID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // AvailabilityZone - READ-ONLY; The availabilityZone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` +} + +// MarshalJSON is the custom marshaler for Peers. +func (p Peers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // Policies subscription policies. type Policies struct { // LocationPlacementID - READ-ONLY; The subscription location placement ID. The ID indicates which regions are visible for a subscription. For example, a subscription with a location placement Id of Public_2014-09-01 has access to Azure public regions. diff --git a/services/resources/mgmt/2019-11-01/subscriptions/subscriptions.go b/services/resources/mgmt/2019-11-01/subscriptions/subscriptions.go index 54d0f0d8ce32..41be75ec563e 100644 --- a/services/resources/mgmt/2019-11-01/subscriptions/subscriptions.go +++ b/services/resources/mgmt/2019-11-01/subscriptions/subscriptions.go @@ -32,6 +32,82 @@ func NewClientWithBaseURI(baseURI string) Client { return Client{NewWithBaseURI(baseURI)} } +// CheckZonePeers compares a subscriptions logical zone mapping +// Parameters: +// subscriptionID - the ID of the target subscription. +// parameters - parameters for checking zone peers. +func (client Client) CheckZonePeers(ctx context.Context, subscriptionID string, parameters CheckZonePeersRequest) (result CheckZonePeersResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckZonePeers") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CheckZonePeersPreparer(ctx, subscriptionID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", nil, "Failure preparing request") + return + } + + resp, err := client.CheckZonePeersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", resp, "Failure sending request") + return + } + + result, err = client.CheckZonePeersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", resp, "Failure responding to request") + return + } + + return +} + +// CheckZonePeersPreparer prepares the CheckZonePeers request. +func (client Client) CheckZonePeersPreparer(ctx context.Context, subscriptionID string, parameters CheckZonePeersRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", subscriptionID), + } + + const APIVersion = "2019-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/checkZonePeers/", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckZonePeersSender sends the CheckZonePeers request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CheckZonePeersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckZonePeersResponder handles the response to the CheckZonePeers request. The method always +// closes the http.Response Body. +func (client Client) CheckZonePeersResponder(resp *http.Response) (result CheckZonePeersResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Get gets details about a specified subscription. // Parameters: // subscriptionID - the ID of the target subscription. diff --git a/services/resources/mgmt/2019-11-01/subscriptions/subscriptionsapi/interfaces.go b/services/resources/mgmt/2019-11-01/subscriptions/subscriptionsapi/interfaces.go index 7b9a7c8496c1..c7fea3569d06 100644 --- a/services/resources/mgmt/2019-11-01/subscriptions/subscriptionsapi/interfaces.go +++ b/services/resources/mgmt/2019-11-01/subscriptions/subscriptionsapi/interfaces.go @@ -28,6 +28,7 @@ var _ OperationsClientAPI = (*subscriptions.OperationsClient)(nil) // ClientAPI contains the set of methods on the Client type. type ClientAPI interface { + CheckZonePeers(ctx context.Context, subscriptionID string, parameters subscriptions.CheckZonePeersRequest) (result subscriptions.CheckZonePeersResult, err error) Get(ctx context.Context, subscriptionID string) (result subscriptions.Subscription, err error) List(ctx context.Context) (result subscriptions.ListResultPage, err error) ListComplete(ctx context.Context) (result subscriptions.ListResultIterator, err error) diff --git a/services/resources/mgmt/2020-06-01/resources/CHANGELOG.md b/services/resources/mgmt/2020-06-01/resources/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/resources/mgmt/2020-06-01/resources/CHANGELOG.md +++ b/services/resources/mgmt/2020-06-01/resources/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/resources/mgmt/2020-06-01/resources/_meta.json b/services/resources/mgmt/2020-06-01/resources/_meta.json index a7e68aac7821..5de337478ecc 100644 --- a/services/resources/mgmt/2020-06-01/resources/_meta.json +++ b/services/resources/mgmt/2020-06-01/resources/_meta.json @@ -1,5 +1,5 @@ { - "commit": "c2ea3a3ccd14293b4bd1d17e684ef9129f0dc604", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-resources-2020-06", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2020-06-01/resources/groups.go b/services/resources/mgmt/2020-06-01/resources/groups.go index 3a225c8f9d6b..ce898bbb6eda 100644 --- a/services/resources/mgmt/2020-06-01/resources/groups.go +++ b/services/resources/mgmt/2020-06-01/resources/groups.go @@ -206,10 +206,9 @@ func (client GroupsClient) CreateOrUpdateResponder(resp *http.Response) (result // all of its template deployments and currently stored operations. // Parameters: // resourceGroupName - the name of the resource group to delete. The name is case insensitive. -// forceDeletionResourceTypes - the resource types you want to force delete. Currently, only the following is -// supported: -// forceDeletionResourceTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets -func (client GroupsClient) Delete(ctx context.Context, resourceGroupName string, forceDeletionResourceTypes string) (result GroupsDeleteFuture, err error) { +// forceDeletionTypes - the resource types you want to force delete. Currently, only the following is +// supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets +func (client GroupsClient) Delete(ctx context.Context, resourceGroupName string, forceDeletionTypes string) (result GroupsDeleteFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.Delete") defer func() { @@ -227,7 +226,7 @@ func (client GroupsClient) Delete(ctx context.Context, resourceGroupName string, return result, validation.NewError("resources.GroupsClient", "Delete", err.Error()) } - req, err := client.DeletePreparer(ctx, resourceGroupName, forceDeletionResourceTypes) + req, err := client.DeletePreparer(ctx, resourceGroupName, forceDeletionTypes) if err != nil { err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Delete", nil, "Failure preparing request") return @@ -243,7 +242,7 @@ func (client GroupsClient) Delete(ctx context.Context, resourceGroupName string, } // DeletePreparer prepares the Delete request. -func (client GroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, forceDeletionResourceTypes string) (*http.Request, error) { +func (client GroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, forceDeletionTypes string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), @@ -253,8 +252,8 @@ func (client GroupsClient) DeletePreparer(ctx context.Context, resourceGroupName queryParameters := map[string]interface{}{ "api-version": APIVersion, } - if len(forceDeletionResourceTypes) > 0 { - queryParameters["forceDeletionResourceTypes"] = autorest.Encode("query", forceDeletionResourceTypes) + if len(forceDeletionTypes) > 0 { + queryParameters["forceDeletionTypes"] = autorest.Encode("query", forceDeletionTypes) } preparer := autorest.CreatePreparer( @@ -310,8 +309,7 @@ func (client GroupsClient) ExportTemplate(ctx context.Context, resourceGroupName if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("resources.GroupsClient", "ExportTemplate", err.Error()) } diff --git a/services/resources/mgmt/2020-06-01/resources/resources.go b/services/resources/mgmt/2020-06-01/resources/resources.go index beca650d9773..e3e7a5dda64e 100644 --- a/services/resources/mgmt/2020-06-01/resources/resources.go +++ b/services/resources/mgmt/2020-06-01/resources/resources.go @@ -720,7 +720,7 @@ func (client Client) GetByIDResponder(resp *http.Response) (result GenericResour // plan/name, identity and identity/principalId. // expand - comma-separated list of additional properties to be included in the response. Valid values include // `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. -// top - the number of results to return. If null is passed, returns all resource groups. +// top - the number of results to return. If null is passed, returns all resources. func (client Client) List(ctx context.Context, filter string, expand string, top *int32) (result ListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") diff --git a/services/resources/mgmt/2020-06-01/resources/resourcesapi/interfaces.go b/services/resources/mgmt/2020-06-01/resources/resourcesapi/interfaces.go index c6ba71a9284a..95fa2a707b70 100644 --- a/services/resources/mgmt/2020-06-01/resources/resourcesapi/interfaces.go +++ b/services/resources/mgmt/2020-06-01/resources/resourcesapi/interfaces.go @@ -117,7 +117,7 @@ var _ ClientAPI = (*resources.Client)(nil) type GroupsClientAPI interface { CheckExistence(ctx context.Context, resourceGroupName string) (result autorest.Response, err error) CreateOrUpdate(ctx context.Context, resourceGroupName string, parameters resources.Group) (result resources.Group, err error) - Delete(ctx context.Context, resourceGroupName string, forceDeletionResourceTypes string) (result resources.GroupsDeleteFuture, err error) + Delete(ctx context.Context, resourceGroupName string, forceDeletionTypes string) (result resources.GroupsDeleteFuture, err error) ExportTemplate(ctx context.Context, resourceGroupName string, parameters resources.ExportTemplateRequest) (result resources.GroupsExportTemplateFuture, err error) Get(ctx context.Context, resourceGroupName string) (result resources.Group, err error) List(ctx context.Context, filter string, top *int32) (result resources.GroupListResultPage, err error) diff --git a/services/resources/mgmt/2020-10-01/resources/CHANGELOG.md b/services/resources/mgmt/2020-10-01/resources/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/resources/mgmt/2020-10-01/resources/CHANGELOG.md +++ b/services/resources/mgmt/2020-10-01/resources/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/resources/mgmt/2020-10-01/resources/_meta.json b/services/resources/mgmt/2020-10-01/resources/_meta.json index 0bd5272615e4..069f38f6cfe7 100644 --- a/services/resources/mgmt/2020-10-01/resources/_meta.json +++ b/services/resources/mgmt/2020-10-01/resources/_meta.json @@ -1,5 +1,5 @@ { - "commit": "c2ea3a3ccd14293b4bd1d17e684ef9129f0dc604", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-resources-2020-10", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2020-10-01/resources/groups.go b/services/resources/mgmt/2020-10-01/resources/groups.go index 9a8b6aa97c92..b2c3338ce23c 100644 --- a/services/resources/mgmt/2020-10-01/resources/groups.go +++ b/services/resources/mgmt/2020-10-01/resources/groups.go @@ -304,8 +304,7 @@ func (client GroupsClient) ExportTemplate(ctx context.Context, resourceGroupName if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("resources.GroupsClient", "ExportTemplate", err.Error()) } diff --git a/services/resources/mgmt/2020-10-01/resources/resources.go b/services/resources/mgmt/2020-10-01/resources/resources.go index 8344119cca6c..00e756bd6fe6 100644 --- a/services/resources/mgmt/2020-10-01/resources/resources.go +++ b/services/resources/mgmt/2020-10-01/resources/resources.go @@ -720,7 +720,7 @@ func (client Client) GetByIDResponder(resp *http.Response) (result GenericResour // plan/name, identity and identity/principalId. // expand - comma-separated list of additional properties to be included in the response. Valid values include // `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. -// top - the number of results to return. If null is passed, returns all resource groups. +// top - the number of results to return. If null is passed, returns all resources. func (client Client) List(ctx context.Context, filter string, expand string, top *int32) (result ListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") diff --git a/services/resources/mgmt/2021-01-01/resources/CHANGELOG.md b/services/resources/mgmt/2021-01-01/resources/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/resources/mgmt/2021-01-01/resources/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/resources/mgmt/2021-01-01/resources/_meta.json b/services/resources/mgmt/2021-01-01/resources/_meta.json new file mode 100644 index 000000000000..33a91702cae6 --- /dev/null +++ b/services/resources/mgmt/2021-01-01/resources/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", + "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", + "tag": "package-resources-2021-01", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-resources-2021-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/resources/mgmt/2021-01-01/resources/client.go b/services/resources/mgmt/2021-01-01/resources/client.go new file mode 100644 index 000000000000..0f682a2c7ede --- /dev/null +++ b/services/resources/mgmt/2021-01-01/resources/client.go @@ -0,0 +1,41 @@ +// Package resources implements the Azure ARM Resources service API version 2021-01-01. +// +// Provides operations for working with resources and resource groups. +package resources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Resources + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Resources. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/resources/mgmt/2021-01-01/resources/deploymentoperations.go b/services/resources/mgmt/2021-01-01/resources/deploymentoperations.go new file mode 100644 index 000000000000..0779ea0eed16 --- /dev/null +++ b/services/resources/mgmt/2021-01-01/resources/deploymentoperations.go @@ -0,0 +1,1113 @@ +package resources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DeploymentOperationsClient is the provides operations for working with resources and resource groups. +type DeploymentOperationsClient struct { + BaseClient +} + +// NewDeploymentOperationsClient creates an instance of the DeploymentOperationsClient client. +func NewDeploymentOperationsClient(subscriptionID string) DeploymentOperationsClient { + return NewDeploymentOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDeploymentOperationsClientWithBaseURI creates an instance of the DeploymentOperationsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewDeploymentOperationsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentOperationsClient { + return DeploymentOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a deployments operation. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// deploymentName - the name of the deployment. +// operationID - the ID of the operation to get. +func (client DeploymentOperationsClient) Get(ctx context.Context, resourceGroupName string, deploymentName string, operationID string) (result DeploymentOperation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentOperationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, deploymentName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DeploymentOperationsClient) GetPreparer(ctx context.Context, resourceGroupName string, deploymentName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentOperationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DeploymentOperationsClient) GetResponder(resp *http.Response) (result DeploymentOperation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAtManagementGroupScope gets a deployments operation. +// Parameters: +// groupID - the management group ID. +// deploymentName - the name of the deployment. +// operationID - the ID of the operation to get. +func (client DeploymentOperationsClient) GetAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, operationID string) (result DeploymentOperation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.GetAtManagementGroupScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentOperationsClient", "GetAtManagementGroupScope", err.Error()) + } + + req, err := client.GetAtManagementGroupScopePreparer(ctx, groupID, deploymentName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "GetAtManagementGroupScope", nil, "Failure preparing request") + return + } + + resp, err := client.GetAtManagementGroupScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "GetAtManagementGroupScope", resp, "Failure sending request") + return + } + + result, err = client.GetAtManagementGroupScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "GetAtManagementGroupScope", resp, "Failure responding to request") + return + } + + return +} + +// GetAtManagementGroupScopePreparer prepares the GetAtManagementGroupScope request. +func (client DeploymentOperationsClient) GetAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "groupId": autorest.Encode("path", groupID), + "operationId": autorest.Encode("path", operationID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAtManagementGroupScopeSender sends the GetAtManagementGroupScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentOperationsClient) GetAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetAtManagementGroupScopeResponder handles the response to the GetAtManagementGroupScope request. The method always +// closes the http.Response Body. +func (client DeploymentOperationsClient) GetAtManagementGroupScopeResponder(resp *http.Response) (result DeploymentOperation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAtScope gets a deployments operation. +// Parameters: +// scope - the resource scope. +// deploymentName - the name of the deployment. +// operationID - the ID of the operation to get. +func (client DeploymentOperationsClient) GetAtScope(ctx context.Context, scope string, deploymentName string, operationID string) (result DeploymentOperation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.GetAtScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentOperationsClient", "GetAtScope", err.Error()) + } + + req, err := client.GetAtScopePreparer(ctx, scope, deploymentName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "GetAtScope", nil, "Failure preparing request") + return + } + + resp, err := client.GetAtScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "GetAtScope", resp, "Failure sending request") + return + } + + result, err = client.GetAtScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "GetAtScope", resp, "Failure responding to request") + return + } + + return +} + +// GetAtScopePreparer prepares the GetAtScope request. +func (client DeploymentOperationsClient) GetAtScopePreparer(ctx context.Context, scope string, deploymentName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "operationId": autorest.Encode("path", operationID), + "scope": scope, + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAtScopeSender sends the GetAtScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentOperationsClient) GetAtScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetAtScopeResponder handles the response to the GetAtScope request. The method always +// closes the http.Response Body. +func (client DeploymentOperationsClient) GetAtScopeResponder(resp *http.Response) (result DeploymentOperation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAtSubscriptionScope gets a deployments operation. +// Parameters: +// deploymentName - the name of the deployment. +// operationID - the ID of the operation to get. +func (client DeploymentOperationsClient) GetAtSubscriptionScope(ctx context.Context, deploymentName string, operationID string) (result DeploymentOperation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.GetAtSubscriptionScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentOperationsClient", "GetAtSubscriptionScope", err.Error()) + } + + req, err := client.GetAtSubscriptionScopePreparer(ctx, deploymentName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "GetAtSubscriptionScope", nil, "Failure preparing request") + return + } + + resp, err := client.GetAtSubscriptionScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "GetAtSubscriptionScope", resp, "Failure sending request") + return + } + + result, err = client.GetAtSubscriptionScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "GetAtSubscriptionScope", resp, "Failure responding to request") + return + } + + return +} + +// GetAtSubscriptionScopePreparer prepares the GetAtSubscriptionScope request. +func (client DeploymentOperationsClient) GetAtSubscriptionScopePreparer(ctx context.Context, deploymentName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "operationId": autorest.Encode("path", operationID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAtSubscriptionScopeSender sends the GetAtSubscriptionScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentOperationsClient) GetAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAtSubscriptionScopeResponder handles the response to the GetAtSubscriptionScope request. The method always +// closes the http.Response Body. +func (client DeploymentOperationsClient) GetAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentOperation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAtTenantScope gets a deployments operation. +// Parameters: +// deploymentName - the name of the deployment. +// operationID - the ID of the operation to get. +func (client DeploymentOperationsClient) GetAtTenantScope(ctx context.Context, deploymentName string, operationID string) (result DeploymentOperation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.GetAtTenantScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentOperationsClient", "GetAtTenantScope", err.Error()) + } + + req, err := client.GetAtTenantScopePreparer(ctx, deploymentName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "GetAtTenantScope", nil, "Failure preparing request") + return + } + + resp, err := client.GetAtTenantScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "GetAtTenantScope", resp, "Failure sending request") + return + } + + result, err = client.GetAtTenantScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "GetAtTenantScope", resp, "Failure responding to request") + return + } + + return +} + +// GetAtTenantScopePreparer prepares the GetAtTenantScope request. +func (client DeploymentOperationsClient) GetAtTenantScopePreparer(ctx context.Context, deploymentName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "operationId": autorest.Encode("path", operationID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAtTenantScopeSender sends the GetAtTenantScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentOperationsClient) GetAtTenantScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetAtTenantScopeResponder handles the response to the GetAtTenantScope request. The method always +// closes the http.Response Body. +func (client DeploymentOperationsClient) GetAtTenantScopeResponder(resp *http.Response) (result DeploymentOperation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all deployments operations for a deployment. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// deploymentName - the name of the deployment. +// top - the number of results to return. +func (client DeploymentOperationsClient) List(ctx context.Context, resourceGroupName string, deploymentName string, top *int32) (result DeploymentOperationsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.List") + defer func() { + sc := -1 + if result.dolr.Response.Response != nil { + sc = result.dolr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentOperationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, deploymentName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dolr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure sending request") + return + } + + result.dolr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure responding to request") + return + } + if result.dolr.hasNextLink() && result.dolr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DeploymentOperationsClient) ListPreparer(ctx context.Context, resourceGroupName string, deploymentName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentOperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DeploymentOperationsClient) ListResponder(resp *http.Response) (result DeploymentOperationsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client DeploymentOperationsClient) listNextResults(ctx context.Context, lastResults DeploymentOperationsListResult) (result DeploymentOperationsListResult, err error) { + req, err := lastResults.deploymentOperationsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentOperationsClient) ListComplete(ctx context.Context, resourceGroupName string, deploymentName string, top *int32) (result DeploymentOperationsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, deploymentName, top) + return +} + +// ListAtManagementGroupScope gets all deployments operations for a deployment. +// Parameters: +// groupID - the management group ID. +// deploymentName - the name of the deployment. +// top - the number of results to return. +func (client DeploymentOperationsClient) ListAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, top *int32) (result DeploymentOperationsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtManagementGroupScope") + defer func() { + sc := -1 + if result.dolr.Response.Response != nil { + sc = result.dolr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentOperationsClient", "ListAtManagementGroupScope", err.Error()) + } + + result.fn = client.listAtManagementGroupScopeNextResults + req, err := client.ListAtManagementGroupScopePreparer(ctx, groupID, deploymentName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "ListAtManagementGroupScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtManagementGroupScopeSender(req) + if err != nil { + result.dolr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "ListAtManagementGroupScope", resp, "Failure sending request") + return + } + + result.dolr, err = client.ListAtManagementGroupScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "ListAtManagementGroupScope", resp, "Failure responding to request") + return + } + if result.dolr.hasNextLink() && result.dolr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAtManagementGroupScopePreparer prepares the ListAtManagementGroupScope request. +func (client DeploymentOperationsClient) ListAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "groupId": autorest.Encode("path", groupID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAtManagementGroupScopeSender sends the ListAtManagementGroupScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentOperationsClient) ListAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListAtManagementGroupScopeResponder handles the response to the ListAtManagementGroupScope request. The method always +// closes the http.Response Body. +func (client DeploymentOperationsClient) ListAtManagementGroupScopeResponder(resp *http.Response) (result DeploymentOperationsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAtManagementGroupScopeNextResults retrieves the next set of results, if any. +func (client DeploymentOperationsClient) listAtManagementGroupScopeNextResults(ctx context.Context, lastResults DeploymentOperationsListResult) (result DeploymentOperationsListResult, err error) { + req, err := lastResults.deploymentOperationsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listAtManagementGroupScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAtManagementGroupScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listAtManagementGroupScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAtManagementGroupScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listAtManagementGroupScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAtManagementGroupScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentOperationsClient) ListAtManagementGroupScopeComplete(ctx context.Context, groupID string, deploymentName string, top *int32) (result DeploymentOperationsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtManagementGroupScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAtManagementGroupScope(ctx, groupID, deploymentName, top) + return +} + +// ListAtScope gets all deployments operations for a deployment. +// Parameters: +// scope - the resource scope. +// deploymentName - the name of the deployment. +// top - the number of results to return. +func (client DeploymentOperationsClient) ListAtScope(ctx context.Context, scope string, deploymentName string, top *int32) (result DeploymentOperationsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtScope") + defer func() { + sc := -1 + if result.dolr.Response.Response != nil { + sc = result.dolr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentOperationsClient", "ListAtScope", err.Error()) + } + + result.fn = client.listAtScopeNextResults + req, err := client.ListAtScopePreparer(ctx, scope, deploymentName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "ListAtScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtScopeSender(req) + if err != nil { + result.dolr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "ListAtScope", resp, "Failure sending request") + return + } + + result.dolr, err = client.ListAtScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "ListAtScope", resp, "Failure responding to request") + return + } + if result.dolr.hasNextLink() && result.dolr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAtScopePreparer prepares the ListAtScope request. +func (client DeploymentOperationsClient) ListAtScopePreparer(ctx context.Context, scope string, deploymentName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "scope": scope, + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAtScopeSender sends the ListAtScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentOperationsClient) ListAtScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListAtScopeResponder handles the response to the ListAtScope request. The method always +// closes the http.Response Body. +func (client DeploymentOperationsClient) ListAtScopeResponder(resp *http.Response) (result DeploymentOperationsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAtScopeNextResults retrieves the next set of results, if any. +func (client DeploymentOperationsClient) listAtScopeNextResults(ctx context.Context, lastResults DeploymentOperationsListResult) (result DeploymentOperationsListResult, err error) { + req, err := lastResults.deploymentOperationsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listAtScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAtScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listAtScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAtScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listAtScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAtScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentOperationsClient) ListAtScopeComplete(ctx context.Context, scope string, deploymentName string, top *int32) (result DeploymentOperationsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAtScope(ctx, scope, deploymentName, top) + return +} + +// ListAtSubscriptionScope gets all deployments operations for a deployment. +// Parameters: +// deploymentName - the name of the deployment. +// top - the number of results to return. +func (client DeploymentOperationsClient) ListAtSubscriptionScope(ctx context.Context, deploymentName string, top *int32) (result DeploymentOperationsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtSubscriptionScope") + defer func() { + sc := -1 + if result.dolr.Response.Response != nil { + sc = result.dolr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentOperationsClient", "ListAtSubscriptionScope", err.Error()) + } + + result.fn = client.listAtSubscriptionScopeNextResults + req, err := client.ListAtSubscriptionScopePreparer(ctx, deploymentName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "ListAtSubscriptionScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtSubscriptionScopeSender(req) + if err != nil { + result.dolr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "ListAtSubscriptionScope", resp, "Failure sending request") + return + } + + result.dolr, err = client.ListAtSubscriptionScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "ListAtSubscriptionScope", resp, "Failure responding to request") + return + } + if result.dolr.hasNextLink() && result.dolr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAtSubscriptionScopePreparer prepares the ListAtSubscriptionScope request. +func (client DeploymentOperationsClient) ListAtSubscriptionScopePreparer(ctx context.Context, deploymentName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAtSubscriptionScopeSender sends the ListAtSubscriptionScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentOperationsClient) ListAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAtSubscriptionScopeResponder handles the response to the ListAtSubscriptionScope request. The method always +// closes the http.Response Body. +func (client DeploymentOperationsClient) ListAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentOperationsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAtSubscriptionScopeNextResults retrieves the next set of results, if any. +func (client DeploymentOperationsClient) listAtSubscriptionScopeNextResults(ctx context.Context, lastResults DeploymentOperationsListResult) (result DeploymentOperationsListResult, err error) { + req, err := lastResults.deploymentOperationsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listAtSubscriptionScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAtSubscriptionScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listAtSubscriptionScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAtSubscriptionScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listAtSubscriptionScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAtSubscriptionScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentOperationsClient) ListAtSubscriptionScopeComplete(ctx context.Context, deploymentName string, top *int32) (result DeploymentOperationsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtSubscriptionScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAtSubscriptionScope(ctx, deploymentName, top) + return +} + +// ListAtTenantScope gets all deployments operations for a deployment. +// Parameters: +// deploymentName - the name of the deployment. +// top - the number of results to return. +func (client DeploymentOperationsClient) ListAtTenantScope(ctx context.Context, deploymentName string, top *int32) (result DeploymentOperationsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtTenantScope") + defer func() { + sc := -1 + if result.dolr.Response.Response != nil { + sc = result.dolr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentOperationsClient", "ListAtTenantScope", err.Error()) + } + + result.fn = client.listAtTenantScopeNextResults + req, err := client.ListAtTenantScopePreparer(ctx, deploymentName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "ListAtTenantScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtTenantScopeSender(req) + if err != nil { + result.dolr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "ListAtTenantScope", resp, "Failure sending request") + return + } + + result.dolr, err = client.ListAtTenantScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "ListAtTenantScope", resp, "Failure responding to request") + return + } + if result.dolr.hasNextLink() && result.dolr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAtTenantScopePreparer prepares the ListAtTenantScope request. +func (client DeploymentOperationsClient) ListAtTenantScopePreparer(ctx context.Context, deploymentName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}/operations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAtTenantScopeSender sends the ListAtTenantScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentOperationsClient) ListAtTenantScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListAtTenantScopeResponder handles the response to the ListAtTenantScope request. The method always +// closes the http.Response Body. +func (client DeploymentOperationsClient) ListAtTenantScopeResponder(resp *http.Response) (result DeploymentOperationsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAtTenantScopeNextResults retrieves the next set of results, if any. +func (client DeploymentOperationsClient) listAtTenantScopeNextResults(ctx context.Context, lastResults DeploymentOperationsListResult) (result DeploymentOperationsListResult, err error) { + req, err := lastResults.deploymentOperationsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listAtTenantScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAtTenantScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listAtTenantScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAtTenantScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listAtTenantScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAtTenantScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentOperationsClient) ListAtTenantScopeComplete(ctx context.Context, deploymentName string, top *int32) (result DeploymentOperationsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtTenantScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAtTenantScope(ctx, deploymentName, top) + return +} diff --git a/services/resources/mgmt/2021-01-01/resources/deployments.go b/services/resources/mgmt/2021-01-01/resources/deployments.go new file mode 100644 index 000000000000..a9bd4703c9df --- /dev/null +++ b/services/resources/mgmt/2021-01-01/resources/deployments.go @@ -0,0 +1,4211 @@ +package resources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DeploymentsClient is the provides operations for working with resources and resource groups. +type DeploymentsClient struct { + BaseClient +} + +// NewDeploymentsClient creates an instance of the DeploymentsClient client. +func NewDeploymentsClient(subscriptionID string) DeploymentsClient { + return NewDeploymentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDeploymentsClientWithBaseURI creates an instance of the DeploymentsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentsClient { + return DeploymentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CalculateTemplateHash calculate the hash of the given template. +// Parameters: +// templateParameter - the template provided to calculate hash. +func (client DeploymentsClient) CalculateTemplateHash(ctx context.Context, templateParameter interface{}) (result TemplateHashResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CalculateTemplateHash") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CalculateTemplateHashPreparer(ctx, templateParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CalculateTemplateHash", nil, "Failure preparing request") + return + } + + resp, err := client.CalculateTemplateHashSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CalculateTemplateHash", resp, "Failure sending request") + return + } + + result, err = client.CalculateTemplateHashResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CalculateTemplateHash", resp, "Failure responding to request") + return + } + + return +} + +// CalculateTemplateHashPreparer prepares the CalculateTemplateHash request. +func (client DeploymentsClient) CalculateTemplateHashPreparer(ctx context.Context, templateParameter interface{}) (*http.Request, error) { + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Resources/calculateTemplateHash"), + autorest.WithJSON(templateParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CalculateTemplateHashSender sends the CalculateTemplateHash request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CalculateTemplateHashSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CalculateTemplateHashResponder handles the response to the CalculateTemplateHash request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CalculateTemplateHashResponder(resp *http.Response) (result TemplateHashResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Cancel you can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is +// canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running +// template deployment and leaves the resource group partially deployed. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// deploymentName - the name of the deployment. +func (client DeploymentsClient) Cancel(ctx context.Context, resourceGroupName string, deploymentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Cancel") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "Cancel", err.Error()) + } + + req, err := client.CancelPreparer(ctx, resourceGroupName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Cancel", nil, "Failure preparing request") + return + } + + resp, err := client.CancelSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Cancel", resp, "Failure sending request") + return + } + + result, err = client.CancelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Cancel", resp, "Failure responding to request") + return + } + + return +} + +// CancelPreparer prepares the Cancel request. +func (client DeploymentsClient) CancelPreparer(ctx context.Context, resourceGroupName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CancelSender sends the Cancel request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CancelSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CancelResponder handles the response to the Cancel request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// CancelAtManagementGroupScope you can cancel a deployment only if the provisioningState is Accepted or Running. After +// the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the +// currently running template deployment and leaves the resources partially deployed. +// Parameters: +// groupID - the management group ID. +// deploymentName - the name of the deployment. +func (client DeploymentsClient) CancelAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CancelAtManagementGroupScope") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "CancelAtManagementGroupScope", err.Error()) + } + + req, err := client.CancelAtManagementGroupScopePreparer(ctx, groupID, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CancelAtManagementGroupScope", nil, "Failure preparing request") + return + } + + resp, err := client.CancelAtManagementGroupScopeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CancelAtManagementGroupScope", resp, "Failure sending request") + return + } + + result, err = client.CancelAtManagementGroupScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CancelAtManagementGroupScope", resp, "Failure responding to request") + return + } + + return +} + +// CancelAtManagementGroupScopePreparer prepares the CancelAtManagementGroupScope request. +func (client DeploymentsClient) CancelAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "groupId": autorest.Encode("path", groupID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CancelAtManagementGroupScopeSender sends the CancelAtManagementGroupScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CancelAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CancelAtManagementGroupScopeResponder handles the response to the CancelAtManagementGroupScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CancelAtManagementGroupScopeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// CancelAtScope you can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment +// is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running +// template deployment and leaves the resources partially deployed. +// Parameters: +// scope - the resource scope. +// deploymentName - the name of the deployment. +func (client DeploymentsClient) CancelAtScope(ctx context.Context, scope string, deploymentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CancelAtScope") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "CancelAtScope", err.Error()) + } + + req, err := client.CancelAtScopePreparer(ctx, scope, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CancelAtScope", nil, "Failure preparing request") + return + } + + resp, err := client.CancelAtScopeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CancelAtScope", resp, "Failure sending request") + return + } + + result, err = client.CancelAtScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CancelAtScope", resp, "Failure responding to request") + return + } + + return +} + +// CancelAtScopePreparer prepares the CancelAtScope request. +func (client DeploymentsClient) CancelAtScopePreparer(ctx context.Context, scope string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "scope": scope, + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CancelAtScopeSender sends the CancelAtScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CancelAtScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CancelAtScopeResponder handles the response to the CancelAtScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CancelAtScopeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// CancelAtSubscriptionScope you can cancel a deployment only if the provisioningState is Accepted or Running. After +// the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the +// currently running template deployment and leaves the resources partially deployed. +// Parameters: +// deploymentName - the name of the deployment. +func (client DeploymentsClient) CancelAtSubscriptionScope(ctx context.Context, deploymentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CancelAtSubscriptionScope") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "CancelAtSubscriptionScope", err.Error()) + } + + req, err := client.CancelAtSubscriptionScopePreparer(ctx, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CancelAtSubscriptionScope", nil, "Failure preparing request") + return + } + + resp, err := client.CancelAtSubscriptionScopeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CancelAtSubscriptionScope", resp, "Failure sending request") + return + } + + result, err = client.CancelAtSubscriptionScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CancelAtSubscriptionScope", resp, "Failure responding to request") + return + } + + return +} + +// CancelAtSubscriptionScopePreparer prepares the CancelAtSubscriptionScope request. +func (client DeploymentsClient) CancelAtSubscriptionScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CancelAtSubscriptionScopeSender sends the CancelAtSubscriptionScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CancelAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CancelAtSubscriptionScopeResponder handles the response to the CancelAtSubscriptionScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CancelAtSubscriptionScopeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// CancelAtTenantScope you can cancel a deployment only if the provisioningState is Accepted or Running. After the +// deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the +// currently running template deployment and leaves the resources partially deployed. +// Parameters: +// deploymentName - the name of the deployment. +func (client DeploymentsClient) CancelAtTenantScope(ctx context.Context, deploymentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CancelAtTenantScope") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "CancelAtTenantScope", err.Error()) + } + + req, err := client.CancelAtTenantScopePreparer(ctx, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CancelAtTenantScope", nil, "Failure preparing request") + return + } + + resp, err := client.CancelAtTenantScopeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CancelAtTenantScope", resp, "Failure sending request") + return + } + + result, err = client.CancelAtTenantScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CancelAtTenantScope", resp, "Failure responding to request") + return + } + + return +} + +// CancelAtTenantScopePreparer prepares the CancelAtTenantScope request. +func (client DeploymentsClient) CancelAtTenantScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CancelAtTenantScopeSender sends the CancelAtTenantScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CancelAtTenantScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CancelAtTenantScopeResponder handles the response to the CancelAtTenantScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CancelAtTenantScopeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// CheckExistence checks whether the deployment exists. +// Parameters: +// resourceGroupName - the name of the resource group with the deployment to check. The name is case +// insensitive. +// deploymentName - the name of the deployment. +func (client DeploymentsClient) CheckExistence(ctx context.Context, resourceGroupName string, deploymentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CheckExistence") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "CheckExistence", err.Error()) + } + + req, err := client.CheckExistencePreparer(ctx, resourceGroupName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistence", nil, "Failure preparing request") + return + } + + resp, err := client.CheckExistenceSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistence", resp, "Failure sending request") + return + } + + result, err = client.CheckExistenceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistence", resp, "Failure responding to request") + return + } + + return +} + +// CheckExistencePreparer prepares the CheckExistence request. +func (client DeploymentsClient) CheckExistencePreparer(ctx context.Context, resourceGroupName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckExistenceSender sends the CheckExistence request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CheckExistenceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckExistenceResponder handles the response to the CheckExistence request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// CheckExistenceAtManagementGroupScope checks whether the deployment exists. +// Parameters: +// groupID - the management group ID. +// deploymentName - the name of the deployment. +func (client DeploymentsClient) CheckExistenceAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CheckExistenceAtManagementGroupScope") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "CheckExistenceAtManagementGroupScope", err.Error()) + } + + req, err := client.CheckExistenceAtManagementGroupScopePreparer(ctx, groupID, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistenceAtManagementGroupScope", nil, "Failure preparing request") + return + } + + resp, err := client.CheckExistenceAtManagementGroupScopeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistenceAtManagementGroupScope", resp, "Failure sending request") + return + } + + result, err = client.CheckExistenceAtManagementGroupScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistenceAtManagementGroupScope", resp, "Failure responding to request") + return + } + + return +} + +// CheckExistenceAtManagementGroupScopePreparer prepares the CheckExistenceAtManagementGroupScope request. +func (client DeploymentsClient) CheckExistenceAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "groupId": autorest.Encode("path", groupID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckExistenceAtManagementGroupScopeSender sends the CheckExistenceAtManagementGroupScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CheckExistenceAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CheckExistenceAtManagementGroupScopeResponder handles the response to the CheckExistenceAtManagementGroupScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CheckExistenceAtManagementGroupScopeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// CheckExistenceAtScope checks whether the deployment exists. +// Parameters: +// scope - the resource scope. +// deploymentName - the name of the deployment. +func (client DeploymentsClient) CheckExistenceAtScope(ctx context.Context, scope string, deploymentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CheckExistenceAtScope") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "CheckExistenceAtScope", err.Error()) + } + + req, err := client.CheckExistenceAtScopePreparer(ctx, scope, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistenceAtScope", nil, "Failure preparing request") + return + } + + resp, err := client.CheckExistenceAtScopeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistenceAtScope", resp, "Failure sending request") + return + } + + result, err = client.CheckExistenceAtScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistenceAtScope", resp, "Failure responding to request") + return + } + + return +} + +// CheckExistenceAtScopePreparer prepares the CheckExistenceAtScope request. +func (client DeploymentsClient) CheckExistenceAtScopePreparer(ctx context.Context, scope string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "scope": scope, + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckExistenceAtScopeSender sends the CheckExistenceAtScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CheckExistenceAtScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CheckExistenceAtScopeResponder handles the response to the CheckExistenceAtScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CheckExistenceAtScopeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// CheckExistenceAtSubscriptionScope checks whether the deployment exists. +// Parameters: +// deploymentName - the name of the deployment. +func (client DeploymentsClient) CheckExistenceAtSubscriptionScope(ctx context.Context, deploymentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CheckExistenceAtSubscriptionScope") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "CheckExistenceAtSubscriptionScope", err.Error()) + } + + req, err := client.CheckExistenceAtSubscriptionScopePreparer(ctx, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistenceAtSubscriptionScope", nil, "Failure preparing request") + return + } + + resp, err := client.CheckExistenceAtSubscriptionScopeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistenceAtSubscriptionScope", resp, "Failure sending request") + return + } + + result, err = client.CheckExistenceAtSubscriptionScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistenceAtSubscriptionScope", resp, "Failure responding to request") + return + } + + return +} + +// CheckExistenceAtSubscriptionScopePreparer prepares the CheckExistenceAtSubscriptionScope request. +func (client DeploymentsClient) CheckExistenceAtSubscriptionScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckExistenceAtSubscriptionScopeSender sends the CheckExistenceAtSubscriptionScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CheckExistenceAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckExistenceAtSubscriptionScopeResponder handles the response to the CheckExistenceAtSubscriptionScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CheckExistenceAtSubscriptionScopeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// CheckExistenceAtTenantScope checks whether the deployment exists. +// Parameters: +// deploymentName - the name of the deployment. +func (client DeploymentsClient) CheckExistenceAtTenantScope(ctx context.Context, deploymentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CheckExistenceAtTenantScope") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "CheckExistenceAtTenantScope", err.Error()) + } + + req, err := client.CheckExistenceAtTenantScopePreparer(ctx, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistenceAtTenantScope", nil, "Failure preparing request") + return + } + + resp, err := client.CheckExistenceAtTenantScopeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistenceAtTenantScope", resp, "Failure sending request") + return + } + + result, err = client.CheckExistenceAtTenantScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistenceAtTenantScope", resp, "Failure responding to request") + return + } + + return +} + +// CheckExistenceAtTenantScopePreparer prepares the CheckExistenceAtTenantScope request. +func (client DeploymentsClient) CheckExistenceAtTenantScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckExistenceAtTenantScopeSender sends the CheckExistenceAtTenantScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CheckExistenceAtTenantScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CheckExistenceAtTenantScopeResponder handles the response to the CheckExistenceAtTenantScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CheckExistenceAtTenantScopeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate you can provide the template and parameters directly in the request or link to JSON files. +// Parameters: +// resourceGroupName - the name of the resource group to deploy the resources to. The name is case insensitive. +// The resource group must already exist. +// deploymentName - the name of the deployment. +// parameters - additional parameters supplied to the operation. +func (client DeploymentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment) (result DeploymentsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, deploymentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CreateOrUpdateSender(req *http.Request) (future DeploymentsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (result DeploymentExtended, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAtManagementGroupScope you can provide the template and parameters directly in the request or link to +// JSON files. +// Parameters: +// groupID - the management group ID. +// deploymentName - the name of the deployment. +// parameters - additional parameters supplied to the operation. +func (client DeploymentsClient) CreateOrUpdateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment) (result DeploymentsCreateOrUpdateAtManagementGroupScopeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CreateOrUpdateAtManagementGroupScope") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "CreateOrUpdateAtManagementGroupScope", err.Error()) + } + + req, err := client.CreateOrUpdateAtManagementGroupScopePreparer(ctx, groupID, deploymentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdateAtManagementGroupScope", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateAtManagementGroupScopeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdateAtManagementGroupScope", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdateAtManagementGroupScopePreparer prepares the CreateOrUpdateAtManagementGroupScope request. +func (client DeploymentsClient) CreateOrUpdateAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "groupId": autorest.Encode("path", groupID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateAtManagementGroupScopeSender sends the CreateOrUpdateAtManagementGroupScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CreateOrUpdateAtManagementGroupScopeSender(req *http.Request) (future DeploymentsCreateOrUpdateAtManagementGroupScopeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateAtManagementGroupScopeResponder handles the response to the CreateOrUpdateAtManagementGroupScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CreateOrUpdateAtManagementGroupScopeResponder(resp *http.Response) (result DeploymentExtended, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAtScope you can provide the template and parameters directly in the request or link to JSON files. +// Parameters: +// scope - the resource scope. +// deploymentName - the name of the deployment. +// parameters - additional parameters supplied to the operation. +func (client DeploymentsClient) CreateOrUpdateAtScope(ctx context.Context, scope string, deploymentName string, parameters Deployment) (result DeploymentsCreateOrUpdateAtScopeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CreateOrUpdateAtScope") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "CreateOrUpdateAtScope", err.Error()) + } + + req, err := client.CreateOrUpdateAtScopePreparer(ctx, scope, deploymentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdateAtScope", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateAtScopeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdateAtScope", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdateAtScopePreparer prepares the CreateOrUpdateAtScope request. +func (client DeploymentsClient) CreateOrUpdateAtScopePreparer(ctx context.Context, scope string, deploymentName string, parameters Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "scope": scope, + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateAtScopeSender sends the CreateOrUpdateAtScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CreateOrUpdateAtScopeSender(req *http.Request) (future DeploymentsCreateOrUpdateAtScopeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateAtScopeResponder handles the response to the CreateOrUpdateAtScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CreateOrUpdateAtScopeResponder(resp *http.Response) (result DeploymentExtended, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAtSubscriptionScope you can provide the template and parameters directly in the request or link to +// JSON files. +// Parameters: +// deploymentName - the name of the deployment. +// parameters - additional parameters supplied to the operation. +func (client DeploymentsClient) CreateOrUpdateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters Deployment) (result DeploymentsCreateOrUpdateAtSubscriptionScopeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CreateOrUpdateAtSubscriptionScope") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "CreateOrUpdateAtSubscriptionScope", err.Error()) + } + + req, err := client.CreateOrUpdateAtSubscriptionScopePreparer(ctx, deploymentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdateAtSubscriptionScope", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateAtSubscriptionScopeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdateAtSubscriptionScope", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdateAtSubscriptionScopePreparer prepares the CreateOrUpdateAtSubscriptionScope request. +func (client DeploymentsClient) CreateOrUpdateAtSubscriptionScopePreparer(ctx context.Context, deploymentName string, parameters Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateAtSubscriptionScopeSender sends the CreateOrUpdateAtSubscriptionScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CreateOrUpdateAtSubscriptionScopeSender(req *http.Request) (future DeploymentsCreateOrUpdateAtSubscriptionScopeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateAtSubscriptionScopeResponder handles the response to the CreateOrUpdateAtSubscriptionScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CreateOrUpdateAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentExtended, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAtTenantScope you can provide the template and parameters directly in the request or link to JSON +// files. +// Parameters: +// deploymentName - the name of the deployment. +// parameters - additional parameters supplied to the operation. +func (client DeploymentsClient) CreateOrUpdateAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeployment) (result DeploymentsCreateOrUpdateAtTenantScopeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CreateOrUpdateAtTenantScope") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "CreateOrUpdateAtTenantScope", err.Error()) + } + + req, err := client.CreateOrUpdateAtTenantScopePreparer(ctx, deploymentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdateAtTenantScope", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateAtTenantScopeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdateAtTenantScope", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdateAtTenantScopePreparer prepares the CreateOrUpdateAtTenantScope request. +func (client DeploymentsClient) CreateOrUpdateAtTenantScopePreparer(ctx context.Context, deploymentName string, parameters ScopedDeployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateAtTenantScopeSender sends the CreateOrUpdateAtTenantScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CreateOrUpdateAtTenantScopeSender(req *http.Request) (future DeploymentsCreateOrUpdateAtTenantScopeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateAtTenantScopeResponder handles the response to the CreateOrUpdateAtTenantScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CreateOrUpdateAtTenantScopeResponder(resp *http.Response) (result DeploymentExtended, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete a template deployment that is currently running cannot be deleted. Deleting a template deployment removes the +// associated deployment operations. Deleting a template deployment does not affect the state of the resource group. +// This is an asynchronous operation that returns a status of 202 until the template deployment is successfully +// deleted. The Location response header contains the URI that is used to obtain the status of the process. While the +// process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the +// URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the +// Location header returns an error-level status code. +// Parameters: +// resourceGroupName - the name of the resource group with the deployment to delete. The name is case +// insensitive. +// deploymentName - the name of the deployment. +func (client DeploymentsClient) Delete(ctx context.Context, resourceGroupName string, deploymentName string) (result DeploymentsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DeploymentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) DeleteSender(req *http.Request) (future DeploymentsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAtManagementGroupScope a template deployment that is currently running cannot be deleted. Deleting a template +// deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of +// 202 until the template deployment is successfully deleted. The Location response header contains the URI that is +// used to obtain the status of the process. While the process is running, a call to the URI in the Location header +// returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on +// success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. +// Parameters: +// groupID - the management group ID. +// deploymentName - the name of the deployment. +func (client DeploymentsClient) DeleteAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string) (result DeploymentsDeleteAtManagementGroupScopeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.DeleteAtManagementGroupScope") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "DeleteAtManagementGroupScope", err.Error()) + } + + req, err := client.DeleteAtManagementGroupScopePreparer(ctx, groupID, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "DeleteAtManagementGroupScope", nil, "Failure preparing request") + return + } + + result, err = client.DeleteAtManagementGroupScopeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "DeleteAtManagementGroupScope", result.Response(), "Failure sending request") + return + } + + return +} + +// DeleteAtManagementGroupScopePreparer prepares the DeleteAtManagementGroupScope request. +func (client DeploymentsClient) DeleteAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "groupId": autorest.Encode("path", groupID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteAtManagementGroupScopeSender sends the DeleteAtManagementGroupScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) DeleteAtManagementGroupScopeSender(req *http.Request) (future DeploymentsDeleteAtManagementGroupScopeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteAtManagementGroupScopeResponder handles the response to the DeleteAtManagementGroupScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) DeleteAtManagementGroupScopeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAtScope a template deployment that is currently running cannot be deleted. Deleting a template deployment +// removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until +// the template deployment is successfully deleted. The Location response header contains the URI that is used to +// obtain the status of the process. While the process is running, a call to the URI in the Location header returns a +// status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the +// asynchronous request failed, the URI in the Location header returns an error-level status code. +// Parameters: +// scope - the resource scope. +// deploymentName - the name of the deployment. +func (client DeploymentsClient) DeleteAtScope(ctx context.Context, scope string, deploymentName string) (result DeploymentsDeleteAtScopeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.DeleteAtScope") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "DeleteAtScope", err.Error()) + } + + req, err := client.DeleteAtScopePreparer(ctx, scope, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "DeleteAtScope", nil, "Failure preparing request") + return + } + + result, err = client.DeleteAtScopeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "DeleteAtScope", result.Response(), "Failure sending request") + return + } + + return +} + +// DeleteAtScopePreparer prepares the DeleteAtScope request. +func (client DeploymentsClient) DeleteAtScopePreparer(ctx context.Context, scope string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "scope": scope, + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteAtScopeSender sends the DeleteAtScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) DeleteAtScopeSender(req *http.Request) (future DeploymentsDeleteAtScopeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteAtScopeResponder handles the response to the DeleteAtScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) DeleteAtScopeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAtSubscriptionScope a template deployment that is currently running cannot be deleted. Deleting a template +// deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of +// 202 until the template deployment is successfully deleted. The Location response header contains the URI that is +// used to obtain the status of the process. While the process is running, a call to the URI in the Location header +// returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on +// success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. +// Parameters: +// deploymentName - the name of the deployment. +func (client DeploymentsClient) DeleteAtSubscriptionScope(ctx context.Context, deploymentName string) (result DeploymentsDeleteAtSubscriptionScopeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.DeleteAtSubscriptionScope") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "DeleteAtSubscriptionScope", err.Error()) + } + + req, err := client.DeleteAtSubscriptionScopePreparer(ctx, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "DeleteAtSubscriptionScope", nil, "Failure preparing request") + return + } + + result, err = client.DeleteAtSubscriptionScopeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "DeleteAtSubscriptionScope", result.Response(), "Failure sending request") + return + } + + return +} + +// DeleteAtSubscriptionScopePreparer prepares the DeleteAtSubscriptionScope request. +func (client DeploymentsClient) DeleteAtSubscriptionScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteAtSubscriptionScopeSender sends the DeleteAtSubscriptionScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) DeleteAtSubscriptionScopeSender(req *http.Request) (future DeploymentsDeleteAtSubscriptionScopeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteAtSubscriptionScopeResponder handles the response to the DeleteAtSubscriptionScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) DeleteAtSubscriptionScopeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAtTenantScope a template deployment that is currently running cannot be deleted. Deleting a template +// deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of +// 202 until the template deployment is successfully deleted. The Location response header contains the URI that is +// used to obtain the status of the process. While the process is running, a call to the URI in the Location header +// returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on +// success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. +// Parameters: +// deploymentName - the name of the deployment. +func (client DeploymentsClient) DeleteAtTenantScope(ctx context.Context, deploymentName string) (result DeploymentsDeleteAtTenantScopeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.DeleteAtTenantScope") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "DeleteAtTenantScope", err.Error()) + } + + req, err := client.DeleteAtTenantScopePreparer(ctx, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "DeleteAtTenantScope", nil, "Failure preparing request") + return + } + + result, err = client.DeleteAtTenantScopeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "DeleteAtTenantScope", result.Response(), "Failure sending request") + return + } + + return +} + +// DeleteAtTenantScopePreparer prepares the DeleteAtTenantScope request. +func (client DeploymentsClient) DeleteAtTenantScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteAtTenantScopeSender sends the DeleteAtTenantScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) DeleteAtTenantScopeSender(req *http.Request) (future DeploymentsDeleteAtTenantScopeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteAtTenantScopeResponder handles the response to the DeleteAtTenantScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) DeleteAtTenantScopeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ExportTemplate exports the template used for specified deployment. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// deploymentName - the name of the deployment. +func (client DeploymentsClient) ExportTemplate(ctx context.Context, resourceGroupName string, deploymentName string) (result DeploymentExportResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ExportTemplate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "ExportTemplate", err.Error()) + } + + req, err := client.ExportTemplatePreparer(ctx, resourceGroupName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplate", nil, "Failure preparing request") + return + } + + resp, err := client.ExportTemplateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplate", resp, "Failure sending request") + return + } + + result, err = client.ExportTemplateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplate", resp, "Failure responding to request") + return + } + + return +} + +// ExportTemplatePreparer prepares the ExportTemplate request. +func (client DeploymentsClient) ExportTemplatePreparer(ctx context.Context, resourceGroupName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExportTemplateSender sends the ExportTemplate request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ExportTemplateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ExportTemplateResponder handles the response to the ExportTemplate request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ExportTemplateResponder(resp *http.Response) (result DeploymentExportResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ExportTemplateAtManagementGroupScope exports the template used for specified deployment. +// Parameters: +// groupID - the management group ID. +// deploymentName - the name of the deployment. +func (client DeploymentsClient) ExportTemplateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string) (result DeploymentExportResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ExportTemplateAtManagementGroupScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "ExportTemplateAtManagementGroupScope", err.Error()) + } + + req, err := client.ExportTemplateAtManagementGroupScopePreparer(ctx, groupID, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplateAtManagementGroupScope", nil, "Failure preparing request") + return + } + + resp, err := client.ExportTemplateAtManagementGroupScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplateAtManagementGroupScope", resp, "Failure sending request") + return + } + + result, err = client.ExportTemplateAtManagementGroupScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplateAtManagementGroupScope", resp, "Failure responding to request") + return + } + + return +} + +// ExportTemplateAtManagementGroupScopePreparer prepares the ExportTemplateAtManagementGroupScope request. +func (client DeploymentsClient) ExportTemplateAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "groupId": autorest.Encode("path", groupID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExportTemplateAtManagementGroupScopeSender sends the ExportTemplateAtManagementGroupScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ExportTemplateAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ExportTemplateAtManagementGroupScopeResponder handles the response to the ExportTemplateAtManagementGroupScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ExportTemplateAtManagementGroupScopeResponder(resp *http.Response) (result DeploymentExportResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ExportTemplateAtScope exports the template used for specified deployment. +// Parameters: +// scope - the resource scope. +// deploymentName - the name of the deployment. +func (client DeploymentsClient) ExportTemplateAtScope(ctx context.Context, scope string, deploymentName string) (result DeploymentExportResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ExportTemplateAtScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "ExportTemplateAtScope", err.Error()) + } + + req, err := client.ExportTemplateAtScopePreparer(ctx, scope, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplateAtScope", nil, "Failure preparing request") + return + } + + resp, err := client.ExportTemplateAtScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplateAtScope", resp, "Failure sending request") + return + } + + result, err = client.ExportTemplateAtScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplateAtScope", resp, "Failure responding to request") + return + } + + return +} + +// ExportTemplateAtScopePreparer prepares the ExportTemplateAtScope request. +func (client DeploymentsClient) ExportTemplateAtScopePreparer(ctx context.Context, scope string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "scope": scope, + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExportTemplateAtScopeSender sends the ExportTemplateAtScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ExportTemplateAtScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ExportTemplateAtScopeResponder handles the response to the ExportTemplateAtScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ExportTemplateAtScopeResponder(resp *http.Response) (result DeploymentExportResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ExportTemplateAtSubscriptionScope exports the template used for specified deployment. +// Parameters: +// deploymentName - the name of the deployment. +func (client DeploymentsClient) ExportTemplateAtSubscriptionScope(ctx context.Context, deploymentName string) (result DeploymentExportResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ExportTemplateAtSubscriptionScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "ExportTemplateAtSubscriptionScope", err.Error()) + } + + req, err := client.ExportTemplateAtSubscriptionScopePreparer(ctx, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplateAtSubscriptionScope", nil, "Failure preparing request") + return + } + + resp, err := client.ExportTemplateAtSubscriptionScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplateAtSubscriptionScope", resp, "Failure sending request") + return + } + + result, err = client.ExportTemplateAtSubscriptionScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplateAtSubscriptionScope", resp, "Failure responding to request") + return + } + + return +} + +// ExportTemplateAtSubscriptionScopePreparer prepares the ExportTemplateAtSubscriptionScope request. +func (client DeploymentsClient) ExportTemplateAtSubscriptionScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExportTemplateAtSubscriptionScopeSender sends the ExportTemplateAtSubscriptionScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ExportTemplateAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ExportTemplateAtSubscriptionScopeResponder handles the response to the ExportTemplateAtSubscriptionScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ExportTemplateAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentExportResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ExportTemplateAtTenantScope exports the template used for specified deployment. +// Parameters: +// deploymentName - the name of the deployment. +func (client DeploymentsClient) ExportTemplateAtTenantScope(ctx context.Context, deploymentName string) (result DeploymentExportResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ExportTemplateAtTenantScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "ExportTemplateAtTenantScope", err.Error()) + } + + req, err := client.ExportTemplateAtTenantScopePreparer(ctx, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplateAtTenantScope", nil, "Failure preparing request") + return + } + + resp, err := client.ExportTemplateAtTenantScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplateAtTenantScope", resp, "Failure sending request") + return + } + + result, err = client.ExportTemplateAtTenantScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplateAtTenantScope", resp, "Failure responding to request") + return + } + + return +} + +// ExportTemplateAtTenantScopePreparer prepares the ExportTemplateAtTenantScope request. +func (client DeploymentsClient) ExportTemplateAtTenantScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExportTemplateAtTenantScopeSender sends the ExportTemplateAtTenantScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ExportTemplateAtTenantScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ExportTemplateAtTenantScopeResponder handles the response to the ExportTemplateAtTenantScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ExportTemplateAtTenantScopeResponder(resp *http.Response) (result DeploymentExportResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a deployment. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// deploymentName - the name of the deployment. +func (client DeploymentsClient) Get(ctx context.Context, resourceGroupName string, deploymentName string) (result DeploymentExtended, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DeploymentsClient) GetPreparer(ctx context.Context, resourceGroupName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) GetResponder(resp *http.Response) (result DeploymentExtended, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAtManagementGroupScope gets a deployment. +// Parameters: +// groupID - the management group ID. +// deploymentName - the name of the deployment. +func (client DeploymentsClient) GetAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string) (result DeploymentExtended, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GetAtManagementGroupScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "GetAtManagementGroupScope", err.Error()) + } + + req, err := client.GetAtManagementGroupScopePreparer(ctx, groupID, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "GetAtManagementGroupScope", nil, "Failure preparing request") + return + } + + resp, err := client.GetAtManagementGroupScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "GetAtManagementGroupScope", resp, "Failure sending request") + return + } + + result, err = client.GetAtManagementGroupScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "GetAtManagementGroupScope", resp, "Failure responding to request") + return + } + + return +} + +// GetAtManagementGroupScopePreparer prepares the GetAtManagementGroupScope request. +func (client DeploymentsClient) GetAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "groupId": autorest.Encode("path", groupID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAtManagementGroupScopeSender sends the GetAtManagementGroupScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) GetAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetAtManagementGroupScopeResponder handles the response to the GetAtManagementGroupScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) GetAtManagementGroupScopeResponder(resp *http.Response) (result DeploymentExtended, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAtScope gets a deployment. +// Parameters: +// scope - the resource scope. +// deploymentName - the name of the deployment. +func (client DeploymentsClient) GetAtScope(ctx context.Context, scope string, deploymentName string) (result DeploymentExtended, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GetAtScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "GetAtScope", err.Error()) + } + + req, err := client.GetAtScopePreparer(ctx, scope, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "GetAtScope", nil, "Failure preparing request") + return + } + + resp, err := client.GetAtScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "GetAtScope", resp, "Failure sending request") + return + } + + result, err = client.GetAtScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "GetAtScope", resp, "Failure responding to request") + return + } + + return +} + +// GetAtScopePreparer prepares the GetAtScope request. +func (client DeploymentsClient) GetAtScopePreparer(ctx context.Context, scope string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "scope": scope, + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAtScopeSender sends the GetAtScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) GetAtScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetAtScopeResponder handles the response to the GetAtScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) GetAtScopeResponder(resp *http.Response) (result DeploymentExtended, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAtSubscriptionScope gets a deployment. +// Parameters: +// deploymentName - the name of the deployment. +func (client DeploymentsClient) GetAtSubscriptionScope(ctx context.Context, deploymentName string) (result DeploymentExtended, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GetAtSubscriptionScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "GetAtSubscriptionScope", err.Error()) + } + + req, err := client.GetAtSubscriptionScopePreparer(ctx, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "GetAtSubscriptionScope", nil, "Failure preparing request") + return + } + + resp, err := client.GetAtSubscriptionScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "GetAtSubscriptionScope", resp, "Failure sending request") + return + } + + result, err = client.GetAtSubscriptionScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "GetAtSubscriptionScope", resp, "Failure responding to request") + return + } + + return +} + +// GetAtSubscriptionScopePreparer prepares the GetAtSubscriptionScope request. +func (client DeploymentsClient) GetAtSubscriptionScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAtSubscriptionScopeSender sends the GetAtSubscriptionScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) GetAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAtSubscriptionScopeResponder handles the response to the GetAtSubscriptionScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) GetAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentExtended, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAtTenantScope gets a deployment. +// Parameters: +// deploymentName - the name of the deployment. +func (client DeploymentsClient) GetAtTenantScope(ctx context.Context, deploymentName string) (result DeploymentExtended, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GetAtTenantScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "GetAtTenantScope", err.Error()) + } + + req, err := client.GetAtTenantScopePreparer(ctx, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "GetAtTenantScope", nil, "Failure preparing request") + return + } + + resp, err := client.GetAtTenantScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "GetAtTenantScope", resp, "Failure sending request") + return + } + + result, err = client.GetAtTenantScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "GetAtTenantScope", resp, "Failure responding to request") + return + } + + return +} + +// GetAtTenantScopePreparer prepares the GetAtTenantScope request. +func (client DeploymentsClient) GetAtTenantScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAtTenantScopeSender sends the GetAtTenantScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) GetAtTenantScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetAtTenantScopeResponder handles the response to the GetAtTenantScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) GetAtTenantScopeResponder(resp *http.Response) (result DeploymentExtended, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAtManagementGroupScope get all the deployments for a management group. +// Parameters: +// groupID - the management group ID. +// filter - the filter to apply on the operation. For example, you can use $filter=provisioningState eq +// '{state}'. +// top - the number of results to get. If null is passed, returns all deployments. +func (client DeploymentsClient) ListAtManagementGroupScope(ctx context.Context, groupID string, filter string, top *int32) (result DeploymentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtManagementGroupScope") + defer func() { + sc := -1 + if result.dlr.Response.Response != nil { + sc = result.dlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "ListAtManagementGroupScope", err.Error()) + } + + result.fn = client.listAtManagementGroupScopeNextResults + req, err := client.ListAtManagementGroupScopePreparer(ctx, groupID, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListAtManagementGroupScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtManagementGroupScopeSender(req) + if err != nil { + result.dlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListAtManagementGroupScope", resp, "Failure sending request") + return + } + + result.dlr, err = client.ListAtManagementGroupScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListAtManagementGroupScope", resp, "Failure responding to request") + return + } + if result.dlr.hasNextLink() && result.dlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAtManagementGroupScopePreparer prepares the ListAtManagementGroupScope request. +func (client DeploymentsClient) ListAtManagementGroupScopePreparer(ctx context.Context, groupID string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAtManagementGroupScopeSender sends the ListAtManagementGroupScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ListAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListAtManagementGroupScopeResponder handles the response to the ListAtManagementGroupScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ListAtManagementGroupScopeResponder(resp *http.Response) (result DeploymentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAtManagementGroupScopeNextResults retrieves the next set of results, if any. +func (client DeploymentsClient) listAtManagementGroupScopeNextResults(ctx context.Context, lastResults DeploymentListResult) (result DeploymentListResult, err error) { + req, err := lastResults.deploymentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listAtManagementGroupScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAtManagementGroupScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listAtManagementGroupScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAtManagementGroupScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listAtManagementGroupScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAtManagementGroupScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentsClient) ListAtManagementGroupScopeComplete(ctx context.Context, groupID string, filter string, top *int32) (result DeploymentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtManagementGroupScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAtManagementGroupScope(ctx, groupID, filter, top) + return +} + +// ListAtScope get all the deployments at the given scope. +// Parameters: +// scope - the resource scope. +// filter - the filter to apply on the operation. For example, you can use $filter=provisioningState eq +// '{state}'. +// top - the number of results to get. If null is passed, returns all deployments. +func (client DeploymentsClient) ListAtScope(ctx context.Context, scope string, filter string, top *int32) (result DeploymentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtScope") + defer func() { + sc := -1 + if result.dlr.Response.Response != nil { + sc = result.dlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAtScopeNextResults + req, err := client.ListAtScopePreparer(ctx, scope, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListAtScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtScopeSender(req) + if err != nil { + result.dlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListAtScope", resp, "Failure sending request") + return + } + + result.dlr, err = client.ListAtScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListAtScope", resp, "Failure responding to request") + return + } + if result.dlr.hasNextLink() && result.dlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAtScopePreparer prepares the ListAtScope request. +func (client DeploymentsClient) ListAtScopePreparer(ctx context.Context, scope string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAtScopeSender sends the ListAtScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ListAtScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListAtScopeResponder handles the response to the ListAtScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ListAtScopeResponder(resp *http.Response) (result DeploymentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAtScopeNextResults retrieves the next set of results, if any. +func (client DeploymentsClient) listAtScopeNextResults(ctx context.Context, lastResults DeploymentListResult) (result DeploymentListResult, err error) { + req, err := lastResults.deploymentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listAtScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAtScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listAtScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAtScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listAtScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAtScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentsClient) ListAtScopeComplete(ctx context.Context, scope string, filter string, top *int32) (result DeploymentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAtScope(ctx, scope, filter, top) + return +} + +// ListAtSubscriptionScope get all the deployments for a subscription. +// Parameters: +// filter - the filter to apply on the operation. For example, you can use $filter=provisioningState eq +// '{state}'. +// top - the number of results to get. If null is passed, returns all deployments. +func (client DeploymentsClient) ListAtSubscriptionScope(ctx context.Context, filter string, top *int32) (result DeploymentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtSubscriptionScope") + defer func() { + sc := -1 + if result.dlr.Response.Response != nil { + sc = result.dlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAtSubscriptionScopeNextResults + req, err := client.ListAtSubscriptionScopePreparer(ctx, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListAtSubscriptionScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtSubscriptionScopeSender(req) + if err != nil { + result.dlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListAtSubscriptionScope", resp, "Failure sending request") + return + } + + result.dlr, err = client.ListAtSubscriptionScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListAtSubscriptionScope", resp, "Failure responding to request") + return + } + if result.dlr.hasNextLink() && result.dlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAtSubscriptionScopePreparer prepares the ListAtSubscriptionScope request. +func (client DeploymentsClient) ListAtSubscriptionScopePreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAtSubscriptionScopeSender sends the ListAtSubscriptionScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ListAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAtSubscriptionScopeResponder handles the response to the ListAtSubscriptionScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ListAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAtSubscriptionScopeNextResults retrieves the next set of results, if any. +func (client DeploymentsClient) listAtSubscriptionScopeNextResults(ctx context.Context, lastResults DeploymentListResult) (result DeploymentListResult, err error) { + req, err := lastResults.deploymentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listAtSubscriptionScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAtSubscriptionScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listAtSubscriptionScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAtSubscriptionScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listAtSubscriptionScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAtSubscriptionScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentsClient) ListAtSubscriptionScopeComplete(ctx context.Context, filter string, top *int32) (result DeploymentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtSubscriptionScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAtSubscriptionScope(ctx, filter, top) + return +} + +// ListAtTenantScope get all the deployments at the tenant scope. +// Parameters: +// filter - the filter to apply on the operation. For example, you can use $filter=provisioningState eq +// '{state}'. +// top - the number of results to get. If null is passed, returns all deployments. +func (client DeploymentsClient) ListAtTenantScope(ctx context.Context, filter string, top *int32) (result DeploymentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtTenantScope") + defer func() { + sc := -1 + if result.dlr.Response.Response != nil { + sc = result.dlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAtTenantScopeNextResults + req, err := client.ListAtTenantScopePreparer(ctx, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListAtTenantScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtTenantScopeSender(req) + if err != nil { + result.dlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListAtTenantScope", resp, "Failure sending request") + return + } + + result.dlr, err = client.ListAtTenantScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListAtTenantScope", resp, "Failure responding to request") + return + } + if result.dlr.hasNextLink() && result.dlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAtTenantScopePreparer prepares the ListAtTenantScope request. +func (client DeploymentsClient) ListAtTenantScopePreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Resources/deployments/"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAtTenantScopeSender sends the ListAtTenantScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ListAtTenantScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListAtTenantScopeResponder handles the response to the ListAtTenantScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ListAtTenantScopeResponder(resp *http.Response) (result DeploymentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAtTenantScopeNextResults retrieves the next set of results, if any. +func (client DeploymentsClient) listAtTenantScopeNextResults(ctx context.Context, lastResults DeploymentListResult) (result DeploymentListResult, err error) { + req, err := lastResults.deploymentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listAtTenantScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAtTenantScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listAtTenantScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAtTenantScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listAtTenantScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAtTenantScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentsClient) ListAtTenantScopeComplete(ctx context.Context, filter string, top *int32) (result DeploymentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtTenantScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAtTenantScope(ctx, filter, top) + return +} + +// ListByResourceGroup get all the deployments for a resource group. +// Parameters: +// resourceGroupName - the name of the resource group with the deployments to get. The name is case +// insensitive. +// filter - the filter to apply on the operation. For example, you can use $filter=provisioningState eq +// '{state}'. +// top - the number of results to get. If null is passed, returns all deployments. +func (client DeploymentsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DeploymentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.dlr.Response.Response != nil { + sc = result.dlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.dlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.dlr.hasNextLink() && result.dlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DeploymentsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ListByResourceGroupResponder(resp *http.Response) (result DeploymentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client DeploymentsClient) listByResourceGroupNextResults(ctx context.Context, lastResults DeploymentListResult) (result DeploymentListResult, err error) { + req, err := lastResults.deploymentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DeploymentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, filter, top) + return +} + +// Validate validates whether the specified template is syntactically correct and will be accepted by Azure Resource +// Manager.. +// Parameters: +// resourceGroupName - the name of the resource group the template will be deployed to. The name is case +// insensitive. +// deploymentName - the name of the deployment. +// parameters - parameters to validate. +func (client DeploymentsClient) Validate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment) (result DeploymentsValidateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Validate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "Validate", err.Error()) + } + + req, err := client.ValidatePreparer(ctx, resourceGroupName, deploymentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Validate", nil, "Failure preparing request") + return + } + + result, err = client.ValidateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Validate", result.Response(), "Failure sending request") + return + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client DeploymentsClient) ValidatePreparer(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ValidateSender(req *http.Request) (future DeploymentsValidateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ValidateResponder(resp *http.Response) (result DeploymentValidateResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateAtManagementGroupScope validates whether the specified template is syntactically correct and will be +// accepted by Azure Resource Manager.. +// Parameters: +// groupID - the management group ID. +// deploymentName - the name of the deployment. +// parameters - parameters to validate. +func (client DeploymentsClient) ValidateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment) (result DeploymentsValidateAtManagementGroupScopeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ValidateAtManagementGroupScope") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "ValidateAtManagementGroupScope", err.Error()) + } + + req, err := client.ValidateAtManagementGroupScopePreparer(ctx, groupID, deploymentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ValidateAtManagementGroupScope", nil, "Failure preparing request") + return + } + + result, err = client.ValidateAtManagementGroupScopeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ValidateAtManagementGroupScope", result.Response(), "Failure sending request") + return + } + + return +} + +// ValidateAtManagementGroupScopePreparer prepares the ValidateAtManagementGroupScope request. +func (client DeploymentsClient) ValidateAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "groupId": autorest.Encode("path", groupID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateAtManagementGroupScopeSender sends the ValidateAtManagementGroupScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ValidateAtManagementGroupScopeSender(req *http.Request) (future DeploymentsValidateAtManagementGroupScopeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ValidateAtManagementGroupScopeResponder handles the response to the ValidateAtManagementGroupScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ValidateAtManagementGroupScopeResponder(resp *http.Response) (result DeploymentValidateResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateAtScope validates whether the specified template is syntactically correct and will be accepted by Azure +// Resource Manager.. +// Parameters: +// scope - the resource scope. +// deploymentName - the name of the deployment. +// parameters - parameters to validate. +func (client DeploymentsClient) ValidateAtScope(ctx context.Context, scope string, deploymentName string, parameters Deployment) (result DeploymentsValidateAtScopeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ValidateAtScope") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "ValidateAtScope", err.Error()) + } + + req, err := client.ValidateAtScopePreparer(ctx, scope, deploymentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ValidateAtScope", nil, "Failure preparing request") + return + } + + result, err = client.ValidateAtScopeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ValidateAtScope", result.Response(), "Failure sending request") + return + } + + return +} + +// ValidateAtScopePreparer prepares the ValidateAtScope request. +func (client DeploymentsClient) ValidateAtScopePreparer(ctx context.Context, scope string, deploymentName string, parameters Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "scope": scope, + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateAtScopeSender sends the ValidateAtScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ValidateAtScopeSender(req *http.Request) (future DeploymentsValidateAtScopeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ValidateAtScopeResponder handles the response to the ValidateAtScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ValidateAtScopeResponder(resp *http.Response) (result DeploymentValidateResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateAtSubscriptionScope validates whether the specified template is syntactically correct and will be accepted +// by Azure Resource Manager.. +// Parameters: +// deploymentName - the name of the deployment. +// parameters - parameters to validate. +func (client DeploymentsClient) ValidateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters Deployment) (result DeploymentsValidateAtSubscriptionScopeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ValidateAtSubscriptionScope") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "ValidateAtSubscriptionScope", err.Error()) + } + + req, err := client.ValidateAtSubscriptionScopePreparer(ctx, deploymentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ValidateAtSubscriptionScope", nil, "Failure preparing request") + return + } + + result, err = client.ValidateAtSubscriptionScopeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ValidateAtSubscriptionScope", result.Response(), "Failure sending request") + return + } + + return +} + +// ValidateAtSubscriptionScopePreparer prepares the ValidateAtSubscriptionScope request. +func (client DeploymentsClient) ValidateAtSubscriptionScopePreparer(ctx context.Context, deploymentName string, parameters Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateAtSubscriptionScopeSender sends the ValidateAtSubscriptionScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ValidateAtSubscriptionScopeSender(req *http.Request) (future DeploymentsValidateAtSubscriptionScopeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ValidateAtSubscriptionScopeResponder handles the response to the ValidateAtSubscriptionScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ValidateAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentValidateResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateAtTenantScope validates whether the specified template is syntactically correct and will be accepted by +// Azure Resource Manager.. +// Parameters: +// deploymentName - the name of the deployment. +// parameters - parameters to validate. +func (client DeploymentsClient) ValidateAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeployment) (result DeploymentsValidateAtTenantScopeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ValidateAtTenantScope") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "ValidateAtTenantScope", err.Error()) + } + + req, err := client.ValidateAtTenantScopePreparer(ctx, deploymentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ValidateAtTenantScope", nil, "Failure preparing request") + return + } + + result, err = client.ValidateAtTenantScopeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ValidateAtTenantScope", result.Response(), "Failure sending request") + return + } + + return +} + +// ValidateAtTenantScopePreparer prepares the ValidateAtTenantScope request. +func (client DeploymentsClient) ValidateAtTenantScopePreparer(ctx context.Context, deploymentName string, parameters ScopedDeployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}/validate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateAtTenantScopeSender sends the ValidateAtTenantScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ValidateAtTenantScopeSender(req *http.Request) (future DeploymentsValidateAtTenantScopeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ValidateAtTenantScopeResponder handles the response to the ValidateAtTenantScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ValidateAtTenantScopeResponder(resp *http.Response) (result DeploymentValidateResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// WhatIf returns changes that will be made by the deployment if executed at the scope of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group the template will be deployed to. The name is case +// insensitive. +// deploymentName - the name of the deployment. +// parameters - parameters to validate. +func (client DeploymentsClient) WhatIf(ctx context.Context, resourceGroupName string, deploymentName string, parameters DeploymentWhatIf) (result DeploymentsWhatIfFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.WhatIf") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "WhatIf", err.Error()) + } + + req, err := client.WhatIfPreparer(ctx, resourceGroupName, deploymentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "WhatIf", nil, "Failure preparing request") + return + } + + result, err = client.WhatIfSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "WhatIf", result.Response(), "Failure sending request") + return + } + + return +} + +// WhatIfPreparer prepares the WhatIf request. +func (client DeploymentsClient) WhatIfPreparer(ctx context.Context, resourceGroupName string, deploymentName string, parameters DeploymentWhatIf) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// WhatIfSender sends the WhatIf request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) WhatIfSender(req *http.Request) (future DeploymentsWhatIfFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// WhatIfResponder handles the response to the WhatIf request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) WhatIfResponder(resp *http.Response) (result WhatIfOperationResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// WhatIfAtManagementGroupScope returns changes that will be made by the deployment if executed at the scope of the +// management group. +// Parameters: +// groupID - the management group ID. +// deploymentName - the name of the deployment. +// parameters - parameters to validate. +func (client DeploymentsClient) WhatIfAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeploymentWhatIf) (result DeploymentsWhatIfAtManagementGroupScopeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.WhatIfAtManagementGroupScope") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "WhatIfAtManagementGroupScope", err.Error()) + } + + req, err := client.WhatIfAtManagementGroupScopePreparer(ctx, groupID, deploymentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "WhatIfAtManagementGroupScope", nil, "Failure preparing request") + return + } + + result, err = client.WhatIfAtManagementGroupScopeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "WhatIfAtManagementGroupScope", result.Response(), "Failure sending request") + return + } + + return +} + +// WhatIfAtManagementGroupScopePreparer prepares the WhatIfAtManagementGroupScope request. +func (client DeploymentsClient) WhatIfAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeploymentWhatIf) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "groupId": autorest.Encode("path", groupID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// WhatIfAtManagementGroupScopeSender sends the WhatIfAtManagementGroupScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) WhatIfAtManagementGroupScopeSender(req *http.Request) (future DeploymentsWhatIfAtManagementGroupScopeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// WhatIfAtManagementGroupScopeResponder handles the response to the WhatIfAtManagementGroupScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) WhatIfAtManagementGroupScopeResponder(resp *http.Response) (result WhatIfOperationResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// WhatIfAtSubscriptionScope returns changes that will be made by the deployment if executed at the scope of the +// subscription. +// Parameters: +// deploymentName - the name of the deployment. +// parameters - parameters to What If. +func (client DeploymentsClient) WhatIfAtSubscriptionScope(ctx context.Context, deploymentName string, parameters DeploymentWhatIf) (result DeploymentsWhatIfAtSubscriptionScopeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.WhatIfAtSubscriptionScope") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "WhatIfAtSubscriptionScope", err.Error()) + } + + req, err := client.WhatIfAtSubscriptionScopePreparer(ctx, deploymentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "WhatIfAtSubscriptionScope", nil, "Failure preparing request") + return + } + + result, err = client.WhatIfAtSubscriptionScopeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "WhatIfAtSubscriptionScope", result.Response(), "Failure sending request") + return + } + + return +} + +// WhatIfAtSubscriptionScopePreparer prepares the WhatIfAtSubscriptionScope request. +func (client DeploymentsClient) WhatIfAtSubscriptionScopePreparer(ctx context.Context, deploymentName string, parameters DeploymentWhatIf) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// WhatIfAtSubscriptionScopeSender sends the WhatIfAtSubscriptionScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) WhatIfAtSubscriptionScopeSender(req *http.Request) (future DeploymentsWhatIfAtSubscriptionScopeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// WhatIfAtSubscriptionScopeResponder handles the response to the WhatIfAtSubscriptionScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) WhatIfAtSubscriptionScopeResponder(resp *http.Response) (result WhatIfOperationResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// WhatIfAtTenantScope returns changes that will be made by the deployment if executed at the scope of the tenant +// group. +// Parameters: +// deploymentName - the name of the deployment. +// parameters - parameters to validate. +func (client DeploymentsClient) WhatIfAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeploymentWhatIf) (result DeploymentsWhatIfAtTenantScopeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.WhatIfAtTenantScope") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.DeploymentsClient", "WhatIfAtTenantScope", err.Error()) + } + + req, err := client.WhatIfAtTenantScopePreparer(ctx, deploymentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "WhatIfAtTenantScope", nil, "Failure preparing request") + return + } + + result, err = client.WhatIfAtTenantScopeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "WhatIfAtTenantScope", result.Response(), "Failure sending request") + return + } + + return +} + +// WhatIfAtTenantScopePreparer prepares the WhatIfAtTenantScope request. +func (client DeploymentsClient) WhatIfAtTenantScopePreparer(ctx context.Context, deploymentName string, parameters ScopedDeploymentWhatIf) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// WhatIfAtTenantScopeSender sends the WhatIfAtTenantScope request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) WhatIfAtTenantScopeSender(req *http.Request) (future DeploymentsWhatIfAtTenantScopeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// WhatIfAtTenantScopeResponder handles the response to the WhatIfAtTenantScope request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) WhatIfAtTenantScopeResponder(resp *http.Response) (result WhatIfOperationResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/resources/mgmt/2021-01-01/resources/enums.go b/services/resources/mgmt/2021-01-01/resources/enums.go new file mode 100644 index 000000000000..76e53e52ad72 --- /dev/null +++ b/services/resources/mgmt/2021-01-01/resources/enums.go @@ -0,0 +1,317 @@ +package resources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AliasPathAttributes enumerates the values for alias path attributes. +type AliasPathAttributes string + +const ( + // Modifiable The token that the alias path is referring to is modifiable by policies with 'modify' effect. + Modifiable AliasPathAttributes = "Modifiable" + // None The token that the alias path is referring to has no attributes. + None AliasPathAttributes = "None" +) + +// PossibleAliasPathAttributesValues returns an array of possible values for the AliasPathAttributes const type. +func PossibleAliasPathAttributesValues() []AliasPathAttributes { + return []AliasPathAttributes{Modifiable, None} +} + +// AliasPathTokenType enumerates the values for alias path token type. +type AliasPathTokenType string + +const ( + // Any The token type can be anything. + Any AliasPathTokenType = "Any" + // Array The token type is array. + Array AliasPathTokenType = "Array" + // Boolean The token type is boolean. + Boolean AliasPathTokenType = "Boolean" + // Integer The token type is integer. + Integer AliasPathTokenType = "Integer" + // NotSpecified The token type is not specified. + NotSpecified AliasPathTokenType = "NotSpecified" + // Number The token type is number. + Number AliasPathTokenType = "Number" + // Object The token type is object. + Object AliasPathTokenType = "Object" + // String The token type is string. + String AliasPathTokenType = "String" +) + +// PossibleAliasPathTokenTypeValues returns an array of possible values for the AliasPathTokenType const type. +func PossibleAliasPathTokenTypeValues() []AliasPathTokenType { + return []AliasPathTokenType{Any, Array, Boolean, Integer, NotSpecified, Number, Object, String} +} + +// AliasPatternType enumerates the values for alias pattern type. +type AliasPatternType string + +const ( + // AliasPatternTypeExtract Extract is the only allowed value. + AliasPatternTypeExtract AliasPatternType = "Extract" + // AliasPatternTypeNotSpecified NotSpecified is not allowed. + AliasPatternTypeNotSpecified AliasPatternType = "NotSpecified" +) + +// PossibleAliasPatternTypeValues returns an array of possible values for the AliasPatternType const type. +func PossibleAliasPatternTypeValues() []AliasPatternType { + return []AliasPatternType{AliasPatternTypeExtract, AliasPatternTypeNotSpecified} +} + +// AliasType enumerates the values for alias type. +type AliasType string + +const ( + // AliasTypeMask Alias value is secret. + AliasTypeMask AliasType = "Mask" + // AliasTypeNotSpecified Alias type is unknown (same as not providing alias type). + AliasTypeNotSpecified AliasType = "NotSpecified" + // AliasTypePlainText Alias value is not secret. + AliasTypePlainText AliasType = "PlainText" +) + +// PossibleAliasTypeValues returns an array of possible values for the AliasType const type. +func PossibleAliasTypeValues() []AliasType { + return []AliasType{AliasTypeMask, AliasTypeNotSpecified, AliasTypePlainText} +} + +// ChangeType enumerates the values for change type. +type ChangeType string + +const ( + // Create The resource does not exist in the current state but is present in the desired state. The + // resource will be created when the deployment is executed. + Create ChangeType = "Create" + // Delete The resource exists in the current state and is missing from the desired state. The resource will + // be deleted when the deployment is executed. + Delete ChangeType = "Delete" + // Deploy The resource exists in the current state and the desired state and will be redeployed when the + // deployment is executed. The properties of the resource may or may not change. + Deploy ChangeType = "Deploy" + // Ignore The resource exists in the current state and is missing from the desired state. The resource will + // not be deployed or modified when the deployment is executed. + Ignore ChangeType = "Ignore" + // Modify The resource exists in the current state and the desired state and will be redeployed when the + // deployment is executed. The properties of the resource will change. + Modify ChangeType = "Modify" + // NoChange The resource exists in the current state and the desired state and will be redeployed when the + // deployment is executed. The properties of the resource will not change. + NoChange ChangeType = "NoChange" + // Unsupported The resource is not supported by What-If. + Unsupported ChangeType = "Unsupported" +) + +// PossibleChangeTypeValues returns an array of possible values for the ChangeType const type. +func PossibleChangeTypeValues() []ChangeType { + return []ChangeType{Create, Delete, Deploy, Ignore, Modify, NoChange, Unsupported} +} + +// DeploymentMode enumerates the values for deployment mode. +type DeploymentMode string + +const ( + // Complete ... + Complete DeploymentMode = "Complete" + // Incremental ... + Incremental DeploymentMode = "Incremental" +) + +// PossibleDeploymentModeValues returns an array of possible values for the DeploymentMode const type. +func PossibleDeploymentModeValues() []DeploymentMode { + return []DeploymentMode{Complete, Incremental} +} + +// ExpressionEvaluationOptionsScopeType enumerates the values for expression evaluation options scope type. +type ExpressionEvaluationOptionsScopeType string + +const ( + // ExpressionEvaluationOptionsScopeTypeInner ... + ExpressionEvaluationOptionsScopeTypeInner ExpressionEvaluationOptionsScopeType = "Inner" + // ExpressionEvaluationOptionsScopeTypeNotSpecified ... + ExpressionEvaluationOptionsScopeTypeNotSpecified ExpressionEvaluationOptionsScopeType = "NotSpecified" + // ExpressionEvaluationOptionsScopeTypeOuter ... + ExpressionEvaluationOptionsScopeTypeOuter ExpressionEvaluationOptionsScopeType = "Outer" +) + +// PossibleExpressionEvaluationOptionsScopeTypeValues returns an array of possible values for the ExpressionEvaluationOptionsScopeType const type. +func PossibleExpressionEvaluationOptionsScopeTypeValues() []ExpressionEvaluationOptionsScopeType { + return []ExpressionEvaluationOptionsScopeType{ExpressionEvaluationOptionsScopeTypeInner, ExpressionEvaluationOptionsScopeTypeNotSpecified, ExpressionEvaluationOptionsScopeTypeOuter} +} + +// ExtendedLocationType enumerates the values for extended location type. +type ExtendedLocationType string + +const ( + // EdgeZone ... + EdgeZone ExtendedLocationType = "EdgeZone" +) + +// PossibleExtendedLocationTypeValues returns an array of possible values for the ExtendedLocationType const type. +func PossibleExtendedLocationTypeValues() []ExtendedLocationType { + return []ExtendedLocationType{EdgeZone} +} + +// OnErrorDeploymentType enumerates the values for on error deployment type. +type OnErrorDeploymentType string + +const ( + // LastSuccessful ... + LastSuccessful OnErrorDeploymentType = "LastSuccessful" + // SpecificDeployment ... + SpecificDeployment OnErrorDeploymentType = "SpecificDeployment" +) + +// PossibleOnErrorDeploymentTypeValues returns an array of possible values for the OnErrorDeploymentType const type. +func PossibleOnErrorDeploymentTypeValues() []OnErrorDeploymentType { + return []OnErrorDeploymentType{LastSuccessful, SpecificDeployment} +} + +// PropertyChangeType enumerates the values for property change type. +type PropertyChangeType string + +const ( + // PropertyChangeTypeArray The property is an array and contains nested changes. + PropertyChangeTypeArray PropertyChangeType = "Array" + // PropertyChangeTypeCreate The property does not exist in the current state but is present in the desired + // state. The property will be created when the deployment is executed. + PropertyChangeTypeCreate PropertyChangeType = "Create" + // PropertyChangeTypeDelete The property exists in the current state and is missing from the desired state. + // It will be deleted when the deployment is executed. + PropertyChangeTypeDelete PropertyChangeType = "Delete" + // PropertyChangeTypeModify The property exists in both current and desired state and is different. The + // value of the property will change when the deployment is executed. + PropertyChangeTypeModify PropertyChangeType = "Modify" + // PropertyChangeTypeNoEffect The property will not be set or updated. + PropertyChangeTypeNoEffect PropertyChangeType = "NoEffect" +) + +// PossiblePropertyChangeTypeValues returns an array of possible values for the PropertyChangeType const type. +func PossiblePropertyChangeTypeValues() []PropertyChangeType { + return []PropertyChangeType{PropertyChangeTypeArray, PropertyChangeTypeCreate, PropertyChangeTypeDelete, PropertyChangeTypeModify, PropertyChangeTypeNoEffect} +} + +// ProvisioningOperation enumerates the values for provisioning operation. +type ProvisioningOperation string + +const ( + // ProvisioningOperationAction The provisioning operation is action. + ProvisioningOperationAction ProvisioningOperation = "Action" + // ProvisioningOperationAzureAsyncOperationWaiting The provisioning operation is waiting Azure async + // operation. + ProvisioningOperationAzureAsyncOperationWaiting ProvisioningOperation = "AzureAsyncOperationWaiting" + // ProvisioningOperationCreate The provisioning operation is create. + ProvisioningOperationCreate ProvisioningOperation = "Create" + // ProvisioningOperationDelete The provisioning operation is delete. + ProvisioningOperationDelete ProvisioningOperation = "Delete" + // ProvisioningOperationDeploymentCleanup The provisioning operation is cleanup. This operation is part of + // the 'complete' mode deployment. + ProvisioningOperationDeploymentCleanup ProvisioningOperation = "DeploymentCleanup" + // ProvisioningOperationEvaluateDeploymentOutput The provisioning operation is evaluate output. + ProvisioningOperationEvaluateDeploymentOutput ProvisioningOperation = "EvaluateDeploymentOutput" + // ProvisioningOperationNotSpecified The provisioning operation is not specified. + ProvisioningOperationNotSpecified ProvisioningOperation = "NotSpecified" + // ProvisioningOperationRead The provisioning operation is read. + ProvisioningOperationRead ProvisioningOperation = "Read" + // ProvisioningOperationResourceCacheWaiting The provisioning operation is waiting for resource cache. + ProvisioningOperationResourceCacheWaiting ProvisioningOperation = "ResourceCacheWaiting" + // ProvisioningOperationWaiting The provisioning operation is waiting. + ProvisioningOperationWaiting ProvisioningOperation = "Waiting" +) + +// PossibleProvisioningOperationValues returns an array of possible values for the ProvisioningOperation const type. +func PossibleProvisioningOperationValues() []ProvisioningOperation { + return []ProvisioningOperation{ProvisioningOperationAction, ProvisioningOperationAzureAsyncOperationWaiting, ProvisioningOperationCreate, ProvisioningOperationDelete, ProvisioningOperationDeploymentCleanup, ProvisioningOperationEvaluateDeploymentOutput, ProvisioningOperationNotSpecified, ProvisioningOperationRead, ProvisioningOperationResourceCacheWaiting, ProvisioningOperationWaiting} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted ... + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreated ... + ProvisioningStateCreated ProvisioningState = "Created" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleted ... + ProvisioningStateDeleted ProvisioningState = "Deleted" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateNotSpecified ... + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + // ProvisioningStateReady ... + ProvisioningStateReady ProvisioningState = "Ready" + // ProvisioningStateRunning ... + ProvisioningStateRunning ProvisioningState = "Running" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateAccepted, ProvisioningStateCanceled, ProvisioningStateCreated, ProvisioningStateCreating, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateNotSpecified, ProvisioningStateReady, ProvisioningStateRunning, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // ResourceIdentityTypeNone ... + ResourceIdentityTypeNone ResourceIdentityType = "None" + // ResourceIdentityTypeSystemAssigned ... + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + // ResourceIdentityTypeSystemAssignedUserAssigned ... + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + // ResourceIdentityTypeUserAssigned ... + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} +} + +// TagsPatchOperation enumerates the values for tags patch operation. +type TagsPatchOperation string + +const ( + // TagsPatchOperationDelete The 'delete' option allows selectively deleting tags based on given names or + // name/value pairs. + TagsPatchOperationDelete TagsPatchOperation = "Delete" + // TagsPatchOperationMerge The 'merge' option allows adding tags with new names and updating the values of + // tags with existing names. + TagsPatchOperationMerge TagsPatchOperation = "Merge" + // TagsPatchOperationReplace The 'replace' option replaces the entire set of existing tags with a new set. + TagsPatchOperationReplace TagsPatchOperation = "Replace" +) + +// PossibleTagsPatchOperationValues returns an array of possible values for the TagsPatchOperation const type. +func PossibleTagsPatchOperationValues() []TagsPatchOperation { + return []TagsPatchOperation{TagsPatchOperationDelete, TagsPatchOperationMerge, TagsPatchOperationReplace} +} + +// WhatIfResultFormat enumerates the values for what if result format. +type WhatIfResultFormat string + +const ( + // FullResourcePayloads ... + FullResourcePayloads WhatIfResultFormat = "FullResourcePayloads" + // ResourceIDOnly ... + ResourceIDOnly WhatIfResultFormat = "ResourceIdOnly" +) + +// PossibleWhatIfResultFormatValues returns an array of possible values for the WhatIfResultFormat const type. +func PossibleWhatIfResultFormatValues() []WhatIfResultFormat { + return []WhatIfResultFormat{FullResourcePayloads, ResourceIDOnly} +} diff --git a/services/resources/mgmt/2021-01-01/resources/groups.go b/services/resources/mgmt/2021-01-01/resources/groups.go new file mode 100644 index 000000000000..7965e2b02de3 --- /dev/null +++ b/services/resources/mgmt/2021-01-01/resources/groups.go @@ -0,0 +1,673 @@ +package resources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// GroupsClient is the provides operations for working with resources and resource groups. +type GroupsClient struct { + BaseClient +} + +// NewGroupsClient creates an instance of the GroupsClient client. +func NewGroupsClient(subscriptionID string) GroupsClient { + return NewGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGroupsClientWithBaseURI creates an instance of the GroupsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewGroupsClientWithBaseURI(baseURI string, subscriptionID string) GroupsClient { + return GroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckExistence checks whether a resource group exists. +// Parameters: +// resourceGroupName - the name of the resource group to check. The name is case insensitive. +func (client GroupsClient) CheckExistence(ctx context.Context, resourceGroupName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.CheckExistence") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.GroupsClient", "CheckExistence", err.Error()) + } + + req, err := client.CheckExistencePreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CheckExistence", nil, "Failure preparing request") + return + } + + resp, err := client.CheckExistenceSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CheckExistence", resp, "Failure sending request") + return + } + + result, err = client.CheckExistenceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CheckExistence", resp, "Failure responding to request") + return + } + + return +} + +// CheckExistencePreparer prepares the CheckExistence request. +func (client GroupsClient) CheckExistencePreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckExistenceSender sends the CheckExistence request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) CheckExistenceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckExistenceResponder handles the response to the CheckExistence request. The method always +// closes the http.Response Body. +func (client GroupsClient) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate creates or updates a resource group. +// Parameters: +// resourceGroupName - the name of the resource group to create or update. Can include alphanumeric, +// underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed +// characters. +// parameters - parameters supplied to the create or update a resource group. +func (client GroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, parameters Group) (result Group, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.GroupsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, parameters Group) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client GroupsClient) CreateOrUpdateResponder(resp *http.Response) (result Group, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete when you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes +// all of its template deployments and currently stored operations. +// Parameters: +// resourceGroupName - the name of the resource group to delete. The name is case insensitive. +// forceDeletionTypes - the resource types you want to force delete. Currently, only the following is +// supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets +func (client GroupsClient) Delete(ctx context.Context, resourceGroupName string, forceDeletionTypes string) (result GroupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.GroupsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, forceDeletionTypes) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client GroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, forceDeletionTypes string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(forceDeletionTypes) > 0 { + queryParameters["forceDeletionTypes"] = autorest.Encode("query", forceDeletionTypes) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) DeleteSender(req *http.Request) (future GroupsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ExportTemplate captures the specified resource group as a template. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// parameters - parameters for exporting the template. +func (client GroupsClient) ExportTemplate(ctx context.Context, resourceGroupName string, parameters ExportTemplateRequest) (result GroupsExportTemplateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.ExportTemplate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.GroupsClient", "ExportTemplate", err.Error()) + } + + req, err := client.ExportTemplatePreparer(ctx, resourceGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ExportTemplate", nil, "Failure preparing request") + return + } + + result, err = client.ExportTemplateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ExportTemplate", result.Response(), "Failure sending request") + return + } + + return +} + +// ExportTemplatePreparer prepares the ExportTemplate request. +func (client GroupsClient) ExportTemplatePreparer(ctx context.Context, resourceGroupName string, parameters ExportTemplateRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExportTemplateSender sends the ExportTemplate request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) ExportTemplateSender(req *http.Request) (future GroupsExportTemplateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ExportTemplateResponder handles the response to the ExportTemplate request. The method always +// closes the http.Response Body. +func (client GroupsClient) ExportTemplateResponder(resp *http.Response) (result GroupExportResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a resource group. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +func (client GroupsClient) Get(ctx context.Context, resourceGroupName string) (result Group, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.GroupsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client GroupsClient) GetPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GroupsClient) GetResponder(resp *http.Response) (result Group, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the resource groups for a subscription. +// Parameters: +// filter - the filter to apply on the operation.

You can filter by tag names and values. For example, +// to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1' +// top - the number of results to return. If null is passed, returns all resource groups. +func (client GroupsClient) List(ctx context.Context, filter string, top *int32) (result GroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.List") + defer func() { + sc := -1 + if result.glr.Response.Response != nil { + sc = result.glr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.glr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure sending request") + return + } + + result.glr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure responding to request") + return + } + if result.glr.hasNextLink() && result.glr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client GroupsClient) ListPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client GroupsClient) ListResponder(resp *http.Response) (result GroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client GroupsClient) listNextResults(ctx context.Context, lastResults GroupListResult) (result GroupListResult, err error) { + req, err := lastResults.groupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client GroupsClient) ListComplete(ctx context.Context, filter string, top *int32) (result GroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, filter, top) + return +} + +// Update resource groups can be updated through a simple PATCH operation to a group address. The format of the request +// is the same as that for creating a resource group. If a field is unspecified, the current value is retained. +// Parameters: +// resourceGroupName - the name of the resource group to update. The name is case insensitive. +// parameters - parameters supplied to update a resource group. +func (client GroupsClient) Update(ctx context.Context, resourceGroupName string, parameters GroupPatchable) (result Group, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.GroupsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client GroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, parameters GroupPatchable) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client GroupsClient) UpdateResponder(resp *http.Response) (result Group, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/resources/mgmt/2021-01-01/resources/models.go b/services/resources/mgmt/2021-01-01/resources/models.go new file mode 100644 index 000000000000..91599714007a --- /dev/null +++ b/services/resources/mgmt/2021-01-01/resources/models.go @@ -0,0 +1,3636 @@ +package resources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-01-01/resources" + +// Alias the alias type. +type Alias struct { + // Name - The alias name. + Name *string `json:"name,omitempty"` + // Paths - The paths for an alias. + Paths *[]AliasPath `json:"paths,omitempty"` + // Type - The type of the alias. Possible values include: 'AliasTypeNotSpecified', 'AliasTypePlainText', 'AliasTypeMask' + Type AliasType `json:"type,omitempty"` + // DefaultPath - The default path for an alias. + DefaultPath *string `json:"defaultPath,omitempty"` + // DefaultPattern - The default pattern for an alias. + DefaultPattern *AliasPattern `json:"defaultPattern,omitempty"` + // DefaultMetadata - READ-ONLY; The default alias path metadata. Applies to the default path and to any alias path that doesn't have metadata + DefaultMetadata *AliasPathMetadata `json:"defaultMetadata,omitempty"` +} + +// MarshalJSON is the custom marshaler for Alias. +func (a Alias) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.Name != nil { + objectMap["name"] = a.Name + } + if a.Paths != nil { + objectMap["paths"] = a.Paths + } + if a.Type != "" { + objectMap["type"] = a.Type + } + if a.DefaultPath != nil { + objectMap["defaultPath"] = a.DefaultPath + } + if a.DefaultPattern != nil { + objectMap["defaultPattern"] = a.DefaultPattern + } + return json.Marshal(objectMap) +} + +// AliasPath the type of the paths for alias. +type AliasPath struct { + // Path - The path of an alias. + Path *string `json:"path,omitempty"` + // APIVersions - The API versions. + APIVersions *[]string `json:"apiVersions,omitempty"` + // Pattern - The pattern for an alias path. + Pattern *AliasPattern `json:"pattern,omitempty"` + // Metadata - READ-ONLY; The metadata of the alias path. If missing, fall back to the default metadata of the alias. + Metadata *AliasPathMetadata `json:"metadata,omitempty"` +} + +// MarshalJSON is the custom marshaler for AliasPath. +func (ap AliasPath) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.Path != nil { + objectMap["path"] = ap.Path + } + if ap.APIVersions != nil { + objectMap["apiVersions"] = ap.APIVersions + } + if ap.Pattern != nil { + objectMap["pattern"] = ap.Pattern + } + return json.Marshal(objectMap) +} + +// AliasPathMetadata ... +type AliasPathMetadata struct { + // Type - READ-ONLY; The type of the token that the alias path is referring to. Possible values include: 'NotSpecified', 'Any', 'String', 'Object', 'Array', 'Integer', 'Number', 'Boolean' + Type AliasPathTokenType `json:"type,omitempty"` + // Attributes - READ-ONLY; The attributes of the token that the alias path is referring to. Possible values include: 'None', 'Modifiable' + Attributes AliasPathAttributes `json:"attributes,omitempty"` +} + +// MarshalJSON is the custom marshaler for AliasPathMetadata. +func (apm AliasPathMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AliasPattern the type of the pattern for an alias path. +type AliasPattern struct { + // Phrase - The alias pattern phrase. + Phrase *string `json:"phrase,omitempty"` + // Variable - The alias pattern variable. + Variable *string `json:"variable,omitempty"` + // Type - The type of alias pattern. Possible values include: 'AliasPatternTypeNotSpecified', 'AliasPatternTypeExtract' + Type AliasPatternType `json:"type,omitempty"` +} + +// APIProfile ... +type APIProfile struct { + // ProfileVersion - READ-ONLY; The profile version. + ProfileVersion *string `json:"profileVersion,omitempty"` + // APIVersion - READ-ONLY; The API version. + APIVersion *string `json:"apiVersion,omitempty"` +} + +// MarshalJSON is the custom marshaler for APIProfile. +func (ap APIProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BasicDependency deployment dependency information. +type BasicDependency struct { + // ID - The ID of the dependency. + ID *string `json:"id,omitempty"` + // ResourceType - The dependency resource type. + ResourceType *string `json:"resourceType,omitempty"` + // ResourceName - The dependency resource name. + ResourceName *string `json:"resourceName,omitempty"` +} + +// CloudError an error response for a resource management request. +type CloudError struct { + Error *ErrorResponse `json:"error,omitempty"` +} + +// CreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CreateOrUpdateByIDFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (GenericResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CreateOrUpdateByIDFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CreateOrUpdateByIDFuture.Result. +func (future *CreateOrUpdateByIDFuture) result(client Client) (gr GenericResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + gr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.CreateOrUpdateByIDFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { + gr, err = client.CreateOrUpdateByIDResponder(gr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateByIDFuture", "Result", gr.Response.Response, "Failure responding to request") + } + } + return +} + +// CreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (GenericResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CreateOrUpdateFuture.Result. +func (future *CreateOrUpdateFuture) result(client Client) (gr GenericResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + gr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.CreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { + gr, err = client.CreateOrUpdateResponder(gr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateFuture", "Result", gr.Response.Response, "Failure responding to request") + } + } + return +} + +// DebugSetting the debug setting. +type DebugSetting struct { + // DetailLevel - Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations. + DetailLevel *string `json:"detailLevel,omitempty"` +} + +// DeleteByIDFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type DeleteByIDFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeleteByIDFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeleteByIDFuture.Result. +func (future *DeleteByIDFuture) result(client Client) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeleteByIDFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeleteByIDFuture") + return + } + ar.Response = future.Response() + return +} + +// DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type DeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeleteFuture.Result. +func (future *DeleteFuture) result(client Client) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// Dependency deployment dependency information. +type Dependency struct { + // DependsOn - The list of dependencies. + DependsOn *[]BasicDependency `json:"dependsOn,omitempty"` + // ID - The ID of the dependency. + ID *string `json:"id,omitempty"` + // ResourceType - The dependency resource type. + ResourceType *string `json:"resourceType,omitempty"` + // ResourceName - The dependency resource name. + ResourceName *string `json:"resourceName,omitempty"` +} + +// Deployment deployment operation parameters. +type Deployment struct { + // Location - The location to store the deployment data. + Location *string `json:"location,omitempty"` + // Properties - The deployment properties. + Properties *DeploymentProperties `json:"properties,omitempty"` + // Tags - Deployment tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Deployment. +func (d Deployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.Location != nil { + objectMap["location"] = d.Location + } + if d.Properties != nil { + objectMap["properties"] = d.Properties + } + if d.Tags != nil { + objectMap["tags"] = d.Tags + } + return json.Marshal(objectMap) +} + +// DeploymentExportResult the deployment export result. +type DeploymentExportResult struct { + autorest.Response `json:"-"` + // Template - The template content. + Template interface{} `json:"template,omitempty"` +} + +// DeploymentExtended deployment information. +type DeploymentExtended struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the deployment. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the deployment. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the deployment. + Type *string `json:"type,omitempty"` + // Location - the location of the deployment. + Location *string `json:"location,omitempty"` + // Properties - Deployment properties. + Properties *DeploymentPropertiesExtended `json:"properties,omitempty"` + // Tags - Deployment tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DeploymentExtended. +func (de DeploymentExtended) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if de.Location != nil { + objectMap["location"] = de.Location + } + if de.Properties != nil { + objectMap["properties"] = de.Properties + } + if de.Tags != nil { + objectMap["tags"] = de.Tags + } + return json.Marshal(objectMap) +} + +// DeploymentExtendedFilter deployment filter. +type DeploymentExtendedFilter struct { + // ProvisioningState - The provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// DeploymentListResult list of deployments. +type DeploymentListResult struct { + autorest.Response `json:"-"` + // Value - An array of deployments. + Value *[]DeploymentExtended `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentListResult. +func (dlr DeploymentListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dlr.Value != nil { + objectMap["value"] = dlr.Value + } + return json.Marshal(objectMap) +} + +// DeploymentListResultIterator provides access to a complete listing of DeploymentExtended values. +type DeploymentListResultIterator struct { + i int + page DeploymentListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DeploymentListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DeploymentListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeploymentListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DeploymentListResultIterator) Response() DeploymentListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DeploymentListResultIterator) Value() DeploymentExtended { + if !iter.page.NotDone() { + return DeploymentExtended{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DeploymentListResultIterator type. +func NewDeploymentListResultIterator(page DeploymentListResultPage) DeploymentListResultIterator { + return DeploymentListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dlr DeploymentListResult) IsEmpty() bool { + return dlr.Value == nil || len(*dlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dlr DeploymentListResult) hasNextLink() bool { + return dlr.NextLink != nil && len(*dlr.NextLink) != 0 +} + +// deploymentListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dlr DeploymentListResult) deploymentListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dlr.NextLink))) +} + +// DeploymentListResultPage contains a page of DeploymentExtended values. +type DeploymentListResultPage struct { + fn func(context.Context, DeploymentListResult) (DeploymentListResult, error) + dlr DeploymentListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DeploymentListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dlr) + if err != nil { + return err + } + page.dlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DeploymentListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeploymentListResultPage) NotDone() bool { + return !page.dlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeploymentListResultPage) Response() DeploymentListResult { + return page.dlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeploymentListResultPage) Values() []DeploymentExtended { + if page.dlr.IsEmpty() { + return nil + } + return *page.dlr.Value +} + +// Creates a new instance of the DeploymentListResultPage type. +func NewDeploymentListResultPage(cur DeploymentListResult, getNextPage func(context.Context, DeploymentListResult) (DeploymentListResult, error)) DeploymentListResultPage { + return DeploymentListResultPage{ + fn: getNextPage, + dlr: cur, + } +} + +// DeploymentOperation deployment operation information. +type DeploymentOperation struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; Full deployment operation ID. + ID *string `json:"id,omitempty"` + // OperationID - READ-ONLY; Deployment operation ID. + OperationID *string `json:"operationId,omitempty"` + // Properties - Deployment properties. + Properties *DeploymentOperationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentOperation. +func (do DeploymentOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if do.Properties != nil { + objectMap["properties"] = do.Properties + } + return json.Marshal(objectMap) +} + +// DeploymentOperationProperties deployment operation properties. +type DeploymentOperationProperties struct { + // ProvisioningOperation - READ-ONLY; The name of the current provisioning operation. Possible values include: 'ProvisioningOperationNotSpecified', 'ProvisioningOperationCreate', 'ProvisioningOperationDelete', 'ProvisioningOperationWaiting', 'ProvisioningOperationAzureAsyncOperationWaiting', 'ProvisioningOperationResourceCacheWaiting', 'ProvisioningOperationAction', 'ProvisioningOperationRead', 'ProvisioningOperationEvaluateDeploymentOutput', 'ProvisioningOperationDeploymentCleanup' + ProvisioningOperation ProvisioningOperation `json:"provisioningOperation,omitempty"` + // ProvisioningState - READ-ONLY; The state of the provisioning. + ProvisioningState *string `json:"provisioningState,omitempty"` + // Timestamp - READ-ONLY; The date and time of the operation. + Timestamp *date.Time `json:"timestamp,omitempty"` + // Duration - READ-ONLY; The duration of the operation. + Duration *string `json:"duration,omitempty"` + // ServiceRequestID - READ-ONLY; Deployment operation service request id. + ServiceRequestID *string `json:"serviceRequestId,omitempty"` + // StatusCode - READ-ONLY; Operation status code from the resource provider. This property may not be set if a response has not yet been received. + StatusCode *string `json:"statusCode,omitempty"` + // StatusMessage - READ-ONLY; Operation status message from the resource provider. This property is optional. It will only be provided if an error was received from the resource provider. + StatusMessage *StatusMessage `json:"statusMessage,omitempty"` + // TargetResource - READ-ONLY; The target resource. + TargetResource *TargetResource `json:"targetResource,omitempty"` + // Request - READ-ONLY; The HTTP request message. + Request *HTTPMessage `json:"request,omitempty"` + // Response - READ-ONLY; The HTTP response message. + Response *HTTPMessage `json:"response,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentOperationProperties. +func (dop DeploymentOperationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DeploymentOperationsListResult list of deployment operations. +type DeploymentOperationsListResult struct { + autorest.Response `json:"-"` + // Value - An array of deployment operations. + Value *[]DeploymentOperation `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentOperationsListResult. +func (dolr DeploymentOperationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dolr.Value != nil { + objectMap["value"] = dolr.Value + } + return json.Marshal(objectMap) +} + +// DeploymentOperationsListResultIterator provides access to a complete listing of DeploymentOperation +// values. +type DeploymentOperationsListResultIterator struct { + i int + page DeploymentOperationsListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DeploymentOperationsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DeploymentOperationsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeploymentOperationsListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DeploymentOperationsListResultIterator) Response() DeploymentOperationsListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DeploymentOperationsListResultIterator) Value() DeploymentOperation { + if !iter.page.NotDone() { + return DeploymentOperation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DeploymentOperationsListResultIterator type. +func NewDeploymentOperationsListResultIterator(page DeploymentOperationsListResultPage) DeploymentOperationsListResultIterator { + return DeploymentOperationsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dolr DeploymentOperationsListResult) IsEmpty() bool { + return dolr.Value == nil || len(*dolr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dolr DeploymentOperationsListResult) hasNextLink() bool { + return dolr.NextLink != nil && len(*dolr.NextLink) != 0 +} + +// deploymentOperationsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dolr DeploymentOperationsListResult) deploymentOperationsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dolr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dolr.NextLink))) +} + +// DeploymentOperationsListResultPage contains a page of DeploymentOperation values. +type DeploymentOperationsListResultPage struct { + fn func(context.Context, DeploymentOperationsListResult) (DeploymentOperationsListResult, error) + dolr DeploymentOperationsListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DeploymentOperationsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dolr) + if err != nil { + return err + } + page.dolr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DeploymentOperationsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeploymentOperationsListResultPage) NotDone() bool { + return !page.dolr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeploymentOperationsListResultPage) Response() DeploymentOperationsListResult { + return page.dolr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeploymentOperationsListResultPage) Values() []DeploymentOperation { + if page.dolr.IsEmpty() { + return nil + } + return *page.dolr.Value +} + +// Creates a new instance of the DeploymentOperationsListResultPage type. +func NewDeploymentOperationsListResultPage(cur DeploymentOperationsListResult, getNextPage func(context.Context, DeploymentOperationsListResult) (DeploymentOperationsListResult, error)) DeploymentOperationsListResultPage { + return DeploymentOperationsListResultPage{ + fn: getNextPage, + dolr: cur, + } +} + +// DeploymentProperties deployment properties. +type DeploymentProperties struct { + // Template - The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. + Template interface{} `json:"template,omitempty"` + // TemplateLink - The URI of the template. Use either the templateLink property or the template property, but not both. + TemplateLink *TemplateLink `json:"templateLink,omitempty"` + // Parameters - Name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. + Parameters interface{} `json:"parameters,omitempty"` + // ParametersLink - The URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. + ParametersLink *ParametersLink `json:"parametersLink,omitempty"` + // Mode - The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. Possible values include: 'Incremental', 'Complete' + Mode DeploymentMode `json:"mode,omitempty"` + // DebugSetting - The debug setting of the deployment. + DebugSetting *DebugSetting `json:"debugSetting,omitempty"` + // OnErrorDeployment - The deployment on error behavior. + OnErrorDeployment *OnErrorDeployment `json:"onErrorDeployment,omitempty"` + // ExpressionEvaluationOptions - Specifies whether template expressions are evaluated within the scope of the parent template or nested template. Only applicable to nested templates. If not specified, default value is outer. + ExpressionEvaluationOptions *ExpressionEvaluationOptions `json:"expressionEvaluationOptions,omitempty"` +} + +// DeploymentPropertiesExtended deployment properties with additional details. +type DeploymentPropertiesExtended struct { + // ProvisioningState - READ-ONLY; Denotes the state of provisioning. Possible values include: 'ProvisioningStateNotSpecified', 'ProvisioningStateAccepted', 'ProvisioningStateRunning', 'ProvisioningStateReady', 'ProvisioningStateCreating', 'ProvisioningStateCreated', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateCanceled', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // CorrelationID - READ-ONLY; The correlation ID of the deployment. + CorrelationID *string `json:"correlationId,omitempty"` + // Timestamp - READ-ONLY; The timestamp of the template deployment. + Timestamp *date.Time `json:"timestamp,omitempty"` + // Duration - READ-ONLY; The duration of the template deployment. + Duration *string `json:"duration,omitempty"` + // Outputs - READ-ONLY; Key/value pairs that represent deployment output. + Outputs interface{} `json:"outputs,omitempty"` + // Providers - READ-ONLY; The list of resource providers needed for the deployment. + Providers *[]Provider `json:"providers,omitempty"` + // Dependencies - READ-ONLY; The list of deployment dependencies. + Dependencies *[]Dependency `json:"dependencies,omitempty"` + // TemplateLink - READ-ONLY; The URI referencing the template. + TemplateLink *TemplateLink `json:"templateLink,omitempty"` + // Parameters - READ-ONLY; Deployment parameters. + Parameters interface{} `json:"parameters,omitempty"` + // ParametersLink - READ-ONLY; The URI referencing the parameters. + ParametersLink *ParametersLink `json:"parametersLink,omitempty"` + // Mode - READ-ONLY; The deployment mode. Possible values are Incremental and Complete. Possible values include: 'Incremental', 'Complete' + Mode DeploymentMode `json:"mode,omitempty"` + // DebugSetting - READ-ONLY; The debug setting of the deployment. + DebugSetting *DebugSetting `json:"debugSetting,omitempty"` + // OnErrorDeployment - READ-ONLY; The deployment on error behavior. + OnErrorDeployment *OnErrorDeploymentExtended `json:"onErrorDeployment,omitempty"` + // TemplateHash - READ-ONLY; The hash produced for the template. + TemplateHash *string `json:"templateHash,omitempty"` + // OutputResources - READ-ONLY; Array of provisioned resources. + OutputResources *[]Reference `json:"outputResources,omitempty"` + // ValidatedResources - READ-ONLY; Array of validated resources. + ValidatedResources *[]Reference `json:"validatedResources,omitempty"` + // Error - READ-ONLY; The deployment error. + Error *ErrorResponse `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentPropertiesExtended. +func (dpe DeploymentPropertiesExtended) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DeploymentsCreateOrUpdateAtManagementGroupScopeFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type DeploymentsCreateOrUpdateAtManagementGroupScopeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (DeploymentExtended, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsCreateOrUpdateAtManagementGroupScopeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsCreateOrUpdateAtManagementGroupScopeFuture.Result. +func (future *DeploymentsCreateOrUpdateAtManagementGroupScopeFuture) result(client DeploymentsClient) (de DeploymentExtended, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateAtManagementGroupScopeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + de.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsCreateOrUpdateAtManagementGroupScopeFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if de.Response.Response, err = future.GetResult(sender); err == nil && de.Response.Response.StatusCode != http.StatusNoContent { + de, err = client.CreateOrUpdateAtManagementGroupScopeResponder(de.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateAtManagementGroupScopeFuture", "Result", de.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsCreateOrUpdateAtScopeFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsCreateOrUpdateAtScopeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (DeploymentExtended, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsCreateOrUpdateAtScopeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsCreateOrUpdateAtScopeFuture.Result. +func (future *DeploymentsCreateOrUpdateAtScopeFuture) result(client DeploymentsClient) (de DeploymentExtended, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateAtScopeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + de.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsCreateOrUpdateAtScopeFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if de.Response.Response, err = future.GetResult(sender); err == nil && de.Response.Response.StatusCode != http.StatusNoContent { + de, err = client.CreateOrUpdateAtScopeResponder(de.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateAtScopeFuture", "Result", de.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsCreateOrUpdateAtSubscriptionScopeFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type DeploymentsCreateOrUpdateAtSubscriptionScopeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (DeploymentExtended, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsCreateOrUpdateAtSubscriptionScopeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsCreateOrUpdateAtSubscriptionScopeFuture.Result. +func (future *DeploymentsCreateOrUpdateAtSubscriptionScopeFuture) result(client DeploymentsClient) (de DeploymentExtended, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateAtSubscriptionScopeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + de.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsCreateOrUpdateAtSubscriptionScopeFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if de.Response.Response, err = future.GetResult(sender); err == nil && de.Response.Response.StatusCode != http.StatusNoContent { + de, err = client.CreateOrUpdateAtSubscriptionScopeResponder(de.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateAtSubscriptionScopeFuture", "Result", de.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsCreateOrUpdateAtTenantScopeFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type DeploymentsCreateOrUpdateAtTenantScopeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (DeploymentExtended, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsCreateOrUpdateAtTenantScopeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsCreateOrUpdateAtTenantScopeFuture.Result. +func (future *DeploymentsCreateOrUpdateAtTenantScopeFuture) result(client DeploymentsClient) (de DeploymentExtended, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateAtTenantScopeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + de.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsCreateOrUpdateAtTenantScopeFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if de.Response.Response, err = future.GetResult(sender); err == nil && de.Response.Response.StatusCode != http.StatusNoContent { + de, err = client.CreateOrUpdateAtTenantScopeResponder(de.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateAtTenantScopeFuture", "Result", de.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (DeploymentExtended, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsCreateOrUpdateFuture.Result. +func (future *DeploymentsCreateOrUpdateFuture) result(client DeploymentsClient) (de DeploymentExtended, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + de.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if de.Response.Response, err = future.GetResult(sender); err == nil && de.Response.Response.StatusCode != http.StatusNoContent { + de, err = client.CreateOrUpdateResponder(de.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", de.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsDeleteAtManagementGroupScopeFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type DeploymentsDeleteAtManagementGroupScopeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsDeleteAtManagementGroupScopeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsDeleteAtManagementGroupScopeFuture.Result. +func (future *DeploymentsDeleteAtManagementGroupScopeFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteAtManagementGroupScopeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsDeleteAtManagementGroupScopeFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsDeleteAtScopeFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsDeleteAtScopeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsDeleteAtScopeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsDeleteAtScopeFuture.Result. +func (future *DeploymentsDeleteAtScopeFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteAtScopeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsDeleteAtScopeFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsDeleteAtSubscriptionScopeFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsDeleteAtSubscriptionScopeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsDeleteAtSubscriptionScopeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsDeleteAtSubscriptionScopeFuture.Result. +func (future *DeploymentsDeleteAtSubscriptionScopeFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteAtSubscriptionScopeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsDeleteAtSubscriptionScopeFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsDeleteAtTenantScopeFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsDeleteAtTenantScopeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsDeleteAtTenantScopeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsDeleteAtTenantScopeFuture.Result. +func (future *DeploymentsDeleteAtTenantScopeFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteAtTenantScopeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsDeleteAtTenantScopeFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsDeleteFuture.Result. +func (future *DeploymentsDeleteFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsValidateAtManagementGroupScopeFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type DeploymentsValidateAtManagementGroupScopeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (DeploymentValidateResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsValidateAtManagementGroupScopeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsValidateAtManagementGroupScopeFuture.Result. +func (future *DeploymentsValidateAtManagementGroupScopeFuture) result(client DeploymentsClient) (dvr DeploymentValidateResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsValidateAtManagementGroupScopeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dvr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsValidateAtManagementGroupScopeFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dvr.Response.Response, err = future.GetResult(sender); err == nil && dvr.Response.Response.StatusCode != http.StatusNoContent { + dvr, err = client.ValidateAtManagementGroupScopeResponder(dvr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsValidateAtManagementGroupScopeFuture", "Result", dvr.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsValidateAtScopeFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsValidateAtScopeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (DeploymentValidateResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsValidateAtScopeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsValidateAtScopeFuture.Result. +func (future *DeploymentsValidateAtScopeFuture) result(client DeploymentsClient) (dvr DeploymentValidateResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsValidateAtScopeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dvr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsValidateAtScopeFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dvr.Response.Response, err = future.GetResult(sender); err == nil && dvr.Response.Response.StatusCode != http.StatusNoContent { + dvr, err = client.ValidateAtScopeResponder(dvr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsValidateAtScopeFuture", "Result", dvr.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsValidateAtSubscriptionScopeFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type DeploymentsValidateAtSubscriptionScopeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (DeploymentValidateResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsValidateAtSubscriptionScopeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsValidateAtSubscriptionScopeFuture.Result. +func (future *DeploymentsValidateAtSubscriptionScopeFuture) result(client DeploymentsClient) (dvr DeploymentValidateResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsValidateAtSubscriptionScopeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dvr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsValidateAtSubscriptionScopeFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dvr.Response.Response, err = future.GetResult(sender); err == nil && dvr.Response.Response.StatusCode != http.StatusNoContent { + dvr, err = client.ValidateAtSubscriptionScopeResponder(dvr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsValidateAtSubscriptionScopeFuture", "Result", dvr.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsValidateAtTenantScopeFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsValidateAtTenantScopeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (DeploymentValidateResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsValidateAtTenantScopeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsValidateAtTenantScopeFuture.Result. +func (future *DeploymentsValidateAtTenantScopeFuture) result(client DeploymentsClient) (dvr DeploymentValidateResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsValidateAtTenantScopeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dvr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsValidateAtTenantScopeFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dvr.Response.Response, err = future.GetResult(sender); err == nil && dvr.Response.Response.StatusCode != http.StatusNoContent { + dvr, err = client.ValidateAtTenantScopeResponder(dvr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsValidateAtTenantScopeFuture", "Result", dvr.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsValidateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsValidateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (DeploymentValidateResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsValidateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsValidateFuture.Result. +func (future *DeploymentsValidateFuture) result(client DeploymentsClient) (dvr DeploymentValidateResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsValidateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dvr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsValidateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dvr.Response.Response, err = future.GetResult(sender); err == nil && dvr.Response.Response.StatusCode != http.StatusNoContent { + dvr, err = client.ValidateResponder(dvr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsValidateFuture", "Result", dvr.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsWhatIfAtManagementGroupScopeFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type DeploymentsWhatIfAtManagementGroupScopeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (WhatIfOperationResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsWhatIfAtManagementGroupScopeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsWhatIfAtManagementGroupScopeFuture.Result. +func (future *DeploymentsWhatIfAtManagementGroupScopeFuture) result(client DeploymentsClient) (wior WhatIfOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsWhatIfAtManagementGroupScopeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + wior.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsWhatIfAtManagementGroupScopeFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if wior.Response.Response, err = future.GetResult(sender); err == nil && wior.Response.Response.StatusCode != http.StatusNoContent { + wior, err = client.WhatIfAtManagementGroupScopeResponder(wior.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsWhatIfAtManagementGroupScopeFuture", "Result", wior.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsWhatIfAtSubscriptionScopeFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsWhatIfAtSubscriptionScopeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (WhatIfOperationResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsWhatIfAtSubscriptionScopeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsWhatIfAtSubscriptionScopeFuture.Result. +func (future *DeploymentsWhatIfAtSubscriptionScopeFuture) result(client DeploymentsClient) (wior WhatIfOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsWhatIfAtSubscriptionScopeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + wior.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsWhatIfAtSubscriptionScopeFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if wior.Response.Response, err = future.GetResult(sender); err == nil && wior.Response.Response.StatusCode != http.StatusNoContent { + wior, err = client.WhatIfAtSubscriptionScopeResponder(wior.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsWhatIfAtSubscriptionScopeFuture", "Result", wior.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsWhatIfAtTenantScopeFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsWhatIfAtTenantScopeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (WhatIfOperationResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsWhatIfAtTenantScopeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsWhatIfAtTenantScopeFuture.Result. +func (future *DeploymentsWhatIfAtTenantScopeFuture) result(client DeploymentsClient) (wior WhatIfOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsWhatIfAtTenantScopeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + wior.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsWhatIfAtTenantScopeFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if wior.Response.Response, err = future.GetResult(sender); err == nil && wior.Response.Response.StatusCode != http.StatusNoContent { + wior, err = client.WhatIfAtTenantScopeResponder(wior.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsWhatIfAtTenantScopeFuture", "Result", wior.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsWhatIfFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsWhatIfFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (WhatIfOperationResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsWhatIfFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsWhatIfFuture.Result. +func (future *DeploymentsWhatIfFuture) result(client DeploymentsClient) (wior WhatIfOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsWhatIfFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + wior.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsWhatIfFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if wior.Response.Response, err = future.GetResult(sender); err == nil && wior.Response.Response.StatusCode != http.StatusNoContent { + wior, err = client.WhatIfResponder(wior.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsWhatIfFuture", "Result", wior.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentValidateResult information from validate template deployment response. +type DeploymentValidateResult struct { + autorest.Response `json:"-"` + // Error - READ-ONLY; The deployment validation error. + Error *ErrorResponse `json:"error,omitempty"` + // Properties - The template deployment properties. + Properties *DeploymentPropertiesExtended `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentValidateResult. +func (dvr DeploymentValidateResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dvr.Properties != nil { + objectMap["properties"] = dvr.Properties + } + return json.Marshal(objectMap) +} + +// DeploymentWhatIf deployment What-if operation parameters. +type DeploymentWhatIf struct { + // Location - The location to store the deployment data. + Location *string `json:"location,omitempty"` + // Properties - The deployment properties. + Properties *DeploymentWhatIfProperties `json:"properties,omitempty"` +} + +// DeploymentWhatIfProperties deployment What-if properties. +type DeploymentWhatIfProperties struct { + // WhatIfSettings - Optional What-If operation settings. + WhatIfSettings *DeploymentWhatIfSettings `json:"whatIfSettings,omitempty"` + // Template - The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. + Template interface{} `json:"template,omitempty"` + // TemplateLink - The URI of the template. Use either the templateLink property or the template property, but not both. + TemplateLink *TemplateLink `json:"templateLink,omitempty"` + // Parameters - Name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. + Parameters interface{} `json:"parameters,omitempty"` + // ParametersLink - The URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. + ParametersLink *ParametersLink `json:"parametersLink,omitempty"` + // Mode - The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. Possible values include: 'Incremental', 'Complete' + Mode DeploymentMode `json:"mode,omitempty"` + // DebugSetting - The debug setting of the deployment. + DebugSetting *DebugSetting `json:"debugSetting,omitempty"` + // OnErrorDeployment - The deployment on error behavior. + OnErrorDeployment *OnErrorDeployment `json:"onErrorDeployment,omitempty"` + // ExpressionEvaluationOptions - Specifies whether template expressions are evaluated within the scope of the parent template or nested template. Only applicable to nested templates. If not specified, default value is outer. + ExpressionEvaluationOptions *ExpressionEvaluationOptions `json:"expressionEvaluationOptions,omitempty"` +} + +// DeploymentWhatIfSettings deployment What-If operation settings. +type DeploymentWhatIfSettings struct { + // ResultFormat - The format of the What-If results. Possible values include: 'ResourceIDOnly', 'FullResourcePayloads' + ResultFormat WhatIfResultFormat `json:"resultFormat,omitempty"` +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.) +type ErrorResponse struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorResponse `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorResponse. +func (er ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExportTemplateRequest export resource group template request parameters. +type ExportTemplateRequest struct { + // ResourcesProperty - The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. + ResourcesProperty *[]string `json:"resources,omitempty"` + // Options - The export template options. A CSV-formatted list containing zero or more of the following: 'IncludeParameterDefaultValue', 'IncludeComments', 'SkipResourceNameParameterization', 'SkipAllParameterization' + Options *string `json:"options,omitempty"` +} + +// ExpressionEvaluationOptions specifies whether template expressions are evaluated within the scope of the +// parent template or nested template. +type ExpressionEvaluationOptions struct { + // Scope - The scope to be used for evaluation of parameters, variables and functions in a nested template. Possible values include: 'ExpressionEvaluationOptionsScopeTypeNotSpecified', 'ExpressionEvaluationOptionsScopeTypeOuter', 'ExpressionEvaluationOptionsScopeTypeInner' + Scope ExpressionEvaluationOptionsScopeType `json:"scope,omitempty"` +} + +// ExtendedLocation resource extended location. +type ExtendedLocation struct { + // Type - The extended location type. Possible values include: 'EdgeZone' + Type ExtendedLocationType `json:"type,omitempty"` + // Name - The extended location name. + Name *string `json:"name,omitempty"` +} + +// GenericResource resource information. +type GenericResource struct { + autorest.Response `json:"-"` + // Plan - The plan of the resource. + Plan *Plan `json:"plan,omitempty"` + // Properties - The resource properties. + Properties interface{} `json:"properties,omitempty"` + // Kind - The kind of the resource. + Kind *string `json:"kind,omitempty"` + // ManagedBy - ID of the resource that manages this resource. + ManagedBy *string `json:"managedBy,omitempty"` + // Sku - The SKU of the resource. + Sku *Sku `json:"sku,omitempty"` + // Identity - The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + // ID - READ-ONLY; Resource ID + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ExtendedLocation - Resource extended location. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for GenericResource. +func (gr GenericResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gr.Plan != nil { + objectMap["plan"] = gr.Plan + } + if gr.Properties != nil { + objectMap["properties"] = gr.Properties + } + if gr.Kind != nil { + objectMap["kind"] = gr.Kind + } + if gr.ManagedBy != nil { + objectMap["managedBy"] = gr.ManagedBy + } + if gr.Sku != nil { + objectMap["sku"] = gr.Sku + } + if gr.Identity != nil { + objectMap["identity"] = gr.Identity + } + if gr.Location != nil { + objectMap["location"] = gr.Location + } + if gr.ExtendedLocation != nil { + objectMap["extendedLocation"] = gr.ExtendedLocation + } + if gr.Tags != nil { + objectMap["tags"] = gr.Tags + } + return json.Marshal(objectMap) +} + +// GenericResourceExpanded resource information. +type GenericResourceExpanded struct { + // CreatedTime - READ-ONLY; The created time of the resource. This is only present if requested via the $expand query parameter. + CreatedTime *date.Time `json:"createdTime,omitempty"` + // ChangedTime - READ-ONLY; The changed time of the resource. This is only present if requested via the $expand query parameter. + ChangedTime *date.Time `json:"changedTime,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. This is only present if requested via the $expand query parameter. + ProvisioningState *string `json:"provisioningState,omitempty"` + // Plan - The plan of the resource. + Plan *Plan `json:"plan,omitempty"` + // Properties - The resource properties. + Properties interface{} `json:"properties,omitempty"` + // Kind - The kind of the resource. + Kind *string `json:"kind,omitempty"` + // ManagedBy - ID of the resource that manages this resource. + ManagedBy *string `json:"managedBy,omitempty"` + // Sku - The SKU of the resource. + Sku *Sku `json:"sku,omitempty"` + // Identity - The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + // ID - READ-ONLY; Resource ID + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ExtendedLocation - Resource extended location. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for GenericResourceExpanded. +func (gre GenericResourceExpanded) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gre.Plan != nil { + objectMap["plan"] = gre.Plan + } + if gre.Properties != nil { + objectMap["properties"] = gre.Properties + } + if gre.Kind != nil { + objectMap["kind"] = gre.Kind + } + if gre.ManagedBy != nil { + objectMap["managedBy"] = gre.ManagedBy + } + if gre.Sku != nil { + objectMap["sku"] = gre.Sku + } + if gre.Identity != nil { + objectMap["identity"] = gre.Identity + } + if gre.Location != nil { + objectMap["location"] = gre.Location + } + if gre.ExtendedLocation != nil { + objectMap["extendedLocation"] = gre.ExtendedLocation + } + if gre.Tags != nil { + objectMap["tags"] = gre.Tags + } + return json.Marshal(objectMap) +} + +// GenericResourceFilter resource filter. +type GenericResourceFilter struct { + // ResourceType - The resource type. + ResourceType *string `json:"resourceType,omitempty"` + // Tagname - The tag name. + Tagname *string `json:"tagname,omitempty"` + // Tagvalue - The tag value. + Tagvalue *string `json:"tagvalue,omitempty"` +} + +// Group resource group information. +type Group struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the resource group. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource group. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource group. + Type *string `json:"type,omitempty"` + // Properties - The resource group properties. + Properties *GroupProperties `json:"properties,omitempty"` + // Location - The location of the resource group. It cannot be changed after the resource group has been created. It must be one of the supported Azure locations. + Location *string `json:"location,omitempty"` + // ManagedBy - The ID of the resource that manages this resource group. + ManagedBy *string `json:"managedBy,omitempty"` + // Tags - The tags attached to the resource group. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Group. +func (g Group) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if g.Properties != nil { + objectMap["properties"] = g.Properties + } + if g.Location != nil { + objectMap["location"] = g.Location + } + if g.ManagedBy != nil { + objectMap["managedBy"] = g.ManagedBy + } + if g.Tags != nil { + objectMap["tags"] = g.Tags + } + return json.Marshal(objectMap) +} + +// GroupExportResult resource group export result. +type GroupExportResult struct { + autorest.Response `json:"-"` + // Template - The template content. + Template interface{} `json:"template,omitempty"` + // Error - The template export error. + Error *ErrorResponse `json:"error,omitempty"` +} + +// GroupFilter resource group filter. +type GroupFilter struct { + // TagName - The tag name. + TagName *string `json:"tagName,omitempty"` + // TagValue - The tag value. + TagValue *string `json:"tagValue,omitempty"` +} + +// GroupListResult list of resource groups. +type GroupListResult struct { + autorest.Response `json:"-"` + // Value - An array of resource groups. + Value *[]Group `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for GroupListResult. +func (glr GroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if glr.Value != nil { + objectMap["value"] = glr.Value + } + return json.Marshal(objectMap) +} + +// GroupListResultIterator provides access to a complete listing of Group values. +type GroupListResultIterator struct { + i int + page GroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *GroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *GroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter GroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter GroupListResultIterator) Response() GroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter GroupListResultIterator) Value() Group { + if !iter.page.NotDone() { + return Group{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the GroupListResultIterator type. +func NewGroupListResultIterator(page GroupListResultPage) GroupListResultIterator { + return GroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (glr GroupListResult) IsEmpty() bool { + return glr.Value == nil || len(*glr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (glr GroupListResult) hasNextLink() bool { + return glr.NextLink != nil && len(*glr.NextLink) != 0 +} + +// groupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (glr GroupListResult) groupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !glr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(glr.NextLink))) +} + +// GroupListResultPage contains a page of Group values. +type GroupListResultPage struct { + fn func(context.Context, GroupListResult) (GroupListResult, error) + glr GroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *GroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.glr) + if err != nil { + return err + } + page.glr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *GroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page GroupListResultPage) NotDone() bool { + return !page.glr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page GroupListResultPage) Response() GroupListResult { + return page.glr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page GroupListResultPage) Values() []Group { + if page.glr.IsEmpty() { + return nil + } + return *page.glr.Value +} + +// Creates a new instance of the GroupListResultPage type. +func NewGroupListResultPage(cur GroupListResult, getNextPage func(context.Context, GroupListResult) (GroupListResult, error)) GroupListResultPage { + return GroupListResultPage{ + fn: getNextPage, + glr: cur, + } +} + +// GroupPatchable resource group information. +type GroupPatchable struct { + // Name - The name of the resource group. + Name *string `json:"name,omitempty"` + // Properties - The resource group properties. + Properties *GroupProperties `json:"properties,omitempty"` + // ManagedBy - The ID of the resource that manages this resource group. + ManagedBy *string `json:"managedBy,omitempty"` + // Tags - The tags attached to the resource group. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for GroupPatchable. +func (gp GroupPatchable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gp.Name != nil { + objectMap["name"] = gp.Name + } + if gp.Properties != nil { + objectMap["properties"] = gp.Properties + } + if gp.ManagedBy != nil { + objectMap["managedBy"] = gp.ManagedBy + } + if gp.Tags != nil { + objectMap["tags"] = gp.Tags + } + return json.Marshal(objectMap) +} + +// GroupProperties the resource group properties. +type GroupProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for GroupProperties. +func (gp GroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// GroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type GroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(GroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for GroupsDeleteFuture.Result. +func (future *GroupsDeleteFuture) result(client GroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.GroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// GroupsExportTemplateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type GroupsExportTemplateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(GroupsClient) (GroupExportResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GroupsExportTemplateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for GroupsExportTemplateFuture.Result. +func (future *GroupsExportTemplateFuture) result(client GroupsClient) (ger GroupExportResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsExportTemplateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ger.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.GroupsExportTemplateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ger.Response.Response, err = future.GetResult(sender); err == nil && ger.Response.Response.StatusCode != http.StatusNoContent { + ger, err = client.ExportTemplateResponder(ger.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsExportTemplateFuture", "Result", ger.Response.Response, "Failure responding to request") + } + } + return +} + +// HTTPMessage HTTP message. +type HTTPMessage struct { + // Content - HTTP message content. + Content interface{} `json:"content,omitempty"` +} + +// Identity identity for the resource. +type Identity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*IdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + if i.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = i.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// IdentityUserAssignedIdentitiesValue ... +type IdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for IdentityUserAssignedIdentitiesValue. +func (iAiv IdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ListResult list of resource groups. +type ListResult struct { + autorest.Response `json:"-"` + // Value - An array of resources. + Value *[]GenericResourceExpanded `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListResult. +func (lr ListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lr.Value != nil { + objectMap["value"] = lr.Value + } + return json.Marshal(objectMap) +} + +// ListResultIterator provides access to a complete listing of GenericResourceExpanded values. +type ListResultIterator struct { + i int + page ListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListResultIterator) Response() ListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListResultIterator) Value() GenericResourceExpanded { + if !iter.page.NotDone() { + return GenericResourceExpanded{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListResultIterator type. +func NewListResultIterator(page ListResultPage) ListResultIterator { + return ListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lr ListResult) IsEmpty() bool { + return lr.Value == nil || len(*lr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lr ListResult) hasNextLink() bool { + return lr.NextLink != nil && len(*lr.NextLink) != 0 +} + +// listResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { + if !lr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lr.NextLink))) +} + +// ListResultPage contains a page of GenericResourceExpanded values. +type ListResultPage struct { + fn func(context.Context, ListResult) (ListResult, error) + lr ListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lr) + if err != nil { + return err + } + page.lr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListResultPage) NotDone() bool { + return !page.lr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListResultPage) Response() ListResult { + return page.lr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListResultPage) Values() []GenericResourceExpanded { + if page.lr.IsEmpty() { + return nil + } + return *page.lr.Value +} + +// Creates a new instance of the ListResultPage type. +func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { + return ListResultPage{ + fn: getNextPage, + lr: cur, + } +} + +// MoveInfo parameters of move resources. +type MoveInfo struct { + // ResourcesProperty - The IDs of the resources. + ResourcesProperty *[]string `json:"resources,omitempty"` + // TargetResourceGroup - The target resource group. + TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` +} + +// MoveResourcesFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type MoveResourcesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *MoveResourcesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for MoveResourcesFuture.Result. +func (future *MoveResourcesFuture) result(client Client) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.MoveResourcesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.MoveResourcesFuture") + return + } + ar.Response = future.Response() + return +} + +// OnErrorDeployment deployment on error behavior. +type OnErrorDeployment struct { + // Type - The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Possible values include: 'LastSuccessful', 'SpecificDeployment' + Type OnErrorDeploymentType `json:"type,omitempty"` + // DeploymentName - The deployment to be used on error case. + DeploymentName *string `json:"deploymentName,omitempty"` +} + +// OnErrorDeploymentExtended deployment on error behavior with additional details. +type OnErrorDeploymentExtended struct { + // ProvisioningState - READ-ONLY; The state of the provisioning for the on error deployment. + ProvisioningState *string `json:"provisioningState,omitempty"` + // Type - The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Possible values include: 'LastSuccessful', 'SpecificDeployment' + Type OnErrorDeploymentType `json:"type,omitempty"` + // DeploymentName - The deployment to be used on error case. + DeploymentName *string `json:"deploymentName,omitempty"` +} + +// MarshalJSON is the custom marshaler for OnErrorDeploymentExtended. +func (oede OnErrorDeploymentExtended) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oede.Type != "" { + objectMap["type"] = oede.Type + } + if oede.DeploymentName != nil { + objectMap["deploymentName"] = oede.DeploymentName + } + return json.Marshal(objectMap) +} + +// Operation microsoft.Resources operation +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - The object that represents the operation. + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay the object that represents the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft.Resources + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed: Profile, endpoint, etc. + Resource *string `json:"resource,omitempty"` + // Operation - Operation type: Read, write, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of the operation. + Description *string `json:"description,omitempty"` +} + +// OperationListResult result of the request to list Microsoft.Resources operations. It contains a list of +// operations and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of Microsoft.Resources operations. + Value *[]Operation `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// ParametersLink entity representing the reference to the deployment parameters. +type ParametersLink struct { + // URI - The URI of the parameters file. + URI *string `json:"uri,omitempty"` + // ContentVersion - If included, must match the ContentVersion in the template. + ContentVersion *string `json:"contentVersion,omitempty"` +} + +// Plan plan for the resource. +type Plan struct { + // Name - The plan ID. + Name *string `json:"name,omitempty"` + // Publisher - The publisher ID. + Publisher *string `json:"publisher,omitempty"` + // Product - The offer ID. + Product *string `json:"product,omitempty"` + // PromotionCode - The promotion code. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The plan's version. + Version *string `json:"version,omitempty"` +} + +// Provider resource provider information. +type Provider struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The provider ID. + ID *string `json:"id,omitempty"` + // Namespace - The namespace of the resource provider. + Namespace *string `json:"namespace,omitempty"` + // RegistrationState - READ-ONLY; The registration state of the resource provider. + RegistrationState *string `json:"registrationState,omitempty"` + // RegistrationPolicy - READ-ONLY; The registration policy of the resource provider. + RegistrationPolicy *string `json:"registrationPolicy,omitempty"` + // ResourceTypes - READ-ONLY; The collection of provider resource types. + ResourceTypes *[]ProviderResourceType `json:"resourceTypes,omitempty"` +} + +// MarshalJSON is the custom marshaler for Provider. +func (p Provider) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.Namespace != nil { + objectMap["namespace"] = p.Namespace + } + return json.Marshal(objectMap) +} + +// ProviderExtendedLocation the provider extended location. +type ProviderExtendedLocation struct { + // Location - The azure location. + Location *string `json:"location,omitempty"` + // Type - The extended location type. + Type *string `json:"type,omitempty"` + // ExtendedLocations - The extended locations for the azure location. + ExtendedLocations *[]string `json:"extendedLocations,omitempty"` +} + +// ProviderListResult list of resource providers. +type ProviderListResult struct { + autorest.Response `json:"-"` + // Value - An array of resource providers. + Value *[]Provider `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProviderListResult. +func (plr ProviderListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.Value != nil { + objectMap["value"] = plr.Value + } + return json.Marshal(objectMap) +} + +// ProviderListResultIterator provides access to a complete listing of Provider values. +type ProviderListResultIterator struct { + i int + page ProviderListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ProviderListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ProviderListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ProviderListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ProviderListResultIterator) Response() ProviderListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ProviderListResultIterator) Value() Provider { + if !iter.page.NotDone() { + return Provider{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ProviderListResultIterator type. +func NewProviderListResultIterator(page ProviderListResultPage) ProviderListResultIterator { + return ProviderListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (plr ProviderListResult) IsEmpty() bool { + return plr.Value == nil || len(*plr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (plr ProviderListResult) hasNextLink() bool { + return plr.NextLink != nil && len(*plr.NextLink) != 0 +} + +// providerListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plr ProviderListResult) providerListResultPreparer(ctx context.Context) (*http.Request, error) { + if !plr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(plr.NextLink))) +} + +// ProviderListResultPage contains a page of Provider values. +type ProviderListResultPage struct { + fn func(context.Context, ProviderListResult) (ProviderListResult, error) + plr ProviderListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ProviderListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.plr) + if err != nil { + return err + } + page.plr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ProviderListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ProviderListResultPage) NotDone() bool { + return !page.plr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ProviderListResultPage) Response() ProviderListResult { + return page.plr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ProviderListResultPage) Values() []Provider { + if page.plr.IsEmpty() { + return nil + } + return *page.plr.Value +} + +// Creates a new instance of the ProviderListResultPage type. +func NewProviderListResultPage(cur ProviderListResult, getNextPage func(context.Context, ProviderListResult) (ProviderListResult, error)) ProviderListResultPage { + return ProviderListResultPage{ + fn: getNextPage, + plr: cur, + } +} + +// ProviderOperationDisplayProperties resource provider operation's display properties. +type ProviderOperationDisplayProperties struct { + // Publisher - Operation description. + Publisher *string `json:"publisher,omitempty"` + // Provider - Operation provider. + Provider *string `json:"provider,omitempty"` + // Resource - Operation resource. + Resource *string `json:"resource,omitempty"` + // Operation - Resource provider operation. + Operation *string `json:"operation,omitempty"` + // Description - Operation description. + Description *string `json:"description,omitempty"` +} + +// ProviderResourceType resource type managed by the resource provider. +type ProviderResourceType struct { + // ResourceType - The resource type. + ResourceType *string `json:"resourceType,omitempty"` + // Locations - The collection of locations where this resource type can be created. + Locations *[]string `json:"locations,omitempty"` + // LocationMappings - The location mappings that are supported by this resource type. + LocationMappings *[]ProviderExtendedLocation `json:"locationMappings,omitempty"` + // Aliases - The aliases that are supported by this resource type. + Aliases *[]Alias `json:"aliases,omitempty"` + // APIVersions - The API version. + APIVersions *[]string `json:"apiVersions,omitempty"` + // DefaultAPIVersion - READ-ONLY; The default API version. + DefaultAPIVersion *string `json:"defaultApiVersion,omitempty"` + ZoneMappings *[]ZoneMapping `json:"zoneMappings,omitempty"` + // APIProfiles - READ-ONLY; The API profiles for the resource provider. + APIProfiles *[]APIProfile `json:"apiProfiles,omitempty"` + // Capabilities - The additional capabilities offered by this resource type. + Capabilities *string `json:"capabilities,omitempty"` + // Properties - The properties. + Properties map[string]*string `json:"properties"` +} + +// MarshalJSON is the custom marshaler for ProviderResourceType. +func (prt ProviderResourceType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if prt.ResourceType != nil { + objectMap["resourceType"] = prt.ResourceType + } + if prt.Locations != nil { + objectMap["locations"] = prt.Locations + } + if prt.LocationMappings != nil { + objectMap["locationMappings"] = prt.LocationMappings + } + if prt.Aliases != nil { + objectMap["aliases"] = prt.Aliases + } + if prt.APIVersions != nil { + objectMap["apiVersions"] = prt.APIVersions + } + if prt.ZoneMappings != nil { + objectMap["zoneMappings"] = prt.ZoneMappings + } + if prt.Capabilities != nil { + objectMap["capabilities"] = prt.Capabilities + } + if prt.Properties != nil { + objectMap["properties"] = prt.Properties + } + return json.Marshal(objectMap) +} + +// ProviderResourceTypeListResult list of resource types of a resource provider. +type ProviderResourceTypeListResult struct { + autorest.Response `json:"-"` + // Value - An array of resource types. + Value *[]ProviderResourceType `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProviderResourceTypeListResult. +func (prtlr ProviderResourceTypeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if prtlr.Value != nil { + objectMap["value"] = prtlr.Value + } + return json.Marshal(objectMap) +} + +// Reference the resource Id model. +type Reference struct { + // ID - READ-ONLY; The fully qualified resource Id. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for Reference. +func (r Reference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource specified resource. +type Resource struct { + // ID - READ-ONLY; Resource ID + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ExtendedLocation - Resource extended location. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.ExtendedLocation != nil { + objectMap["extendedLocation"] = r.ExtendedLocation + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// ScopedDeployment deployment operation parameters. +type ScopedDeployment struct { + // Location - The location to store the deployment data. + Location *string `json:"location,omitempty"` + // Properties - The deployment properties. + Properties *DeploymentProperties `json:"properties,omitempty"` + // Tags - Deployment tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ScopedDeployment. +func (sd ScopedDeployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sd.Location != nil { + objectMap["location"] = sd.Location + } + if sd.Properties != nil { + objectMap["properties"] = sd.Properties + } + if sd.Tags != nil { + objectMap["tags"] = sd.Tags + } + return json.Marshal(objectMap) +} + +// ScopedDeploymentWhatIf deployment What-if operation parameters. +type ScopedDeploymentWhatIf struct { + // Location - The location to store the deployment data. + Location *string `json:"location,omitempty"` + // Properties - The deployment properties. + Properties *DeploymentWhatIfProperties `json:"properties,omitempty"` +} + +// Sku SKU for the resource. +type Sku struct { + // Name - The SKU name. + Name *string `json:"name,omitempty"` + // Tier - The SKU tier. + Tier *string `json:"tier,omitempty"` + // Size - The SKU size. + Size *string `json:"size,omitempty"` + // Family - The SKU family. + Family *string `json:"family,omitempty"` + // Model - The SKU model. + Model *string `json:"model,omitempty"` + // Capacity - The SKU capacity. + Capacity *int32 `json:"capacity,omitempty"` +} + +// StatusMessage operation status message object. +type StatusMessage struct { + // Status - Status of the deployment operation. + Status *string `json:"status,omitempty"` + // Error - The error reported by the operation. + Error *ErrorResponse `json:"error,omitempty"` +} + +// SubResource sub-resource. +type SubResource struct { + // ID - Resource ID + ID *string `json:"id,omitempty"` +} + +// TagCount tag count. +type TagCount struct { + // Type - Type of count. + Type *string `json:"type,omitempty"` + // Value - Value of count. + Value *int32 `json:"value,omitempty"` +} + +// TagDetails tag details. +type TagDetails struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The tag name ID. + ID *string `json:"id,omitempty"` + // TagName - The tag name. + TagName *string `json:"tagName,omitempty"` + // Count - The total number of resources that use the resource tag. When a tag is initially created and has no associated resources, the value is 0. + Count *TagCount `json:"count,omitempty"` + // Values - The list of tag values. + Values *[]TagValue `json:"values,omitempty"` +} + +// MarshalJSON is the custom marshaler for TagDetails. +func (td TagDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if td.TagName != nil { + objectMap["tagName"] = td.TagName + } + if td.Count != nil { + objectMap["count"] = td.Count + } + if td.Values != nil { + objectMap["values"] = td.Values + } + return json.Marshal(objectMap) +} + +// Tags a dictionary of name and value pairs. +type Tags struct { + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Tags. +func (t Tags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.Tags != nil { + objectMap["tags"] = t.Tags + } + return json.Marshal(objectMap) +} + +// TagsListResult list of subscription tags. +type TagsListResult struct { + autorest.Response `json:"-"` + // Value - An array of tags. + Value *[]TagDetails `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for TagsListResult. +func (tlr TagsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tlr.Value != nil { + objectMap["value"] = tlr.Value + } + return json.Marshal(objectMap) +} + +// TagsListResultIterator provides access to a complete listing of TagDetails values. +type TagsListResultIterator struct { + i int + page TagsListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *TagsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagsListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *TagsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TagsListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter TagsListResultIterator) Response() TagsListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter TagsListResultIterator) Value() TagDetails { + if !iter.page.NotDone() { + return TagDetails{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the TagsListResultIterator type. +func NewTagsListResultIterator(page TagsListResultPage) TagsListResultIterator { + return TagsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (tlr TagsListResult) IsEmpty() bool { + return tlr.Value == nil || len(*tlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (tlr TagsListResult) hasNextLink() bool { + return tlr.NextLink != nil && len(*tlr.NextLink) != 0 +} + +// tagsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (tlr TagsListResult) tagsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !tlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(tlr.NextLink))) +} + +// TagsListResultPage contains a page of TagDetails values. +type TagsListResultPage struct { + fn func(context.Context, TagsListResult) (TagsListResult, error) + tlr TagsListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *TagsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagsListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.tlr) + if err != nil { + return err + } + page.tlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *TagsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TagsListResultPage) NotDone() bool { + return !page.tlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page TagsListResultPage) Response() TagsListResult { + return page.tlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page TagsListResultPage) Values() []TagDetails { + if page.tlr.IsEmpty() { + return nil + } + return *page.tlr.Value +} + +// Creates a new instance of the TagsListResultPage type. +func NewTagsListResultPage(cur TagsListResult, getNextPage func(context.Context, TagsListResult) (TagsListResult, error)) TagsListResultPage { + return TagsListResultPage{ + fn: getNextPage, + tlr: cur, + } +} + +// TagsPatchResource wrapper resource for tags patch API request only. +type TagsPatchResource struct { + // Operation - The operation type for the patch API. Possible values include: 'TagsPatchOperationReplace', 'TagsPatchOperationMerge', 'TagsPatchOperationDelete' + Operation TagsPatchOperation `json:"operation,omitempty"` + // Properties - The set of tags. + Properties *Tags `json:"properties,omitempty"` +} + +// TagsResource wrapper resource for tags API requests and responses. +type TagsResource struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the tags wrapper resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the tags wrapper resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the tags wrapper resource. + Type *string `json:"type,omitempty"` + // Properties - The set of tags. + Properties *Tags `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for TagsResource. +func (tr TagsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Properties != nil { + objectMap["properties"] = tr.Properties + } + return json.Marshal(objectMap) +} + +// TagValue tag information. +type TagValue struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The tag value ID. + ID *string `json:"id,omitempty"` + // TagValue - The tag value. + TagValue *string `json:"tagValue,omitempty"` + // Count - The tag value count. + Count *TagCount `json:"count,omitempty"` +} + +// MarshalJSON is the custom marshaler for TagValue. +func (tv TagValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tv.TagValue != nil { + objectMap["tagValue"] = tv.TagValue + } + if tv.Count != nil { + objectMap["count"] = tv.Count + } + return json.Marshal(objectMap) +} + +// TargetResource target resource. +type TargetResource struct { + // ID - The ID of the resource. + ID *string `json:"id,omitempty"` + // ResourceName - The name of the resource. + ResourceName *string `json:"resourceName,omitempty"` + // ResourceType - The type of the resource. + ResourceType *string `json:"resourceType,omitempty"` +} + +// TemplateHashResult result of the request to calculate template hash. It contains a string of minified +// template and its hash. +type TemplateHashResult struct { + autorest.Response `json:"-"` + // MinifiedTemplate - The minified template string. + MinifiedTemplate *string `json:"minifiedTemplate,omitempty"` + // TemplateHash - The template hash. + TemplateHash *string `json:"templateHash,omitempty"` +} + +// TemplateLink entity representing the reference to the template. +type TemplateLink struct { + // URI - The URI of the template to deploy. Use either the uri or id property, but not both. + URI *string `json:"uri,omitempty"` + // ID - The resource id of a Template Spec. Use either the id or uri property, but not both. + ID *string `json:"id,omitempty"` + // RelativePath - The relativePath property can be used to deploy a linked template at a location relative to the parent. If the parent template was linked with a TemplateSpec, this will reference an artifact in the TemplateSpec. If the parent was linked with a URI, the child deployment will be a combination of the parent and relativePath URIs + RelativePath *string `json:"relativePath,omitempty"` + // ContentVersion - If included, must match the ContentVersion in the template. + ContentVersion *string `json:"contentVersion,omitempty"` + // QueryString - The query string (for example, a SAS token) to be used with the templateLink URI. + QueryString *string `json:"queryString,omitempty"` +} + +// UpdateByIDFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type UpdateByIDFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (GenericResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *UpdateByIDFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for UpdateByIDFuture.Result. +func (future *UpdateByIDFuture) result(client Client) (gr GenericResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.UpdateByIDFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + gr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.UpdateByIDFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { + gr, err = client.UpdateByIDResponder(gr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.UpdateByIDFuture", "Result", gr.Response.Response, "Failure responding to request") + } + } + return +} + +// UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type UpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (GenericResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *UpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for UpdateFuture.Result. +func (future *UpdateFuture) result(client Client) (gr GenericResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + gr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.UpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { + gr, err = client.UpdateResponder(gr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", gr.Response.Response, "Failure responding to request") + } + } + return +} + +// ValidateMoveResourcesFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ValidateMoveResourcesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ValidateMoveResourcesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ValidateMoveResourcesFuture.Result. +func (future *ValidateMoveResourcesFuture) result(client Client) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ValidateMoveResourcesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("resources.ValidateMoveResourcesFuture") + return + } + ar.Response = future.Response() + return +} + +// WhatIfChange information about a single resource change predicted by What-If operation. +type WhatIfChange struct { + // ResourceID - Resource ID + ResourceID *string `json:"resourceId,omitempty"` + // ChangeType - Type of change that will be made to the resource when the deployment is executed. Possible values include: 'Create', 'Delete', 'Ignore', 'Deploy', 'NoChange', 'Modify', 'Unsupported' + ChangeType ChangeType `json:"changeType,omitempty"` + // UnsupportedReason - The explanation about why the resource is unsupported by What-If. + UnsupportedReason *string `json:"unsupportedReason,omitempty"` + // Before - The snapshot of the resource before the deployment is executed. + Before interface{} `json:"before,omitempty"` + // After - The predicted snapshot of the resource after the deployment is executed. + After interface{} `json:"after,omitempty"` + // Delta - The predicted changes to resource properties. + Delta *[]WhatIfPropertyChange `json:"delta,omitempty"` +} + +// WhatIfOperationProperties deployment operation properties. +type WhatIfOperationProperties struct { + // Changes - List of resource changes predicted by What-If operation. + Changes *[]WhatIfChange `json:"changes,omitempty"` +} + +// WhatIfOperationResult result of the What-If operation. Contains a list of predicted changes and a URL +// link to get to the next set of results. +type WhatIfOperationResult struct { + autorest.Response `json:"-"` + // Status - Status of the What-If operation. + Status *string `json:"status,omitempty"` + // WhatIfOperationProperties - What-If operation properties. + *WhatIfOperationProperties `json:"properties,omitempty"` + // Error - Error when What-If operation fails. + Error *ErrorResponse `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for WhatIfOperationResult. +func (wior WhatIfOperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wior.Status != nil { + objectMap["status"] = wior.Status + } + if wior.WhatIfOperationProperties != nil { + objectMap["properties"] = wior.WhatIfOperationProperties + } + if wior.Error != nil { + objectMap["error"] = wior.Error + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WhatIfOperationResult struct. +func (wior *WhatIfOperationResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "status": + if v != nil { + var status string + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + wior.Status = &status + } + case "properties": + if v != nil { + var whatIfOperationProperties WhatIfOperationProperties + err = json.Unmarshal(*v, &whatIfOperationProperties) + if err != nil { + return err + } + wior.WhatIfOperationProperties = &whatIfOperationProperties + } + case "error": + if v != nil { + var errorVar ErrorResponse + err = json.Unmarshal(*v, &errorVar) + if err != nil { + return err + } + wior.Error = &errorVar + } + } + } + + return nil +} + +// WhatIfPropertyChange the predicted change to the resource property. +type WhatIfPropertyChange struct { + // Path - The path of the property. + Path *string `json:"path,omitempty"` + // PropertyChangeType - The type of property change. Possible values include: 'PropertyChangeTypeCreate', 'PropertyChangeTypeDelete', 'PropertyChangeTypeModify', 'PropertyChangeTypeArray', 'PropertyChangeTypeNoEffect' + PropertyChangeType PropertyChangeType `json:"propertyChangeType,omitempty"` + // Before - The value of the property before the deployment is executed. + Before interface{} `json:"before,omitempty"` + // After - The value of the property after the deployment is executed. + After interface{} `json:"after,omitempty"` + // Children - Nested property changes. + Children *[]WhatIfPropertyChange `json:"children,omitempty"` +} + +// ZoneMapping ... +type ZoneMapping struct { + // Location - The location of the zone mapping. + Location *string `json:"location,omitempty"` + Zones *[]string `json:"zones,omitempty"` +} diff --git a/services/resources/mgmt/2021-01-01/subscriptions/operations.go b/services/resources/mgmt/2021-01-01/resources/operations.go similarity index 75% rename from services/resources/mgmt/2021-01-01/subscriptions/operations.go rename to services/resources/mgmt/2021-01-01/resources/operations.go index bd5ea8abac22..4f31758b2abe 100644 --- a/services/resources/mgmt/2021-01-01/subscriptions/operations.go +++ b/services/resources/mgmt/2021-01-01/resources/operations.go @@ -1,4 +1,4 @@ -package subscriptions +package resources // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,22 +14,20 @@ import ( "net/http" ) -// OperationsClient is the all resource groups and resources exist within subscriptions. These operation enable you get -// information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure -// AD) for your organization. +// OperationsClient is the provides operations for working with resources and resource groups. type OperationsClient struct { BaseClient } // NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient() OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI) +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this // when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI)} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} } // List lists all of the available Microsoft.Resources REST API operations. @@ -47,20 +45,20 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe result.fn = client.listNextResults req, err := client.ListPreparer(ctx) if err != nil { - err = autorest.NewErrorWithError(err, "subscriptions.OperationsClient", "List", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "resources.OperationsClient", "List", nil, "Failure preparing request") return } resp, err := client.ListSender(req) if err != nil { result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "subscriptions.OperationsClient", "List", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "resources.OperationsClient", "List", resp, "Failure sending request") return } result.olr, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "subscriptions.OperationsClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "resources.OperationsClient", "List", resp, "Failure responding to request") return } if result.olr.hasNextLink() && result.olr.IsEmpty() { @@ -108,7 +106,7 @@ func (client OperationsClient) ListResponder(resp *http.Response) (result Operat func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { req, err := lastResults.operationListResultPreparer(ctx) if err != nil { - return result, autorest.NewErrorWithError(err, "subscriptions.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "resources.OperationsClient", "listNextResults", nil, "Failure preparing next results request") } if req == nil { return @@ -116,11 +114,11 @@ func (client OperationsClient) listNextResults(ctx context.Context, lastResults resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "subscriptions.OperationsClient", "listNextResults", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "resources.OperationsClient", "listNextResults", resp, "Failure sending next results request") } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "subscriptions.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "resources.OperationsClient", "listNextResults", resp, "Failure responding to next results request") } return } diff --git a/services/resources/mgmt/2021-01-01/resources/providerresourcetypes.go b/services/resources/mgmt/2021-01-01/resources/providerresourcetypes.go new file mode 100644 index 000000000000..d749eeb8747e --- /dev/null +++ b/services/resources/mgmt/2021-01-01/resources/providerresourcetypes.go @@ -0,0 +1,111 @@ +package resources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ProviderResourceTypesClient is the provides operations for working with resources and resource groups. +type ProviderResourceTypesClient struct { + BaseClient +} + +// NewProviderResourceTypesClient creates an instance of the ProviderResourceTypesClient client. +func NewProviderResourceTypesClient(subscriptionID string) ProviderResourceTypesClient { + return NewProviderResourceTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProviderResourceTypesClientWithBaseURI creates an instance of the ProviderResourceTypesClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewProviderResourceTypesClientWithBaseURI(baseURI string, subscriptionID string) ProviderResourceTypesClient { + return ProviderResourceTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list the resource types for a specified resource provider. +// Parameters: +// resourceProviderNamespace - the namespace of the resource provider. +// expand - the $expand query parameter. For example, to include property aliases in response, use +// $expand=resourceTypes/aliases. +func (client ProviderResourceTypesClient) List(ctx context.Context, resourceProviderNamespace string, expand string) (result ProviderResourceTypeListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderResourceTypesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceProviderNamespace, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProviderResourceTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.ProviderResourceTypesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProviderResourceTypesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ProviderResourceTypesClient) ListPreparer(ctx context.Context, resourceProviderNamespace string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/resourceTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ProviderResourceTypesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ProviderResourceTypesClient) ListResponder(resp *http.Response) (result ProviderResourceTypeListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/resources/mgmt/2021-01-01/resources/providers.go b/services/resources/mgmt/2021-01-01/resources/providers.go new file mode 100644 index 000000000000..2926685dbe6a --- /dev/null +++ b/services/resources/mgmt/2021-01-01/resources/providers.go @@ -0,0 +1,662 @@ +package resources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ProvidersClient is the provides operations for working with resources and resource groups. +type ProvidersClient struct { + BaseClient +} + +// NewProvidersClient creates an instance of the ProvidersClient client. +func NewProvidersClient(subscriptionID string) ProvidersClient { + return NewProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProvidersClientWithBaseURI creates an instance of the ProvidersClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewProvidersClientWithBaseURI(baseURI string, subscriptionID string) ProvidersClient { + return ProvidersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the specified resource provider. +// Parameters: +// resourceProviderNamespace - the namespace of the resource provider. +// expand - the $expand query parameter. For example, to include property aliases in response, use +// $expand=resourceTypes/aliases. +func (client ProvidersClient) Get(ctx context.Context, resourceProviderNamespace string, expand string) (result Provider, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProvidersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceProviderNamespace, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProvidersClient) GetPreparer(ctx context.Context, resourceProviderNamespace string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProvidersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProvidersClient) GetResponder(resp *http.Response) (result Provider, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAtTenantScope gets the specified resource provider at the tenant level. +// Parameters: +// resourceProviderNamespace - the namespace of the resource provider. +// expand - the $expand query parameter. For example, to include property aliases in response, use +// $expand=resourceTypes/aliases. +func (client ProvidersClient) GetAtTenantScope(ctx context.Context, resourceProviderNamespace string, expand string) (result Provider, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProvidersClient.GetAtTenantScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetAtTenantScopePreparer(ctx, resourceProviderNamespace, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "GetAtTenantScope", nil, "Failure preparing request") + return + } + + resp, err := client.GetAtTenantScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "GetAtTenantScope", resp, "Failure sending request") + return + } + + result, err = client.GetAtTenantScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "GetAtTenantScope", resp, "Failure responding to request") + return + } + + return +} + +// GetAtTenantScopePreparer prepares the GetAtTenantScope request. +func (client ProvidersClient) GetAtTenantScopePreparer(ctx context.Context, resourceProviderNamespace string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/{resourceProviderNamespace}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAtTenantScopeSender sends the GetAtTenantScope request. The method will close the +// http.Response Body if it receives an error. +func (client ProvidersClient) GetAtTenantScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetAtTenantScopeResponder handles the response to the GetAtTenantScope request. The method always +// closes the http.Response Body. +func (client ProvidersClient) GetAtTenantScopeResponder(resp *http.Response) (result Provider, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all resource providers for a subscription. +// Parameters: +// top - the number of results to return. If null is passed returns all deployments. +// expand - the properties to include in the results. For example, use &$expand=metadata in the query string to +// retrieve resource provider metadata. To include property aliases in response, use +// $expand=resourceTypes/aliases. +func (client ProvidersClient) List(ctx context.Context, top *int32, expand string) (result ProviderListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProvidersClient.List") + defer func() { + sc := -1 + if result.plr.Response.Response != nil { + sc = result.plr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, top, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.plr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure sending request") + return + } + + result.plr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure responding to request") + return + } + if result.plr.hasNextLink() && result.plr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ProvidersClient) ListPreparer(ctx context.Context, top *int32, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ProvidersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ProvidersClient) ListResponder(resp *http.Response) (result ProviderListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ProvidersClient) listNextResults(ctx context.Context, lastResults ProviderListResult) (result ProviderListResult, err error) { + req, err := lastResults.providerListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProvidersClient) ListComplete(ctx context.Context, top *int32, expand string) (result ProviderListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProvidersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, top, expand) + return +} + +// ListAtTenantScope gets all resource providers for the tenant. +// Parameters: +// top - the number of results to return. If null is passed returns all providers. +// expand - the properties to include in the results. For example, use &$expand=metadata in the query string to +// retrieve resource provider metadata. To include property aliases in response, use +// $expand=resourceTypes/aliases. +func (client ProvidersClient) ListAtTenantScope(ctx context.Context, top *int32, expand string) (result ProviderListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProvidersClient.ListAtTenantScope") + defer func() { + sc := -1 + if result.plr.Response.Response != nil { + sc = result.plr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAtTenantScopeNextResults + req, err := client.ListAtTenantScopePreparer(ctx, top, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "ListAtTenantScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtTenantScopeSender(req) + if err != nil { + result.plr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "ListAtTenantScope", resp, "Failure sending request") + return + } + + result.plr, err = client.ListAtTenantScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "ListAtTenantScope", resp, "Failure responding to request") + return + } + if result.plr.hasNextLink() && result.plr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAtTenantScopePreparer prepares the ListAtTenantScope request. +func (client ProvidersClient) ListAtTenantScopePreparer(ctx context.Context, top *int32, expand string) (*http.Request, error) { + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAtTenantScopeSender sends the ListAtTenantScope request. The method will close the +// http.Response Body if it receives an error. +func (client ProvidersClient) ListAtTenantScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListAtTenantScopeResponder handles the response to the ListAtTenantScope request. The method always +// closes the http.Response Body. +func (client ProvidersClient) ListAtTenantScopeResponder(resp *http.Response) (result ProviderListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAtTenantScopeNextResults retrieves the next set of results, if any. +func (client ProvidersClient) listAtTenantScopeNextResults(ctx context.Context, lastResults ProviderListResult) (result ProviderListResult, err error) { + req, err := lastResults.providerListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "listAtTenantScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAtTenantScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "listAtTenantScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAtTenantScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "listAtTenantScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAtTenantScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProvidersClient) ListAtTenantScopeComplete(ctx context.Context, top *int32, expand string) (result ProviderListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProvidersClient.ListAtTenantScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAtTenantScope(ctx, top, expand) + return +} + +// Register registers a subscription with a resource provider. +// Parameters: +// resourceProviderNamespace - the namespace of the resource provider to register. +func (client ProvidersClient) Register(ctx context.Context, resourceProviderNamespace string) (result Provider, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProvidersClient.Register") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RegisterPreparer(ctx, resourceProviderNamespace) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Register", nil, "Failure preparing request") + return + } + + resp, err := client.RegisterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Register", resp, "Failure sending request") + return + } + + result, err = client.RegisterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Register", resp, "Failure responding to request") + return + } + + return +} + +// RegisterPreparer prepares the Register request. +func (client ProvidersClient) RegisterPreparer(ctx context.Context, resourceProviderNamespace string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegisterSender sends the Register request. The method will close the +// http.Response Body if it receives an error. +func (client ProvidersClient) RegisterSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RegisterResponder handles the response to the Register request. The method always +// closes the http.Response Body. +func (client ProvidersClient) RegisterResponder(resp *http.Response) (result Provider, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegisterAtManagementGroupScope registers a management group with a resource provider. +// Parameters: +// resourceProviderNamespace - the namespace of the resource provider to register. +// groupID - the management group ID. +func (client ProvidersClient) RegisterAtManagementGroupScope(ctx context.Context, resourceProviderNamespace string, groupID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProvidersClient.RegisterAtManagementGroupScope") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.ProvidersClient", "RegisterAtManagementGroupScope", err.Error()) + } + + req, err := client.RegisterAtManagementGroupScopePreparer(ctx, resourceProviderNamespace, groupID) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "RegisterAtManagementGroupScope", nil, "Failure preparing request") + return + } + + resp, err := client.RegisterAtManagementGroupScopeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "RegisterAtManagementGroupScope", resp, "Failure sending request") + return + } + + result, err = client.RegisterAtManagementGroupScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "RegisterAtManagementGroupScope", resp, "Failure responding to request") + return + } + + return +} + +// RegisterAtManagementGroupScopePreparer prepares the RegisterAtManagementGroupScope request. +func (client ProvidersClient) RegisterAtManagementGroupScopePreparer(ctx context.Context, resourceProviderNamespace string, groupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegisterAtManagementGroupScopeSender sends the RegisterAtManagementGroupScope request. The method will close the +// http.Response Body if it receives an error. +func (client ProvidersClient) RegisterAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// RegisterAtManagementGroupScopeResponder handles the response to the RegisterAtManagementGroupScope request. The method always +// closes the http.Response Body. +func (client ProvidersClient) RegisterAtManagementGroupScopeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Unregister unregisters a subscription from a resource provider. +// Parameters: +// resourceProviderNamespace - the namespace of the resource provider to unregister. +func (client ProvidersClient) Unregister(ctx context.Context, resourceProviderNamespace string) (result Provider, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProvidersClient.Unregister") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UnregisterPreparer(ctx, resourceProviderNamespace) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Unregister", nil, "Failure preparing request") + return + } + + resp, err := client.UnregisterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Unregister", resp, "Failure sending request") + return + } + + result, err = client.UnregisterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Unregister", resp, "Failure responding to request") + return + } + + return +} + +// UnregisterPreparer prepares the Unregister request. +func (client ProvidersClient) UnregisterPreparer(ctx context.Context, resourceProviderNamespace string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UnregisterSender sends the Unregister request. The method will close the +// http.Response Body if it receives an error. +func (client ProvidersClient) UnregisterSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UnregisterResponder handles the response to the Unregister request. The method always +// closes the http.Response Body. +func (client ProvidersClient) UnregisterResponder(resp *http.Response) (result Provider, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/resources/mgmt/2021-01-01/resources/resources.go b/services/resources/mgmt/2021-01-01/resources/resources.go new file mode 100644 index 000000000000..2daf49781871 --- /dev/null +++ b/services/resources/mgmt/2021-01-01/resources/resources.go @@ -0,0 +1,1362 @@ +package resources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// Client is the provides operations for working with resources and resource groups. +type Client struct { + BaseClient +} + +// NewClient creates an instance of the Client client. +func NewClient(subscriptionID string) Client { + return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting +// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { + return Client{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckExistence checks whether a resource exists. +// Parameters: +// resourceGroupName - the name of the resource group containing the resource to check. The name is case +// insensitive. +// resourceProviderNamespace - the resource provider of the resource to check. +// parentResourcePath - the parent resource identity. +// resourceType - the resource type. +// resourceName - the name of the resource to check whether it exists. +// APIVersion - the API version to use for the operation. +func (client Client) CheckExistence(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckExistence") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.Client", "CheckExistence", err.Error()) + } + + req, err := client.CheckExistencePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, APIVersion) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "CheckExistence", nil, "Failure preparing request") + return + } + + resp, err := client.CheckExistenceSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.Client", "CheckExistence", resp, "Failure sending request") + return + } + + result, err = client.CheckExistenceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "CheckExistence", resp, "Failure responding to request") + return + } + + return +} + +// CheckExistencePreparer prepares the CheckExistence request. +func (client Client) CheckExistencePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckExistenceSender sends the CheckExistence request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CheckExistenceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckExistenceResponder handles the response to the CheckExistence request. The method always +// closes the http.Response Body. +func (client Client) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// CheckExistenceByID checks by ID whether a resource exists. +// Parameters: +// resourceID - the fully qualified ID of the resource, including the resource name and resource type. Use the +// format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} +// APIVersion - the API version to use for the operation. +func (client Client) CheckExistenceByID(ctx context.Context, resourceID string, APIVersion string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckExistenceByID") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CheckExistenceByIDPreparer(ctx, resourceID, APIVersion) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "CheckExistenceByID", nil, "Failure preparing request") + return + } + + resp, err := client.CheckExistenceByIDSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.Client", "CheckExistenceByID", resp, "Failure sending request") + return + } + + result, err = client.CheckExistenceByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "CheckExistenceByID", resp, "Failure responding to request") + return + } + + return +} + +// CheckExistenceByIDPreparer prepares the CheckExistenceByID request. +func (client Client) CheckExistenceByIDPreparer(ctx context.Context, resourceID string, APIVersion string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceId": resourceID, + } + + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckExistenceByIDSender sends the CheckExistenceByID request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CheckExistenceByIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CheckExistenceByIDResponder handles the response to the CheckExistenceByID request. The method always +// closes the http.Response Body. +func (client Client) CheckExistenceByIDResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate creates a resource. +// Parameters: +// resourceGroupName - the name of the resource group for the resource. The name is case insensitive. +// resourceProviderNamespace - the namespace of the resource provider. +// parentResourcePath - the parent resource identity. +// resourceType - the resource type of the resource to create. +// resourceName - the name of the resource to create. +// APIVersion - the API version to use for the operation. +// parameters - parameters for creating or updating the resource. +func (client Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string, parameters GenericResource) (result CreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("resources.Client", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, APIVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client Client) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string, parameters GenericResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CreateOrUpdateSender(req *http.Request) (future CreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client Client) CreateOrUpdateResponder(resp *http.Response) (result GenericResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateByID create a resource by ID. +// Parameters: +// resourceID - the fully qualified ID of the resource, including the resource name and resource type. Use the +// format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} +// APIVersion - the API version to use for the operation. +// parameters - create or update resource parameters. +func (client Client) CreateOrUpdateByID(ctx context.Context, resourceID string, APIVersion string, parameters GenericResource) (result CreateOrUpdateByIDFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateOrUpdateByID") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("resources.Client", "CreateOrUpdateByID", err.Error()) + } + + req, err := client.CreateOrUpdateByIDPreparer(ctx, resourceID, APIVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdateByID", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateByIDSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdateByID", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdateByIDPreparer prepares the CreateOrUpdateByID request. +func (client Client) CreateOrUpdateByIDPreparer(ctx context.Context, resourceID string, APIVersion string, parameters GenericResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceId": resourceID, + } + + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateByIDSender sends the CreateOrUpdateByID request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CreateOrUpdateByIDSender(req *http.Request) (future CreateOrUpdateByIDFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateByIDResponder handles the response to the CreateOrUpdateByID request. The method always +// closes the http.Response Body. +func (client Client) CreateOrUpdateByIDResponder(resp *http.Response) (result GenericResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource to delete. The name is case +// insensitive. +// resourceProviderNamespace - the namespace of the resource provider. +// parentResourcePath - the parent resource identity. +// resourceType - the resource type. +// resourceName - the name of the resource to delete. +// APIVersion - the API version to use for the operation. +func (client Client) Delete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string) (result DeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.Client", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, APIVersion) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client Client) DeletePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client Client) DeleteSender(req *http.Request) (future DeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteByID deletes a resource by ID. +// Parameters: +// resourceID - the fully qualified ID of the resource, including the resource name and resource type. Use the +// format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} +// APIVersion - the API version to use for the operation. +func (client Client) DeleteByID(ctx context.Context, resourceID string, APIVersion string) (result DeleteByIDFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.DeleteByID") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteByIDPreparer(ctx, resourceID, APIVersion) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "DeleteByID", nil, "Failure preparing request") + return + } + + result, err = client.DeleteByIDSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "DeleteByID", result.Response(), "Failure sending request") + return + } + + return +} + +// DeleteByIDPreparer prepares the DeleteByID request. +func (client Client) DeleteByIDPreparer(ctx context.Context, resourceID string, APIVersion string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceId": resourceID, + } + + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteByIDSender sends the DeleteByID request. The method will close the +// http.Response Body if it receives an error. +func (client Client) DeleteByIDSender(req *http.Request) (future DeleteByIDFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteByIDResponder handles the response to the DeleteByID request. The method always +// closes the http.Response Body. +func (client Client) DeleteByIDResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a resource. +// Parameters: +// resourceGroupName - the name of the resource group containing the resource to get. The name is case +// insensitive. +// resourceProviderNamespace - the namespace of the resource provider. +// parentResourcePath - the parent resource identity. +// resourceType - the resource type of the resource. +// resourceName - the name of the resource to get. +// APIVersion - the API version to use for the operation. +func (client Client) Get(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string) (result GenericResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.Client", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, APIVersion) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.Client", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client Client) GetPreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client Client) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client Client) GetResponder(resp *http.Response) (result GenericResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByID gets a resource by ID. +// Parameters: +// resourceID - the fully qualified ID of the resource, including the resource name and resource type. Use the +// format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} +// APIVersion - the API version to use for the operation. +func (client Client) GetByID(ctx context.Context, resourceID string, APIVersion string) (result GenericResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetByID") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetByIDPreparer(ctx, resourceID, APIVersion) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "GetByID", nil, "Failure preparing request") + return + } + + resp, err := client.GetByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.Client", "GetByID", resp, "Failure sending request") + return + } + + result, err = client.GetByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "GetByID", resp, "Failure responding to request") + return + } + + return +} + +// GetByIDPreparer prepares the GetByID request. +func (client Client) GetByIDPreparer(ctx context.Context, resourceID string, APIVersion string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceId": resourceID, + } + + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetByIDSender sends the GetByID request. The method will close the +// http.Response Body if it receives an error. +func (client Client) GetByIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetByIDResponder handles the response to the GetByID request. The method always +// closes the http.Response Body. +func (client Client) GetByIDResponder(resp *http.Response) (result GenericResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all the resources in a subscription. +// Parameters: +// filter - the filter to apply on the operation.

The properties you can use for eq (equals) or ne (not +// equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, +// plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.

For example, to filter +// by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'

You can use +// substringof(value, property) in the filter. The properties you can use for substring are: name and +// resourceGroup.

For example, to get all resources with 'demo' anywhere in the name, use: +// $filter=substringof('demo', name)

You can link more than one substringof together by adding and/or +// operators.

You can filter by tag names and values. For example, to filter for a tag name and value, +// use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags +// for each resource are not returned in the results.

You can use some properties together when +// filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and +// plan/name, identity and identity/principalId. +// expand - comma-separated list of additional properties to be included in the response. Valid values include +// `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. +// top - the number of results to return. If null is passed, returns all resources. +func (client Client) List(ctx context.Context, filter string, expand string, top *int32) (result ListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") + defer func() { + sc := -1 + if result.lr.Response.Response != nil { + sc = result.lr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, filter, expand, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.Client", "List", resp, "Failure sending request") + return + } + + result.lr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "List", resp, "Failure responding to request") + return + } + if result.lr.hasNextLink() && result.lr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client Client) ListPreparer(ctx context.Context, filter string, expand string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client Client) ListResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client Client) listNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.listResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.Client", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.Client", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client Client) ListComplete(ctx context.Context, filter string, expand string, top *int32) (result ListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, filter, expand, top) + return +} + +// ListByResourceGroup get all the resources for a resource group. +// Parameters: +// resourceGroupName - the resource group with the resources to get. +// filter - the filter to apply on the operation.

The properties you can use for eq (equals) or ne (not +// equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, +// plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.

For example, to filter +// by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'

You can use +// substringof(value, property) in the filter. The properties you can use for substring are: name and +// resourceGroup.

For example, to get all resources with 'demo' anywhere in the name, use: +// $filter=substringof('demo', name)

You can link more than one substringof together by adding and/or +// operators.

You can filter by tag names and values. For example, to filter for a tag name and value, +// use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags +// for each resource are not returned in the results.

You can use some properties together when +// filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and +// plan/name, identity and identity/principalId. +// expand - comma-separated list of additional properties to be included in the response. Valid values include +// `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. +// top - the number of results to return. If null is passed, returns all resources. +func (client Client) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, expand string, top *int32) (result ListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") + defer func() { + sc := -1 + if result.lr.Response.Response != nil { + sc = result.lr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.Client", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, expand, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.lr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.Client", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.lr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.lr.hasNextLink() && result.lr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client Client) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, expand string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client Client) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client Client) listByResourceGroupNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.listResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.Client", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.Client", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client Client) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, expand string, top *int32) (result ListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, filter, expand, top) + return +} + +// MoveResources the resources to move must be in the same source resource group. The target resource group may be in a +// different subscription. When moving resources, both the source group and the target group are locked for the +// duration of the operation. Write and delete operations are blocked on the groups until the move completes. +// Parameters: +// sourceResourceGroupName - the name of the resource group containing the resources to move. +// parameters - parameters for moving resources. +func (client Client) MoveResources(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo) (result MoveResourcesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.MoveResources") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: sourceResourceGroupName, + Constraints: []validation.Constraint{{Target: "sourceResourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "sourceResourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "sourceResourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.Client", "MoveResources", err.Error()) + } + + req, err := client.MoveResourcesPreparer(ctx, sourceResourceGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "MoveResources", nil, "Failure preparing request") + return + } + + result, err = client.MoveResourcesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "MoveResources", result.Response(), "Failure sending request") + return + } + + return +} + +// MoveResourcesPreparer prepares the MoveResources request. +func (client Client) MoveResourcesPreparer(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "sourceResourceGroupName": autorest.Encode("path", sourceResourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// MoveResourcesSender sends the MoveResources request. The method will close the +// http.Response Body if it receives an error. +func (client Client) MoveResourcesSender(req *http.Request) (future MoveResourcesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// MoveResourcesResponder handles the response to the MoveResources request. The method always +// closes the http.Response Body. +func (client Client) MoveResourcesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates a resource. +// Parameters: +// resourceGroupName - the name of the resource group for the resource. The name is case insensitive. +// resourceProviderNamespace - the namespace of the resource provider. +// parentResourcePath - the parent resource identity. +// resourceType - the resource type of the resource to update. +// resourceName - the name of the resource to update. +// APIVersion - the API version to use for the operation. +// parameters - parameters for updating the resource. +func (client Client) Update(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string, parameters GenericResource) (result UpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.Client", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, APIVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client Client) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string, parameters GenericResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client Client) UpdateSender(req *http.Request) (future UpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client Client) UpdateResponder(resp *http.Response) (result GenericResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateByID updates a resource by ID. +// Parameters: +// resourceID - the fully qualified ID of the resource, including the resource name and resource type. Use the +// format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} +// APIVersion - the API version to use for the operation. +// parameters - update resource parameters. +func (client Client) UpdateByID(ctx context.Context, resourceID string, APIVersion string, parameters GenericResource) (result UpdateByIDFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.UpdateByID") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateByIDPreparer(ctx, resourceID, APIVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "UpdateByID", nil, "Failure preparing request") + return + } + + result, err = client.UpdateByIDSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "UpdateByID", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateByIDPreparer prepares the UpdateByID request. +func (client Client) UpdateByIDPreparer(ctx context.Context, resourceID string, APIVersion string, parameters GenericResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceId": resourceID, + } + + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateByIDSender sends the UpdateByID request. The method will close the +// http.Response Body if it receives an error. +func (client Client) UpdateByIDSender(req *http.Request) (future UpdateByIDFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateByIDResponder handles the response to the UpdateByID request. The method always +// closes the http.Response Body. +func (client Client) UpdateByIDResponder(resp *http.Response) (result GenericResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateMoveResources this operation checks whether the specified resources can be moved to the target. The +// resources to move must be in the same source resource group. The target resource group may be in a different +// subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it +// returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to +// check the result of the long-running operation. +// Parameters: +// sourceResourceGroupName - the name of the resource group containing the resources to validate for move. +// parameters - parameters for moving resources. +func (client Client) ValidateMoveResources(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo) (result ValidateMoveResourcesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ValidateMoveResources") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: sourceResourceGroupName, + Constraints: []validation.Constraint{{Target: "sourceResourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "sourceResourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "sourceResourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.Client", "ValidateMoveResources", err.Error()) + } + + req, err := client.ValidateMoveResourcesPreparer(ctx, sourceResourceGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "ValidateMoveResources", nil, "Failure preparing request") + return + } + + result, err = client.ValidateMoveResourcesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.Client", "ValidateMoveResources", result.Response(), "Failure sending request") + return + } + + return +} + +// ValidateMoveResourcesPreparer prepares the ValidateMoveResources request. +func (client Client) ValidateMoveResourcesPreparer(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "sourceResourceGroupName": autorest.Encode("path", sourceResourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateMoveResourcesSender sends the ValidateMoveResources request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ValidateMoveResourcesSender(req *http.Request) (future ValidateMoveResourcesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ValidateMoveResourcesResponder handles the response to the ValidateMoveResources request. The method always +// closes the http.Response Body. +func (client Client) ValidateMoveResourcesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/resources/mgmt/2021-01-01/resources/resourcesapi/interfaces.go b/services/resources/mgmt/2021-01-01/resources/resourcesapi/interfaces.go new file mode 100644 index 000000000000..b7373096010f --- /dev/null +++ b/services/resources/mgmt/2021-01-01/resources/resourcesapi/interfaces.go @@ -0,0 +1,172 @@ +package resourcesapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-01-01/resources" + "github.com/Azure/go-autorest/autorest" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result resources.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result resources.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*resources.OperationsClient)(nil) + +// DeploymentsClientAPI contains the set of methods on the DeploymentsClient type. +type DeploymentsClientAPI interface { + CalculateTemplateHash(ctx context.Context, templateParameter interface{}) (result resources.TemplateHashResult, err error) + Cancel(ctx context.Context, resourceGroupName string, deploymentName string) (result autorest.Response, err error) + CancelAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string) (result autorest.Response, err error) + CancelAtScope(ctx context.Context, scope string, deploymentName string) (result autorest.Response, err error) + CancelAtSubscriptionScope(ctx context.Context, deploymentName string) (result autorest.Response, err error) + CancelAtTenantScope(ctx context.Context, deploymentName string) (result autorest.Response, err error) + CheckExistence(ctx context.Context, resourceGroupName string, deploymentName string) (result autorest.Response, err error) + CheckExistenceAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string) (result autorest.Response, err error) + CheckExistenceAtScope(ctx context.Context, scope string, deploymentName string) (result autorest.Response, err error) + CheckExistenceAtSubscriptionScope(ctx context.Context, deploymentName string) (result autorest.Response, err error) + CheckExistenceAtTenantScope(ctx context.Context, deploymentName string) (result autorest.Response, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, parameters resources.Deployment) (result resources.DeploymentsCreateOrUpdateFuture, err error) + CreateOrUpdateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters resources.ScopedDeployment) (result resources.DeploymentsCreateOrUpdateAtManagementGroupScopeFuture, err error) + CreateOrUpdateAtScope(ctx context.Context, scope string, deploymentName string, parameters resources.Deployment) (result resources.DeploymentsCreateOrUpdateAtScopeFuture, err error) + CreateOrUpdateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters resources.Deployment) (result resources.DeploymentsCreateOrUpdateAtSubscriptionScopeFuture, err error) + CreateOrUpdateAtTenantScope(ctx context.Context, deploymentName string, parameters resources.ScopedDeployment) (result resources.DeploymentsCreateOrUpdateAtTenantScopeFuture, err error) + Delete(ctx context.Context, resourceGroupName string, deploymentName string) (result resources.DeploymentsDeleteFuture, err error) + DeleteAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string) (result resources.DeploymentsDeleteAtManagementGroupScopeFuture, err error) + DeleteAtScope(ctx context.Context, scope string, deploymentName string) (result resources.DeploymentsDeleteAtScopeFuture, err error) + DeleteAtSubscriptionScope(ctx context.Context, deploymentName string) (result resources.DeploymentsDeleteAtSubscriptionScopeFuture, err error) + DeleteAtTenantScope(ctx context.Context, deploymentName string) (result resources.DeploymentsDeleteAtTenantScopeFuture, err error) + ExportTemplate(ctx context.Context, resourceGroupName string, deploymentName string) (result resources.DeploymentExportResult, err error) + ExportTemplateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string) (result resources.DeploymentExportResult, err error) + ExportTemplateAtScope(ctx context.Context, scope string, deploymentName string) (result resources.DeploymentExportResult, err error) + ExportTemplateAtSubscriptionScope(ctx context.Context, deploymentName string) (result resources.DeploymentExportResult, err error) + ExportTemplateAtTenantScope(ctx context.Context, deploymentName string) (result resources.DeploymentExportResult, err error) + Get(ctx context.Context, resourceGroupName string, deploymentName string) (result resources.DeploymentExtended, err error) + GetAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string) (result resources.DeploymentExtended, err error) + GetAtScope(ctx context.Context, scope string, deploymentName string) (result resources.DeploymentExtended, err error) + GetAtSubscriptionScope(ctx context.Context, deploymentName string) (result resources.DeploymentExtended, err error) + GetAtTenantScope(ctx context.Context, deploymentName string) (result resources.DeploymentExtended, err error) + ListAtManagementGroupScope(ctx context.Context, groupID string, filter string, top *int32) (result resources.DeploymentListResultPage, err error) + ListAtManagementGroupScopeComplete(ctx context.Context, groupID string, filter string, top *int32) (result resources.DeploymentListResultIterator, err error) + ListAtScope(ctx context.Context, scope string, filter string, top *int32) (result resources.DeploymentListResultPage, err error) + ListAtScopeComplete(ctx context.Context, scope string, filter string, top *int32) (result resources.DeploymentListResultIterator, err error) + ListAtSubscriptionScope(ctx context.Context, filter string, top *int32) (result resources.DeploymentListResultPage, err error) + ListAtSubscriptionScopeComplete(ctx context.Context, filter string, top *int32) (result resources.DeploymentListResultIterator, err error) + ListAtTenantScope(ctx context.Context, filter string, top *int32) (result resources.DeploymentListResultPage, err error) + ListAtTenantScopeComplete(ctx context.Context, filter string, top *int32) (result resources.DeploymentListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result resources.DeploymentListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result resources.DeploymentListResultIterator, err error) + Validate(ctx context.Context, resourceGroupName string, deploymentName string, parameters resources.Deployment) (result resources.DeploymentsValidateFuture, err error) + ValidateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters resources.ScopedDeployment) (result resources.DeploymentsValidateAtManagementGroupScopeFuture, err error) + ValidateAtScope(ctx context.Context, scope string, deploymentName string, parameters resources.Deployment) (result resources.DeploymentsValidateAtScopeFuture, err error) + ValidateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters resources.Deployment) (result resources.DeploymentsValidateAtSubscriptionScopeFuture, err error) + ValidateAtTenantScope(ctx context.Context, deploymentName string, parameters resources.ScopedDeployment) (result resources.DeploymentsValidateAtTenantScopeFuture, err error) + WhatIf(ctx context.Context, resourceGroupName string, deploymentName string, parameters resources.DeploymentWhatIf) (result resources.DeploymentsWhatIfFuture, err error) + WhatIfAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters resources.ScopedDeploymentWhatIf) (result resources.DeploymentsWhatIfAtManagementGroupScopeFuture, err error) + WhatIfAtSubscriptionScope(ctx context.Context, deploymentName string, parameters resources.DeploymentWhatIf) (result resources.DeploymentsWhatIfAtSubscriptionScopeFuture, err error) + WhatIfAtTenantScope(ctx context.Context, deploymentName string, parameters resources.ScopedDeploymentWhatIf) (result resources.DeploymentsWhatIfAtTenantScopeFuture, err error) +} + +var _ DeploymentsClientAPI = (*resources.DeploymentsClient)(nil) + +// ProvidersClientAPI contains the set of methods on the ProvidersClient type. +type ProvidersClientAPI interface { + Get(ctx context.Context, resourceProviderNamespace string, expand string) (result resources.Provider, err error) + GetAtTenantScope(ctx context.Context, resourceProviderNamespace string, expand string) (result resources.Provider, err error) + List(ctx context.Context, top *int32, expand string) (result resources.ProviderListResultPage, err error) + ListComplete(ctx context.Context, top *int32, expand string) (result resources.ProviderListResultIterator, err error) + ListAtTenantScope(ctx context.Context, top *int32, expand string) (result resources.ProviderListResultPage, err error) + ListAtTenantScopeComplete(ctx context.Context, top *int32, expand string) (result resources.ProviderListResultIterator, err error) + Register(ctx context.Context, resourceProviderNamespace string) (result resources.Provider, err error) + RegisterAtManagementGroupScope(ctx context.Context, resourceProviderNamespace string, groupID string) (result autorest.Response, err error) + Unregister(ctx context.Context, resourceProviderNamespace string) (result resources.Provider, err error) +} + +var _ ProvidersClientAPI = (*resources.ProvidersClient)(nil) + +// ProviderResourceTypesClientAPI contains the set of methods on the ProviderResourceTypesClient type. +type ProviderResourceTypesClientAPI interface { + List(ctx context.Context, resourceProviderNamespace string, expand string) (result resources.ProviderResourceTypeListResult, err error) +} + +var _ ProviderResourceTypesClientAPI = (*resources.ProviderResourceTypesClient)(nil) + +// ClientAPI contains the set of methods on the Client type. +type ClientAPI interface { + CheckExistence(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string) (result autorest.Response, err error) + CheckExistenceByID(ctx context.Context, resourceID string, APIVersion string) (result autorest.Response, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string, parameters resources.GenericResource) (result resources.CreateOrUpdateFuture, err error) + CreateOrUpdateByID(ctx context.Context, resourceID string, APIVersion string, parameters resources.GenericResource) (result resources.CreateOrUpdateByIDFuture, err error) + Delete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string) (result resources.DeleteFuture, err error) + DeleteByID(ctx context.Context, resourceID string, APIVersion string) (result resources.DeleteByIDFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string) (result resources.GenericResource, err error) + GetByID(ctx context.Context, resourceID string, APIVersion string) (result resources.GenericResource, err error) + List(ctx context.Context, filter string, expand string, top *int32) (result resources.ListResultPage, err error) + ListComplete(ctx context.Context, filter string, expand string, top *int32) (result resources.ListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, expand string, top *int32) (result resources.ListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, expand string, top *int32) (result resources.ListResultIterator, err error) + MoveResources(ctx context.Context, sourceResourceGroupName string, parameters resources.MoveInfo) (result resources.MoveResourcesFuture, err error) + Update(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string, parameters resources.GenericResource) (result resources.UpdateFuture, err error) + UpdateByID(ctx context.Context, resourceID string, APIVersion string, parameters resources.GenericResource) (result resources.UpdateByIDFuture, err error) + ValidateMoveResources(ctx context.Context, sourceResourceGroupName string, parameters resources.MoveInfo) (result resources.ValidateMoveResourcesFuture, err error) +} + +var _ ClientAPI = (*resources.Client)(nil) + +// GroupsClientAPI contains the set of methods on the GroupsClient type. +type GroupsClientAPI interface { + CheckExistence(ctx context.Context, resourceGroupName string) (result autorest.Response, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, parameters resources.Group) (result resources.Group, err error) + Delete(ctx context.Context, resourceGroupName string, forceDeletionTypes string) (result resources.GroupsDeleteFuture, err error) + ExportTemplate(ctx context.Context, resourceGroupName string, parameters resources.ExportTemplateRequest) (result resources.GroupsExportTemplateFuture, err error) + Get(ctx context.Context, resourceGroupName string) (result resources.Group, err error) + List(ctx context.Context, filter string, top *int32) (result resources.GroupListResultPage, err error) + ListComplete(ctx context.Context, filter string, top *int32) (result resources.GroupListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, parameters resources.GroupPatchable) (result resources.Group, err error) +} + +var _ GroupsClientAPI = (*resources.GroupsClient)(nil) + +// TagsClientAPI contains the set of methods on the TagsClient type. +type TagsClientAPI interface { + CreateOrUpdate(ctx context.Context, tagName string) (result resources.TagDetails, err error) + CreateOrUpdateAtScope(ctx context.Context, scope string, parameters resources.TagsResource) (result resources.TagsResource, err error) + CreateOrUpdateValue(ctx context.Context, tagName string, tagValue string) (result resources.TagValue, err error) + Delete(ctx context.Context, tagName string) (result autorest.Response, err error) + DeleteAtScope(ctx context.Context, scope string) (result autorest.Response, err error) + DeleteValue(ctx context.Context, tagName string, tagValue string) (result autorest.Response, err error) + GetAtScope(ctx context.Context, scope string) (result resources.TagsResource, err error) + List(ctx context.Context) (result resources.TagsListResultPage, err error) + ListComplete(ctx context.Context) (result resources.TagsListResultIterator, err error) + UpdateAtScope(ctx context.Context, scope string, parameters resources.TagsPatchResource) (result resources.TagsResource, err error) +} + +var _ TagsClientAPI = (*resources.TagsClient)(nil) + +// DeploymentOperationsClientAPI contains the set of methods on the DeploymentOperationsClient type. +type DeploymentOperationsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, deploymentName string, operationID string) (result resources.DeploymentOperation, err error) + GetAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, operationID string) (result resources.DeploymentOperation, err error) + GetAtScope(ctx context.Context, scope string, deploymentName string, operationID string) (result resources.DeploymentOperation, err error) + GetAtSubscriptionScope(ctx context.Context, deploymentName string, operationID string) (result resources.DeploymentOperation, err error) + GetAtTenantScope(ctx context.Context, deploymentName string, operationID string) (result resources.DeploymentOperation, err error) + List(ctx context.Context, resourceGroupName string, deploymentName string, top *int32) (result resources.DeploymentOperationsListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, deploymentName string, top *int32) (result resources.DeploymentOperationsListResultIterator, err error) + ListAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, top *int32) (result resources.DeploymentOperationsListResultPage, err error) + ListAtManagementGroupScopeComplete(ctx context.Context, groupID string, deploymentName string, top *int32) (result resources.DeploymentOperationsListResultIterator, err error) + ListAtScope(ctx context.Context, scope string, deploymentName string, top *int32) (result resources.DeploymentOperationsListResultPage, err error) + ListAtScopeComplete(ctx context.Context, scope string, deploymentName string, top *int32) (result resources.DeploymentOperationsListResultIterator, err error) + ListAtSubscriptionScope(ctx context.Context, deploymentName string, top *int32) (result resources.DeploymentOperationsListResultPage, err error) + ListAtSubscriptionScopeComplete(ctx context.Context, deploymentName string, top *int32) (result resources.DeploymentOperationsListResultIterator, err error) + ListAtTenantScope(ctx context.Context, deploymentName string, top *int32) (result resources.DeploymentOperationsListResultPage, err error) + ListAtTenantScopeComplete(ctx context.Context, deploymentName string, top *int32) (result resources.DeploymentOperationsListResultIterator, err error) +} + +var _ DeploymentOperationsClientAPI = (*resources.DeploymentOperationsClient)(nil) diff --git a/services/resources/mgmt/2021-01-01/resources/tags.go b/services/resources/mgmt/2021-01-01/resources/tags.go new file mode 100644 index 000000000000..ebe3c1b71fe1 --- /dev/null +++ b/services/resources/mgmt/2021-01-01/resources/tags.go @@ -0,0 +1,760 @@ +package resources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// TagsClient is the provides operations for working with resources and resource groups. +type TagsClient struct { + BaseClient +} + +// NewTagsClient creates an instance of the TagsClient client. +func NewTagsClient(subscriptionID string) TagsClient { + return NewTagsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTagsClientWithBaseURI creates an instance of the TagsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewTagsClientWithBaseURI(baseURI string, subscriptionID string) TagsClient { + return TagsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate this operation allows adding a name to the list of predefined tag names for the given subscription. A +// tag name can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes +// which are reserved for Azure use: 'microsoft', 'azure', 'windows'. +// Parameters: +// tagName - the name of the tag to create. +func (client TagsClient) CreateOrUpdate(ctx context.Context, tagName string) (result TagDetails, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, tagName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client TagsClient) CreateOrUpdatePreparer(ctx context.Context, tagName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tagName": autorest.Encode("path", tagName), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames/{tagName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client TagsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client TagsClient) CreateOrUpdateResponder(resp *http.Response) (result TagDetails, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAtScope this operation allows adding or replacing the entire set of tags on the specified resource or +// subscription. The specified entity can have a maximum of 50 tags. +// Parameters: +// scope - the resource scope. +func (client TagsClient) CreateOrUpdateAtScope(ctx context.Context, scope string, parameters TagsResource) (result TagsResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagsClient.CreateOrUpdateAtScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("resources.TagsClient", "CreateOrUpdateAtScope", err.Error()) + } + + req, err := client.CreateOrUpdateAtScopePreparer(ctx, scope, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateAtScope", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAtScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateAtScope", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAtScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateAtScope", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateAtScopePreparer prepares the CreateOrUpdateAtScope request. +func (client TagsClient) CreateOrUpdateAtScopePreparer(ctx context.Context, scope string, parameters TagsResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/tags/default", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateAtScopeSender sends the CreateOrUpdateAtScope request. The method will close the +// http.Response Body if it receives an error. +func (client TagsClient) CreateOrUpdateAtScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateOrUpdateAtScopeResponder handles the response to the CreateOrUpdateAtScope request. The method always +// closes the http.Response Body. +func (client TagsClient) CreateOrUpdateAtScopeResponder(resp *http.Response) (result TagsResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateValue this operation allows adding a value to the list of predefined values for an existing predefined +// tag name. A tag value can have a maximum of 256 characters. +// Parameters: +// tagName - the name of the tag. +// tagValue - the value of the tag to create. +func (client TagsClient) CreateOrUpdateValue(ctx context.Context, tagName string, tagValue string) (result TagValue, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagsClient.CreateOrUpdateValue") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdateValuePreparer(ctx, tagName, tagValue) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateValue", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateValueSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateValue", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateValueResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateValue", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateValuePreparer prepares the CreateOrUpdateValue request. +func (client TagsClient) CreateOrUpdateValuePreparer(ctx context.Context, tagName string, tagValue string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tagName": autorest.Encode("path", tagName), + "tagValue": autorest.Encode("path", tagValue), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateValueSender sends the CreateOrUpdateValue request. The method will close the +// http.Response Body if it receives an error. +func (client TagsClient) CreateOrUpdateValueSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateValueResponder handles the response to the CreateOrUpdateValue request. The method always +// closes the http.Response Body. +func (client TagsClient) CreateOrUpdateValueResponder(resp *http.Response) (result TagValue, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete this operation allows deleting a name from the list of predefined tag names for the given subscription. The +// name being deleted must not be in use as a tag name for any resource. All predefined values for the given name must +// have already been deleted. +// Parameters: +// tagName - the name of the tag. +func (client TagsClient) Delete(ctx context.Context, tagName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, tagName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.TagsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TagsClient) DeletePreparer(ctx context.Context, tagName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tagName": autorest.Encode("path", tagName), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames/{tagName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client TagsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client TagsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAtScope sends the delete at scope request. +// Parameters: +// scope - the resource scope. +func (client TagsClient) DeleteAtScope(ctx context.Context, scope string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagsClient.DeleteAtScope") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteAtScopePreparer(ctx, scope) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteAtScope", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAtScopeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteAtScope", resp, "Failure sending request") + return + } + + result, err = client.DeleteAtScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteAtScope", resp, "Failure responding to request") + return + } + + return +} + +// DeleteAtScopePreparer prepares the DeleteAtScope request. +func (client TagsClient) DeleteAtScopePreparer(ctx context.Context, scope string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/tags/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteAtScopeSender sends the DeleteAtScope request. The method will close the +// http.Response Body if it receives an error. +func (client TagsClient) DeleteAtScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteAtScopeResponder handles the response to the DeleteAtScope request. The method always +// closes the http.Response Body. +func (client TagsClient) DeleteAtScopeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteValue this operation allows deleting a value from the list of predefined values for an existing predefined tag +// name. The value being deleted must not be in use as a tag value for the given tag name for any resource. +// Parameters: +// tagName - the name of the tag. +// tagValue - the value of the tag to delete. +func (client TagsClient) DeleteValue(ctx context.Context, tagName string, tagValue string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagsClient.DeleteValue") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteValuePreparer(ctx, tagName, tagValue) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteValue", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteValueSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteValue", resp, "Failure sending request") + return + } + + result, err = client.DeleteValueResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteValue", resp, "Failure responding to request") + return + } + + return +} + +// DeleteValuePreparer prepares the DeleteValue request. +func (client TagsClient) DeleteValuePreparer(ctx context.Context, tagName string, tagValue string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tagName": autorest.Encode("path", tagName), + "tagValue": autorest.Encode("path", tagValue), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteValueSender sends the DeleteValue request. The method will close the +// http.Response Body if it receives an error. +func (client TagsClient) DeleteValueSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteValueResponder handles the response to the DeleteValue request. The method always +// closes the http.Response Body. +func (client TagsClient) DeleteValueResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetAtScope sends the get at scope request. +// Parameters: +// scope - the resource scope. +func (client TagsClient) GetAtScope(ctx context.Context, scope string) (result TagsResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagsClient.GetAtScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetAtScopePreparer(ctx, scope) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "GetAtScope", nil, "Failure preparing request") + return + } + + resp, err := client.GetAtScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.TagsClient", "GetAtScope", resp, "Failure sending request") + return + } + + result, err = client.GetAtScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "GetAtScope", resp, "Failure responding to request") + return + } + + return +} + +// GetAtScopePreparer prepares the GetAtScope request. +func (client TagsClient) GetAtScopePreparer(ctx context.Context, scope string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/tags/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAtScopeSender sends the GetAtScope request. The method will close the +// http.Response Body if it receives an error. +func (client TagsClient) GetAtScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetAtScopeResponder handles the response to the GetAtScope request. The method always +// closes the http.Response Body. +func (client TagsClient) GetAtScopeResponder(resp *http.Response) (result TagsResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List this operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, +// and returns a summary of usage for each tag name and value under the given subscription. In case of a large number +// of tags, this operation may return a previously cached result. +func (client TagsClient) List(ctx context.Context) (result TagsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagsClient.List") + defer func() { + sc := -1 + if result.tlr.Response.Response != nil { + sc = result.tlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.tlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure sending request") + return + } + + result.tlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure responding to request") + return + } + if result.tlr.hasNextLink() && result.tlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client TagsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client TagsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client TagsClient) ListResponder(resp *http.Response) (result TagsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client TagsClient) listNextResults(ctx context.Context, lastResults TagsListResult) (result TagsListResult, err error) { + req, err := lastResults.tagsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.TagsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.TagsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client TagsClient) ListComplete(ctx context.Context) (result TagsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// UpdateAtScope this operation allows replacing, merging or selectively deleting tags on the specified resource or +// subscription. The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option +// replaces the entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and +// updating the values of tags with existing names. The 'delete' option allows selectively deleting tags based on given +// names or name/value pairs. +// Parameters: +// scope - the resource scope. +func (client TagsClient) UpdateAtScope(ctx context.Context, scope string, parameters TagsPatchResource) (result TagsResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagsClient.UpdateAtScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateAtScopePreparer(ctx, scope, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "UpdateAtScope", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateAtScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.TagsClient", "UpdateAtScope", resp, "Failure sending request") + return + } + + result, err = client.UpdateAtScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "UpdateAtScope", resp, "Failure responding to request") + return + } + + return +} + +// UpdateAtScopePreparer prepares the UpdateAtScope request. +func (client TagsClient) UpdateAtScopePreparer(ctx context.Context, scope string, parameters TagsPatchResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/tags/default", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateAtScopeSender sends the UpdateAtScope request. The method will close the +// http.Response Body if it receives an error. +func (client TagsClient) UpdateAtScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateAtScopeResponder handles the response to the UpdateAtScope request. The method always +// closes the http.Response Body. +func (client TagsClient) UpdateAtScopeResponder(resp *http.Response) (result TagsResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/resources/mgmt/2021-01-01/resources/version.go b/services/resources/mgmt/2021-01-01/resources/version.go new file mode 100644 index 000000000000..2acbcecfb8ec --- /dev/null +++ b/services/resources/mgmt/2021-01-01/resources/version.go @@ -0,0 +1,19 @@ +package resources + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " resources/2021-01-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/resources/mgmt/2021-01-01/subscriptions/CHANGELOG.md b/services/resources/mgmt/2021-01-01/subscriptions/CHANGELOG.md index 52911e4cc5e4..7392eb18b2c3 100644 --- a/services/resources/mgmt/2021-01-01/subscriptions/CHANGELOG.md +++ b/services/resources/mgmt/2021-01-01/subscriptions/CHANGELOG.md @@ -1,2 +1,59 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Funcs + +1. *OperationListResultIterator.Next() error +1. *OperationListResultIterator.NextWithContext(context.Context) error +1. *OperationListResultPage.Next() error +1. *OperationListResultPage.NextWithContext(context.Context) error +1. NewOperationListResultIterator(OperationListResultPage) OperationListResultIterator +1. NewOperationListResultPage(OperationListResult, func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage +1. NewOperationsClient() OperationsClient +1. NewOperationsClientWithBaseURI(string) OperationsClient +1. OperationListResult.IsEmpty() bool +1. OperationListResultIterator.NotDone() bool +1. OperationListResultIterator.Response() OperationListResult +1. OperationListResultIterator.Value() Operation +1. OperationListResultPage.NotDone() bool +1. OperationListResultPage.Response() OperationListResult +1. OperationListResultPage.Values() []Operation +1. OperationsClient.List(context.Context) (OperationListResultPage, error) +1. OperationsClient.ListComplete(context.Context) (OperationListResultIterator, error) +1. OperationsClient.ListPreparer(context.Context) (*http.Request, error) +1. OperationsClient.ListResponder(*http.Response) (OperationListResult, error) +1. OperationsClient.ListSender(*http.Request) (*http.Response, error) + +### Struct Changes + +#### Removed Structs + +1. OperationListResultIterator +1. OperationListResultPage +1. OperationsClient + +#### Removed Struct Fields + +1. OperationListResult.autorest.Response + +## Additive Changes + +### New Funcs + +1. AvailabilityZonePeers.MarshalJSON() ([]byte, error) +1. CheckZonePeersResult.MarshalJSON() ([]byte, error) +1. Client.CheckZonePeers(context.Context, string, CheckZonePeersRequest) (CheckZonePeersResult, error) +1. Client.CheckZonePeersPreparer(context.Context, string, CheckZonePeersRequest) (*http.Request, error) +1. Client.CheckZonePeersResponder(*http.Response) (CheckZonePeersResult, error) +1. Client.CheckZonePeersSender(*http.Request) (*http.Response, error) +1. Peers.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. AvailabilityZonePeers +1. CheckZonePeersRequest +1. CheckZonePeersResult +1. Peers diff --git a/services/resources/mgmt/2021-01-01/subscriptions/_meta.json b/services/resources/mgmt/2021-01-01/subscriptions/_meta.json index 49472869c595..6ab34a4414a5 100644 --- a/services/resources/mgmt/2021-01-01/subscriptions/_meta.json +++ b/services/resources/mgmt/2021-01-01/subscriptions/_meta.json @@ -1,5 +1,5 @@ { - "commit": "6300f518091891b00c993e538dc2d282c9b814de", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-subscriptions-2021-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/resources/mgmt/2021-01-01/subscriptions/models.go b/services/resources/mgmt/2021-01-01/subscriptions/models.go index b4322705c5cd..f663990b8350 100644 --- a/services/resources/mgmt/2021-01-01/subscriptions/models.go +++ b/services/resources/mgmt/2021-01-01/subscriptions/models.go @@ -18,6 +18,23 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-01-01/subscriptions" +// AvailabilityZonePeers list of availability zones shared by the subscriptions. +type AvailabilityZonePeers struct { + // AvailabilityZone - READ-ONLY; The availabilityZone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` + // Peers - Details of shared availability zone. + Peers *[]Peers `json:"peers,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvailabilityZonePeers. +func (azp AvailabilityZonePeers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if azp.Peers != nil { + objectMap["peers"] = azp.Peers + } + return json.Marshal(objectMap) +} + // CheckResourceNameResult resource Name valid if not a reserved word, does not contain a reserved word and // does not start with a reserved word type CheckResourceNameResult struct { @@ -30,6 +47,37 @@ type CheckResourceNameResult struct { Status ResourceNameStatus `json:"status,omitempty"` } +// CheckZonePeersRequest check zone peers request parameters. +type CheckZonePeersRequest struct { + // Location - The Microsoft location. + Location *string `json:"location,omitempty"` + // SubscriptionIds - The peer Microsoft Azure subscription ID. + SubscriptionIds *[]string `json:"subscriptionIds,omitempty"` +} + +// CheckZonePeersResult result of the Check zone peers operation. +type CheckZonePeersResult struct { + autorest.Response `json:"-"` + // SubscriptionID - READ-ONLY; The subscription ID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // Location - the location of the subscription. + Location *string `json:"location,omitempty"` + // AvailabilityZonePeers - The Availability Zones shared by the subscriptions. + AvailabilityZonePeers *[]AvailabilityZonePeers `json:"availabilityZonePeers,omitempty"` +} + +// MarshalJSON is the custom marshaler for CheckZonePeersResult. +func (czpr CheckZonePeersResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if czpr.Location != nil { + objectMap["location"] = czpr.Location + } + if czpr.AvailabilityZonePeers != nil { + objectMap["availabilityZonePeers"] = czpr.AvailabilityZonePeers + } + return json.Marshal(objectMap) +} + // CloudError an error response for a resource management request. type CloudError struct { Error *ErrorResponse `json:"error,omitempty"` @@ -327,163 +375,12 @@ type OperationDisplay struct { // OperationListResult result of the request to list Microsoft.Resources operations. It contains a list of // operations and a URL link to get the next set of results. type OperationListResult struct { - autorest.Response `json:"-"` // Value - List of Microsoft.Resources operations. Value *[]Operation `json:"value,omitempty"` // NextLink - URL to get the next set of operation list results if there are any. NextLink *string `json:"nextLink,omitempty"` } -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - // PairedRegion information regarding paired region. type PairedRegion struct { // Name - READ-ONLY; The name of the paired region. @@ -500,6 +397,20 @@ func (pr PairedRegion) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// Peers information about shared availability zone. +type Peers struct { + // SubscriptionID - READ-ONLY; The subscription ID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // AvailabilityZone - READ-ONLY; The availabilityZone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` +} + +// MarshalJSON is the custom marshaler for Peers. +func (p Peers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // Policies subscription policies. type Policies struct { // LocationPlacementID - READ-ONLY; The subscription location placement ID. The ID indicates which regions are visible for a subscription. For example, a subscription with a location placement Id of Public_2014-09-01 has access to Azure public regions. diff --git a/services/resources/mgmt/2021-01-01/subscriptions/subscriptions.go b/services/resources/mgmt/2021-01-01/subscriptions/subscriptions.go index 446443ec0f70..909ad9dca19f 100644 --- a/services/resources/mgmt/2021-01-01/subscriptions/subscriptions.go +++ b/services/resources/mgmt/2021-01-01/subscriptions/subscriptions.go @@ -32,6 +32,82 @@ func NewClientWithBaseURI(baseURI string) Client { return Client{NewWithBaseURI(baseURI)} } +// CheckZonePeers compares a subscriptions logical zone mapping +// Parameters: +// subscriptionID - the ID of the target subscription. +// parameters - parameters for checking zone peers. +func (client Client) CheckZonePeers(ctx context.Context, subscriptionID string, parameters CheckZonePeersRequest) (result CheckZonePeersResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckZonePeers") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CheckZonePeersPreparer(ctx, subscriptionID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", nil, "Failure preparing request") + return + } + + resp, err := client.CheckZonePeersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", resp, "Failure sending request") + return + } + + result, err = client.CheckZonePeersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.Client", "CheckZonePeers", resp, "Failure responding to request") + return + } + + return +} + +// CheckZonePeersPreparer prepares the CheckZonePeers request. +func (client Client) CheckZonePeersPreparer(ctx context.Context, subscriptionID string, parameters CheckZonePeersRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", subscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/checkZonePeers/", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckZonePeersSender sends the CheckZonePeers request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CheckZonePeersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckZonePeersResponder handles the response to the CheckZonePeers request. The method always +// closes the http.Response Body. +func (client Client) CheckZonePeersResponder(resp *http.Response) (result CheckZonePeersResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Get gets details about a specified subscription. // Parameters: // subscriptionID - the ID of the target subscription. diff --git a/services/resources/mgmt/2021-01-01/subscriptions/subscriptionsapi/interfaces.go b/services/resources/mgmt/2021-01-01/subscriptions/subscriptionsapi/interfaces.go index ef3e02d067b9..bace31c2322f 100644 --- a/services/resources/mgmt/2021-01-01/subscriptions/subscriptionsapi/interfaces.go +++ b/services/resources/mgmt/2021-01-01/subscriptions/subscriptionsapi/interfaces.go @@ -18,16 +18,9 @@ type BaseClientAPI interface { var _ BaseClientAPI = (*subscriptions.BaseClient)(nil) -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result subscriptions.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result subscriptions.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*subscriptions.OperationsClient)(nil) - // ClientAPI contains the set of methods on the Client type. type ClientAPI interface { + CheckZonePeers(ctx context.Context, subscriptionID string, parameters subscriptions.CheckZonePeersRequest) (result subscriptions.CheckZonePeersResult, err error) Get(ctx context.Context, subscriptionID string) (result subscriptions.Subscription, err error) List(ctx context.Context) (result subscriptions.ListResultPage, err error) ListComplete(ctx context.Context) (result subscriptions.ListResultIterator, err error) diff --git a/services/resources/mgmt/2021-07-01/features/CHANGELOG.md b/services/resources/mgmt/2021-07-01/features/CHANGELOG.md index aa46aac70fc6..a1ecf841edb0 100644 --- a/services/resources/mgmt/2021-07-01/features/CHANGELOG.md +++ b/services/resources/mgmt/2021-07-01/features/CHANGELOG.md @@ -1,110 +1,2 @@ -# Change History +# Unreleased -## Breaking Changes - -### Struct Changes - -#### Removed Struct Fields - -1. BaseClient.ProviderNamespace - -### Signature Changes - -#### Funcs - -1. BaseClient.ListOperations - - Params - - From: context.Context, string - - To: context.Context -1. BaseClient.ListOperationsComplete - - Params - - From: context.Context, string - - To: context.Context -1. BaseClient.ListOperationsPreparer - - Params - - From: context.Context, string - - To: context.Context -1. Client.Get - - Params - - From: context.Context, string, string, string - - To: context.Context, string, string -1. Client.GetPreparer - - Params - - From: context.Context, string, string, string - - To: context.Context, string, string -1. Client.List - - Params - - From: context.Context, string, string - - To: context.Context, string -1. Client.ListAll - - Params - - From: context.Context, string - - To: context.Context -1. Client.ListAllComplete - - Params - - From: context.Context, string - - To: context.Context -1. Client.ListAllPreparer - - Params - - From: context.Context, string - - To: context.Context -1. Client.ListComplete - - Params - - From: context.Context, string, string - - To: context.Context, string -1. Client.ListPreparer - - Params - - From: context.Context, string, string - - To: context.Context, string -1. Client.Register - - Params - - From: context.Context, string, string, string - - To: context.Context, string, string -1. Client.RegisterPreparer - - Params - - From: context.Context, string, string, string - - To: context.Context, string, string -1. Client.Unregister - - Params - - From: context.Context, string, string, string - - To: context.Context, string, string -1. Client.UnregisterPreparer - - Params - - From: context.Context, string, string, string - - To: context.Context, string, string -1. New - - Params - - From: string, string - - To: string -1. NewClient - - Params - - From: string, string - - To: string -1. NewClientWithBaseURI - - Params - - From: string, string, string - - To: string, string -1. NewSubscriptionFeatureRegistrationsClient - - Params - - From: string, string - - To: string -1. NewSubscriptionFeatureRegistrationsClientWithBaseURI - - Params - - From: string, string, string - - To: string, string -1. NewWithBaseURI - - Params - - From: string, string, string - - To: string, string -1. SubscriptionFeatureRegistrationsClient.ListAllBySubscription - - Params - - From: context.Context, string - - To: context.Context -1. SubscriptionFeatureRegistrationsClient.ListAllBySubscriptionComplete - - Params - - From: context.Context, string - - To: context.Context -1. SubscriptionFeatureRegistrationsClient.ListAllBySubscriptionPreparer - - Params - - From: context.Context, string - - To: context.Context diff --git a/services/resources/mgmt/2021-07-01/features/_meta.json b/services/resources/mgmt/2021-07-01/features/_meta.json index a4b8ce338e7f..4f4878a97ced 100644 --- a/services/resources/mgmt/2021-07-01/features/_meta.json +++ b/services/resources/mgmt/2021-07-01/features/_meta.json @@ -1,5 +1,5 @@ { - "commit": "af463c3f9502d353b8a009685177f13335adb8cd", + "commit": "d8ea7da67c4e0f3c004662afda82f79abc881f57", "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", "tag": "package-features-2021-07", "use": "@microsoft.azure/autorest.go@2.1.187",