profile/p20200901/resourcemanager/resources/armresources/deployments_client.go (1,931 lines of code) (raw):

//go:build go1.18 // +build go1.18 // 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. // DO NOT EDIT. package armresources import ( "context" "errors" "github.com/Azure/azure-sdk-for-go/profile/p20200901/internal" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" ) // DeploymentsClient contains the methods for the Deployments group. // Don't use this type directly, use NewDeploymentsClient() instead. type DeploymentsClient struct { internal *arm.Client subscriptionID string } // NewDeploymentsClient creates a new instance of DeploymentsClient with the specified values. // - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewDeploymentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeploymentsClient, error) { cl, err := arm.NewClient(internal.ModuleName+"/armresources.DeploymentsClient", internal.ModuleVersion, credential, options) if err != nil { return nil, err } client := &DeploymentsClient{ subscriptionID: subscriptionID, internal: cl, } return client, nil } // CalculateTemplateHash - Calculate the hash of the given template. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - templateParam - The template provided to calculate hash. // - options - DeploymentsClientCalculateTemplateHashOptions contains the optional parameters for the DeploymentsClient.CalculateTemplateHash // method. func (client *DeploymentsClient) CalculateTemplateHash(ctx context.Context, templateParam any, options *DeploymentsClientCalculateTemplateHashOptions) (DeploymentsClientCalculateTemplateHashResponse, error) { req, err := client.calculateTemplateHashCreateRequest(ctx, templateParam, options) if err != nil { return DeploymentsClientCalculateTemplateHashResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCalculateTemplateHashResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return DeploymentsClientCalculateTemplateHashResponse{}, runtime.NewResponseError(resp) } return client.calculateTemplateHashHandleResponse(resp) } // calculateTemplateHashCreateRequest creates the CalculateTemplateHash request. func (client *DeploymentsClient) calculateTemplateHashCreateRequest(ctx context.Context, templateParam any, options *DeploymentsClientCalculateTemplateHashOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Resources/calculateTemplateHash" req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, templateParam) } // calculateTemplateHashHandleResponse handles the CalculateTemplateHash response. func (client *DeploymentsClient) calculateTemplateHashHandleResponse(resp *http.Response) (DeploymentsClientCalculateTemplateHashResponse, error) { result := DeploymentsClientCalculateTemplateHashResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.TemplateHashResult); err != nil { return DeploymentsClientCalculateTemplateHashResponse{}, err } return result, nil } // 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. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deploymentName - The name of the deployment. // - options - DeploymentsClientCancelOptions contains the optional parameters for the DeploymentsClient.Cancel method. func (client *DeploymentsClient) Cancel(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientCancelOptions) (DeploymentsClientCancelResponse, error) { req, err := client.cancelCreateRequest(ctx, resourceGroupName, deploymentName, options) if err != nil { return DeploymentsClientCancelResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCancelResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusNoContent) { return DeploymentsClientCancelResponse{}, runtime.NewResponseError(resp) } return DeploymentsClientCancelResponse{}, nil } // cancelCreateRequest creates the Cancel request. func (client *DeploymentsClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientCancelOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // 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. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - groupID - The management group ID. // - deploymentName - The name of the deployment. // - options - DeploymentsClientCancelAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtManagementGroupScope // method. func (client *DeploymentsClient) CancelAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientCancelAtManagementGroupScopeOptions) (DeploymentsClientCancelAtManagementGroupScopeResponse, error) { req, err := client.cancelAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) if err != nil { return DeploymentsClientCancelAtManagementGroupScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCancelAtManagementGroupScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusNoContent) { return DeploymentsClientCancelAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) } return DeploymentsClientCancelAtManagementGroupScopeResponse{}, nil } // cancelAtManagementGroupScopeCreateRequest creates the CancelAtManagementGroupScope request. func (client *DeploymentsClient) cancelAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientCancelAtManagementGroupScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel" if groupID == "" { return nil, errors.New("parameter groupID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // 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. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - scope - The resource scope. // - deploymentName - The name of the deployment. // - options - DeploymentsClientCancelAtScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtScope // method. func (client *DeploymentsClient) CancelAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientCancelAtScopeOptions) (DeploymentsClientCancelAtScopeResponse, error) { req, err := client.cancelAtScopeCreateRequest(ctx, scope, deploymentName, options) if err != nil { return DeploymentsClientCancelAtScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCancelAtScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusNoContent) { return DeploymentsClientCancelAtScopeResponse{}, runtime.NewResponseError(resp) } return DeploymentsClientCancelAtScopeResponse{}, nil } // cancelAtScopeCreateRequest creates the CancelAtScope request. func (client *DeploymentsClient) cancelAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientCancelAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // 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. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - deploymentName - The name of the deployment. // - options - DeploymentsClientCancelAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtSubscriptionScope // method. func (client *DeploymentsClient) CancelAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientCancelAtSubscriptionScopeOptions) (DeploymentsClientCancelAtSubscriptionScopeResponse, error) { req, err := client.cancelAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) if err != nil { return DeploymentsClientCancelAtSubscriptionScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCancelAtSubscriptionScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusNoContent) { return DeploymentsClientCancelAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) } return DeploymentsClientCancelAtSubscriptionScopeResponse{}, nil } // cancelAtSubscriptionScopeCreateRequest creates the CancelAtSubscriptionScope request. func (client *DeploymentsClient) cancelAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientCancelAtSubscriptionScopeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel" if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // 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. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - deploymentName - The name of the deployment. // - options - DeploymentsClientCancelAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtTenantScope // method. func (client *DeploymentsClient) CancelAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientCancelAtTenantScopeOptions) (DeploymentsClientCancelAtTenantScopeResponse, error) { req, err := client.cancelAtTenantScopeCreateRequest(ctx, deploymentName, options) if err != nil { return DeploymentsClientCancelAtTenantScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCancelAtTenantScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusNoContent) { return DeploymentsClientCancelAtTenantScopeResponse{}, runtime.NewResponseError(resp) } return DeploymentsClientCancelAtTenantScopeResponse{}, nil } // cancelAtTenantScopeCreateRequest creates the CancelAtTenantScope request. func (client *DeploymentsClient) cancelAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientCancelAtTenantScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}/cancel" if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // CheckExistence - Checks whether the deployment exists. // // Generated from API version 2019-10-01 // - resourceGroupName - The name of the resource group with the deployment to check. The name is case insensitive. // - deploymentName - The name of the deployment. // - options - DeploymentsClientCheckExistenceOptions contains the optional parameters for the DeploymentsClient.CheckExistence // method. func (client *DeploymentsClient) CheckExistence(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientCheckExistenceOptions) (DeploymentsClientCheckExistenceResponse, error) { req, err := client.checkExistenceCreateRequest(ctx, resourceGroupName, deploymentName, options) if err != nil { return DeploymentsClientCheckExistenceResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCheckExistenceResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { return DeploymentsClientCheckExistenceResponse{}, runtime.NewResponseError(resp) } return DeploymentsClientCheckExistenceResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil } // checkExistenceCreateRequest creates the CheckExistence request. func (client *DeploymentsClient) checkExistenceCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientCheckExistenceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // CheckExistenceAtManagementGroupScope - Checks whether the deployment exists. // // Generated from API version 2019-10-01 // - groupID - The management group ID. // - deploymentName - The name of the deployment. // - options - DeploymentsClientCheckExistenceAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtManagementGroupScope // method. func (client *DeploymentsClient) CheckExistenceAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientCheckExistenceAtManagementGroupScopeOptions) (DeploymentsClientCheckExistenceAtManagementGroupScopeResponse, error) { req, err := client.checkExistenceAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) if err != nil { return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) } return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil } // checkExistenceAtManagementGroupScopeCreateRequest creates the CheckExistenceAtManagementGroupScope request. func (client *DeploymentsClient) checkExistenceAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientCheckExistenceAtManagementGroupScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}" if groupID == "" { return nil, errors.New("parameter groupID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // CheckExistenceAtScope - Checks whether the deployment exists. // // Generated from API version 2019-10-01 // - scope - The resource scope. // - deploymentName - The name of the deployment. // - options - DeploymentsClientCheckExistenceAtScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtScope // method. func (client *DeploymentsClient) CheckExistenceAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientCheckExistenceAtScopeOptions) (DeploymentsClientCheckExistenceAtScopeResponse, error) { req, err := client.checkExistenceAtScopeCreateRequest(ctx, scope, deploymentName, options) if err != nil { return DeploymentsClientCheckExistenceAtScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCheckExistenceAtScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { return DeploymentsClientCheckExistenceAtScopeResponse{}, runtime.NewResponseError(resp) } return DeploymentsClientCheckExistenceAtScopeResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil } // checkExistenceAtScopeCreateRequest creates the CheckExistenceAtScope request. func (client *DeploymentsClient) checkExistenceAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientCheckExistenceAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // CheckExistenceAtSubscriptionScope - Checks whether the deployment exists. // // Generated from API version 2019-10-01 // - deploymentName - The name of the deployment. // - options - DeploymentsClientCheckExistenceAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtSubscriptionScope // method. func (client *DeploymentsClient) CheckExistenceAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientCheckExistenceAtSubscriptionScopeOptions) (DeploymentsClientCheckExistenceAtSubscriptionScopeResponse, error) { req, err := client.checkExistenceAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) if err != nil { return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) } return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil } // checkExistenceAtSubscriptionScopeCreateRequest creates the CheckExistenceAtSubscriptionScope request. func (client *DeploymentsClient) checkExistenceAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientCheckExistenceAtSubscriptionScopeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // CheckExistenceAtTenantScope - Checks whether the deployment exists. // // Generated from API version 2019-10-01 // - deploymentName - The name of the deployment. // - options - DeploymentsClientCheckExistenceAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtTenantScope // method. func (client *DeploymentsClient) CheckExistenceAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientCheckExistenceAtTenantScopeOptions) (DeploymentsClientCheckExistenceAtTenantScopeResponse, error) { req, err := client.checkExistenceAtTenantScopeCreateRequest(ctx, deploymentName, options) if err != nil { return DeploymentsClientCheckExistenceAtTenantScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCheckExistenceAtTenantScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { return DeploymentsClientCheckExistenceAtTenantScopeResponse{}, runtime.NewResponseError(resp) } return DeploymentsClientCheckExistenceAtTenantScopeResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil } // checkExistenceAtTenantScopeCreateRequest creates the CheckExistenceAtTenantScope request. func (client *DeploymentsClient) checkExistenceAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientCheckExistenceAtTenantScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}" if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // BeginCreateOrUpdate - You can provide the template and parameters directly in the request or link to JSON files. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - 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. // - options - DeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdate // method. func (client *DeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DeploymentsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, deploymentName, parameters, options) if err != nil { return nil, err } return runtime.NewPoller[DeploymentsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CreateOrUpdate - You can provide the template and parameters directly in the request or link to JSON files. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, deploymentName, parameters, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, runtime.NewResponseError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } // BeginCreateOrUpdateAtManagementGroupScope - You can provide the template and parameters directly in the request or link // to JSON files. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - groupID - The management group ID. // - deploymentName - The name of the deployment. // - parameters - Additional parameters supplied to the operation. // - options - DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtManagementGroupScope // method. func (client *DeploymentsClient) BeginCreateOrUpdateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions) (*runtime.Poller[DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdateAtManagementGroupScope(ctx, groupID, deploymentName, parameters, options) if err != nil { return nil, err } return runtime.NewPoller[DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse](resp, client.internal.Pipeline(), nil) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CreateOrUpdateAtManagementGroupScope - You can provide the template and parameters directly in the request or link to JSON // files. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) createOrUpdateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions) (*http.Response, error) { req, err := client.createOrUpdateAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, parameters, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, runtime.NewResponseError(resp) } return resp, nil } // createOrUpdateAtManagementGroupScopeCreateRequest creates the CreateOrUpdateAtManagementGroupScope request. func (client *DeploymentsClient) createOrUpdateAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}" if groupID == "" { return nil, errors.New("parameter groupID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } // BeginCreateOrUpdateAtScope - You can provide the template and parameters directly in the request or link to JSON files. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - scope - The resource scope. // - deploymentName - The name of the deployment. // - parameters - Additional parameters supplied to the operation. // - options - DeploymentsClientBeginCreateOrUpdateAtScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtScope // method. func (client *DeploymentsClient) BeginCreateOrUpdateAtScope(ctx context.Context, scope string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateAtScopeOptions) (*runtime.Poller[DeploymentsClientCreateOrUpdateAtScopeResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdateAtScope(ctx, scope, deploymentName, parameters, options) if err != nil { return nil, err } return runtime.NewPoller[DeploymentsClientCreateOrUpdateAtScopeResponse](resp, client.internal.Pipeline(), nil) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateAtScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CreateOrUpdateAtScope - You can provide the template and parameters directly in the request or link to JSON files. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) createOrUpdateAtScope(ctx context.Context, scope string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateAtScopeOptions) (*http.Response, error) { req, err := client.createOrUpdateAtScopeCreateRequest(ctx, scope, deploymentName, parameters, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, runtime.NewResponseError(resp) } return resp, nil } // createOrUpdateAtScopeCreateRequest creates the CreateOrUpdateAtScope request. func (client *DeploymentsClient) createOrUpdateAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } // BeginCreateOrUpdateAtSubscriptionScope - You can provide the template and parameters directly in the request or link to // JSON files. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - deploymentName - The name of the deployment. // - parameters - Additional parameters supplied to the operation. // - options - DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtSubscriptionScope // method. func (client *DeploymentsClient) BeginCreateOrUpdateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions) (*runtime.Poller[DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdateAtSubscriptionScope(ctx, deploymentName, parameters, options) if err != nil { return nil, err } return runtime.NewPoller[DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse](resp, client.internal.Pipeline(), nil) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CreateOrUpdateAtSubscriptionScope - You can provide the template and parameters directly in the request or link to JSON // files. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) createOrUpdateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions) (*http.Response, error) { req, err := client.createOrUpdateAtSubscriptionScopeCreateRequest(ctx, deploymentName, parameters, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, runtime.NewResponseError(resp) } return resp, nil } // createOrUpdateAtSubscriptionScopeCreateRequest creates the CreateOrUpdateAtSubscriptionScope request. func (client *DeploymentsClient) createOrUpdateAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } // BeginCreateOrUpdateAtTenantScope - You can provide the template and parameters directly in the request or link to JSON // files. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - deploymentName - The name of the deployment. // - parameters - Additional parameters supplied to the operation. // - options - DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtTenantScope // method. func (client *DeploymentsClient) BeginCreateOrUpdateAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions) (*runtime.Poller[DeploymentsClientCreateOrUpdateAtTenantScopeResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdateAtTenantScope(ctx, deploymentName, parameters, options) if err != nil { return nil, err } return runtime.NewPoller[DeploymentsClientCreateOrUpdateAtTenantScopeResponse](resp, client.internal.Pipeline(), nil) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateAtTenantScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CreateOrUpdateAtTenantScope - You can provide the template and parameters directly in the request or link to JSON files. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) createOrUpdateAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions) (*http.Response, error) { req, err := client.createOrUpdateAtTenantScopeCreateRequest(ctx, deploymentName, parameters, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, runtime.NewResponseError(resp) } return resp, nil } // createOrUpdateAtTenantScopeCreateRequest creates the CreateOrUpdateAtTenantScope request. func (client *DeploymentsClient) createOrUpdateAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}" if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } // BeginDelete - 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. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - resourceGroupName - The name of the resource group with the deployment to delete. The name is case insensitive. // - deploymentName - The name of the deployment. // - options - DeploymentsClientBeginDeleteOptions contains the optional parameters for the DeploymentsClient.BeginDelete method. func (client *DeploymentsClient) BeginDelete(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginDeleteOptions) (*runtime.Poller[DeploymentsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, deploymentName, options) if err != nil { return nil, err } return runtime.NewPoller[DeploymentsClientDeleteResponse](resp, client.internal.Pipeline(), nil) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // 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. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) deleteOperation(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, deploymentName, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { return nil, runtime.NewResponseError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // BeginDeleteAtManagementGroupScope - 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. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - groupID - The management group ID. // - deploymentName - The name of the deployment. // - options - DeploymentsClientBeginDeleteAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtManagementGroupScope // method. func (client *DeploymentsClient) BeginDeleteAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientBeginDeleteAtManagementGroupScopeOptions) (*runtime.Poller[DeploymentsClientDeleteAtManagementGroupScopeResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteAtManagementGroupScope(ctx, groupID, deploymentName, options) if err != nil { return nil, err } return runtime.NewPoller[DeploymentsClientDeleteAtManagementGroupScopeResponse](resp, client.internal.Pipeline(), nil) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteAtManagementGroupScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // 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. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) deleteAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientBeginDeleteAtManagementGroupScopeOptions) (*http.Response, error) { req, err := client.deleteAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { return nil, runtime.NewResponseError(resp) } return resp, nil } // deleteAtManagementGroupScopeCreateRequest creates the DeleteAtManagementGroupScope request. func (client *DeploymentsClient) deleteAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientBeginDeleteAtManagementGroupScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}" if groupID == "" { return nil, errors.New("parameter groupID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // BeginDeleteAtScope - 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. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - scope - The resource scope. // - deploymentName - The name of the deployment. // - options - DeploymentsClientBeginDeleteAtScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtScope // method. func (client *DeploymentsClient) BeginDeleteAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientBeginDeleteAtScopeOptions) (*runtime.Poller[DeploymentsClientDeleteAtScopeResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteAtScope(ctx, scope, deploymentName, options) if err != nil { return nil, err } return runtime.NewPoller[DeploymentsClientDeleteAtScopeResponse](resp, client.internal.Pipeline(), nil) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteAtScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // 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. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) deleteAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientBeginDeleteAtScopeOptions) (*http.Response, error) { req, err := client.deleteAtScopeCreateRequest(ctx, scope, deploymentName, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { return nil, runtime.NewResponseError(resp) } return resp, nil } // deleteAtScopeCreateRequest creates the DeleteAtScope request. func (client *DeploymentsClient) deleteAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientBeginDeleteAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // BeginDeleteAtSubscriptionScope - 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. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - deploymentName - The name of the deployment. // - options - DeploymentsClientBeginDeleteAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtSubscriptionScope // method. func (client *DeploymentsClient) BeginDeleteAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientBeginDeleteAtSubscriptionScopeOptions) (*runtime.Poller[DeploymentsClientDeleteAtSubscriptionScopeResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteAtSubscriptionScope(ctx, deploymentName, options) if err != nil { return nil, err } return runtime.NewPoller[DeploymentsClientDeleteAtSubscriptionScopeResponse](resp, client.internal.Pipeline(), nil) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteAtSubscriptionScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // 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. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) deleteAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientBeginDeleteAtSubscriptionScopeOptions) (*http.Response, error) { req, err := client.deleteAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { return nil, runtime.NewResponseError(resp) } return resp, nil } // deleteAtSubscriptionScopeCreateRequest creates the DeleteAtSubscriptionScope request. func (client *DeploymentsClient) deleteAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientBeginDeleteAtSubscriptionScopeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // BeginDeleteAtTenantScope - 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. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - deploymentName - The name of the deployment. // - options - DeploymentsClientBeginDeleteAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtTenantScope // method. func (client *DeploymentsClient) BeginDeleteAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientBeginDeleteAtTenantScopeOptions) (*runtime.Poller[DeploymentsClientDeleteAtTenantScopeResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteAtTenantScope(ctx, deploymentName, options) if err != nil { return nil, err } return runtime.NewPoller[DeploymentsClientDeleteAtTenantScopeResponse](resp, client.internal.Pipeline(), nil) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteAtTenantScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // 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. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) deleteAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientBeginDeleteAtTenantScopeOptions) (*http.Response, error) { req, err := client.deleteAtTenantScopeCreateRequest(ctx, deploymentName, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { return nil, runtime.NewResponseError(resp) } return resp, nil } // deleteAtTenantScopeCreateRequest creates the DeleteAtTenantScope request. func (client *DeploymentsClient) deleteAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientBeginDeleteAtTenantScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}" if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // ExportTemplate - Exports the template used for specified deployment. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deploymentName - The name of the deployment. // - options - DeploymentsClientExportTemplateOptions contains the optional parameters for the DeploymentsClient.ExportTemplate // method. func (client *DeploymentsClient) ExportTemplate(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientExportTemplateOptions) (DeploymentsClientExportTemplateResponse, error) { req, err := client.exportTemplateCreateRequest(ctx, resourceGroupName, deploymentName, options) if err != nil { return DeploymentsClientExportTemplateResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientExportTemplateResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return DeploymentsClientExportTemplateResponse{}, runtime.NewResponseError(resp) } return client.exportTemplateHandleResponse(resp) } // exportTemplateCreateRequest creates the ExportTemplate request. func (client *DeploymentsClient) exportTemplateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientExportTemplateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // exportTemplateHandleResponse handles the ExportTemplate response. func (client *DeploymentsClient) exportTemplateHandleResponse(resp *http.Response) (DeploymentsClientExportTemplateResponse, error) { result := DeploymentsClientExportTemplateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExportResult); err != nil { return DeploymentsClientExportTemplateResponse{}, err } return result, nil } // ExportTemplateAtManagementGroupScope - Exports the template used for specified deployment. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - groupID - The management group ID. // - deploymentName - The name of the deployment. // - options - DeploymentsClientExportTemplateAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtManagementGroupScope // method. func (client *DeploymentsClient) ExportTemplateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientExportTemplateAtManagementGroupScopeOptions) (DeploymentsClientExportTemplateAtManagementGroupScopeResponse, error) { req, err := client.exportTemplateAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) if err != nil { return DeploymentsClientExportTemplateAtManagementGroupScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientExportTemplateAtManagementGroupScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return DeploymentsClientExportTemplateAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) } return client.exportTemplateAtManagementGroupScopeHandleResponse(resp) } // exportTemplateAtManagementGroupScopeCreateRequest creates the ExportTemplateAtManagementGroupScope request. func (client *DeploymentsClient) exportTemplateAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientExportTemplateAtManagementGroupScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate" if groupID == "" { return nil, errors.New("parameter groupID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // exportTemplateAtManagementGroupScopeHandleResponse handles the ExportTemplateAtManagementGroupScope response. func (client *DeploymentsClient) exportTemplateAtManagementGroupScopeHandleResponse(resp *http.Response) (DeploymentsClientExportTemplateAtManagementGroupScopeResponse, error) { result := DeploymentsClientExportTemplateAtManagementGroupScopeResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExportResult); err != nil { return DeploymentsClientExportTemplateAtManagementGroupScopeResponse{}, err } return result, nil } // ExportTemplateAtScope - Exports the template used for specified deployment. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - scope - The resource scope. // - deploymentName - The name of the deployment. // - options - DeploymentsClientExportTemplateAtScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtScope // method. func (client *DeploymentsClient) ExportTemplateAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientExportTemplateAtScopeOptions) (DeploymentsClientExportTemplateAtScopeResponse, error) { req, err := client.exportTemplateAtScopeCreateRequest(ctx, scope, deploymentName, options) if err != nil { return DeploymentsClientExportTemplateAtScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientExportTemplateAtScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return DeploymentsClientExportTemplateAtScopeResponse{}, runtime.NewResponseError(resp) } return client.exportTemplateAtScopeHandleResponse(resp) } // exportTemplateAtScopeCreateRequest creates the ExportTemplateAtScope request. func (client *DeploymentsClient) exportTemplateAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientExportTemplateAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // exportTemplateAtScopeHandleResponse handles the ExportTemplateAtScope response. func (client *DeploymentsClient) exportTemplateAtScopeHandleResponse(resp *http.Response) (DeploymentsClientExportTemplateAtScopeResponse, error) { result := DeploymentsClientExportTemplateAtScopeResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExportResult); err != nil { return DeploymentsClientExportTemplateAtScopeResponse{}, err } return result, nil } // ExportTemplateAtSubscriptionScope - Exports the template used for specified deployment. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - deploymentName - The name of the deployment. // - options - DeploymentsClientExportTemplateAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtSubscriptionScope // method. func (client *DeploymentsClient) ExportTemplateAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientExportTemplateAtSubscriptionScopeOptions) (DeploymentsClientExportTemplateAtSubscriptionScopeResponse, error) { req, err := client.exportTemplateAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) if err != nil { return DeploymentsClientExportTemplateAtSubscriptionScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientExportTemplateAtSubscriptionScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return DeploymentsClientExportTemplateAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) } return client.exportTemplateAtSubscriptionScopeHandleResponse(resp) } // exportTemplateAtSubscriptionScopeCreateRequest creates the ExportTemplateAtSubscriptionScope request. func (client *DeploymentsClient) exportTemplateAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientExportTemplateAtSubscriptionScopeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate" if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // exportTemplateAtSubscriptionScopeHandleResponse handles the ExportTemplateAtSubscriptionScope response. func (client *DeploymentsClient) exportTemplateAtSubscriptionScopeHandleResponse(resp *http.Response) (DeploymentsClientExportTemplateAtSubscriptionScopeResponse, error) { result := DeploymentsClientExportTemplateAtSubscriptionScopeResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExportResult); err != nil { return DeploymentsClientExportTemplateAtSubscriptionScopeResponse{}, err } return result, nil } // ExportTemplateAtTenantScope - Exports the template used for specified deployment. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - deploymentName - The name of the deployment. // - options - DeploymentsClientExportTemplateAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtTenantScope // method. func (client *DeploymentsClient) ExportTemplateAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientExportTemplateAtTenantScopeOptions) (DeploymentsClientExportTemplateAtTenantScopeResponse, error) { req, err := client.exportTemplateAtTenantScopeCreateRequest(ctx, deploymentName, options) if err != nil { return DeploymentsClientExportTemplateAtTenantScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientExportTemplateAtTenantScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return DeploymentsClientExportTemplateAtTenantScopeResponse{}, runtime.NewResponseError(resp) } return client.exportTemplateAtTenantScopeHandleResponse(resp) } // exportTemplateAtTenantScopeCreateRequest creates the ExportTemplateAtTenantScope request. func (client *DeploymentsClient) exportTemplateAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientExportTemplateAtTenantScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate" if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // exportTemplateAtTenantScopeHandleResponse handles the ExportTemplateAtTenantScope response. func (client *DeploymentsClient) exportTemplateAtTenantScopeHandleResponse(resp *http.Response) (DeploymentsClientExportTemplateAtTenantScopeResponse, error) { result := DeploymentsClientExportTemplateAtTenantScopeResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExportResult); err != nil { return DeploymentsClientExportTemplateAtTenantScopeResponse{}, err } return result, nil } // Get - Gets a deployment. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deploymentName - The name of the deployment. // - options - DeploymentsClientGetOptions contains the optional parameters for the DeploymentsClient.Get method. func (client *DeploymentsClient) Get(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientGetOptions) (DeploymentsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, deploymentName, options) if err != nil { return DeploymentsClientGetResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientGetResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return DeploymentsClientGetResponse{}, runtime.NewResponseError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. func (client *DeploymentsClient) getHandleResponse(resp *http.Response) (DeploymentsClientGetResponse, error) { result := DeploymentsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExtended); err != nil { return DeploymentsClientGetResponse{}, err } return result, nil } // GetAtManagementGroupScope - Gets a deployment. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - groupID - The management group ID. // - deploymentName - The name of the deployment. // - options - DeploymentsClientGetAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.GetAtManagementGroupScope // method. func (client *DeploymentsClient) GetAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientGetAtManagementGroupScopeOptions) (DeploymentsClientGetAtManagementGroupScopeResponse, error) { req, err := client.getAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) if err != nil { return DeploymentsClientGetAtManagementGroupScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientGetAtManagementGroupScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return DeploymentsClientGetAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) } return client.getAtManagementGroupScopeHandleResponse(resp) } // getAtManagementGroupScopeCreateRequest creates the GetAtManagementGroupScope request. func (client *DeploymentsClient) getAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientGetAtManagementGroupScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}" if groupID == "" { return nil, errors.New("parameter groupID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getAtManagementGroupScopeHandleResponse handles the GetAtManagementGroupScope response. func (client *DeploymentsClient) getAtManagementGroupScopeHandleResponse(resp *http.Response) (DeploymentsClientGetAtManagementGroupScopeResponse, error) { result := DeploymentsClientGetAtManagementGroupScopeResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExtended); err != nil { return DeploymentsClientGetAtManagementGroupScopeResponse{}, err } return result, nil } // GetAtScope - Gets a deployment. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - scope - The resource scope. // - deploymentName - The name of the deployment. // - options - DeploymentsClientGetAtScopeOptions contains the optional parameters for the DeploymentsClient.GetAtScope method. func (client *DeploymentsClient) GetAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientGetAtScopeOptions) (DeploymentsClientGetAtScopeResponse, error) { req, err := client.getAtScopeCreateRequest(ctx, scope, deploymentName, options) if err != nil { return DeploymentsClientGetAtScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientGetAtScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return DeploymentsClientGetAtScopeResponse{}, runtime.NewResponseError(resp) } return client.getAtScopeHandleResponse(resp) } // getAtScopeCreateRequest creates the GetAtScope request. func (client *DeploymentsClient) getAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientGetAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getAtScopeHandleResponse handles the GetAtScope response. func (client *DeploymentsClient) getAtScopeHandleResponse(resp *http.Response) (DeploymentsClientGetAtScopeResponse, error) { result := DeploymentsClientGetAtScopeResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExtended); err != nil { return DeploymentsClientGetAtScopeResponse{}, err } return result, nil } // GetAtSubscriptionScope - Gets a deployment. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - deploymentName - The name of the deployment. // - options - DeploymentsClientGetAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.GetAtSubscriptionScope // method. func (client *DeploymentsClient) GetAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientGetAtSubscriptionScopeOptions) (DeploymentsClientGetAtSubscriptionScopeResponse, error) { req, err := client.getAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) if err != nil { return DeploymentsClientGetAtSubscriptionScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientGetAtSubscriptionScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return DeploymentsClientGetAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) } return client.getAtSubscriptionScopeHandleResponse(resp) } // getAtSubscriptionScopeCreateRequest creates the GetAtSubscriptionScope request. func (client *DeploymentsClient) getAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientGetAtSubscriptionScopeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getAtSubscriptionScopeHandleResponse handles the GetAtSubscriptionScope response. func (client *DeploymentsClient) getAtSubscriptionScopeHandleResponse(resp *http.Response) (DeploymentsClientGetAtSubscriptionScopeResponse, error) { result := DeploymentsClientGetAtSubscriptionScopeResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExtended); err != nil { return DeploymentsClientGetAtSubscriptionScopeResponse{}, err } return result, nil } // GetAtTenantScope - Gets a deployment. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - deploymentName - The name of the deployment. // - options - DeploymentsClientGetAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.GetAtTenantScope // method. func (client *DeploymentsClient) GetAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientGetAtTenantScopeOptions) (DeploymentsClientGetAtTenantScopeResponse, error) { req, err := client.getAtTenantScopeCreateRequest(ctx, deploymentName, options) if err != nil { return DeploymentsClientGetAtTenantScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientGetAtTenantScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return DeploymentsClientGetAtTenantScopeResponse{}, runtime.NewResponseError(resp) } return client.getAtTenantScopeHandleResponse(resp) } // getAtTenantScopeCreateRequest creates the GetAtTenantScope request. func (client *DeploymentsClient) getAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientGetAtTenantScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}" if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getAtTenantScopeHandleResponse handles the GetAtTenantScope response. func (client *DeploymentsClient) getAtTenantScopeHandleResponse(resp *http.Response) (DeploymentsClientGetAtTenantScopeResponse, error) { result := DeploymentsClientGetAtTenantScopeResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExtended); err != nil { return DeploymentsClientGetAtTenantScopeResponse{}, err } return result, nil } // NewListAtManagementGroupScopePager - Get all the deployments for a management group. // // Generated from API version 2019-10-01 // - groupID - The management group ID. // - options - DeploymentsClientListAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.NewListAtManagementGroupScopePager // method. func (client *DeploymentsClient) NewListAtManagementGroupScopePager(groupID string, options *DeploymentsClientListAtManagementGroupScopeOptions) *runtime.Pager[DeploymentsClientListAtManagementGroupScopeResponse] { return runtime.NewPager(runtime.PagingHandler[DeploymentsClientListAtManagementGroupScopeResponse]{ More: func(page DeploymentsClientListAtManagementGroupScopeResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DeploymentsClientListAtManagementGroupScopeResponse) (DeploymentsClientListAtManagementGroupScopeResponse, error) { var req *policy.Request var err error if page == nil { req, err = client.listAtManagementGroupScopeCreateRequest(ctx, groupID, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return DeploymentsClientListAtManagementGroupScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientListAtManagementGroupScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return DeploymentsClientListAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) } return client.listAtManagementGroupScopeHandleResponse(resp) }, }) } // listAtManagementGroupScopeCreateRequest creates the ListAtManagementGroupScope request. func (client *DeploymentsClient) listAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, options *DeploymentsClientListAtManagementGroupScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/" if groupID == "" { return nil, errors.New("parameter groupID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listAtManagementGroupScopeHandleResponse handles the ListAtManagementGroupScope response. func (client *DeploymentsClient) listAtManagementGroupScopeHandleResponse(resp *http.Response) (DeploymentsClientListAtManagementGroupScopeResponse, error) { result := DeploymentsClientListAtManagementGroupScopeResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentListResult); err != nil { return DeploymentsClientListAtManagementGroupScopeResponse{}, err } return result, nil } // NewListAtScopePager - Get all the deployments at the given scope. // // Generated from API version 2019-10-01 // - scope - The resource scope. // - options - DeploymentsClientListAtScopeOptions contains the optional parameters for the DeploymentsClient.NewListAtScopePager // method. func (client *DeploymentsClient) NewListAtScopePager(scope string, options *DeploymentsClientListAtScopeOptions) *runtime.Pager[DeploymentsClientListAtScopeResponse] { return runtime.NewPager(runtime.PagingHandler[DeploymentsClientListAtScopeResponse]{ More: func(page DeploymentsClientListAtScopeResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DeploymentsClientListAtScopeResponse) (DeploymentsClientListAtScopeResponse, error) { var req *policy.Request var err error if page == nil { req, err = client.listAtScopeCreateRequest(ctx, scope, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return DeploymentsClientListAtScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientListAtScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return DeploymentsClientListAtScopeResponse{}, runtime.NewResponseError(resp) } return client.listAtScopeHandleResponse(resp) }, }) } // listAtScopeCreateRequest creates the ListAtScope request. func (client *DeploymentsClient) listAtScopeCreateRequest(ctx context.Context, scope string, options *DeploymentsClientListAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listAtScopeHandleResponse handles the ListAtScope response. func (client *DeploymentsClient) listAtScopeHandleResponse(resp *http.Response) (DeploymentsClientListAtScopeResponse, error) { result := DeploymentsClientListAtScopeResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentListResult); err != nil { return DeploymentsClientListAtScopeResponse{}, err } return result, nil } // NewListAtSubscriptionScopePager - Get all the deployments for a subscription. // // Generated from API version 2019-10-01 // - options - DeploymentsClientListAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.NewListAtSubscriptionScopePager // method. func (client *DeploymentsClient) NewListAtSubscriptionScopePager(options *DeploymentsClientListAtSubscriptionScopeOptions) *runtime.Pager[DeploymentsClientListAtSubscriptionScopeResponse] { return runtime.NewPager(runtime.PagingHandler[DeploymentsClientListAtSubscriptionScopeResponse]{ More: func(page DeploymentsClientListAtSubscriptionScopeResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DeploymentsClientListAtSubscriptionScopeResponse) (DeploymentsClientListAtSubscriptionScopeResponse, error) { var req *policy.Request var err error if page == nil { req, err = client.listAtSubscriptionScopeCreateRequest(ctx, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return DeploymentsClientListAtSubscriptionScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientListAtSubscriptionScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return DeploymentsClientListAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) } return client.listAtSubscriptionScopeHandleResponse(resp) }, }) } // listAtSubscriptionScopeCreateRequest creates the ListAtSubscriptionScope request. func (client *DeploymentsClient) listAtSubscriptionScopeCreateRequest(ctx context.Context, options *DeploymentsClientListAtSubscriptionScopeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listAtSubscriptionScopeHandleResponse handles the ListAtSubscriptionScope response. func (client *DeploymentsClient) listAtSubscriptionScopeHandleResponse(resp *http.Response) (DeploymentsClientListAtSubscriptionScopeResponse, error) { result := DeploymentsClientListAtSubscriptionScopeResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentListResult); err != nil { return DeploymentsClientListAtSubscriptionScopeResponse{}, err } return result, nil } // NewListAtTenantScopePager - Get all the deployments at the tenant scope. // // Generated from API version 2019-10-01 // - options - DeploymentsClientListAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.NewListAtTenantScopePager // method. func (client *DeploymentsClient) NewListAtTenantScopePager(options *DeploymentsClientListAtTenantScopeOptions) *runtime.Pager[DeploymentsClientListAtTenantScopeResponse] { return runtime.NewPager(runtime.PagingHandler[DeploymentsClientListAtTenantScopeResponse]{ More: func(page DeploymentsClientListAtTenantScopeResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DeploymentsClientListAtTenantScopeResponse) (DeploymentsClientListAtTenantScopeResponse, error) { var req *policy.Request var err error if page == nil { req, err = client.listAtTenantScopeCreateRequest(ctx, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return DeploymentsClientListAtTenantScopeResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientListAtTenantScopeResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return DeploymentsClientListAtTenantScopeResponse{}, runtime.NewResponseError(resp) } return client.listAtTenantScopeHandleResponse(resp) }, }) } // listAtTenantScopeCreateRequest creates the ListAtTenantScope request. func (client *DeploymentsClient) listAtTenantScopeCreateRequest(ctx context.Context, options *DeploymentsClientListAtTenantScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Resources/deployments/" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listAtTenantScopeHandleResponse handles the ListAtTenantScope response. func (client *DeploymentsClient) listAtTenantScopeHandleResponse(resp *http.Response) (DeploymentsClientListAtTenantScopeResponse, error) { result := DeploymentsClientListAtTenantScopeResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentListResult); err != nil { return DeploymentsClientListAtTenantScopeResponse{}, err } return result, nil } // NewListByResourceGroupPager - Get all the deployments for a resource group. // // Generated from API version 2019-10-01 // - resourceGroupName - The name of the resource group with the deployments to get. The name is case insensitive. // - options - DeploymentsClientListByResourceGroupOptions contains the optional parameters for the DeploymentsClient.NewListByResourceGroupPager // method. func (client *DeploymentsClient) NewListByResourceGroupPager(resourceGroupName string, options *DeploymentsClientListByResourceGroupOptions) *runtime.Pager[DeploymentsClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[DeploymentsClientListByResourceGroupResponse]{ More: func(page DeploymentsClientListByResourceGroupResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DeploymentsClientListByResourceGroupResponse) (DeploymentsClientListByResourceGroupResponse, error) { var req *policy.Request var err error if page == nil { req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return DeploymentsClientListByResourceGroupResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientListByResourceGroupResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return DeploymentsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) } return client.listByResourceGroupHandleResponse(resp) }, }) } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. func (client *DeploymentsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DeploymentsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *DeploymentsClient) listByResourceGroupHandleResponse(resp *http.Response) (DeploymentsClientListByResourceGroupResponse, error) { result := DeploymentsClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentListResult); err != nil { return DeploymentsClientListByResourceGroupResponse{}, err } return result, nil } // BeginValidate - Validates whether the specified template is syntactically correct and will be accepted by Azure Resource // Manager.. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - 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. // - options - DeploymentsClientBeginValidateOptions contains the optional parameters for the DeploymentsClient.BeginValidate // method. func (client *DeploymentsClient) BeginValidate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateOptions) (*runtime.Poller[DeploymentsClientValidateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.validate(ctx, resourceGroupName, deploymentName, parameters, options) if err != nil { return nil, err } return runtime.NewPoller[DeploymentsClientValidateResponse](resp, client.internal.Pipeline(), nil) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientValidateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Validate - Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) validate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateOptions) (*http.Response, error) { req, err := client.validateCreateRequest(ctx, resourceGroupName, deploymentName, parameters, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { return nil, runtime.NewResponseError(resp) } return resp, nil } // validateCreateRequest creates the Validate request. func (client *DeploymentsClient) validateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } // BeginValidateAtManagementGroupScope - Validates whether the specified template is syntactically correct and will be accepted // by Azure Resource Manager.. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - groupID - The management group ID. // - deploymentName - The name of the deployment. // - parameters - Parameters to validate. // - options - DeploymentsClientBeginValidateAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtManagementGroupScope // method. func (client *DeploymentsClient) BeginValidateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginValidateAtManagementGroupScopeOptions) (*runtime.Poller[DeploymentsClientValidateAtManagementGroupScopeResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.validateAtManagementGroupScope(ctx, groupID, deploymentName, parameters, options) if err != nil { return nil, err } return runtime.NewPoller[DeploymentsClientValidateAtManagementGroupScopeResponse](resp, client.internal.Pipeline(), nil) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientValidateAtManagementGroupScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // ValidateAtManagementGroupScope - Validates whether the specified template is syntactically correct and will be accepted // by Azure Resource Manager.. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) validateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginValidateAtManagementGroupScopeOptions) (*http.Response, error) { req, err := client.validateAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, parameters, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { return nil, runtime.NewResponseError(resp) } return resp, nil } // validateAtManagementGroupScopeCreateRequest creates the ValidateAtManagementGroupScope request. func (client *DeploymentsClient) validateAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginValidateAtManagementGroupScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate" if groupID == "" { return nil, errors.New("parameter groupID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } // BeginValidateAtScope - Validates whether the specified template is syntactically correct and will be accepted by Azure // Resource Manager.. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - scope - The resource scope. // - deploymentName - The name of the deployment. // - parameters - Parameters to validate. // - options - DeploymentsClientBeginValidateAtScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtScope // method. func (client *DeploymentsClient) BeginValidateAtScope(ctx context.Context, scope string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateAtScopeOptions) (*runtime.Poller[DeploymentsClientValidateAtScopeResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.validateAtScope(ctx, scope, deploymentName, parameters, options) if err != nil { return nil, err } return runtime.NewPoller[DeploymentsClientValidateAtScopeResponse](resp, client.internal.Pipeline(), nil) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientValidateAtScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // ValidateAtScope - Validates whether the specified template is syntactically correct and will be accepted by Azure Resource // Manager.. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) validateAtScope(ctx context.Context, scope string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateAtScopeOptions) (*http.Response, error) { req, err := client.validateAtScopeCreateRequest(ctx, scope, deploymentName, parameters, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { return nil, runtime.NewResponseError(resp) } return resp, nil } // validateAtScopeCreateRequest creates the ValidateAtScope request. func (client *DeploymentsClient) validateAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } // BeginValidateAtSubscriptionScope - Validates whether the specified template is syntactically correct and will be accepted // by Azure Resource Manager.. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - deploymentName - The name of the deployment. // - parameters - Parameters to validate. // - options - DeploymentsClientBeginValidateAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtSubscriptionScope // method. func (client *DeploymentsClient) BeginValidateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateAtSubscriptionScopeOptions) (*runtime.Poller[DeploymentsClientValidateAtSubscriptionScopeResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.validateAtSubscriptionScope(ctx, deploymentName, parameters, options) if err != nil { return nil, err } return runtime.NewPoller[DeploymentsClientValidateAtSubscriptionScopeResponse](resp, client.internal.Pipeline(), nil) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientValidateAtSubscriptionScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // ValidateAtSubscriptionScope - Validates whether the specified template is syntactically correct and will be accepted by // Azure Resource Manager.. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) validateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateAtSubscriptionScopeOptions) (*http.Response, error) { req, err := client.validateAtSubscriptionScopeCreateRequest(ctx, deploymentName, parameters, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { return nil, runtime.NewResponseError(resp) } return resp, nil } // validateAtSubscriptionScopeCreateRequest creates the ValidateAtSubscriptionScope request. func (client *DeploymentsClient) validateAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateAtSubscriptionScopeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate" if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } // BeginValidateAtTenantScope - Validates whether the specified template is syntactically correct and will be accepted by // Azure Resource Manager.. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - deploymentName - The name of the deployment. // - parameters - Parameters to validate. // - options - DeploymentsClientBeginValidateAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtTenantScope // method. func (client *DeploymentsClient) BeginValidateAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginValidateAtTenantScopeOptions) (*runtime.Poller[DeploymentsClientValidateAtTenantScopeResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.validateAtTenantScope(ctx, deploymentName, parameters, options) if err != nil { return nil, err } return runtime.NewPoller[DeploymentsClientValidateAtTenantScopeResponse](resp, client.internal.Pipeline(), nil) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientValidateAtTenantScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // ValidateAtTenantScope - Validates whether the specified template is syntactically correct and will be accepted by Azure // Resource Manager.. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) validateAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginValidateAtTenantScopeOptions) (*http.Response, error) { req, err := client.validateAtTenantScopeCreateRequest(ctx, deploymentName, parameters, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { return nil, runtime.NewResponseError(resp) } return resp, nil } // validateAtTenantScopeCreateRequest creates the ValidateAtTenantScope request. func (client *DeploymentsClient) validateAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginValidateAtTenantScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}/validate" if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } // BeginWhatIf - Returns changes that will be made by the deployment if executed at the scope of the resource group. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - 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. // - options - DeploymentsClientBeginWhatIfOptions contains the optional parameters for the DeploymentsClient.BeginWhatIf method. func (client *DeploymentsClient) BeginWhatIf(ctx context.Context, resourceGroupName string, deploymentName string, parameters DeploymentWhatIf, options *DeploymentsClientBeginWhatIfOptions) (*runtime.Poller[DeploymentsClientWhatIfResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.whatIf(ctx, resourceGroupName, deploymentName, parameters, options) if err != nil { return nil, err } return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientWhatIfResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientWhatIfResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // WhatIf - Returns changes that will be made by the deployment if executed at the scope of the resource group. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) whatIf(ctx context.Context, resourceGroupName string, deploymentName string, parameters DeploymentWhatIf, options *DeploymentsClientBeginWhatIfOptions) (*http.Response, error) { req, err := client.whatIfCreateRequest(ctx, resourceGroupName, deploymentName, parameters, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, runtime.NewResponseError(resp) } return resp, nil } // whatIfCreateRequest creates the WhatIf request. func (client *DeploymentsClient) whatIfCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, parameters DeploymentWhatIf, options *DeploymentsClientBeginWhatIfOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } // BeginWhatIfAtManagementGroupScope - Returns changes that will be made by the deployment if executed at the scope of the // management group. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - groupID - The management group ID. // - deploymentName - The name of the deployment. // - parameters - Parameters to validate. // - options - DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginWhatIfAtManagementGroupScope // method. func (client *DeploymentsClient) BeginWhatIfAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions) (*runtime.Poller[DeploymentsClientWhatIfAtManagementGroupScopeResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.whatIfAtManagementGroupScope(ctx, groupID, deploymentName, parameters, options) if err != nil { return nil, err } return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientWhatIfAtManagementGroupScopeResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientWhatIfAtManagementGroupScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // WhatIfAtManagementGroupScope - Returns changes that will be made by the deployment if executed at the scope of the management // group. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) whatIfAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions) (*http.Response, error) { req, err := client.whatIfAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, parameters, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, runtime.NewResponseError(resp) } return resp, nil } // whatIfAtManagementGroupScopeCreateRequest creates the WhatIfAtManagementGroupScope request. func (client *DeploymentsClient) whatIfAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf" if groupID == "" { return nil, errors.New("parameter groupID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } // BeginWhatIfAtSubscriptionScope - Returns changes that will be made by the deployment if executed at the scope of the subscription. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - deploymentName - The name of the deployment. // - parameters - Parameters to What If. // - options - DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginWhatIfAtSubscriptionScope // method. func (client *DeploymentsClient) BeginWhatIfAtSubscriptionScope(ctx context.Context, deploymentName string, parameters DeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions) (*runtime.Poller[DeploymentsClientWhatIfAtSubscriptionScopeResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.whatIfAtSubscriptionScope(ctx, deploymentName, parameters, options) if err != nil { return nil, err } return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientWhatIfAtSubscriptionScopeResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientWhatIfAtSubscriptionScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // WhatIfAtSubscriptionScope - Returns changes that will be made by the deployment if executed at the scope of the subscription. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) whatIfAtSubscriptionScope(ctx context.Context, deploymentName string, parameters DeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions) (*http.Response, error) { req, err := client.whatIfAtSubscriptionScopeCreateRequest(ctx, deploymentName, parameters, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, runtime.NewResponseError(resp) } return resp, nil } // whatIfAtSubscriptionScopeCreateRequest creates the WhatIfAtSubscriptionScope request. func (client *DeploymentsClient) whatIfAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, parameters DeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf" if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } // BeginWhatIfAtTenantScope - Returns changes that will be made by the deployment if executed at the scope of the tenant group. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 // - deploymentName - The name of the deployment. // - parameters - Parameters to validate. // - options - DeploymentsClientBeginWhatIfAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginWhatIfAtTenantScope // method. func (client *DeploymentsClient) BeginWhatIfAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtTenantScopeOptions) (*runtime.Poller[DeploymentsClientWhatIfAtTenantScopeResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.whatIfAtTenantScope(ctx, deploymentName, parameters, options) if err != nil { return nil, err } return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientWhatIfAtTenantScopeResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientWhatIfAtTenantScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // WhatIfAtTenantScope - Returns changes that will be made by the deployment if executed at the scope of the tenant group. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-10-01 func (client *DeploymentsClient) whatIfAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtTenantScopeOptions) (*http.Response, error) { req, err := client.whatIfAtTenantScopeCreateRequest(ctx, deploymentName, parameters, options) if err != nil { return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, runtime.NewResponseError(resp) } return resp, nil } // whatIfAtTenantScopeCreateRequest creates the WhatIfAtTenantScope request. func (client *DeploymentsClient) whatIfAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, parameters ScopedDeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtTenantScopeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf" if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) }