...

Source file src/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/features/deployments.go

Documentation: github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/features

     1  package features
     2  
     3  // Copyright (c) Microsoft Corporation. All rights reserved.
     4  // Licensed under the MIT License. See License.txt in the project root for license information.
     5  //
     6  // Code generated by Microsoft (R) AutoRest Code Generator.
     7  // Changes may cause incorrect behavior and will be lost if the code is regenerated.
     8  
     9  import (
    10  	"context"
    11  	"github.com/Azure/go-autorest/autorest"
    12  	"github.com/Azure/go-autorest/autorest/azure"
    13  	"github.com/Azure/go-autorest/autorest/validation"
    14  	"github.com/Azure/go-autorest/tracing"
    15  	"net/http"
    16  )
    17  
    18  // DeploymentsClient is the provides operations for working with resources and resource groups.
    19  type DeploymentsClient struct {
    20  	BaseClient
    21  }
    22  
    23  // NewDeploymentsClient creates an instance of the DeploymentsClient client.
    24  func NewDeploymentsClient(subscriptionID string) DeploymentsClient {
    25  	return NewDeploymentsClientWithBaseURI(DefaultBaseURI, subscriptionID)
    26  }
    27  
    28  // NewDeploymentsClientWithBaseURI creates an instance of the DeploymentsClient client using a custom endpoint.  Use
    29  // this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
    30  func NewDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentsClient {
    31  	return DeploymentsClient{NewWithBaseURI(baseURI, subscriptionID)}
    32  }
    33  
    34  // CalculateTemplateHash calculate the hash of the given template.
    35  // Parameters:
    36  // templateParameter - the template provided to calculate hash.
    37  func (client DeploymentsClient) CalculateTemplateHash(ctx context.Context, templateParameter interface{}) (result TemplateHashResult, err error) {
    38  	if tracing.IsEnabled() {
    39  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CalculateTemplateHash")
    40  		defer func() {
    41  			sc := -1
    42  			if result.Response.Response != nil {
    43  				sc = result.Response.Response.StatusCode
    44  			}
    45  			tracing.EndSpan(ctx, sc, err)
    46  		}()
    47  	}
    48  	req, err := client.CalculateTemplateHashPreparer(ctx, templateParameter)
    49  	if err != nil {
    50  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CalculateTemplateHash", nil, "Failure preparing request")
    51  		return
    52  	}
    53  
    54  	resp, err := client.CalculateTemplateHashSender(req)
    55  	if err != nil {
    56  		result.Response = autorest.Response{Response: resp}
    57  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CalculateTemplateHash", resp, "Failure sending request")
    58  		return
    59  	}
    60  
    61  	result, err = client.CalculateTemplateHashResponder(resp)
    62  	if err != nil {
    63  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CalculateTemplateHash", resp, "Failure responding to request")
    64  		return
    65  	}
    66  
    67  	return
    68  }
    69  
    70  // CalculateTemplateHashPreparer prepares the CalculateTemplateHash request.
    71  func (client DeploymentsClient) CalculateTemplateHashPreparer(ctx context.Context, templateParameter interface{}) (*http.Request, error) {
    72  	const APIVersion = "2019-07-01"
    73  	queryParameters := map[string]interface{}{
    74  		"api-version": APIVersion,
    75  	}
    76  
    77  	preparer := autorest.CreatePreparer(
    78  		autorest.AsContentType("application/json; charset=utf-8"),
    79  		autorest.AsPost(),
    80  		autorest.WithBaseURL(client.BaseURI),
    81  		autorest.WithPath("/providers/Microsoft.Resources/calculateTemplateHash"),
    82  		autorest.WithJSON(templateParameter),
    83  		autorest.WithQueryParameters(queryParameters))
    84  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
    85  }
    86  
    87  // CalculateTemplateHashSender sends the CalculateTemplateHash request. The method will close the
    88  // http.Response Body if it receives an error.
    89  func (client DeploymentsClient) CalculateTemplateHashSender(req *http.Request) (*http.Response, error) {
    90  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
    91  }
    92  
    93  // CalculateTemplateHashResponder handles the response to the CalculateTemplateHash request. The method always
    94  // closes the http.Response Body.
    95  func (client DeploymentsClient) CalculateTemplateHashResponder(resp *http.Response) (result TemplateHashResult, err error) {
    96  	err = autorest.Respond(
    97  		resp,
    98  		azure.WithErrorUnlessStatusCode(http.StatusOK),
    99  		autorest.ByUnmarshallingJSON(&result),
   100  		autorest.ByClosing())
   101  	result.Response = autorest.Response{Response: resp}
   102  	return
   103  }
   104  
   105  // Cancel you can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is
   106  // canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running
   107  // template deployment and leaves the resource group partially deployed.
   108  // Parameters:
   109  // resourceGroupName - the name of the resource group. The name is case insensitive.
   110  // deploymentName - the name of the deployment.
   111  func (client DeploymentsClient) Cancel(ctx context.Context, resourceGroupName string, deploymentName string) (result autorest.Response, err error) {
   112  	if tracing.IsEnabled() {
   113  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Cancel")
   114  		defer func() {
   115  			sc := -1
   116  			if result.Response != nil {
   117  				sc = result.Response.StatusCode
   118  			}
   119  			tracing.EndSpan(ctx, sc, err)
   120  		}()
   121  	}
   122  	if err := validation.Validate([]validation.Validation{
   123  		{TargetValue: resourceGroupName,
   124  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   125  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
   126  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}},
   127  		{TargetValue: deploymentName,
   128  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   129  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   130  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   131  		return result, validation.NewError("features.DeploymentsClient", "Cancel", err.Error())
   132  	}
   133  
   134  	req, err := client.CancelPreparer(ctx, resourceGroupName, deploymentName)
   135  	if err != nil {
   136  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "Cancel", nil, "Failure preparing request")
   137  		return
   138  	}
   139  
   140  	resp, err := client.CancelSender(req)
   141  	if err != nil {
   142  		result.Response = resp
   143  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "Cancel", resp, "Failure sending request")
   144  		return
   145  	}
   146  
   147  	result, err = client.CancelResponder(resp)
   148  	if err != nil {
   149  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "Cancel", resp, "Failure responding to request")
   150  		return
   151  	}
   152  
   153  	return
   154  }
   155  
   156  // CancelPreparer prepares the Cancel request.
   157  func (client DeploymentsClient) CancelPreparer(ctx context.Context, resourceGroupName string, deploymentName string) (*http.Request, error) {
   158  	pathParameters := map[string]interface{}{
   159  		"deploymentName":    autorest.Encode("path", deploymentName),
   160  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   161  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   162  	}
   163  
   164  	const APIVersion = "2019-07-01"
   165  	queryParameters := map[string]interface{}{
   166  		"api-version": APIVersion,
   167  	}
   168  
   169  	preparer := autorest.CreatePreparer(
   170  		autorest.AsPost(),
   171  		autorest.WithBaseURL(client.BaseURI),
   172  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", pathParameters),
   173  		autorest.WithQueryParameters(queryParameters))
   174  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   175  }
   176  
   177  // CancelSender sends the Cancel request. The method will close the
   178  // http.Response Body if it receives an error.
   179  func (client DeploymentsClient) CancelSender(req *http.Request) (*http.Response, error) {
   180  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   181  }
   182  
   183  // CancelResponder handles the response to the Cancel request. The method always
   184  // closes the http.Response Body.
   185  func (client DeploymentsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) {
   186  	err = autorest.Respond(
   187  		resp,
   188  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
   189  		autorest.ByClosing())
   190  	result.Response = resp
   191  	return
   192  }
   193  
   194  // CancelAtManagementGroupScope you can cancel a deployment only if the provisioningState is Accepted or Running. After
   195  // the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the
   196  // currently running template deployment and leaves the resources partially deployed.
   197  // Parameters:
   198  // groupID - the management group ID.
   199  // deploymentName - the name of the deployment.
   200  func (client DeploymentsClient) CancelAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string) (result autorest.Response, err error) {
   201  	if tracing.IsEnabled() {
   202  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CancelAtManagementGroupScope")
   203  		defer func() {
   204  			sc := -1
   205  			if result.Response != nil {
   206  				sc = result.Response.StatusCode
   207  			}
   208  			tracing.EndSpan(ctx, sc, err)
   209  		}()
   210  	}
   211  	if err := validation.Validate([]validation.Validation{
   212  		{TargetValue: groupID,
   213  			Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil},
   214  				{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   215  		{TargetValue: deploymentName,
   216  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   217  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   218  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   219  		return result, validation.NewError("features.DeploymentsClient", "CancelAtManagementGroupScope", err.Error())
   220  	}
   221  
   222  	req, err := client.CancelAtManagementGroupScopePreparer(ctx, groupID, deploymentName)
   223  	if err != nil {
   224  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CancelAtManagementGroupScope", nil, "Failure preparing request")
   225  		return
   226  	}
   227  
   228  	resp, err := client.CancelAtManagementGroupScopeSender(req)
   229  	if err != nil {
   230  		result.Response = resp
   231  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CancelAtManagementGroupScope", resp, "Failure sending request")
   232  		return
   233  	}
   234  
   235  	result, err = client.CancelAtManagementGroupScopeResponder(resp)
   236  	if err != nil {
   237  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CancelAtManagementGroupScope", resp, "Failure responding to request")
   238  		return
   239  	}
   240  
   241  	return
   242  }
   243  
   244  // CancelAtManagementGroupScopePreparer prepares the CancelAtManagementGroupScope request.
   245  func (client DeploymentsClient) CancelAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string) (*http.Request, error) {
   246  	pathParameters := map[string]interface{}{
   247  		"deploymentName": autorest.Encode("path", deploymentName),
   248  		"groupId":        autorest.Encode("path", groupID),
   249  	}
   250  
   251  	const APIVersion = "2019-07-01"
   252  	queryParameters := map[string]interface{}{
   253  		"api-version": APIVersion,
   254  	}
   255  
   256  	preparer := autorest.CreatePreparer(
   257  		autorest.AsPost(),
   258  		autorest.WithBaseURL(client.BaseURI),
   259  		autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", pathParameters),
   260  		autorest.WithQueryParameters(queryParameters))
   261  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   262  }
   263  
   264  // CancelAtManagementGroupScopeSender sends the CancelAtManagementGroupScope request. The method will close the
   265  // http.Response Body if it receives an error.
   266  func (client DeploymentsClient) CancelAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) {
   267  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   268  }
   269  
   270  // CancelAtManagementGroupScopeResponder handles the response to the CancelAtManagementGroupScope request. The method always
   271  // closes the http.Response Body.
   272  func (client DeploymentsClient) CancelAtManagementGroupScopeResponder(resp *http.Response) (result autorest.Response, err error) {
   273  	err = autorest.Respond(
   274  		resp,
   275  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
   276  		autorest.ByClosing())
   277  	result.Response = resp
   278  	return
   279  }
   280  
   281  // CancelAtScope you can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment
   282  // is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running
   283  // template deployment and leaves the resources partially deployed.
   284  // Parameters:
   285  // scope - the scope of a deployment.
   286  // deploymentName - the name of the deployment.
   287  func (client DeploymentsClient) CancelAtScope(ctx context.Context, scope string, deploymentName string) (result autorest.Response, err error) {
   288  	if tracing.IsEnabled() {
   289  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CancelAtScope")
   290  		defer func() {
   291  			sc := -1
   292  			if result.Response != nil {
   293  				sc = result.Response.StatusCode
   294  			}
   295  			tracing.EndSpan(ctx, sc, err)
   296  		}()
   297  	}
   298  	if err := validation.Validate([]validation.Validation{
   299  		{TargetValue: deploymentName,
   300  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   301  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   302  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   303  		return result, validation.NewError("features.DeploymentsClient", "CancelAtScope", err.Error())
   304  	}
   305  
   306  	req, err := client.CancelAtScopePreparer(ctx, scope, deploymentName)
   307  	if err != nil {
   308  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CancelAtScope", nil, "Failure preparing request")
   309  		return
   310  	}
   311  
   312  	resp, err := client.CancelAtScopeSender(req)
   313  	if err != nil {
   314  		result.Response = resp
   315  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CancelAtScope", resp, "Failure sending request")
   316  		return
   317  	}
   318  
   319  	result, err = client.CancelAtScopeResponder(resp)
   320  	if err != nil {
   321  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CancelAtScope", resp, "Failure responding to request")
   322  		return
   323  	}
   324  
   325  	return
   326  }
   327  
   328  // CancelAtScopePreparer prepares the CancelAtScope request.
   329  func (client DeploymentsClient) CancelAtScopePreparer(ctx context.Context, scope string, deploymentName string) (*http.Request, error) {
   330  	pathParameters := map[string]interface{}{
   331  		"deploymentName": autorest.Encode("path", deploymentName),
   332  		"scope":          autorest.Encode("path", scope),
   333  	}
   334  
   335  	const APIVersion = "2019-07-01"
   336  	queryParameters := map[string]interface{}{
   337  		"api-version": APIVersion,
   338  	}
   339  
   340  	preparer := autorest.CreatePreparer(
   341  		autorest.AsPost(),
   342  		autorest.WithBaseURL(client.BaseURI),
   343  		autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", pathParameters),
   344  		autorest.WithQueryParameters(queryParameters))
   345  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   346  }
   347  
   348  // CancelAtScopeSender sends the CancelAtScope request. The method will close the
   349  // http.Response Body if it receives an error.
   350  func (client DeploymentsClient) CancelAtScopeSender(req *http.Request) (*http.Response, error) {
   351  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   352  }
   353  
   354  // CancelAtScopeResponder handles the response to the CancelAtScope request. The method always
   355  // closes the http.Response Body.
   356  func (client DeploymentsClient) CancelAtScopeResponder(resp *http.Response) (result autorest.Response, err error) {
   357  	err = autorest.Respond(
   358  		resp,
   359  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
   360  		autorest.ByClosing())
   361  	result.Response = resp
   362  	return
   363  }
   364  
   365  // CancelAtSubscriptionScope you can cancel a deployment only if the provisioningState is Accepted or Running. After
   366  // the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the
   367  // currently running template deployment and leaves the resources partially deployed.
   368  // Parameters:
   369  // deploymentName - the name of the deployment.
   370  func (client DeploymentsClient) CancelAtSubscriptionScope(ctx context.Context, deploymentName string) (result autorest.Response, err error) {
   371  	if tracing.IsEnabled() {
   372  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CancelAtSubscriptionScope")
   373  		defer func() {
   374  			sc := -1
   375  			if result.Response != nil {
   376  				sc = result.Response.StatusCode
   377  			}
   378  			tracing.EndSpan(ctx, sc, err)
   379  		}()
   380  	}
   381  	if err := validation.Validate([]validation.Validation{
   382  		{TargetValue: deploymentName,
   383  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   384  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   385  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   386  		return result, validation.NewError("features.DeploymentsClient", "CancelAtSubscriptionScope", err.Error())
   387  	}
   388  
   389  	req, err := client.CancelAtSubscriptionScopePreparer(ctx, deploymentName)
   390  	if err != nil {
   391  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CancelAtSubscriptionScope", nil, "Failure preparing request")
   392  		return
   393  	}
   394  
   395  	resp, err := client.CancelAtSubscriptionScopeSender(req)
   396  	if err != nil {
   397  		result.Response = resp
   398  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CancelAtSubscriptionScope", resp, "Failure sending request")
   399  		return
   400  	}
   401  
   402  	result, err = client.CancelAtSubscriptionScopeResponder(resp)
   403  	if err != nil {
   404  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CancelAtSubscriptionScope", resp, "Failure responding to request")
   405  		return
   406  	}
   407  
   408  	return
   409  }
   410  
   411  // CancelAtSubscriptionScopePreparer prepares the CancelAtSubscriptionScope request.
   412  func (client DeploymentsClient) CancelAtSubscriptionScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) {
   413  	pathParameters := map[string]interface{}{
   414  		"deploymentName": autorest.Encode("path", deploymentName),
   415  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   416  	}
   417  
   418  	const APIVersion = "2019-07-01"
   419  	queryParameters := map[string]interface{}{
   420  		"api-version": APIVersion,
   421  	}
   422  
   423  	preparer := autorest.CreatePreparer(
   424  		autorest.AsPost(),
   425  		autorest.WithBaseURL(client.BaseURI),
   426  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", pathParameters),
   427  		autorest.WithQueryParameters(queryParameters))
   428  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   429  }
   430  
   431  // CancelAtSubscriptionScopeSender sends the CancelAtSubscriptionScope request. The method will close the
   432  // http.Response Body if it receives an error.
   433  func (client DeploymentsClient) CancelAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) {
   434  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   435  }
   436  
   437  // CancelAtSubscriptionScopeResponder handles the response to the CancelAtSubscriptionScope request. The method always
   438  // closes the http.Response Body.
   439  func (client DeploymentsClient) CancelAtSubscriptionScopeResponder(resp *http.Response) (result autorest.Response, err error) {
   440  	err = autorest.Respond(
   441  		resp,
   442  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
   443  		autorest.ByClosing())
   444  	result.Response = resp
   445  	return
   446  }
   447  
   448  // CancelAtTenantScope you can cancel a deployment only if the provisioningState is Accepted or Running. After the
   449  // deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the
   450  // currently running template deployment and leaves the resources partially deployed.
   451  // Parameters:
   452  // deploymentName - the name of the deployment.
   453  func (client DeploymentsClient) CancelAtTenantScope(ctx context.Context, deploymentName string) (result autorest.Response, err error) {
   454  	if tracing.IsEnabled() {
   455  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CancelAtTenantScope")
   456  		defer func() {
   457  			sc := -1
   458  			if result.Response != nil {
   459  				sc = result.Response.StatusCode
   460  			}
   461  			tracing.EndSpan(ctx, sc, err)
   462  		}()
   463  	}
   464  	if err := validation.Validate([]validation.Validation{
   465  		{TargetValue: deploymentName,
   466  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   467  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   468  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   469  		return result, validation.NewError("features.DeploymentsClient", "CancelAtTenantScope", err.Error())
   470  	}
   471  
   472  	req, err := client.CancelAtTenantScopePreparer(ctx, deploymentName)
   473  	if err != nil {
   474  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CancelAtTenantScope", nil, "Failure preparing request")
   475  		return
   476  	}
   477  
   478  	resp, err := client.CancelAtTenantScopeSender(req)
   479  	if err != nil {
   480  		result.Response = resp
   481  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CancelAtTenantScope", resp, "Failure sending request")
   482  		return
   483  	}
   484  
   485  	result, err = client.CancelAtTenantScopeResponder(resp)
   486  	if err != nil {
   487  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CancelAtTenantScope", resp, "Failure responding to request")
   488  		return
   489  	}
   490  
   491  	return
   492  }
   493  
   494  // CancelAtTenantScopePreparer prepares the CancelAtTenantScope request.
   495  func (client DeploymentsClient) CancelAtTenantScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) {
   496  	pathParameters := map[string]interface{}{
   497  		"deploymentName": autorest.Encode("path", deploymentName),
   498  	}
   499  
   500  	const APIVersion = "2019-07-01"
   501  	queryParameters := map[string]interface{}{
   502  		"api-version": APIVersion,
   503  	}
   504  
   505  	preparer := autorest.CreatePreparer(
   506  		autorest.AsPost(),
   507  		autorest.WithBaseURL(client.BaseURI),
   508  		autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", pathParameters),
   509  		autorest.WithQueryParameters(queryParameters))
   510  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   511  }
   512  
   513  // CancelAtTenantScopeSender sends the CancelAtTenantScope request. The method will close the
   514  // http.Response Body if it receives an error.
   515  func (client DeploymentsClient) CancelAtTenantScopeSender(req *http.Request) (*http.Response, error) {
   516  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   517  }
   518  
   519  // CancelAtTenantScopeResponder handles the response to the CancelAtTenantScope request. The method always
   520  // closes the http.Response Body.
   521  func (client DeploymentsClient) CancelAtTenantScopeResponder(resp *http.Response) (result autorest.Response, err error) {
   522  	err = autorest.Respond(
   523  		resp,
   524  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
   525  		autorest.ByClosing())
   526  	result.Response = resp
   527  	return
   528  }
   529  
   530  // CheckExistence checks whether the deployment exists.
   531  // Parameters:
   532  // resourceGroupName - the name of the resource group with the deployment to check. The name is case
   533  // insensitive.
   534  // deploymentName - the name of the deployment.
   535  func (client DeploymentsClient) CheckExistence(ctx context.Context, resourceGroupName string, deploymentName string) (result autorest.Response, err error) {
   536  	if tracing.IsEnabled() {
   537  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CheckExistence")
   538  		defer func() {
   539  			sc := -1
   540  			if result.Response != nil {
   541  				sc = result.Response.StatusCode
   542  			}
   543  			tracing.EndSpan(ctx, sc, err)
   544  		}()
   545  	}
   546  	if err := validation.Validate([]validation.Validation{
   547  		{TargetValue: resourceGroupName,
   548  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   549  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
   550  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}},
   551  		{TargetValue: deploymentName,
   552  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   553  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   554  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   555  		return result, validation.NewError("features.DeploymentsClient", "CheckExistence", err.Error())
   556  	}
   557  
   558  	req, err := client.CheckExistencePreparer(ctx, resourceGroupName, deploymentName)
   559  	if err != nil {
   560  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CheckExistence", nil, "Failure preparing request")
   561  		return
   562  	}
   563  
   564  	resp, err := client.CheckExistenceSender(req)
   565  	if err != nil {
   566  		result.Response = resp
   567  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CheckExistence", resp, "Failure sending request")
   568  		return
   569  	}
   570  
   571  	result, err = client.CheckExistenceResponder(resp)
   572  	if err != nil {
   573  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CheckExistence", resp, "Failure responding to request")
   574  		return
   575  	}
   576  
   577  	return
   578  }
   579  
   580  // CheckExistencePreparer prepares the CheckExistence request.
   581  func (client DeploymentsClient) CheckExistencePreparer(ctx context.Context, resourceGroupName string, deploymentName string) (*http.Request, error) {
   582  	pathParameters := map[string]interface{}{
   583  		"deploymentName":    autorest.Encode("path", deploymentName),
   584  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   585  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   586  	}
   587  
   588  	const APIVersion = "2019-07-01"
   589  	queryParameters := map[string]interface{}{
   590  		"api-version": APIVersion,
   591  	}
   592  
   593  	preparer := autorest.CreatePreparer(
   594  		autorest.AsHead(),
   595  		autorest.WithBaseURL(client.BaseURI),
   596  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
   597  		autorest.WithQueryParameters(queryParameters))
   598  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   599  }
   600  
   601  // CheckExistenceSender sends the CheckExistence request. The method will close the
   602  // http.Response Body if it receives an error.
   603  func (client DeploymentsClient) CheckExistenceSender(req *http.Request) (*http.Response, error) {
   604  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   605  }
   606  
   607  // CheckExistenceResponder handles the response to the CheckExistence request. The method always
   608  // closes the http.Response Body.
   609  func (client DeploymentsClient) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) {
   610  	err = autorest.Respond(
   611  		resp,
   612  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound),
   613  		autorest.ByClosing())
   614  	result.Response = resp
   615  	return
   616  }
   617  
   618  // CheckExistenceAtManagementGroupScope checks whether the deployment exists.
   619  // Parameters:
   620  // groupID - the management group ID.
   621  // deploymentName - the name of the deployment.
   622  func (client DeploymentsClient) CheckExistenceAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string) (result autorest.Response, err error) {
   623  	if tracing.IsEnabled() {
   624  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CheckExistenceAtManagementGroupScope")
   625  		defer func() {
   626  			sc := -1
   627  			if result.Response != nil {
   628  				sc = result.Response.StatusCode
   629  			}
   630  			tracing.EndSpan(ctx, sc, err)
   631  		}()
   632  	}
   633  	if err := validation.Validate([]validation.Validation{
   634  		{TargetValue: groupID,
   635  			Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil},
   636  				{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   637  		{TargetValue: deploymentName,
   638  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   639  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   640  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   641  		return result, validation.NewError("features.DeploymentsClient", "CheckExistenceAtManagementGroupScope", err.Error())
   642  	}
   643  
   644  	req, err := client.CheckExistenceAtManagementGroupScopePreparer(ctx, groupID, deploymentName)
   645  	if err != nil {
   646  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CheckExistenceAtManagementGroupScope", nil, "Failure preparing request")
   647  		return
   648  	}
   649  
   650  	resp, err := client.CheckExistenceAtManagementGroupScopeSender(req)
   651  	if err != nil {
   652  		result.Response = resp
   653  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CheckExistenceAtManagementGroupScope", resp, "Failure sending request")
   654  		return
   655  	}
   656  
   657  	result, err = client.CheckExistenceAtManagementGroupScopeResponder(resp)
   658  	if err != nil {
   659  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CheckExistenceAtManagementGroupScope", resp, "Failure responding to request")
   660  		return
   661  	}
   662  
   663  	return
   664  }
   665  
   666  // CheckExistenceAtManagementGroupScopePreparer prepares the CheckExistenceAtManagementGroupScope request.
   667  func (client DeploymentsClient) CheckExistenceAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string) (*http.Request, error) {
   668  	pathParameters := map[string]interface{}{
   669  		"deploymentName": autorest.Encode("path", deploymentName),
   670  		"groupId":        autorest.Encode("path", groupID),
   671  	}
   672  
   673  	const APIVersion = "2019-07-01"
   674  	queryParameters := map[string]interface{}{
   675  		"api-version": APIVersion,
   676  	}
   677  
   678  	preparer := autorest.CreatePreparer(
   679  		autorest.AsHead(),
   680  		autorest.WithBaseURL(client.BaseURI),
   681  		autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
   682  		autorest.WithQueryParameters(queryParameters))
   683  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   684  }
   685  
   686  // CheckExistenceAtManagementGroupScopeSender sends the CheckExistenceAtManagementGroupScope request. The method will close the
   687  // http.Response Body if it receives an error.
   688  func (client DeploymentsClient) CheckExistenceAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) {
   689  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   690  }
   691  
   692  // CheckExistenceAtManagementGroupScopeResponder handles the response to the CheckExistenceAtManagementGroupScope request. The method always
   693  // closes the http.Response Body.
   694  func (client DeploymentsClient) CheckExistenceAtManagementGroupScopeResponder(resp *http.Response) (result autorest.Response, err error) {
   695  	err = autorest.Respond(
   696  		resp,
   697  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound),
   698  		autorest.ByClosing())
   699  	result.Response = resp
   700  	return
   701  }
   702  
   703  // CheckExistenceAtScope checks whether the deployment exists.
   704  // Parameters:
   705  // scope - the scope of a deployment.
   706  // deploymentName - the name of the deployment.
   707  func (client DeploymentsClient) CheckExistenceAtScope(ctx context.Context, scope string, deploymentName string) (result autorest.Response, err error) {
   708  	if tracing.IsEnabled() {
   709  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CheckExistenceAtScope")
   710  		defer func() {
   711  			sc := -1
   712  			if result.Response != nil {
   713  				sc = result.Response.StatusCode
   714  			}
   715  			tracing.EndSpan(ctx, sc, err)
   716  		}()
   717  	}
   718  	if err := validation.Validate([]validation.Validation{
   719  		{TargetValue: deploymentName,
   720  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   721  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   722  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   723  		return result, validation.NewError("features.DeploymentsClient", "CheckExistenceAtScope", err.Error())
   724  	}
   725  
   726  	req, err := client.CheckExistenceAtScopePreparer(ctx, scope, deploymentName)
   727  	if err != nil {
   728  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CheckExistenceAtScope", nil, "Failure preparing request")
   729  		return
   730  	}
   731  
   732  	resp, err := client.CheckExistenceAtScopeSender(req)
   733  	if err != nil {
   734  		result.Response = resp
   735  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CheckExistenceAtScope", resp, "Failure sending request")
   736  		return
   737  	}
   738  
   739  	result, err = client.CheckExistenceAtScopeResponder(resp)
   740  	if err != nil {
   741  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CheckExistenceAtScope", resp, "Failure responding to request")
   742  		return
   743  	}
   744  
   745  	return
   746  }
   747  
   748  // CheckExistenceAtScopePreparer prepares the CheckExistenceAtScope request.
   749  func (client DeploymentsClient) CheckExistenceAtScopePreparer(ctx context.Context, scope string, deploymentName string) (*http.Request, error) {
   750  	pathParameters := map[string]interface{}{
   751  		"deploymentName": autorest.Encode("path", deploymentName),
   752  		"scope":          autorest.Encode("path", scope),
   753  	}
   754  
   755  	const APIVersion = "2019-07-01"
   756  	queryParameters := map[string]interface{}{
   757  		"api-version": APIVersion,
   758  	}
   759  
   760  	preparer := autorest.CreatePreparer(
   761  		autorest.AsHead(),
   762  		autorest.WithBaseURL(client.BaseURI),
   763  		autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
   764  		autorest.WithQueryParameters(queryParameters))
   765  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   766  }
   767  
   768  // CheckExistenceAtScopeSender sends the CheckExistenceAtScope request. The method will close the
   769  // http.Response Body if it receives an error.
   770  func (client DeploymentsClient) CheckExistenceAtScopeSender(req *http.Request) (*http.Response, error) {
   771  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   772  }
   773  
   774  // CheckExistenceAtScopeResponder handles the response to the CheckExistenceAtScope request. The method always
   775  // closes the http.Response Body.
   776  func (client DeploymentsClient) CheckExistenceAtScopeResponder(resp *http.Response) (result autorest.Response, err error) {
   777  	err = autorest.Respond(
   778  		resp,
   779  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound),
   780  		autorest.ByClosing())
   781  	result.Response = resp
   782  	return
   783  }
   784  
   785  // CheckExistenceAtSubscriptionScope checks whether the deployment exists.
   786  // Parameters:
   787  // deploymentName - the name of the deployment.
   788  func (client DeploymentsClient) CheckExistenceAtSubscriptionScope(ctx context.Context, deploymentName string) (result autorest.Response, err error) {
   789  	if tracing.IsEnabled() {
   790  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CheckExistenceAtSubscriptionScope")
   791  		defer func() {
   792  			sc := -1
   793  			if result.Response != nil {
   794  				sc = result.Response.StatusCode
   795  			}
   796  			tracing.EndSpan(ctx, sc, err)
   797  		}()
   798  	}
   799  	if err := validation.Validate([]validation.Validation{
   800  		{TargetValue: deploymentName,
   801  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   802  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   803  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   804  		return result, validation.NewError("features.DeploymentsClient", "CheckExistenceAtSubscriptionScope", err.Error())
   805  	}
   806  
   807  	req, err := client.CheckExistenceAtSubscriptionScopePreparer(ctx, deploymentName)
   808  	if err != nil {
   809  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CheckExistenceAtSubscriptionScope", nil, "Failure preparing request")
   810  		return
   811  	}
   812  
   813  	resp, err := client.CheckExistenceAtSubscriptionScopeSender(req)
   814  	if err != nil {
   815  		result.Response = resp
   816  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CheckExistenceAtSubscriptionScope", resp, "Failure sending request")
   817  		return
   818  	}
   819  
   820  	result, err = client.CheckExistenceAtSubscriptionScopeResponder(resp)
   821  	if err != nil {
   822  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CheckExistenceAtSubscriptionScope", resp, "Failure responding to request")
   823  		return
   824  	}
   825  
   826  	return
   827  }
   828  
   829  // CheckExistenceAtSubscriptionScopePreparer prepares the CheckExistenceAtSubscriptionScope request.
   830  func (client DeploymentsClient) CheckExistenceAtSubscriptionScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) {
   831  	pathParameters := map[string]interface{}{
   832  		"deploymentName": autorest.Encode("path", deploymentName),
   833  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   834  	}
   835  
   836  	const APIVersion = "2019-07-01"
   837  	queryParameters := map[string]interface{}{
   838  		"api-version": APIVersion,
   839  	}
   840  
   841  	preparer := autorest.CreatePreparer(
   842  		autorest.AsHead(),
   843  		autorest.WithBaseURL(client.BaseURI),
   844  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
   845  		autorest.WithQueryParameters(queryParameters))
   846  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   847  }
   848  
   849  // CheckExistenceAtSubscriptionScopeSender sends the CheckExistenceAtSubscriptionScope request. The method will close the
   850  // http.Response Body if it receives an error.
   851  func (client DeploymentsClient) CheckExistenceAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) {
   852  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   853  }
   854  
   855  // CheckExistenceAtSubscriptionScopeResponder handles the response to the CheckExistenceAtSubscriptionScope request. The method always
   856  // closes the http.Response Body.
   857  func (client DeploymentsClient) CheckExistenceAtSubscriptionScopeResponder(resp *http.Response) (result autorest.Response, err error) {
   858  	err = autorest.Respond(
   859  		resp,
   860  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound),
   861  		autorest.ByClosing())
   862  	result.Response = resp
   863  	return
   864  }
   865  
   866  // CheckExistenceAtTenantScope checks whether the deployment exists.
   867  // Parameters:
   868  // deploymentName - the name of the deployment.
   869  func (client DeploymentsClient) CheckExistenceAtTenantScope(ctx context.Context, deploymentName string) (result autorest.Response, err error) {
   870  	if tracing.IsEnabled() {
   871  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CheckExistenceAtTenantScope")
   872  		defer func() {
   873  			sc := -1
   874  			if result.Response != nil {
   875  				sc = result.Response.StatusCode
   876  			}
   877  			tracing.EndSpan(ctx, sc, err)
   878  		}()
   879  	}
   880  	if err := validation.Validate([]validation.Validation{
   881  		{TargetValue: deploymentName,
   882  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   883  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   884  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   885  		return result, validation.NewError("features.DeploymentsClient", "CheckExistenceAtTenantScope", err.Error())
   886  	}
   887  
   888  	req, err := client.CheckExistenceAtTenantScopePreparer(ctx, deploymentName)
   889  	if err != nil {
   890  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CheckExistenceAtTenantScope", nil, "Failure preparing request")
   891  		return
   892  	}
   893  
   894  	resp, err := client.CheckExistenceAtTenantScopeSender(req)
   895  	if err != nil {
   896  		result.Response = resp
   897  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CheckExistenceAtTenantScope", resp, "Failure sending request")
   898  		return
   899  	}
   900  
   901  	result, err = client.CheckExistenceAtTenantScopeResponder(resp)
   902  	if err != nil {
   903  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CheckExistenceAtTenantScope", resp, "Failure responding to request")
   904  		return
   905  	}
   906  
   907  	return
   908  }
   909  
   910  // CheckExistenceAtTenantScopePreparer prepares the CheckExistenceAtTenantScope request.
   911  func (client DeploymentsClient) CheckExistenceAtTenantScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) {
   912  	pathParameters := map[string]interface{}{
   913  		"deploymentName": autorest.Encode("path", deploymentName),
   914  	}
   915  
   916  	const APIVersion = "2019-07-01"
   917  	queryParameters := map[string]interface{}{
   918  		"api-version": APIVersion,
   919  	}
   920  
   921  	preparer := autorest.CreatePreparer(
   922  		autorest.AsHead(),
   923  		autorest.WithBaseURL(client.BaseURI),
   924  		autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
   925  		autorest.WithQueryParameters(queryParameters))
   926  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   927  }
   928  
   929  // CheckExistenceAtTenantScopeSender sends the CheckExistenceAtTenantScope request. The method will close the
   930  // http.Response Body if it receives an error.
   931  func (client DeploymentsClient) CheckExistenceAtTenantScopeSender(req *http.Request) (*http.Response, error) {
   932  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   933  }
   934  
   935  // CheckExistenceAtTenantScopeResponder handles the response to the CheckExistenceAtTenantScope request. The method always
   936  // closes the http.Response Body.
   937  func (client DeploymentsClient) CheckExistenceAtTenantScopeResponder(resp *http.Response) (result autorest.Response, err error) {
   938  	err = autorest.Respond(
   939  		resp,
   940  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound),
   941  		autorest.ByClosing())
   942  	result.Response = resp
   943  	return
   944  }
   945  
   946  // CreateOrUpdate you can provide the template and parameters directly in the request or link to JSON files.
   947  // Parameters:
   948  // resourceGroupName - the name of the resource group to deploy the resources to. The name is case insensitive.
   949  // The resource group must already exist.
   950  // deploymentName - the name of the deployment.
   951  // parameters - additional parameters supplied to the operation.
   952  func (client DeploymentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment) (result DeploymentsCreateOrUpdateFuture, err error) {
   953  	if tracing.IsEnabled() {
   954  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CreateOrUpdate")
   955  		defer func() {
   956  			sc := -1
   957  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   958  				sc = result.FutureAPI.Response().StatusCode
   959  			}
   960  			tracing.EndSpan(ctx, sc, err)
   961  		}()
   962  	}
   963  	if err := validation.Validate([]validation.Validation{
   964  		{TargetValue: resourceGroupName,
   965  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   966  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
   967  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}},
   968  		{TargetValue: deploymentName,
   969  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   970  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   971  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
   972  		{TargetValue: parameters,
   973  			Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true,
   974  				Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false,
   975  					Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
   976  					{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false,
   977  						Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
   978  				}}}}}); err != nil {
   979  		return result, validation.NewError("features.DeploymentsClient", "CreateOrUpdate", err.Error())
   980  	}
   981  
   982  	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, deploymentName, parameters)
   983  	if err != nil {
   984  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request")
   985  		return
   986  	}
   987  
   988  	result, err = client.CreateOrUpdateSender(req)
   989  	if err != nil {
   990  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
   991  		return
   992  	}
   993  
   994  	return
   995  }
   996  
   997  // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
   998  func (client DeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment) (*http.Request, error) {
   999  	pathParameters := map[string]interface{}{
  1000  		"deploymentName":    autorest.Encode("path", deploymentName),
  1001  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1002  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1003  	}
  1004  
  1005  	const APIVersion = "2019-07-01"
  1006  	queryParameters := map[string]interface{}{
  1007  		"api-version": APIVersion,
  1008  	}
  1009  
  1010  	preparer := autorest.CreatePreparer(
  1011  		autorest.AsContentType("application/json; charset=utf-8"),
  1012  		autorest.AsPut(),
  1013  		autorest.WithBaseURL(client.BaseURI),
  1014  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
  1015  		autorest.WithJSON(parameters),
  1016  		autorest.WithQueryParameters(queryParameters))
  1017  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1018  }
  1019  
  1020  // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
  1021  // http.Response Body if it receives an error.
  1022  func (client DeploymentsClient) CreateOrUpdateSender(req *http.Request) (future DeploymentsCreateOrUpdateFuture, err error) {
  1023  	var resp *http.Response
  1024  	future.FutureAPI = &azure.Future{}
  1025  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1026  	if err != nil {
  1027  		return
  1028  	}
  1029  	var azf azure.Future
  1030  	azf, err = azure.NewFutureFromResponse(resp)
  1031  	future.FutureAPI = &azf
  1032  	future.Result = future.result
  1033  	return
  1034  }
  1035  
  1036  // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
  1037  // closes the http.Response Body.
  1038  func (client DeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (result DeploymentExtended, err error) {
  1039  	err = autorest.Respond(
  1040  		resp,
  1041  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
  1042  		autorest.ByUnmarshallingJSON(&result),
  1043  		autorest.ByClosing())
  1044  	result.Response = autorest.Response{Response: resp}
  1045  	return
  1046  }
  1047  
  1048  // CreateOrUpdateAtManagementGroupScope you can provide the template and parameters directly in the request or link to
  1049  // JSON files.
  1050  // Parameters:
  1051  // groupID - the management group ID.
  1052  // deploymentName - the name of the deployment.
  1053  // parameters - additional parameters supplied to the operation.
  1054  func (client DeploymentsClient) CreateOrUpdateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters Deployment) (result DeploymentsCreateOrUpdateAtManagementGroupScopeFuture, err error) {
  1055  	if tracing.IsEnabled() {
  1056  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CreateOrUpdateAtManagementGroupScope")
  1057  		defer func() {
  1058  			sc := -1
  1059  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1060  				sc = result.FutureAPI.Response().StatusCode
  1061  			}
  1062  			tracing.EndSpan(ctx, sc, err)
  1063  		}()
  1064  	}
  1065  	if err := validation.Validate([]validation.Validation{
  1066  		{TargetValue: groupID,
  1067  			Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1068  				{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1069  		{TargetValue: deploymentName,
  1070  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  1071  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1072  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  1073  		{TargetValue: parameters,
  1074  			Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true,
  1075  				Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false,
  1076  					Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  1077  					{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false,
  1078  						Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  1079  				}}}}}); err != nil {
  1080  		return result, validation.NewError("features.DeploymentsClient", "CreateOrUpdateAtManagementGroupScope", err.Error())
  1081  	}
  1082  
  1083  	req, err := client.CreateOrUpdateAtManagementGroupScopePreparer(ctx, groupID, deploymentName, parameters)
  1084  	if err != nil {
  1085  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CreateOrUpdateAtManagementGroupScope", nil, "Failure preparing request")
  1086  		return
  1087  	}
  1088  
  1089  	result, err = client.CreateOrUpdateAtManagementGroupScopeSender(req)
  1090  	if err != nil {
  1091  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CreateOrUpdateAtManagementGroupScope", result.Response(), "Failure sending request")
  1092  		return
  1093  	}
  1094  
  1095  	return
  1096  }
  1097  
  1098  // CreateOrUpdateAtManagementGroupScopePreparer prepares the CreateOrUpdateAtManagementGroupScope request.
  1099  func (client DeploymentsClient) CreateOrUpdateAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string, parameters Deployment) (*http.Request, error) {
  1100  	pathParameters := map[string]interface{}{
  1101  		"deploymentName": autorest.Encode("path", deploymentName),
  1102  		"groupId":        autorest.Encode("path", groupID),
  1103  	}
  1104  
  1105  	const APIVersion = "2019-07-01"
  1106  	queryParameters := map[string]interface{}{
  1107  		"api-version": APIVersion,
  1108  	}
  1109  
  1110  	preparer := autorest.CreatePreparer(
  1111  		autorest.AsContentType("application/json; charset=utf-8"),
  1112  		autorest.AsPut(),
  1113  		autorest.WithBaseURL(client.BaseURI),
  1114  		autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
  1115  		autorest.WithJSON(parameters),
  1116  		autorest.WithQueryParameters(queryParameters))
  1117  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1118  }
  1119  
  1120  // CreateOrUpdateAtManagementGroupScopeSender sends the CreateOrUpdateAtManagementGroupScope request. The method will close the
  1121  // http.Response Body if it receives an error.
  1122  func (client DeploymentsClient) CreateOrUpdateAtManagementGroupScopeSender(req *http.Request) (future DeploymentsCreateOrUpdateAtManagementGroupScopeFuture, err error) {
  1123  	var resp *http.Response
  1124  	future.FutureAPI = &azure.Future{}
  1125  	resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1126  	if err != nil {
  1127  		return
  1128  	}
  1129  	var azf azure.Future
  1130  	azf, err = azure.NewFutureFromResponse(resp)
  1131  	future.FutureAPI = &azf
  1132  	future.Result = future.result
  1133  	return
  1134  }
  1135  
  1136  // CreateOrUpdateAtManagementGroupScopeResponder handles the response to the CreateOrUpdateAtManagementGroupScope request. The method always
  1137  // closes the http.Response Body.
  1138  func (client DeploymentsClient) CreateOrUpdateAtManagementGroupScopeResponder(resp *http.Response) (result DeploymentExtended, err error) {
  1139  	err = autorest.Respond(
  1140  		resp,
  1141  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
  1142  		autorest.ByUnmarshallingJSON(&result),
  1143  		autorest.ByClosing())
  1144  	result.Response = autorest.Response{Response: resp}
  1145  	return
  1146  }
  1147  
  1148  // CreateOrUpdateAtScope you can provide the template and parameters directly in the request or link to JSON files.
  1149  // Parameters:
  1150  // scope - the scope of a deployment.
  1151  // deploymentName - the name of the deployment.
  1152  // parameters - additional parameters supplied to the operation.
  1153  func (client DeploymentsClient) CreateOrUpdateAtScope(ctx context.Context, scope string, deploymentName string, parameters Deployment) (result DeploymentsCreateOrUpdateAtScopeFuture, err error) {
  1154  	if tracing.IsEnabled() {
  1155  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CreateOrUpdateAtScope")
  1156  		defer func() {
  1157  			sc := -1
  1158  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1159  				sc = result.FutureAPI.Response().StatusCode
  1160  			}
  1161  			tracing.EndSpan(ctx, sc, err)
  1162  		}()
  1163  	}
  1164  	if err := validation.Validate([]validation.Validation{
  1165  		{TargetValue: deploymentName,
  1166  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  1167  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1168  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  1169  		{TargetValue: parameters,
  1170  			Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true,
  1171  				Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false,
  1172  					Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  1173  					{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false,
  1174  						Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  1175  				}}}}}); err != nil {
  1176  		return result, validation.NewError("features.DeploymentsClient", "CreateOrUpdateAtScope", err.Error())
  1177  	}
  1178  
  1179  	req, err := client.CreateOrUpdateAtScopePreparer(ctx, scope, deploymentName, parameters)
  1180  	if err != nil {
  1181  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CreateOrUpdateAtScope", nil, "Failure preparing request")
  1182  		return
  1183  	}
  1184  
  1185  	result, err = client.CreateOrUpdateAtScopeSender(req)
  1186  	if err != nil {
  1187  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CreateOrUpdateAtScope", result.Response(), "Failure sending request")
  1188  		return
  1189  	}
  1190  
  1191  	return
  1192  }
  1193  
  1194  // CreateOrUpdateAtScopePreparer prepares the CreateOrUpdateAtScope request.
  1195  func (client DeploymentsClient) CreateOrUpdateAtScopePreparer(ctx context.Context, scope string, deploymentName string, parameters Deployment) (*http.Request, error) {
  1196  	pathParameters := map[string]interface{}{
  1197  		"deploymentName": autorest.Encode("path", deploymentName),
  1198  		"scope":          autorest.Encode("path", scope),
  1199  	}
  1200  
  1201  	const APIVersion = "2019-07-01"
  1202  	queryParameters := map[string]interface{}{
  1203  		"api-version": APIVersion,
  1204  	}
  1205  
  1206  	preparer := autorest.CreatePreparer(
  1207  		autorest.AsContentType("application/json; charset=utf-8"),
  1208  		autorest.AsPut(),
  1209  		autorest.WithBaseURL(client.BaseURI),
  1210  		autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
  1211  		autorest.WithJSON(parameters),
  1212  		autorest.WithQueryParameters(queryParameters))
  1213  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1214  }
  1215  
  1216  // CreateOrUpdateAtScopeSender sends the CreateOrUpdateAtScope request. The method will close the
  1217  // http.Response Body if it receives an error.
  1218  func (client DeploymentsClient) CreateOrUpdateAtScopeSender(req *http.Request) (future DeploymentsCreateOrUpdateAtScopeFuture, err error) {
  1219  	var resp *http.Response
  1220  	future.FutureAPI = &azure.Future{}
  1221  	resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1222  	if err != nil {
  1223  		return
  1224  	}
  1225  	var azf azure.Future
  1226  	azf, err = azure.NewFutureFromResponse(resp)
  1227  	future.FutureAPI = &azf
  1228  	future.Result = future.result
  1229  	return
  1230  }
  1231  
  1232  // CreateOrUpdateAtScopeResponder handles the response to the CreateOrUpdateAtScope request. The method always
  1233  // closes the http.Response Body.
  1234  func (client DeploymentsClient) CreateOrUpdateAtScopeResponder(resp *http.Response) (result DeploymentExtended, err error) {
  1235  	err = autorest.Respond(
  1236  		resp,
  1237  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
  1238  		autorest.ByUnmarshallingJSON(&result),
  1239  		autorest.ByClosing())
  1240  	result.Response = autorest.Response{Response: resp}
  1241  	return
  1242  }
  1243  
  1244  // CreateOrUpdateAtSubscriptionScope you can provide the template and parameters directly in the request or link to
  1245  // JSON files.
  1246  // Parameters:
  1247  // deploymentName - the name of the deployment.
  1248  // parameters - additional parameters supplied to the operation.
  1249  func (client DeploymentsClient) CreateOrUpdateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters Deployment) (result DeploymentsCreateOrUpdateAtSubscriptionScopeFuture, err error) {
  1250  	if tracing.IsEnabled() {
  1251  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CreateOrUpdateAtSubscriptionScope")
  1252  		defer func() {
  1253  			sc := -1
  1254  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1255  				sc = result.FutureAPI.Response().StatusCode
  1256  			}
  1257  			tracing.EndSpan(ctx, sc, err)
  1258  		}()
  1259  	}
  1260  	if err := validation.Validate([]validation.Validation{
  1261  		{TargetValue: deploymentName,
  1262  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  1263  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1264  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  1265  		{TargetValue: parameters,
  1266  			Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true,
  1267  				Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false,
  1268  					Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  1269  					{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false,
  1270  						Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  1271  				}}}}}); err != nil {
  1272  		return result, validation.NewError("features.DeploymentsClient", "CreateOrUpdateAtSubscriptionScope", err.Error())
  1273  	}
  1274  
  1275  	req, err := client.CreateOrUpdateAtSubscriptionScopePreparer(ctx, deploymentName, parameters)
  1276  	if err != nil {
  1277  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CreateOrUpdateAtSubscriptionScope", nil, "Failure preparing request")
  1278  		return
  1279  	}
  1280  
  1281  	result, err = client.CreateOrUpdateAtSubscriptionScopeSender(req)
  1282  	if err != nil {
  1283  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CreateOrUpdateAtSubscriptionScope", result.Response(), "Failure sending request")
  1284  		return
  1285  	}
  1286  
  1287  	return
  1288  }
  1289  
  1290  // CreateOrUpdateAtSubscriptionScopePreparer prepares the CreateOrUpdateAtSubscriptionScope request.
  1291  func (client DeploymentsClient) CreateOrUpdateAtSubscriptionScopePreparer(ctx context.Context, deploymentName string, parameters Deployment) (*http.Request, error) {
  1292  	pathParameters := map[string]interface{}{
  1293  		"deploymentName": autorest.Encode("path", deploymentName),
  1294  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
  1295  	}
  1296  
  1297  	const APIVersion = "2019-07-01"
  1298  	queryParameters := map[string]interface{}{
  1299  		"api-version": APIVersion,
  1300  	}
  1301  
  1302  	preparer := autorest.CreatePreparer(
  1303  		autorest.AsContentType("application/json; charset=utf-8"),
  1304  		autorest.AsPut(),
  1305  		autorest.WithBaseURL(client.BaseURI),
  1306  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
  1307  		autorest.WithJSON(parameters),
  1308  		autorest.WithQueryParameters(queryParameters))
  1309  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1310  }
  1311  
  1312  // CreateOrUpdateAtSubscriptionScopeSender sends the CreateOrUpdateAtSubscriptionScope request. The method will close the
  1313  // http.Response Body if it receives an error.
  1314  func (client DeploymentsClient) CreateOrUpdateAtSubscriptionScopeSender(req *http.Request) (future DeploymentsCreateOrUpdateAtSubscriptionScopeFuture, err error) {
  1315  	var resp *http.Response
  1316  	future.FutureAPI = &azure.Future{}
  1317  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1318  	if err != nil {
  1319  		return
  1320  	}
  1321  	var azf azure.Future
  1322  	azf, err = azure.NewFutureFromResponse(resp)
  1323  	future.FutureAPI = &azf
  1324  	future.Result = future.result
  1325  	return
  1326  }
  1327  
  1328  // CreateOrUpdateAtSubscriptionScopeResponder handles the response to the CreateOrUpdateAtSubscriptionScope request. The method always
  1329  // closes the http.Response Body.
  1330  func (client DeploymentsClient) CreateOrUpdateAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentExtended, err error) {
  1331  	err = autorest.Respond(
  1332  		resp,
  1333  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
  1334  		autorest.ByUnmarshallingJSON(&result),
  1335  		autorest.ByClosing())
  1336  	result.Response = autorest.Response{Response: resp}
  1337  	return
  1338  }
  1339  
  1340  // CreateOrUpdateAtTenantScope you can provide the template and parameters directly in the request or link to JSON
  1341  // files.
  1342  // Parameters:
  1343  // deploymentName - the name of the deployment.
  1344  // parameters - additional parameters supplied to the operation.
  1345  func (client DeploymentsClient) CreateOrUpdateAtTenantScope(ctx context.Context, deploymentName string, parameters Deployment) (result DeploymentsCreateOrUpdateAtTenantScopeFuture, err error) {
  1346  	if tracing.IsEnabled() {
  1347  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CreateOrUpdateAtTenantScope")
  1348  		defer func() {
  1349  			sc := -1
  1350  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1351  				sc = result.FutureAPI.Response().StatusCode
  1352  			}
  1353  			tracing.EndSpan(ctx, sc, err)
  1354  		}()
  1355  	}
  1356  	if err := validation.Validate([]validation.Validation{
  1357  		{TargetValue: deploymentName,
  1358  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  1359  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1360  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  1361  		{TargetValue: parameters,
  1362  			Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true,
  1363  				Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false,
  1364  					Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  1365  					{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false,
  1366  						Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  1367  				}}}}}); err != nil {
  1368  		return result, validation.NewError("features.DeploymentsClient", "CreateOrUpdateAtTenantScope", err.Error())
  1369  	}
  1370  
  1371  	req, err := client.CreateOrUpdateAtTenantScopePreparer(ctx, deploymentName, parameters)
  1372  	if err != nil {
  1373  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CreateOrUpdateAtTenantScope", nil, "Failure preparing request")
  1374  		return
  1375  	}
  1376  
  1377  	result, err = client.CreateOrUpdateAtTenantScopeSender(req)
  1378  	if err != nil {
  1379  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "CreateOrUpdateAtTenantScope", result.Response(), "Failure sending request")
  1380  		return
  1381  	}
  1382  
  1383  	return
  1384  }
  1385  
  1386  // CreateOrUpdateAtTenantScopePreparer prepares the CreateOrUpdateAtTenantScope request.
  1387  func (client DeploymentsClient) CreateOrUpdateAtTenantScopePreparer(ctx context.Context, deploymentName string, parameters Deployment) (*http.Request, error) {
  1388  	pathParameters := map[string]interface{}{
  1389  		"deploymentName": autorest.Encode("path", deploymentName),
  1390  	}
  1391  
  1392  	const APIVersion = "2019-07-01"
  1393  	queryParameters := map[string]interface{}{
  1394  		"api-version": APIVersion,
  1395  	}
  1396  
  1397  	preparer := autorest.CreatePreparer(
  1398  		autorest.AsContentType("application/json; charset=utf-8"),
  1399  		autorest.AsPut(),
  1400  		autorest.WithBaseURL(client.BaseURI),
  1401  		autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
  1402  		autorest.WithJSON(parameters),
  1403  		autorest.WithQueryParameters(queryParameters))
  1404  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1405  }
  1406  
  1407  // CreateOrUpdateAtTenantScopeSender sends the CreateOrUpdateAtTenantScope request. The method will close the
  1408  // http.Response Body if it receives an error.
  1409  func (client DeploymentsClient) CreateOrUpdateAtTenantScopeSender(req *http.Request) (future DeploymentsCreateOrUpdateAtTenantScopeFuture, err error) {
  1410  	var resp *http.Response
  1411  	future.FutureAPI = &azure.Future{}
  1412  	resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1413  	if err != nil {
  1414  		return
  1415  	}
  1416  	var azf azure.Future
  1417  	azf, err = azure.NewFutureFromResponse(resp)
  1418  	future.FutureAPI = &azf
  1419  	future.Result = future.result
  1420  	return
  1421  }
  1422  
  1423  // CreateOrUpdateAtTenantScopeResponder handles the response to the CreateOrUpdateAtTenantScope request. The method always
  1424  // closes the http.Response Body.
  1425  func (client DeploymentsClient) CreateOrUpdateAtTenantScopeResponder(resp *http.Response) (result DeploymentExtended, err error) {
  1426  	err = autorest.Respond(
  1427  		resp,
  1428  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
  1429  		autorest.ByUnmarshallingJSON(&result),
  1430  		autorest.ByClosing())
  1431  	result.Response = autorest.Response{Response: resp}
  1432  	return
  1433  }
  1434  
  1435  // Delete a template deployment that is currently running cannot be deleted. Deleting a template deployment removes the
  1436  // associated deployment operations. Deleting a template deployment does not affect the state of the resource group.
  1437  // This is an asynchronous operation that returns a status of 202 until the template deployment is successfully
  1438  // deleted. The Location response header contains the URI that is used to obtain the status of the process. While the
  1439  // process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the
  1440  // URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the
  1441  // Location header returns an error-level status code.
  1442  // Parameters:
  1443  // resourceGroupName - the name of the resource group with the deployment to delete. The name is case
  1444  // insensitive.
  1445  // deploymentName - the name of the deployment.
  1446  func (client DeploymentsClient) Delete(ctx context.Context, resourceGroupName string, deploymentName string) (result DeploymentsDeleteFuture, err error) {
  1447  	if tracing.IsEnabled() {
  1448  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Delete")
  1449  		defer func() {
  1450  			sc := -1
  1451  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1452  				sc = result.FutureAPI.Response().StatusCode
  1453  			}
  1454  			tracing.EndSpan(ctx, sc, err)
  1455  		}()
  1456  	}
  1457  	if err := validation.Validate([]validation.Validation{
  1458  		{TargetValue: resourceGroupName,
  1459  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1460  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1461  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}},
  1462  		{TargetValue: deploymentName,
  1463  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  1464  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1465  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
  1466  		return result, validation.NewError("features.DeploymentsClient", "Delete", err.Error())
  1467  	}
  1468  
  1469  	req, err := client.DeletePreparer(ctx, resourceGroupName, deploymentName)
  1470  	if err != nil {
  1471  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "Delete", nil, "Failure preparing request")
  1472  		return
  1473  	}
  1474  
  1475  	result, err = client.DeleteSender(req)
  1476  	if err != nil {
  1477  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "Delete", result.Response(), "Failure sending request")
  1478  		return
  1479  	}
  1480  
  1481  	return
  1482  }
  1483  
  1484  // DeletePreparer prepares the Delete request.
  1485  func (client DeploymentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, deploymentName string) (*http.Request, error) {
  1486  	pathParameters := map[string]interface{}{
  1487  		"deploymentName":    autorest.Encode("path", deploymentName),
  1488  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1489  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1490  	}
  1491  
  1492  	const APIVersion = "2019-07-01"
  1493  	queryParameters := map[string]interface{}{
  1494  		"api-version": APIVersion,
  1495  	}
  1496  
  1497  	preparer := autorest.CreatePreparer(
  1498  		autorest.AsDelete(),
  1499  		autorest.WithBaseURL(client.BaseURI),
  1500  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
  1501  		autorest.WithQueryParameters(queryParameters))
  1502  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1503  }
  1504  
  1505  // DeleteSender sends the Delete request. The method will close the
  1506  // http.Response Body if it receives an error.
  1507  func (client DeploymentsClient) DeleteSender(req *http.Request) (future DeploymentsDeleteFuture, err error) {
  1508  	var resp *http.Response
  1509  	future.FutureAPI = &azure.Future{}
  1510  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1511  	if err != nil {
  1512  		return
  1513  	}
  1514  	var azf azure.Future
  1515  	azf, err = azure.NewFutureFromResponse(resp)
  1516  	future.FutureAPI = &azf
  1517  	future.Result = future.result
  1518  	return
  1519  }
  1520  
  1521  // DeleteResponder handles the response to the Delete request. The method always
  1522  // closes the http.Response Body.
  1523  func (client DeploymentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
  1524  	err = autorest.Respond(
  1525  		resp,
  1526  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
  1527  		autorest.ByClosing())
  1528  	result.Response = resp
  1529  	return
  1530  }
  1531  
  1532  // DeleteAtManagementGroupScope a template deployment that is currently running cannot be deleted. Deleting a template
  1533  // deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of
  1534  // 202 until the template deployment is successfully deleted. The Location response header contains the URI that is
  1535  // used to obtain the status of the process. While the process is running, a call to the URI in the Location header
  1536  // returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on
  1537  // success. If the asynchronous request failed, the URI in the Location header returns an error-level status code.
  1538  // Parameters:
  1539  // groupID - the management group ID.
  1540  // deploymentName - the name of the deployment.
  1541  func (client DeploymentsClient) DeleteAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string) (result DeploymentsDeleteAtManagementGroupScopeFuture, err error) {
  1542  	if tracing.IsEnabled() {
  1543  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.DeleteAtManagementGroupScope")
  1544  		defer func() {
  1545  			sc := -1
  1546  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1547  				sc = result.FutureAPI.Response().StatusCode
  1548  			}
  1549  			tracing.EndSpan(ctx, sc, err)
  1550  		}()
  1551  	}
  1552  	if err := validation.Validate([]validation.Validation{
  1553  		{TargetValue: groupID,
  1554  			Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1555  				{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1556  		{TargetValue: deploymentName,
  1557  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  1558  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1559  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
  1560  		return result, validation.NewError("features.DeploymentsClient", "DeleteAtManagementGroupScope", err.Error())
  1561  	}
  1562  
  1563  	req, err := client.DeleteAtManagementGroupScopePreparer(ctx, groupID, deploymentName)
  1564  	if err != nil {
  1565  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "DeleteAtManagementGroupScope", nil, "Failure preparing request")
  1566  		return
  1567  	}
  1568  
  1569  	result, err = client.DeleteAtManagementGroupScopeSender(req)
  1570  	if err != nil {
  1571  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "DeleteAtManagementGroupScope", result.Response(), "Failure sending request")
  1572  		return
  1573  	}
  1574  
  1575  	return
  1576  }
  1577  
  1578  // DeleteAtManagementGroupScopePreparer prepares the DeleteAtManagementGroupScope request.
  1579  func (client DeploymentsClient) DeleteAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string) (*http.Request, error) {
  1580  	pathParameters := map[string]interface{}{
  1581  		"deploymentName": autorest.Encode("path", deploymentName),
  1582  		"groupId":        autorest.Encode("path", groupID),
  1583  	}
  1584  
  1585  	const APIVersion = "2019-07-01"
  1586  	queryParameters := map[string]interface{}{
  1587  		"api-version": APIVersion,
  1588  	}
  1589  
  1590  	preparer := autorest.CreatePreparer(
  1591  		autorest.AsDelete(),
  1592  		autorest.WithBaseURL(client.BaseURI),
  1593  		autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
  1594  		autorest.WithQueryParameters(queryParameters))
  1595  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1596  }
  1597  
  1598  // DeleteAtManagementGroupScopeSender sends the DeleteAtManagementGroupScope request. The method will close the
  1599  // http.Response Body if it receives an error.
  1600  func (client DeploymentsClient) DeleteAtManagementGroupScopeSender(req *http.Request) (future DeploymentsDeleteAtManagementGroupScopeFuture, err error) {
  1601  	var resp *http.Response
  1602  	future.FutureAPI = &azure.Future{}
  1603  	resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1604  	if err != nil {
  1605  		return
  1606  	}
  1607  	var azf azure.Future
  1608  	azf, err = azure.NewFutureFromResponse(resp)
  1609  	future.FutureAPI = &azf
  1610  	future.Result = future.result
  1611  	return
  1612  }
  1613  
  1614  // DeleteAtManagementGroupScopeResponder handles the response to the DeleteAtManagementGroupScope request. The method always
  1615  // closes the http.Response Body.
  1616  func (client DeploymentsClient) DeleteAtManagementGroupScopeResponder(resp *http.Response) (result autorest.Response, err error) {
  1617  	err = autorest.Respond(
  1618  		resp,
  1619  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
  1620  		autorest.ByClosing())
  1621  	result.Response = resp
  1622  	return
  1623  }
  1624  
  1625  // DeleteAtScope a template deployment that is currently running cannot be deleted. Deleting a template deployment
  1626  // removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until
  1627  // the template deployment is successfully deleted. The Location response header contains the URI that is used to
  1628  // obtain the status of the process. While the process is running, a call to the URI in the Location header returns a
  1629  // status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the
  1630  // asynchronous request failed, the URI in the Location header returns an error-level status code.
  1631  // Parameters:
  1632  // scope - the scope of a deployment.
  1633  // deploymentName - the name of the deployment.
  1634  func (client DeploymentsClient) DeleteAtScope(ctx context.Context, scope string, deploymentName string) (result DeploymentsDeleteAtScopeFuture, err error) {
  1635  	if tracing.IsEnabled() {
  1636  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.DeleteAtScope")
  1637  		defer func() {
  1638  			sc := -1
  1639  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1640  				sc = result.FutureAPI.Response().StatusCode
  1641  			}
  1642  			tracing.EndSpan(ctx, sc, err)
  1643  		}()
  1644  	}
  1645  	if err := validation.Validate([]validation.Validation{
  1646  		{TargetValue: deploymentName,
  1647  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  1648  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1649  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
  1650  		return result, validation.NewError("features.DeploymentsClient", "DeleteAtScope", err.Error())
  1651  	}
  1652  
  1653  	req, err := client.DeleteAtScopePreparer(ctx, scope, deploymentName)
  1654  	if err != nil {
  1655  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "DeleteAtScope", nil, "Failure preparing request")
  1656  		return
  1657  	}
  1658  
  1659  	result, err = client.DeleteAtScopeSender(req)
  1660  	if err != nil {
  1661  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "DeleteAtScope", result.Response(), "Failure sending request")
  1662  		return
  1663  	}
  1664  
  1665  	return
  1666  }
  1667  
  1668  // DeleteAtScopePreparer prepares the DeleteAtScope request.
  1669  func (client DeploymentsClient) DeleteAtScopePreparer(ctx context.Context, scope string, deploymentName string) (*http.Request, error) {
  1670  	pathParameters := map[string]interface{}{
  1671  		"deploymentName": autorest.Encode("path", deploymentName),
  1672  		"scope":          autorest.Encode("path", scope),
  1673  	}
  1674  
  1675  	const APIVersion = "2019-07-01"
  1676  	queryParameters := map[string]interface{}{
  1677  		"api-version": APIVersion,
  1678  	}
  1679  
  1680  	preparer := autorest.CreatePreparer(
  1681  		autorest.AsDelete(),
  1682  		autorest.WithBaseURL(client.BaseURI),
  1683  		autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
  1684  		autorest.WithQueryParameters(queryParameters))
  1685  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1686  }
  1687  
  1688  // DeleteAtScopeSender sends the DeleteAtScope request. The method will close the
  1689  // http.Response Body if it receives an error.
  1690  func (client DeploymentsClient) DeleteAtScopeSender(req *http.Request) (future DeploymentsDeleteAtScopeFuture, err error) {
  1691  	var resp *http.Response
  1692  	future.FutureAPI = &azure.Future{}
  1693  	resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1694  	if err != nil {
  1695  		return
  1696  	}
  1697  	var azf azure.Future
  1698  	azf, err = azure.NewFutureFromResponse(resp)
  1699  	future.FutureAPI = &azf
  1700  	future.Result = future.result
  1701  	return
  1702  }
  1703  
  1704  // DeleteAtScopeResponder handles the response to the DeleteAtScope request. The method always
  1705  // closes the http.Response Body.
  1706  func (client DeploymentsClient) DeleteAtScopeResponder(resp *http.Response) (result autorest.Response, err error) {
  1707  	err = autorest.Respond(
  1708  		resp,
  1709  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
  1710  		autorest.ByClosing())
  1711  	result.Response = resp
  1712  	return
  1713  }
  1714  
  1715  // DeleteAtSubscriptionScope a template deployment that is currently running cannot be deleted. Deleting a template
  1716  // deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of
  1717  // 202 until the template deployment is successfully deleted. The Location response header contains the URI that is
  1718  // used to obtain the status of the process. While the process is running, a call to the URI in the Location header
  1719  // returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on
  1720  // success. If the asynchronous request failed, the URI in the Location header returns an error-level status code.
  1721  // Parameters:
  1722  // deploymentName - the name of the deployment.
  1723  func (client DeploymentsClient) DeleteAtSubscriptionScope(ctx context.Context, deploymentName string) (result DeploymentsDeleteAtSubscriptionScopeFuture, err error) {
  1724  	if tracing.IsEnabled() {
  1725  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.DeleteAtSubscriptionScope")
  1726  		defer func() {
  1727  			sc := -1
  1728  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1729  				sc = result.FutureAPI.Response().StatusCode
  1730  			}
  1731  			tracing.EndSpan(ctx, sc, err)
  1732  		}()
  1733  	}
  1734  	if err := validation.Validate([]validation.Validation{
  1735  		{TargetValue: deploymentName,
  1736  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  1737  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1738  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
  1739  		return result, validation.NewError("features.DeploymentsClient", "DeleteAtSubscriptionScope", err.Error())
  1740  	}
  1741  
  1742  	req, err := client.DeleteAtSubscriptionScopePreparer(ctx, deploymentName)
  1743  	if err != nil {
  1744  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "DeleteAtSubscriptionScope", nil, "Failure preparing request")
  1745  		return
  1746  	}
  1747  
  1748  	result, err = client.DeleteAtSubscriptionScopeSender(req)
  1749  	if err != nil {
  1750  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "DeleteAtSubscriptionScope", result.Response(), "Failure sending request")
  1751  		return
  1752  	}
  1753  
  1754  	return
  1755  }
  1756  
  1757  // DeleteAtSubscriptionScopePreparer prepares the DeleteAtSubscriptionScope request.
  1758  func (client DeploymentsClient) DeleteAtSubscriptionScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) {
  1759  	pathParameters := map[string]interface{}{
  1760  		"deploymentName": autorest.Encode("path", deploymentName),
  1761  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
  1762  	}
  1763  
  1764  	const APIVersion = "2019-07-01"
  1765  	queryParameters := map[string]interface{}{
  1766  		"api-version": APIVersion,
  1767  	}
  1768  
  1769  	preparer := autorest.CreatePreparer(
  1770  		autorest.AsDelete(),
  1771  		autorest.WithBaseURL(client.BaseURI),
  1772  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
  1773  		autorest.WithQueryParameters(queryParameters))
  1774  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1775  }
  1776  
  1777  // DeleteAtSubscriptionScopeSender sends the DeleteAtSubscriptionScope request. The method will close the
  1778  // http.Response Body if it receives an error.
  1779  func (client DeploymentsClient) DeleteAtSubscriptionScopeSender(req *http.Request) (future DeploymentsDeleteAtSubscriptionScopeFuture, err error) {
  1780  	var resp *http.Response
  1781  	future.FutureAPI = &azure.Future{}
  1782  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1783  	if err != nil {
  1784  		return
  1785  	}
  1786  	var azf azure.Future
  1787  	azf, err = azure.NewFutureFromResponse(resp)
  1788  	future.FutureAPI = &azf
  1789  	future.Result = future.result
  1790  	return
  1791  }
  1792  
  1793  // DeleteAtSubscriptionScopeResponder handles the response to the DeleteAtSubscriptionScope request. The method always
  1794  // closes the http.Response Body.
  1795  func (client DeploymentsClient) DeleteAtSubscriptionScopeResponder(resp *http.Response) (result autorest.Response, err error) {
  1796  	err = autorest.Respond(
  1797  		resp,
  1798  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
  1799  		autorest.ByClosing())
  1800  	result.Response = resp
  1801  	return
  1802  }
  1803  
  1804  // DeleteAtTenantScope a template deployment that is currently running cannot be deleted. Deleting a template
  1805  // deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of
  1806  // 202 until the template deployment is successfully deleted. The Location response header contains the URI that is
  1807  // used to obtain the status of the process. While the process is running, a call to the URI in the Location header
  1808  // returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on
  1809  // success. If the asynchronous request failed, the URI in the Location header returns an error-level status code.
  1810  // Parameters:
  1811  // deploymentName - the name of the deployment.
  1812  func (client DeploymentsClient) DeleteAtTenantScope(ctx context.Context, deploymentName string) (result DeploymentsDeleteAtTenantScopeFuture, err error) {
  1813  	if tracing.IsEnabled() {
  1814  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.DeleteAtTenantScope")
  1815  		defer func() {
  1816  			sc := -1
  1817  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1818  				sc = result.FutureAPI.Response().StatusCode
  1819  			}
  1820  			tracing.EndSpan(ctx, sc, err)
  1821  		}()
  1822  	}
  1823  	if err := validation.Validate([]validation.Validation{
  1824  		{TargetValue: deploymentName,
  1825  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  1826  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1827  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
  1828  		return result, validation.NewError("features.DeploymentsClient", "DeleteAtTenantScope", err.Error())
  1829  	}
  1830  
  1831  	req, err := client.DeleteAtTenantScopePreparer(ctx, deploymentName)
  1832  	if err != nil {
  1833  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "DeleteAtTenantScope", nil, "Failure preparing request")
  1834  		return
  1835  	}
  1836  
  1837  	result, err = client.DeleteAtTenantScopeSender(req)
  1838  	if err != nil {
  1839  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "DeleteAtTenantScope", result.Response(), "Failure sending request")
  1840  		return
  1841  	}
  1842  
  1843  	return
  1844  }
  1845  
  1846  // DeleteAtTenantScopePreparer prepares the DeleteAtTenantScope request.
  1847  func (client DeploymentsClient) DeleteAtTenantScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) {
  1848  	pathParameters := map[string]interface{}{
  1849  		"deploymentName": autorest.Encode("path", deploymentName),
  1850  	}
  1851  
  1852  	const APIVersion = "2019-07-01"
  1853  	queryParameters := map[string]interface{}{
  1854  		"api-version": APIVersion,
  1855  	}
  1856  
  1857  	preparer := autorest.CreatePreparer(
  1858  		autorest.AsDelete(),
  1859  		autorest.WithBaseURL(client.BaseURI),
  1860  		autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
  1861  		autorest.WithQueryParameters(queryParameters))
  1862  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1863  }
  1864  
  1865  // DeleteAtTenantScopeSender sends the DeleteAtTenantScope request. The method will close the
  1866  // http.Response Body if it receives an error.
  1867  func (client DeploymentsClient) DeleteAtTenantScopeSender(req *http.Request) (future DeploymentsDeleteAtTenantScopeFuture, err error) {
  1868  	var resp *http.Response
  1869  	future.FutureAPI = &azure.Future{}
  1870  	resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1871  	if err != nil {
  1872  		return
  1873  	}
  1874  	var azf azure.Future
  1875  	azf, err = azure.NewFutureFromResponse(resp)
  1876  	future.FutureAPI = &azf
  1877  	future.Result = future.result
  1878  	return
  1879  }
  1880  
  1881  // DeleteAtTenantScopeResponder handles the response to the DeleteAtTenantScope request. The method always
  1882  // closes the http.Response Body.
  1883  func (client DeploymentsClient) DeleteAtTenantScopeResponder(resp *http.Response) (result autorest.Response, err error) {
  1884  	err = autorest.Respond(
  1885  		resp,
  1886  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
  1887  		autorest.ByClosing())
  1888  	result.Response = resp
  1889  	return
  1890  }
  1891  
  1892  // ExportTemplate exports the template used for specified deployment.
  1893  // Parameters:
  1894  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1895  // deploymentName - the name of the deployment.
  1896  func (client DeploymentsClient) ExportTemplate(ctx context.Context, resourceGroupName string, deploymentName string) (result DeploymentExportResult, err error) {
  1897  	if tracing.IsEnabled() {
  1898  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ExportTemplate")
  1899  		defer func() {
  1900  			sc := -1
  1901  			if result.Response.Response != nil {
  1902  				sc = result.Response.Response.StatusCode
  1903  			}
  1904  			tracing.EndSpan(ctx, sc, err)
  1905  		}()
  1906  	}
  1907  	if err := validation.Validate([]validation.Validation{
  1908  		{TargetValue: resourceGroupName,
  1909  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1910  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1911  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}},
  1912  		{TargetValue: deploymentName,
  1913  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  1914  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1915  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
  1916  		return result, validation.NewError("features.DeploymentsClient", "ExportTemplate", err.Error())
  1917  	}
  1918  
  1919  	req, err := client.ExportTemplatePreparer(ctx, resourceGroupName, deploymentName)
  1920  	if err != nil {
  1921  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ExportTemplate", nil, "Failure preparing request")
  1922  		return
  1923  	}
  1924  
  1925  	resp, err := client.ExportTemplateSender(req)
  1926  	if err != nil {
  1927  		result.Response = autorest.Response{Response: resp}
  1928  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ExportTemplate", resp, "Failure sending request")
  1929  		return
  1930  	}
  1931  
  1932  	result, err = client.ExportTemplateResponder(resp)
  1933  	if err != nil {
  1934  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ExportTemplate", resp, "Failure responding to request")
  1935  		return
  1936  	}
  1937  
  1938  	return
  1939  }
  1940  
  1941  // ExportTemplatePreparer prepares the ExportTemplate request.
  1942  func (client DeploymentsClient) ExportTemplatePreparer(ctx context.Context, resourceGroupName string, deploymentName string) (*http.Request, error) {
  1943  	pathParameters := map[string]interface{}{
  1944  		"deploymentName":    autorest.Encode("path", deploymentName),
  1945  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1946  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1947  	}
  1948  
  1949  	const APIVersion = "2019-07-01"
  1950  	queryParameters := map[string]interface{}{
  1951  		"api-version": APIVersion,
  1952  	}
  1953  
  1954  	preparer := autorest.CreatePreparer(
  1955  		autorest.AsPost(),
  1956  		autorest.WithBaseURL(client.BaseURI),
  1957  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", pathParameters),
  1958  		autorest.WithQueryParameters(queryParameters))
  1959  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1960  }
  1961  
  1962  // ExportTemplateSender sends the ExportTemplate request. The method will close the
  1963  // http.Response Body if it receives an error.
  1964  func (client DeploymentsClient) ExportTemplateSender(req *http.Request) (*http.Response, error) {
  1965  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1966  }
  1967  
  1968  // ExportTemplateResponder handles the response to the ExportTemplate request. The method always
  1969  // closes the http.Response Body.
  1970  func (client DeploymentsClient) ExportTemplateResponder(resp *http.Response) (result DeploymentExportResult, err error) {
  1971  	err = autorest.Respond(
  1972  		resp,
  1973  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1974  		autorest.ByUnmarshallingJSON(&result),
  1975  		autorest.ByClosing())
  1976  	result.Response = autorest.Response{Response: resp}
  1977  	return
  1978  }
  1979  
  1980  // ExportTemplateAtManagementGroupScope exports the template used for specified deployment.
  1981  // Parameters:
  1982  // groupID - the management group ID.
  1983  // deploymentName - the name of the deployment.
  1984  func (client DeploymentsClient) ExportTemplateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string) (result DeploymentExportResult, err error) {
  1985  	if tracing.IsEnabled() {
  1986  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ExportTemplateAtManagementGroupScope")
  1987  		defer func() {
  1988  			sc := -1
  1989  			if result.Response.Response != nil {
  1990  				sc = result.Response.Response.StatusCode
  1991  			}
  1992  			tracing.EndSpan(ctx, sc, err)
  1993  		}()
  1994  	}
  1995  	if err := validation.Validate([]validation.Validation{
  1996  		{TargetValue: groupID,
  1997  			Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1998  				{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1999  		{TargetValue: deploymentName,
  2000  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  2001  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2002  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
  2003  		return result, validation.NewError("features.DeploymentsClient", "ExportTemplateAtManagementGroupScope", err.Error())
  2004  	}
  2005  
  2006  	req, err := client.ExportTemplateAtManagementGroupScopePreparer(ctx, groupID, deploymentName)
  2007  	if err != nil {
  2008  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ExportTemplateAtManagementGroupScope", nil, "Failure preparing request")
  2009  		return
  2010  	}
  2011  
  2012  	resp, err := client.ExportTemplateAtManagementGroupScopeSender(req)
  2013  	if err != nil {
  2014  		result.Response = autorest.Response{Response: resp}
  2015  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ExportTemplateAtManagementGroupScope", resp, "Failure sending request")
  2016  		return
  2017  	}
  2018  
  2019  	result, err = client.ExportTemplateAtManagementGroupScopeResponder(resp)
  2020  	if err != nil {
  2021  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ExportTemplateAtManagementGroupScope", resp, "Failure responding to request")
  2022  		return
  2023  	}
  2024  
  2025  	return
  2026  }
  2027  
  2028  // ExportTemplateAtManagementGroupScopePreparer prepares the ExportTemplateAtManagementGroupScope request.
  2029  func (client DeploymentsClient) ExportTemplateAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string) (*http.Request, error) {
  2030  	pathParameters := map[string]interface{}{
  2031  		"deploymentName": autorest.Encode("path", deploymentName),
  2032  		"groupId":        autorest.Encode("path", groupID),
  2033  	}
  2034  
  2035  	const APIVersion = "2019-07-01"
  2036  	queryParameters := map[string]interface{}{
  2037  		"api-version": APIVersion,
  2038  	}
  2039  
  2040  	preparer := autorest.CreatePreparer(
  2041  		autorest.AsPost(),
  2042  		autorest.WithBaseURL(client.BaseURI),
  2043  		autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", pathParameters),
  2044  		autorest.WithQueryParameters(queryParameters))
  2045  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2046  }
  2047  
  2048  // ExportTemplateAtManagementGroupScopeSender sends the ExportTemplateAtManagementGroupScope request. The method will close the
  2049  // http.Response Body if it receives an error.
  2050  func (client DeploymentsClient) ExportTemplateAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) {
  2051  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2052  }
  2053  
  2054  // ExportTemplateAtManagementGroupScopeResponder handles the response to the ExportTemplateAtManagementGroupScope request. The method always
  2055  // closes the http.Response Body.
  2056  func (client DeploymentsClient) ExportTemplateAtManagementGroupScopeResponder(resp *http.Response) (result DeploymentExportResult, err error) {
  2057  	err = autorest.Respond(
  2058  		resp,
  2059  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2060  		autorest.ByUnmarshallingJSON(&result),
  2061  		autorest.ByClosing())
  2062  	result.Response = autorest.Response{Response: resp}
  2063  	return
  2064  }
  2065  
  2066  // ExportTemplateAtScope exports the template used for specified deployment.
  2067  // Parameters:
  2068  // scope - the scope of a deployment.
  2069  // deploymentName - the name of the deployment.
  2070  func (client DeploymentsClient) ExportTemplateAtScope(ctx context.Context, scope string, deploymentName string) (result DeploymentExportResult, err error) {
  2071  	if tracing.IsEnabled() {
  2072  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ExportTemplateAtScope")
  2073  		defer func() {
  2074  			sc := -1
  2075  			if result.Response.Response != nil {
  2076  				sc = result.Response.Response.StatusCode
  2077  			}
  2078  			tracing.EndSpan(ctx, sc, err)
  2079  		}()
  2080  	}
  2081  	if err := validation.Validate([]validation.Validation{
  2082  		{TargetValue: deploymentName,
  2083  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  2084  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2085  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
  2086  		return result, validation.NewError("features.DeploymentsClient", "ExportTemplateAtScope", err.Error())
  2087  	}
  2088  
  2089  	req, err := client.ExportTemplateAtScopePreparer(ctx, scope, deploymentName)
  2090  	if err != nil {
  2091  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ExportTemplateAtScope", nil, "Failure preparing request")
  2092  		return
  2093  	}
  2094  
  2095  	resp, err := client.ExportTemplateAtScopeSender(req)
  2096  	if err != nil {
  2097  		result.Response = autorest.Response{Response: resp}
  2098  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ExportTemplateAtScope", resp, "Failure sending request")
  2099  		return
  2100  	}
  2101  
  2102  	result, err = client.ExportTemplateAtScopeResponder(resp)
  2103  	if err != nil {
  2104  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ExportTemplateAtScope", resp, "Failure responding to request")
  2105  		return
  2106  	}
  2107  
  2108  	return
  2109  }
  2110  
  2111  // ExportTemplateAtScopePreparer prepares the ExportTemplateAtScope request.
  2112  func (client DeploymentsClient) ExportTemplateAtScopePreparer(ctx context.Context, scope string, deploymentName string) (*http.Request, error) {
  2113  	pathParameters := map[string]interface{}{
  2114  		"deploymentName": autorest.Encode("path", deploymentName),
  2115  		"scope":          autorest.Encode("path", scope),
  2116  	}
  2117  
  2118  	const APIVersion = "2019-07-01"
  2119  	queryParameters := map[string]interface{}{
  2120  		"api-version": APIVersion,
  2121  	}
  2122  
  2123  	preparer := autorest.CreatePreparer(
  2124  		autorest.AsPost(),
  2125  		autorest.WithBaseURL(client.BaseURI),
  2126  		autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", pathParameters),
  2127  		autorest.WithQueryParameters(queryParameters))
  2128  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2129  }
  2130  
  2131  // ExportTemplateAtScopeSender sends the ExportTemplateAtScope request. The method will close the
  2132  // http.Response Body if it receives an error.
  2133  func (client DeploymentsClient) ExportTemplateAtScopeSender(req *http.Request) (*http.Response, error) {
  2134  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2135  }
  2136  
  2137  // ExportTemplateAtScopeResponder handles the response to the ExportTemplateAtScope request. The method always
  2138  // closes the http.Response Body.
  2139  func (client DeploymentsClient) ExportTemplateAtScopeResponder(resp *http.Response) (result DeploymentExportResult, err error) {
  2140  	err = autorest.Respond(
  2141  		resp,
  2142  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2143  		autorest.ByUnmarshallingJSON(&result),
  2144  		autorest.ByClosing())
  2145  	result.Response = autorest.Response{Response: resp}
  2146  	return
  2147  }
  2148  
  2149  // ExportTemplateAtSubscriptionScope exports the template used for specified deployment.
  2150  // Parameters:
  2151  // deploymentName - the name of the deployment.
  2152  func (client DeploymentsClient) ExportTemplateAtSubscriptionScope(ctx context.Context, deploymentName string) (result DeploymentExportResult, err error) {
  2153  	if tracing.IsEnabled() {
  2154  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ExportTemplateAtSubscriptionScope")
  2155  		defer func() {
  2156  			sc := -1
  2157  			if result.Response.Response != nil {
  2158  				sc = result.Response.Response.StatusCode
  2159  			}
  2160  			tracing.EndSpan(ctx, sc, err)
  2161  		}()
  2162  	}
  2163  	if err := validation.Validate([]validation.Validation{
  2164  		{TargetValue: deploymentName,
  2165  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  2166  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2167  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
  2168  		return result, validation.NewError("features.DeploymentsClient", "ExportTemplateAtSubscriptionScope", err.Error())
  2169  	}
  2170  
  2171  	req, err := client.ExportTemplateAtSubscriptionScopePreparer(ctx, deploymentName)
  2172  	if err != nil {
  2173  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ExportTemplateAtSubscriptionScope", nil, "Failure preparing request")
  2174  		return
  2175  	}
  2176  
  2177  	resp, err := client.ExportTemplateAtSubscriptionScopeSender(req)
  2178  	if err != nil {
  2179  		result.Response = autorest.Response{Response: resp}
  2180  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ExportTemplateAtSubscriptionScope", resp, "Failure sending request")
  2181  		return
  2182  	}
  2183  
  2184  	result, err = client.ExportTemplateAtSubscriptionScopeResponder(resp)
  2185  	if err != nil {
  2186  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ExportTemplateAtSubscriptionScope", resp, "Failure responding to request")
  2187  		return
  2188  	}
  2189  
  2190  	return
  2191  }
  2192  
  2193  // ExportTemplateAtSubscriptionScopePreparer prepares the ExportTemplateAtSubscriptionScope request.
  2194  func (client DeploymentsClient) ExportTemplateAtSubscriptionScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) {
  2195  	pathParameters := map[string]interface{}{
  2196  		"deploymentName": autorest.Encode("path", deploymentName),
  2197  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
  2198  	}
  2199  
  2200  	const APIVersion = "2019-07-01"
  2201  	queryParameters := map[string]interface{}{
  2202  		"api-version": APIVersion,
  2203  	}
  2204  
  2205  	preparer := autorest.CreatePreparer(
  2206  		autorest.AsPost(),
  2207  		autorest.WithBaseURL(client.BaseURI),
  2208  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", pathParameters),
  2209  		autorest.WithQueryParameters(queryParameters))
  2210  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2211  }
  2212  
  2213  // ExportTemplateAtSubscriptionScopeSender sends the ExportTemplateAtSubscriptionScope request. The method will close the
  2214  // http.Response Body if it receives an error.
  2215  func (client DeploymentsClient) ExportTemplateAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) {
  2216  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2217  }
  2218  
  2219  // ExportTemplateAtSubscriptionScopeResponder handles the response to the ExportTemplateAtSubscriptionScope request. The method always
  2220  // closes the http.Response Body.
  2221  func (client DeploymentsClient) ExportTemplateAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentExportResult, err error) {
  2222  	err = autorest.Respond(
  2223  		resp,
  2224  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2225  		autorest.ByUnmarshallingJSON(&result),
  2226  		autorest.ByClosing())
  2227  	result.Response = autorest.Response{Response: resp}
  2228  	return
  2229  }
  2230  
  2231  // ExportTemplateAtTenantScope exports the template used for specified deployment.
  2232  // Parameters:
  2233  // deploymentName - the name of the deployment.
  2234  func (client DeploymentsClient) ExportTemplateAtTenantScope(ctx context.Context, deploymentName string) (result DeploymentExportResult, err error) {
  2235  	if tracing.IsEnabled() {
  2236  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ExportTemplateAtTenantScope")
  2237  		defer func() {
  2238  			sc := -1
  2239  			if result.Response.Response != nil {
  2240  				sc = result.Response.Response.StatusCode
  2241  			}
  2242  			tracing.EndSpan(ctx, sc, err)
  2243  		}()
  2244  	}
  2245  	if err := validation.Validate([]validation.Validation{
  2246  		{TargetValue: deploymentName,
  2247  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  2248  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2249  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
  2250  		return result, validation.NewError("features.DeploymentsClient", "ExportTemplateAtTenantScope", err.Error())
  2251  	}
  2252  
  2253  	req, err := client.ExportTemplateAtTenantScopePreparer(ctx, deploymentName)
  2254  	if err != nil {
  2255  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ExportTemplateAtTenantScope", nil, "Failure preparing request")
  2256  		return
  2257  	}
  2258  
  2259  	resp, err := client.ExportTemplateAtTenantScopeSender(req)
  2260  	if err != nil {
  2261  		result.Response = autorest.Response{Response: resp}
  2262  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ExportTemplateAtTenantScope", resp, "Failure sending request")
  2263  		return
  2264  	}
  2265  
  2266  	result, err = client.ExportTemplateAtTenantScopeResponder(resp)
  2267  	if err != nil {
  2268  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ExportTemplateAtTenantScope", resp, "Failure responding to request")
  2269  		return
  2270  	}
  2271  
  2272  	return
  2273  }
  2274  
  2275  // ExportTemplateAtTenantScopePreparer prepares the ExportTemplateAtTenantScope request.
  2276  func (client DeploymentsClient) ExportTemplateAtTenantScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) {
  2277  	pathParameters := map[string]interface{}{
  2278  		"deploymentName": autorest.Encode("path", deploymentName),
  2279  	}
  2280  
  2281  	const APIVersion = "2019-07-01"
  2282  	queryParameters := map[string]interface{}{
  2283  		"api-version": APIVersion,
  2284  	}
  2285  
  2286  	preparer := autorest.CreatePreparer(
  2287  		autorest.AsPost(),
  2288  		autorest.WithBaseURL(client.BaseURI),
  2289  		autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", pathParameters),
  2290  		autorest.WithQueryParameters(queryParameters))
  2291  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2292  }
  2293  
  2294  // ExportTemplateAtTenantScopeSender sends the ExportTemplateAtTenantScope request. The method will close the
  2295  // http.Response Body if it receives an error.
  2296  func (client DeploymentsClient) ExportTemplateAtTenantScopeSender(req *http.Request) (*http.Response, error) {
  2297  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2298  }
  2299  
  2300  // ExportTemplateAtTenantScopeResponder handles the response to the ExportTemplateAtTenantScope request. The method always
  2301  // closes the http.Response Body.
  2302  func (client DeploymentsClient) ExportTemplateAtTenantScopeResponder(resp *http.Response) (result DeploymentExportResult, err error) {
  2303  	err = autorest.Respond(
  2304  		resp,
  2305  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2306  		autorest.ByUnmarshallingJSON(&result),
  2307  		autorest.ByClosing())
  2308  	result.Response = autorest.Response{Response: resp}
  2309  	return
  2310  }
  2311  
  2312  // Get gets a deployment.
  2313  // Parameters:
  2314  // resourceGroupName - the name of the resource group. The name is case insensitive.
  2315  // deploymentName - the name of the deployment.
  2316  func (client DeploymentsClient) Get(ctx context.Context, resourceGroupName string, deploymentName string) (result DeploymentExtended, err error) {
  2317  	if tracing.IsEnabled() {
  2318  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Get")
  2319  		defer func() {
  2320  			sc := -1
  2321  			if result.Response.Response != nil {
  2322  				sc = result.Response.Response.StatusCode
  2323  			}
  2324  			tracing.EndSpan(ctx, sc, err)
  2325  		}()
  2326  	}
  2327  	if err := validation.Validate([]validation.Validation{
  2328  		{TargetValue: resourceGroupName,
  2329  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2330  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2331  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}},
  2332  		{TargetValue: deploymentName,
  2333  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  2334  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2335  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
  2336  		return result, validation.NewError("features.DeploymentsClient", "Get", err.Error())
  2337  	}
  2338  
  2339  	req, err := client.GetPreparer(ctx, resourceGroupName, deploymentName)
  2340  	if err != nil {
  2341  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "Get", nil, "Failure preparing request")
  2342  		return
  2343  	}
  2344  
  2345  	resp, err := client.GetSender(req)
  2346  	if err != nil {
  2347  		result.Response = autorest.Response{Response: resp}
  2348  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "Get", resp, "Failure sending request")
  2349  		return
  2350  	}
  2351  
  2352  	result, err = client.GetResponder(resp)
  2353  	if err != nil {
  2354  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "Get", resp, "Failure responding to request")
  2355  		return
  2356  	}
  2357  
  2358  	return
  2359  }
  2360  
  2361  // GetPreparer prepares the Get request.
  2362  func (client DeploymentsClient) GetPreparer(ctx context.Context, resourceGroupName string, deploymentName string) (*http.Request, error) {
  2363  	pathParameters := map[string]interface{}{
  2364  		"deploymentName":    autorest.Encode("path", deploymentName),
  2365  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  2366  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  2367  	}
  2368  
  2369  	const APIVersion = "2019-07-01"
  2370  	queryParameters := map[string]interface{}{
  2371  		"api-version": APIVersion,
  2372  	}
  2373  
  2374  	preparer := autorest.CreatePreparer(
  2375  		autorest.AsGet(),
  2376  		autorest.WithBaseURL(client.BaseURI),
  2377  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
  2378  		autorest.WithQueryParameters(queryParameters))
  2379  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2380  }
  2381  
  2382  // GetSender sends the Get request. The method will close the
  2383  // http.Response Body if it receives an error.
  2384  func (client DeploymentsClient) GetSender(req *http.Request) (*http.Response, error) {
  2385  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2386  }
  2387  
  2388  // GetResponder handles the response to the Get request. The method always
  2389  // closes the http.Response Body.
  2390  func (client DeploymentsClient) GetResponder(resp *http.Response) (result DeploymentExtended, err error) {
  2391  	err = autorest.Respond(
  2392  		resp,
  2393  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2394  		autorest.ByUnmarshallingJSON(&result),
  2395  		autorest.ByClosing())
  2396  	result.Response = autorest.Response{Response: resp}
  2397  	return
  2398  }
  2399  
  2400  // GetAtManagementGroupScope gets a deployment.
  2401  // Parameters:
  2402  // groupID - the management group ID.
  2403  // deploymentName - the name of the deployment.
  2404  func (client DeploymentsClient) GetAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string) (result DeploymentExtended, err error) {
  2405  	if tracing.IsEnabled() {
  2406  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GetAtManagementGroupScope")
  2407  		defer func() {
  2408  			sc := -1
  2409  			if result.Response.Response != nil {
  2410  				sc = result.Response.Response.StatusCode
  2411  			}
  2412  			tracing.EndSpan(ctx, sc, err)
  2413  		}()
  2414  	}
  2415  	if err := validation.Validate([]validation.Validation{
  2416  		{TargetValue: groupID,
  2417  			Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2418  				{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2419  		{TargetValue: deploymentName,
  2420  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  2421  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2422  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
  2423  		return result, validation.NewError("features.DeploymentsClient", "GetAtManagementGroupScope", err.Error())
  2424  	}
  2425  
  2426  	req, err := client.GetAtManagementGroupScopePreparer(ctx, groupID, deploymentName)
  2427  	if err != nil {
  2428  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "GetAtManagementGroupScope", nil, "Failure preparing request")
  2429  		return
  2430  	}
  2431  
  2432  	resp, err := client.GetAtManagementGroupScopeSender(req)
  2433  	if err != nil {
  2434  		result.Response = autorest.Response{Response: resp}
  2435  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "GetAtManagementGroupScope", resp, "Failure sending request")
  2436  		return
  2437  	}
  2438  
  2439  	result, err = client.GetAtManagementGroupScopeResponder(resp)
  2440  	if err != nil {
  2441  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "GetAtManagementGroupScope", resp, "Failure responding to request")
  2442  		return
  2443  	}
  2444  
  2445  	return
  2446  }
  2447  
  2448  // GetAtManagementGroupScopePreparer prepares the GetAtManagementGroupScope request.
  2449  func (client DeploymentsClient) GetAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string) (*http.Request, error) {
  2450  	pathParameters := map[string]interface{}{
  2451  		"deploymentName": autorest.Encode("path", deploymentName),
  2452  		"groupId":        autorest.Encode("path", groupID),
  2453  	}
  2454  
  2455  	const APIVersion = "2019-07-01"
  2456  	queryParameters := map[string]interface{}{
  2457  		"api-version": APIVersion,
  2458  	}
  2459  
  2460  	preparer := autorest.CreatePreparer(
  2461  		autorest.AsGet(),
  2462  		autorest.WithBaseURL(client.BaseURI),
  2463  		autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
  2464  		autorest.WithQueryParameters(queryParameters))
  2465  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2466  }
  2467  
  2468  // GetAtManagementGroupScopeSender sends the GetAtManagementGroupScope request. The method will close the
  2469  // http.Response Body if it receives an error.
  2470  func (client DeploymentsClient) GetAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) {
  2471  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2472  }
  2473  
  2474  // GetAtManagementGroupScopeResponder handles the response to the GetAtManagementGroupScope request. The method always
  2475  // closes the http.Response Body.
  2476  func (client DeploymentsClient) GetAtManagementGroupScopeResponder(resp *http.Response) (result DeploymentExtended, err error) {
  2477  	err = autorest.Respond(
  2478  		resp,
  2479  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2480  		autorest.ByUnmarshallingJSON(&result),
  2481  		autorest.ByClosing())
  2482  	result.Response = autorest.Response{Response: resp}
  2483  	return
  2484  }
  2485  
  2486  // GetAtScope gets a deployment.
  2487  // Parameters:
  2488  // scope - the scope of a deployment.
  2489  // deploymentName - the name of the deployment.
  2490  func (client DeploymentsClient) GetAtScope(ctx context.Context, scope string, deploymentName string) (result DeploymentExtended, err error) {
  2491  	if tracing.IsEnabled() {
  2492  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GetAtScope")
  2493  		defer func() {
  2494  			sc := -1
  2495  			if result.Response.Response != nil {
  2496  				sc = result.Response.Response.StatusCode
  2497  			}
  2498  			tracing.EndSpan(ctx, sc, err)
  2499  		}()
  2500  	}
  2501  	if err := validation.Validate([]validation.Validation{
  2502  		{TargetValue: deploymentName,
  2503  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  2504  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2505  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
  2506  		return result, validation.NewError("features.DeploymentsClient", "GetAtScope", err.Error())
  2507  	}
  2508  
  2509  	req, err := client.GetAtScopePreparer(ctx, scope, deploymentName)
  2510  	if err != nil {
  2511  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "GetAtScope", nil, "Failure preparing request")
  2512  		return
  2513  	}
  2514  
  2515  	resp, err := client.GetAtScopeSender(req)
  2516  	if err != nil {
  2517  		result.Response = autorest.Response{Response: resp}
  2518  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "GetAtScope", resp, "Failure sending request")
  2519  		return
  2520  	}
  2521  
  2522  	result, err = client.GetAtScopeResponder(resp)
  2523  	if err != nil {
  2524  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "GetAtScope", resp, "Failure responding to request")
  2525  		return
  2526  	}
  2527  
  2528  	return
  2529  }
  2530  
  2531  // GetAtScopePreparer prepares the GetAtScope request.
  2532  func (client DeploymentsClient) GetAtScopePreparer(ctx context.Context, scope string, deploymentName string) (*http.Request, error) {
  2533  	pathParameters := map[string]interface{}{
  2534  		"deploymentName": autorest.Encode("path", deploymentName),
  2535  		"scope":          autorest.Encode("path", scope),
  2536  	}
  2537  
  2538  	const APIVersion = "2019-07-01"
  2539  	queryParameters := map[string]interface{}{
  2540  		"api-version": APIVersion,
  2541  	}
  2542  
  2543  	preparer := autorest.CreatePreparer(
  2544  		autorest.AsGet(),
  2545  		autorest.WithBaseURL(client.BaseURI),
  2546  		autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
  2547  		autorest.WithQueryParameters(queryParameters))
  2548  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2549  }
  2550  
  2551  // GetAtScopeSender sends the GetAtScope request. The method will close the
  2552  // http.Response Body if it receives an error.
  2553  func (client DeploymentsClient) GetAtScopeSender(req *http.Request) (*http.Response, error) {
  2554  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2555  }
  2556  
  2557  // GetAtScopeResponder handles the response to the GetAtScope request. The method always
  2558  // closes the http.Response Body.
  2559  func (client DeploymentsClient) GetAtScopeResponder(resp *http.Response) (result DeploymentExtended, err error) {
  2560  	err = autorest.Respond(
  2561  		resp,
  2562  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2563  		autorest.ByUnmarshallingJSON(&result),
  2564  		autorest.ByClosing())
  2565  	result.Response = autorest.Response{Response: resp}
  2566  	return
  2567  }
  2568  
  2569  // GetAtSubscriptionScope gets a deployment.
  2570  // Parameters:
  2571  // deploymentName - the name of the deployment.
  2572  func (client DeploymentsClient) GetAtSubscriptionScope(ctx context.Context, deploymentName string) (result DeploymentExtended, err error) {
  2573  	if tracing.IsEnabled() {
  2574  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GetAtSubscriptionScope")
  2575  		defer func() {
  2576  			sc := -1
  2577  			if result.Response.Response != nil {
  2578  				sc = result.Response.Response.StatusCode
  2579  			}
  2580  			tracing.EndSpan(ctx, sc, err)
  2581  		}()
  2582  	}
  2583  	if err := validation.Validate([]validation.Validation{
  2584  		{TargetValue: deploymentName,
  2585  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  2586  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2587  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
  2588  		return result, validation.NewError("features.DeploymentsClient", "GetAtSubscriptionScope", err.Error())
  2589  	}
  2590  
  2591  	req, err := client.GetAtSubscriptionScopePreparer(ctx, deploymentName)
  2592  	if err != nil {
  2593  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "GetAtSubscriptionScope", nil, "Failure preparing request")
  2594  		return
  2595  	}
  2596  
  2597  	resp, err := client.GetAtSubscriptionScopeSender(req)
  2598  	if err != nil {
  2599  		result.Response = autorest.Response{Response: resp}
  2600  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "GetAtSubscriptionScope", resp, "Failure sending request")
  2601  		return
  2602  	}
  2603  
  2604  	result, err = client.GetAtSubscriptionScopeResponder(resp)
  2605  	if err != nil {
  2606  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "GetAtSubscriptionScope", resp, "Failure responding to request")
  2607  		return
  2608  	}
  2609  
  2610  	return
  2611  }
  2612  
  2613  // GetAtSubscriptionScopePreparer prepares the GetAtSubscriptionScope request.
  2614  func (client DeploymentsClient) GetAtSubscriptionScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) {
  2615  	pathParameters := map[string]interface{}{
  2616  		"deploymentName": autorest.Encode("path", deploymentName),
  2617  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
  2618  	}
  2619  
  2620  	const APIVersion = "2019-07-01"
  2621  	queryParameters := map[string]interface{}{
  2622  		"api-version": APIVersion,
  2623  	}
  2624  
  2625  	preparer := autorest.CreatePreparer(
  2626  		autorest.AsGet(),
  2627  		autorest.WithBaseURL(client.BaseURI),
  2628  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
  2629  		autorest.WithQueryParameters(queryParameters))
  2630  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2631  }
  2632  
  2633  // GetAtSubscriptionScopeSender sends the GetAtSubscriptionScope request. The method will close the
  2634  // http.Response Body if it receives an error.
  2635  func (client DeploymentsClient) GetAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) {
  2636  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2637  }
  2638  
  2639  // GetAtSubscriptionScopeResponder handles the response to the GetAtSubscriptionScope request. The method always
  2640  // closes the http.Response Body.
  2641  func (client DeploymentsClient) GetAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentExtended, err error) {
  2642  	err = autorest.Respond(
  2643  		resp,
  2644  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2645  		autorest.ByUnmarshallingJSON(&result),
  2646  		autorest.ByClosing())
  2647  	result.Response = autorest.Response{Response: resp}
  2648  	return
  2649  }
  2650  
  2651  // GetAtTenantScope gets a deployment.
  2652  // Parameters:
  2653  // deploymentName - the name of the deployment.
  2654  func (client DeploymentsClient) GetAtTenantScope(ctx context.Context, deploymentName string) (result DeploymentExtended, err error) {
  2655  	if tracing.IsEnabled() {
  2656  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GetAtTenantScope")
  2657  		defer func() {
  2658  			sc := -1
  2659  			if result.Response.Response != nil {
  2660  				sc = result.Response.Response.StatusCode
  2661  			}
  2662  			tracing.EndSpan(ctx, sc, err)
  2663  		}()
  2664  	}
  2665  	if err := validation.Validate([]validation.Validation{
  2666  		{TargetValue: deploymentName,
  2667  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  2668  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2669  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
  2670  		return result, validation.NewError("features.DeploymentsClient", "GetAtTenantScope", err.Error())
  2671  	}
  2672  
  2673  	req, err := client.GetAtTenantScopePreparer(ctx, deploymentName)
  2674  	if err != nil {
  2675  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "GetAtTenantScope", nil, "Failure preparing request")
  2676  		return
  2677  	}
  2678  
  2679  	resp, err := client.GetAtTenantScopeSender(req)
  2680  	if err != nil {
  2681  		result.Response = autorest.Response{Response: resp}
  2682  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "GetAtTenantScope", resp, "Failure sending request")
  2683  		return
  2684  	}
  2685  
  2686  	result, err = client.GetAtTenantScopeResponder(resp)
  2687  	if err != nil {
  2688  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "GetAtTenantScope", resp, "Failure responding to request")
  2689  		return
  2690  	}
  2691  
  2692  	return
  2693  }
  2694  
  2695  // GetAtTenantScopePreparer prepares the GetAtTenantScope request.
  2696  func (client DeploymentsClient) GetAtTenantScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) {
  2697  	pathParameters := map[string]interface{}{
  2698  		"deploymentName": autorest.Encode("path", deploymentName),
  2699  	}
  2700  
  2701  	const APIVersion = "2019-07-01"
  2702  	queryParameters := map[string]interface{}{
  2703  		"api-version": APIVersion,
  2704  	}
  2705  
  2706  	preparer := autorest.CreatePreparer(
  2707  		autorest.AsGet(),
  2708  		autorest.WithBaseURL(client.BaseURI),
  2709  		autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters),
  2710  		autorest.WithQueryParameters(queryParameters))
  2711  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2712  }
  2713  
  2714  // GetAtTenantScopeSender sends the GetAtTenantScope request. The method will close the
  2715  // http.Response Body if it receives an error.
  2716  func (client DeploymentsClient) GetAtTenantScopeSender(req *http.Request) (*http.Response, error) {
  2717  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2718  }
  2719  
  2720  // GetAtTenantScopeResponder handles the response to the GetAtTenantScope request. The method always
  2721  // closes the http.Response Body.
  2722  func (client DeploymentsClient) GetAtTenantScopeResponder(resp *http.Response) (result DeploymentExtended, err error) {
  2723  	err = autorest.Respond(
  2724  		resp,
  2725  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2726  		autorest.ByUnmarshallingJSON(&result),
  2727  		autorest.ByClosing())
  2728  	result.Response = autorest.Response{Response: resp}
  2729  	return
  2730  }
  2731  
  2732  // ListAtManagementGroupScope get all the deployments for a management group.
  2733  // Parameters:
  2734  // groupID - the management group ID.
  2735  // filter - the filter to apply on the operation. For example, you can use $filter=provisioningState eq
  2736  // '{state}'.
  2737  // top - the number of results to get. If null is passed, returns all deployments.
  2738  func (client DeploymentsClient) ListAtManagementGroupScope(ctx context.Context, groupID string, filter string, top *int32) (result DeploymentListResultPage, err error) {
  2739  	if tracing.IsEnabled() {
  2740  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtManagementGroupScope")
  2741  		defer func() {
  2742  			sc := -1
  2743  			if result.dlr.Response.Response != nil {
  2744  				sc = result.dlr.Response.Response.StatusCode
  2745  			}
  2746  			tracing.EndSpan(ctx, sc, err)
  2747  		}()
  2748  	}
  2749  	if err := validation.Validate([]validation.Validation{
  2750  		{TargetValue: groupID,
  2751  			Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2752  				{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
  2753  		return result, validation.NewError("features.DeploymentsClient", "ListAtManagementGroupScope", err.Error())
  2754  	}
  2755  
  2756  	result.fn = client.listAtManagementGroupScopeNextResults
  2757  	req, err := client.ListAtManagementGroupScopePreparer(ctx, groupID, filter, top)
  2758  	if err != nil {
  2759  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ListAtManagementGroupScope", nil, "Failure preparing request")
  2760  		return
  2761  	}
  2762  
  2763  	resp, err := client.ListAtManagementGroupScopeSender(req)
  2764  	if err != nil {
  2765  		result.dlr.Response = autorest.Response{Response: resp}
  2766  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ListAtManagementGroupScope", resp, "Failure sending request")
  2767  		return
  2768  	}
  2769  
  2770  	result.dlr, err = client.ListAtManagementGroupScopeResponder(resp)
  2771  	if err != nil {
  2772  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ListAtManagementGroupScope", resp, "Failure responding to request")
  2773  		return
  2774  	}
  2775  	if result.dlr.hasNextLink() && result.dlr.IsEmpty() {
  2776  		err = result.NextWithContext(ctx)
  2777  		return
  2778  	}
  2779  
  2780  	return
  2781  }
  2782  
  2783  // ListAtManagementGroupScopePreparer prepares the ListAtManagementGroupScope request.
  2784  func (client DeploymentsClient) ListAtManagementGroupScopePreparer(ctx context.Context, groupID string, filter string, top *int32) (*http.Request, error) {
  2785  	pathParameters := map[string]interface{}{
  2786  		"groupId": autorest.Encode("path", groupID),
  2787  	}
  2788  
  2789  	const APIVersion = "2019-07-01"
  2790  	queryParameters := map[string]interface{}{
  2791  		"api-version": APIVersion,
  2792  	}
  2793  	if len(filter) > 0 {
  2794  		queryParameters["$filter"] = autorest.Encode("query", filter)
  2795  	}
  2796  	if top != nil {
  2797  		queryParameters["$top"] = autorest.Encode("query", *top)
  2798  	}
  2799  
  2800  	preparer := autorest.CreatePreparer(
  2801  		autorest.AsGet(),
  2802  		autorest.WithBaseURL(client.BaseURI),
  2803  		autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/", pathParameters),
  2804  		autorest.WithQueryParameters(queryParameters))
  2805  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2806  }
  2807  
  2808  // ListAtManagementGroupScopeSender sends the ListAtManagementGroupScope request. The method will close the
  2809  // http.Response Body if it receives an error.
  2810  func (client DeploymentsClient) ListAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) {
  2811  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2812  }
  2813  
  2814  // ListAtManagementGroupScopeResponder handles the response to the ListAtManagementGroupScope request. The method always
  2815  // closes the http.Response Body.
  2816  func (client DeploymentsClient) ListAtManagementGroupScopeResponder(resp *http.Response) (result DeploymentListResult, err error) {
  2817  	err = autorest.Respond(
  2818  		resp,
  2819  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2820  		autorest.ByUnmarshallingJSON(&result),
  2821  		autorest.ByClosing())
  2822  	result.Response = autorest.Response{Response: resp}
  2823  	return
  2824  }
  2825  
  2826  // listAtManagementGroupScopeNextResults retrieves the next set of results, if any.
  2827  func (client DeploymentsClient) listAtManagementGroupScopeNextResults(ctx context.Context, lastResults DeploymentListResult) (result DeploymentListResult, err error) {
  2828  	req, err := lastResults.deploymentListResultPreparer(ctx)
  2829  	if err != nil {
  2830  		return result, autorest.NewErrorWithError(err, "features.DeploymentsClient", "listAtManagementGroupScopeNextResults", nil, "Failure preparing next results request")
  2831  	}
  2832  	if req == nil {
  2833  		return
  2834  	}
  2835  	resp, err := client.ListAtManagementGroupScopeSender(req)
  2836  	if err != nil {
  2837  		result.Response = autorest.Response{Response: resp}
  2838  		return result, autorest.NewErrorWithError(err, "features.DeploymentsClient", "listAtManagementGroupScopeNextResults", resp, "Failure sending next results request")
  2839  	}
  2840  	result, err = client.ListAtManagementGroupScopeResponder(resp)
  2841  	if err != nil {
  2842  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "listAtManagementGroupScopeNextResults", resp, "Failure responding to next results request")
  2843  	}
  2844  	return
  2845  }
  2846  
  2847  // ListAtManagementGroupScopeComplete enumerates all values, automatically crossing page boundaries as required.
  2848  func (client DeploymentsClient) ListAtManagementGroupScopeComplete(ctx context.Context, groupID string, filter string, top *int32) (result DeploymentListResultIterator, err error) {
  2849  	if tracing.IsEnabled() {
  2850  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtManagementGroupScope")
  2851  		defer func() {
  2852  			sc := -1
  2853  			if result.Response().Response.Response != nil {
  2854  				sc = result.page.Response().Response.Response.StatusCode
  2855  			}
  2856  			tracing.EndSpan(ctx, sc, err)
  2857  		}()
  2858  	}
  2859  	result.page, err = client.ListAtManagementGroupScope(ctx, groupID, filter, top)
  2860  	return
  2861  }
  2862  
  2863  // ListAtScope get all the deployments at the given scope.
  2864  // Parameters:
  2865  // scope - the scope of a deployment.
  2866  // filter - the filter to apply on the operation. For example, you can use $filter=provisioningState eq
  2867  // '{state}'.
  2868  // top - the number of results to get. If null is passed, returns all deployments.
  2869  func (client DeploymentsClient) ListAtScope(ctx context.Context, scope string, filter string, top *int32) (result DeploymentListResultPage, err error) {
  2870  	if tracing.IsEnabled() {
  2871  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtScope")
  2872  		defer func() {
  2873  			sc := -1
  2874  			if result.dlr.Response.Response != nil {
  2875  				sc = result.dlr.Response.Response.StatusCode
  2876  			}
  2877  			tracing.EndSpan(ctx, sc, err)
  2878  		}()
  2879  	}
  2880  	result.fn = client.listAtScopeNextResults
  2881  	req, err := client.ListAtScopePreparer(ctx, scope, filter, top)
  2882  	if err != nil {
  2883  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ListAtScope", nil, "Failure preparing request")
  2884  		return
  2885  	}
  2886  
  2887  	resp, err := client.ListAtScopeSender(req)
  2888  	if err != nil {
  2889  		result.dlr.Response = autorest.Response{Response: resp}
  2890  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ListAtScope", resp, "Failure sending request")
  2891  		return
  2892  	}
  2893  
  2894  	result.dlr, err = client.ListAtScopeResponder(resp)
  2895  	if err != nil {
  2896  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ListAtScope", resp, "Failure responding to request")
  2897  		return
  2898  	}
  2899  	if result.dlr.hasNextLink() && result.dlr.IsEmpty() {
  2900  		err = result.NextWithContext(ctx)
  2901  		return
  2902  	}
  2903  
  2904  	return
  2905  }
  2906  
  2907  // ListAtScopePreparer prepares the ListAtScope request.
  2908  func (client DeploymentsClient) ListAtScopePreparer(ctx context.Context, scope string, filter string, top *int32) (*http.Request, error) {
  2909  	pathParameters := map[string]interface{}{
  2910  		"scope": autorest.Encode("path", scope),
  2911  	}
  2912  
  2913  	const APIVersion = "2019-07-01"
  2914  	queryParameters := map[string]interface{}{
  2915  		"api-version": APIVersion,
  2916  	}
  2917  	if len(filter) > 0 {
  2918  		queryParameters["$filter"] = autorest.Encode("query", filter)
  2919  	}
  2920  	if top != nil {
  2921  		queryParameters["$top"] = autorest.Encode("query", *top)
  2922  	}
  2923  
  2924  	preparer := autorest.CreatePreparer(
  2925  		autorest.AsGet(),
  2926  		autorest.WithBaseURL(client.BaseURI),
  2927  		autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/", pathParameters),
  2928  		autorest.WithQueryParameters(queryParameters))
  2929  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2930  }
  2931  
  2932  // ListAtScopeSender sends the ListAtScope request. The method will close the
  2933  // http.Response Body if it receives an error.
  2934  func (client DeploymentsClient) ListAtScopeSender(req *http.Request) (*http.Response, error) {
  2935  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2936  }
  2937  
  2938  // ListAtScopeResponder handles the response to the ListAtScope request. The method always
  2939  // closes the http.Response Body.
  2940  func (client DeploymentsClient) ListAtScopeResponder(resp *http.Response) (result DeploymentListResult, err error) {
  2941  	err = autorest.Respond(
  2942  		resp,
  2943  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2944  		autorest.ByUnmarshallingJSON(&result),
  2945  		autorest.ByClosing())
  2946  	result.Response = autorest.Response{Response: resp}
  2947  	return
  2948  }
  2949  
  2950  // listAtScopeNextResults retrieves the next set of results, if any.
  2951  func (client DeploymentsClient) listAtScopeNextResults(ctx context.Context, lastResults DeploymentListResult) (result DeploymentListResult, err error) {
  2952  	req, err := lastResults.deploymentListResultPreparer(ctx)
  2953  	if err != nil {
  2954  		return result, autorest.NewErrorWithError(err, "features.DeploymentsClient", "listAtScopeNextResults", nil, "Failure preparing next results request")
  2955  	}
  2956  	if req == nil {
  2957  		return
  2958  	}
  2959  	resp, err := client.ListAtScopeSender(req)
  2960  	if err != nil {
  2961  		result.Response = autorest.Response{Response: resp}
  2962  		return result, autorest.NewErrorWithError(err, "features.DeploymentsClient", "listAtScopeNextResults", resp, "Failure sending next results request")
  2963  	}
  2964  	result, err = client.ListAtScopeResponder(resp)
  2965  	if err != nil {
  2966  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "listAtScopeNextResults", resp, "Failure responding to next results request")
  2967  	}
  2968  	return
  2969  }
  2970  
  2971  // ListAtScopeComplete enumerates all values, automatically crossing page boundaries as required.
  2972  func (client DeploymentsClient) ListAtScopeComplete(ctx context.Context, scope string, filter string, top *int32) (result DeploymentListResultIterator, err error) {
  2973  	if tracing.IsEnabled() {
  2974  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtScope")
  2975  		defer func() {
  2976  			sc := -1
  2977  			if result.Response().Response.Response != nil {
  2978  				sc = result.page.Response().Response.Response.StatusCode
  2979  			}
  2980  			tracing.EndSpan(ctx, sc, err)
  2981  		}()
  2982  	}
  2983  	result.page, err = client.ListAtScope(ctx, scope, filter, top)
  2984  	return
  2985  }
  2986  
  2987  // ListAtSubscriptionScope get all the deployments for a subscription.
  2988  // Parameters:
  2989  // filter - the filter to apply on the operation. For example, you can use $filter=provisioningState eq
  2990  // '{state}'.
  2991  // top - the number of results to get. If null is passed, returns all deployments.
  2992  func (client DeploymentsClient) ListAtSubscriptionScope(ctx context.Context, filter string, top *int32) (result DeploymentListResultPage, err error) {
  2993  	if tracing.IsEnabled() {
  2994  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtSubscriptionScope")
  2995  		defer func() {
  2996  			sc := -1
  2997  			if result.dlr.Response.Response != nil {
  2998  				sc = result.dlr.Response.Response.StatusCode
  2999  			}
  3000  			tracing.EndSpan(ctx, sc, err)
  3001  		}()
  3002  	}
  3003  	result.fn = client.listAtSubscriptionScopeNextResults
  3004  	req, err := client.ListAtSubscriptionScopePreparer(ctx, filter, top)
  3005  	if err != nil {
  3006  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ListAtSubscriptionScope", nil, "Failure preparing request")
  3007  		return
  3008  	}
  3009  
  3010  	resp, err := client.ListAtSubscriptionScopeSender(req)
  3011  	if err != nil {
  3012  		result.dlr.Response = autorest.Response{Response: resp}
  3013  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ListAtSubscriptionScope", resp, "Failure sending request")
  3014  		return
  3015  	}
  3016  
  3017  	result.dlr, err = client.ListAtSubscriptionScopeResponder(resp)
  3018  	if err != nil {
  3019  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ListAtSubscriptionScope", resp, "Failure responding to request")
  3020  		return
  3021  	}
  3022  	if result.dlr.hasNextLink() && result.dlr.IsEmpty() {
  3023  		err = result.NextWithContext(ctx)
  3024  		return
  3025  	}
  3026  
  3027  	return
  3028  }
  3029  
  3030  // ListAtSubscriptionScopePreparer prepares the ListAtSubscriptionScope request.
  3031  func (client DeploymentsClient) ListAtSubscriptionScopePreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) {
  3032  	pathParameters := map[string]interface{}{
  3033  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
  3034  	}
  3035  
  3036  	const APIVersion = "2019-07-01"
  3037  	queryParameters := map[string]interface{}{
  3038  		"api-version": APIVersion,
  3039  	}
  3040  	if len(filter) > 0 {
  3041  		queryParameters["$filter"] = autorest.Encode("query", filter)
  3042  	}
  3043  	if top != nil {
  3044  		queryParameters["$top"] = autorest.Encode("query", *top)
  3045  	}
  3046  
  3047  	preparer := autorest.CreatePreparer(
  3048  		autorest.AsGet(),
  3049  		autorest.WithBaseURL(client.BaseURI),
  3050  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/", pathParameters),
  3051  		autorest.WithQueryParameters(queryParameters))
  3052  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3053  }
  3054  
  3055  // ListAtSubscriptionScopeSender sends the ListAtSubscriptionScope request. The method will close the
  3056  // http.Response Body if it receives an error.
  3057  func (client DeploymentsClient) ListAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) {
  3058  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  3059  }
  3060  
  3061  // ListAtSubscriptionScopeResponder handles the response to the ListAtSubscriptionScope request. The method always
  3062  // closes the http.Response Body.
  3063  func (client DeploymentsClient) ListAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentListResult, err error) {
  3064  	err = autorest.Respond(
  3065  		resp,
  3066  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  3067  		autorest.ByUnmarshallingJSON(&result),
  3068  		autorest.ByClosing())
  3069  	result.Response = autorest.Response{Response: resp}
  3070  	return
  3071  }
  3072  
  3073  // listAtSubscriptionScopeNextResults retrieves the next set of results, if any.
  3074  func (client DeploymentsClient) listAtSubscriptionScopeNextResults(ctx context.Context, lastResults DeploymentListResult) (result DeploymentListResult, err error) {
  3075  	req, err := lastResults.deploymentListResultPreparer(ctx)
  3076  	if err != nil {
  3077  		return result, autorest.NewErrorWithError(err, "features.DeploymentsClient", "listAtSubscriptionScopeNextResults", nil, "Failure preparing next results request")
  3078  	}
  3079  	if req == nil {
  3080  		return
  3081  	}
  3082  	resp, err := client.ListAtSubscriptionScopeSender(req)
  3083  	if err != nil {
  3084  		result.Response = autorest.Response{Response: resp}
  3085  		return result, autorest.NewErrorWithError(err, "features.DeploymentsClient", "listAtSubscriptionScopeNextResults", resp, "Failure sending next results request")
  3086  	}
  3087  	result, err = client.ListAtSubscriptionScopeResponder(resp)
  3088  	if err != nil {
  3089  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "listAtSubscriptionScopeNextResults", resp, "Failure responding to next results request")
  3090  	}
  3091  	return
  3092  }
  3093  
  3094  // ListAtSubscriptionScopeComplete enumerates all values, automatically crossing page boundaries as required.
  3095  func (client DeploymentsClient) ListAtSubscriptionScopeComplete(ctx context.Context, filter string, top *int32) (result DeploymentListResultIterator, err error) {
  3096  	if tracing.IsEnabled() {
  3097  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtSubscriptionScope")
  3098  		defer func() {
  3099  			sc := -1
  3100  			if result.Response().Response.Response != nil {
  3101  				sc = result.page.Response().Response.Response.StatusCode
  3102  			}
  3103  			tracing.EndSpan(ctx, sc, err)
  3104  		}()
  3105  	}
  3106  	result.page, err = client.ListAtSubscriptionScope(ctx, filter, top)
  3107  	return
  3108  }
  3109  
  3110  // ListAtTenantScope get all the deployments at the tenant scope.
  3111  // Parameters:
  3112  // filter - the filter to apply on the operation. For example, you can use $filter=provisioningState eq
  3113  // '{state}'.
  3114  // top - the number of results to get. If null is passed, returns all deployments.
  3115  func (client DeploymentsClient) ListAtTenantScope(ctx context.Context, filter string, top *int32) (result DeploymentListResultPage, err error) {
  3116  	if tracing.IsEnabled() {
  3117  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtTenantScope")
  3118  		defer func() {
  3119  			sc := -1
  3120  			if result.dlr.Response.Response != nil {
  3121  				sc = result.dlr.Response.Response.StatusCode
  3122  			}
  3123  			tracing.EndSpan(ctx, sc, err)
  3124  		}()
  3125  	}
  3126  	result.fn = client.listAtTenantScopeNextResults
  3127  	req, err := client.ListAtTenantScopePreparer(ctx, filter, top)
  3128  	if err != nil {
  3129  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ListAtTenantScope", nil, "Failure preparing request")
  3130  		return
  3131  	}
  3132  
  3133  	resp, err := client.ListAtTenantScopeSender(req)
  3134  	if err != nil {
  3135  		result.dlr.Response = autorest.Response{Response: resp}
  3136  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ListAtTenantScope", resp, "Failure sending request")
  3137  		return
  3138  	}
  3139  
  3140  	result.dlr, err = client.ListAtTenantScopeResponder(resp)
  3141  	if err != nil {
  3142  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ListAtTenantScope", resp, "Failure responding to request")
  3143  		return
  3144  	}
  3145  	if result.dlr.hasNextLink() && result.dlr.IsEmpty() {
  3146  		err = result.NextWithContext(ctx)
  3147  		return
  3148  	}
  3149  
  3150  	return
  3151  }
  3152  
  3153  // ListAtTenantScopePreparer prepares the ListAtTenantScope request.
  3154  func (client DeploymentsClient) ListAtTenantScopePreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) {
  3155  	const APIVersion = "2019-07-01"
  3156  	queryParameters := map[string]interface{}{
  3157  		"api-version": APIVersion,
  3158  	}
  3159  	if len(filter) > 0 {
  3160  		queryParameters["$filter"] = autorest.Encode("query", filter)
  3161  	}
  3162  	if top != nil {
  3163  		queryParameters["$top"] = autorest.Encode("query", *top)
  3164  	}
  3165  
  3166  	preparer := autorest.CreatePreparer(
  3167  		autorest.AsGet(),
  3168  		autorest.WithBaseURL(client.BaseURI),
  3169  		autorest.WithPath("/providers/Microsoft.Resources/deployments/"),
  3170  		autorest.WithQueryParameters(queryParameters))
  3171  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3172  }
  3173  
  3174  // ListAtTenantScopeSender sends the ListAtTenantScope request. The method will close the
  3175  // http.Response Body if it receives an error.
  3176  func (client DeploymentsClient) ListAtTenantScopeSender(req *http.Request) (*http.Response, error) {
  3177  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  3178  }
  3179  
  3180  // ListAtTenantScopeResponder handles the response to the ListAtTenantScope request. The method always
  3181  // closes the http.Response Body.
  3182  func (client DeploymentsClient) ListAtTenantScopeResponder(resp *http.Response) (result DeploymentListResult, err error) {
  3183  	err = autorest.Respond(
  3184  		resp,
  3185  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  3186  		autorest.ByUnmarshallingJSON(&result),
  3187  		autorest.ByClosing())
  3188  	result.Response = autorest.Response{Response: resp}
  3189  	return
  3190  }
  3191  
  3192  // listAtTenantScopeNextResults retrieves the next set of results, if any.
  3193  func (client DeploymentsClient) listAtTenantScopeNextResults(ctx context.Context, lastResults DeploymentListResult) (result DeploymentListResult, err error) {
  3194  	req, err := lastResults.deploymentListResultPreparer(ctx)
  3195  	if err != nil {
  3196  		return result, autorest.NewErrorWithError(err, "features.DeploymentsClient", "listAtTenantScopeNextResults", nil, "Failure preparing next results request")
  3197  	}
  3198  	if req == nil {
  3199  		return
  3200  	}
  3201  	resp, err := client.ListAtTenantScopeSender(req)
  3202  	if err != nil {
  3203  		result.Response = autorest.Response{Response: resp}
  3204  		return result, autorest.NewErrorWithError(err, "features.DeploymentsClient", "listAtTenantScopeNextResults", resp, "Failure sending next results request")
  3205  	}
  3206  	result, err = client.ListAtTenantScopeResponder(resp)
  3207  	if err != nil {
  3208  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "listAtTenantScopeNextResults", resp, "Failure responding to next results request")
  3209  	}
  3210  	return
  3211  }
  3212  
  3213  // ListAtTenantScopeComplete enumerates all values, automatically crossing page boundaries as required.
  3214  func (client DeploymentsClient) ListAtTenantScopeComplete(ctx context.Context, filter string, top *int32) (result DeploymentListResultIterator, err error) {
  3215  	if tracing.IsEnabled() {
  3216  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtTenantScope")
  3217  		defer func() {
  3218  			sc := -1
  3219  			if result.Response().Response.Response != nil {
  3220  				sc = result.page.Response().Response.Response.StatusCode
  3221  			}
  3222  			tracing.EndSpan(ctx, sc, err)
  3223  		}()
  3224  	}
  3225  	result.page, err = client.ListAtTenantScope(ctx, filter, top)
  3226  	return
  3227  }
  3228  
  3229  // ListByResourceGroup get all the deployments for a resource group.
  3230  // Parameters:
  3231  // resourceGroupName - the name of the resource group with the deployments to get. The name is case
  3232  // insensitive.
  3233  // filter - the filter to apply on the operation. For example, you can use $filter=provisioningState eq
  3234  // '{state}'.
  3235  // top - the number of results to get. If null is passed, returns all deployments.
  3236  func (client DeploymentsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DeploymentListResultPage, err error) {
  3237  	if tracing.IsEnabled() {
  3238  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListByResourceGroup")
  3239  		defer func() {
  3240  			sc := -1
  3241  			if result.dlr.Response.Response != nil {
  3242  				sc = result.dlr.Response.Response.StatusCode
  3243  			}
  3244  			tracing.EndSpan(ctx, sc, err)
  3245  		}()
  3246  	}
  3247  	if err := validation.Validate([]validation.Validation{
  3248  		{TargetValue: resourceGroupName,
  3249  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  3250  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  3251  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil {
  3252  		return result, validation.NewError("features.DeploymentsClient", "ListByResourceGroup", err.Error())
  3253  	}
  3254  
  3255  	result.fn = client.listByResourceGroupNextResults
  3256  	req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top)
  3257  	if err != nil {
  3258  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ListByResourceGroup", nil, "Failure preparing request")
  3259  		return
  3260  	}
  3261  
  3262  	resp, err := client.ListByResourceGroupSender(req)
  3263  	if err != nil {
  3264  		result.dlr.Response = autorest.Response{Response: resp}
  3265  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ListByResourceGroup", resp, "Failure sending request")
  3266  		return
  3267  	}
  3268  
  3269  	result.dlr, err = client.ListByResourceGroupResponder(resp)
  3270  	if err != nil {
  3271  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ListByResourceGroup", resp, "Failure responding to request")
  3272  		return
  3273  	}
  3274  	if result.dlr.hasNextLink() && result.dlr.IsEmpty() {
  3275  		err = result.NextWithContext(ctx)
  3276  		return
  3277  	}
  3278  
  3279  	return
  3280  }
  3281  
  3282  // ListByResourceGroupPreparer prepares the ListByResourceGroup request.
  3283  func (client DeploymentsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) {
  3284  	pathParameters := map[string]interface{}{
  3285  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  3286  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  3287  	}
  3288  
  3289  	const APIVersion = "2019-07-01"
  3290  	queryParameters := map[string]interface{}{
  3291  		"api-version": APIVersion,
  3292  	}
  3293  	if len(filter) > 0 {
  3294  		queryParameters["$filter"] = autorest.Encode("query", filter)
  3295  	}
  3296  	if top != nil {
  3297  		queryParameters["$top"] = autorest.Encode("query", *top)
  3298  	}
  3299  
  3300  	preparer := autorest.CreatePreparer(
  3301  		autorest.AsGet(),
  3302  		autorest.WithBaseURL(client.BaseURI),
  3303  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", pathParameters),
  3304  		autorest.WithQueryParameters(queryParameters))
  3305  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3306  }
  3307  
  3308  // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
  3309  // http.Response Body if it receives an error.
  3310  func (client DeploymentsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
  3311  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  3312  }
  3313  
  3314  // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
  3315  // closes the http.Response Body.
  3316  func (client DeploymentsClient) ListByResourceGroupResponder(resp *http.Response) (result DeploymentListResult, err error) {
  3317  	err = autorest.Respond(
  3318  		resp,
  3319  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  3320  		autorest.ByUnmarshallingJSON(&result),
  3321  		autorest.ByClosing())
  3322  	result.Response = autorest.Response{Response: resp}
  3323  	return
  3324  }
  3325  
  3326  // listByResourceGroupNextResults retrieves the next set of results, if any.
  3327  func (client DeploymentsClient) listByResourceGroupNextResults(ctx context.Context, lastResults DeploymentListResult) (result DeploymentListResult, err error) {
  3328  	req, err := lastResults.deploymentListResultPreparer(ctx)
  3329  	if err != nil {
  3330  		return result, autorest.NewErrorWithError(err, "features.DeploymentsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
  3331  	}
  3332  	if req == nil {
  3333  		return
  3334  	}
  3335  	resp, err := client.ListByResourceGroupSender(req)
  3336  	if err != nil {
  3337  		result.Response = autorest.Response{Response: resp}
  3338  		return result, autorest.NewErrorWithError(err, "features.DeploymentsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
  3339  	}
  3340  	result, err = client.ListByResourceGroupResponder(resp)
  3341  	if err != nil {
  3342  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
  3343  	}
  3344  	return
  3345  }
  3346  
  3347  // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
  3348  func (client DeploymentsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DeploymentListResultIterator, err error) {
  3349  	if tracing.IsEnabled() {
  3350  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListByResourceGroup")
  3351  		defer func() {
  3352  			sc := -1
  3353  			if result.Response().Response.Response != nil {
  3354  				sc = result.page.Response().Response.Response.StatusCode
  3355  			}
  3356  			tracing.EndSpan(ctx, sc, err)
  3357  		}()
  3358  	}
  3359  	result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, filter, top)
  3360  	return
  3361  }
  3362  
  3363  // Validate validates whether the specified template is syntactically correct and will be accepted by Azure Resource
  3364  // Manager..
  3365  // Parameters:
  3366  // resourceGroupName - the name of the resource group the template will be deployed to. The name is case
  3367  // insensitive.
  3368  // deploymentName - the name of the deployment.
  3369  // parameters - parameters to validate.
  3370  func (client DeploymentsClient) Validate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment) (result DeploymentValidateResult, err error) {
  3371  	if tracing.IsEnabled() {
  3372  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Validate")
  3373  		defer func() {
  3374  			sc := -1
  3375  			if result.Response.Response != nil {
  3376  				sc = result.Response.Response.StatusCode
  3377  			}
  3378  			tracing.EndSpan(ctx, sc, err)
  3379  		}()
  3380  	}
  3381  	if err := validation.Validate([]validation.Validation{
  3382  		{TargetValue: resourceGroupName,
  3383  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  3384  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  3385  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}},
  3386  		{TargetValue: deploymentName,
  3387  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  3388  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  3389  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  3390  		{TargetValue: parameters,
  3391  			Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true,
  3392  				Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false,
  3393  					Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  3394  					{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false,
  3395  						Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  3396  				}}}}}); err != nil {
  3397  		return result, validation.NewError("features.DeploymentsClient", "Validate", err.Error())
  3398  	}
  3399  
  3400  	req, err := client.ValidatePreparer(ctx, resourceGroupName, deploymentName, parameters)
  3401  	if err != nil {
  3402  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "Validate", nil, "Failure preparing request")
  3403  		return
  3404  	}
  3405  
  3406  	resp, err := client.ValidateSender(req)
  3407  	if err != nil {
  3408  		result.Response = autorest.Response{Response: resp}
  3409  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "Validate", resp, "Failure sending request")
  3410  		return
  3411  	}
  3412  
  3413  	result, err = client.ValidateResponder(resp)
  3414  	if err != nil {
  3415  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "Validate", resp, "Failure responding to request")
  3416  		return
  3417  	}
  3418  
  3419  	return
  3420  }
  3421  
  3422  // ValidatePreparer prepares the Validate request.
  3423  func (client DeploymentsClient) ValidatePreparer(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment) (*http.Request, error) {
  3424  	pathParameters := map[string]interface{}{
  3425  		"deploymentName":    autorest.Encode("path", deploymentName),
  3426  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  3427  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  3428  	}
  3429  
  3430  	const APIVersion = "2019-07-01"
  3431  	queryParameters := map[string]interface{}{
  3432  		"api-version": APIVersion,
  3433  	}
  3434  
  3435  	preparer := autorest.CreatePreparer(
  3436  		autorest.AsContentType("application/json; charset=utf-8"),
  3437  		autorest.AsPost(),
  3438  		autorest.WithBaseURL(client.BaseURI),
  3439  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", pathParameters),
  3440  		autorest.WithJSON(parameters),
  3441  		autorest.WithQueryParameters(queryParameters))
  3442  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3443  }
  3444  
  3445  // ValidateSender sends the Validate request. The method will close the
  3446  // http.Response Body if it receives an error.
  3447  func (client DeploymentsClient) ValidateSender(req *http.Request) (*http.Response, error) {
  3448  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  3449  }
  3450  
  3451  // ValidateResponder handles the response to the Validate request. The method always
  3452  // closes the http.Response Body.
  3453  func (client DeploymentsClient) ValidateResponder(resp *http.Response) (result DeploymentValidateResult, err error) {
  3454  	err = autorest.Respond(
  3455  		resp,
  3456  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest),
  3457  		autorest.ByUnmarshallingJSON(&result),
  3458  		autorest.ByClosing())
  3459  	result.Response = autorest.Response{Response: resp}
  3460  	return
  3461  }
  3462  
  3463  // ValidateAtManagementGroupScope validates whether the specified template is syntactically correct and will be
  3464  // accepted by Azure Resource Manager..
  3465  // Parameters:
  3466  // groupID - the management group ID.
  3467  // deploymentName - the name of the deployment.
  3468  // parameters - parameters to validate.
  3469  func (client DeploymentsClient) ValidateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters Deployment) (result DeploymentValidateResult, err error) {
  3470  	if tracing.IsEnabled() {
  3471  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ValidateAtManagementGroupScope")
  3472  		defer func() {
  3473  			sc := -1
  3474  			if result.Response.Response != nil {
  3475  				sc = result.Response.Response.StatusCode
  3476  			}
  3477  			tracing.EndSpan(ctx, sc, err)
  3478  		}()
  3479  	}
  3480  	if err := validation.Validate([]validation.Validation{
  3481  		{TargetValue: groupID,
  3482  			Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil},
  3483  				{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  3484  		{TargetValue: deploymentName,
  3485  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  3486  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  3487  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  3488  		{TargetValue: parameters,
  3489  			Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true,
  3490  				Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false,
  3491  					Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  3492  					{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false,
  3493  						Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  3494  				}}}}}); err != nil {
  3495  		return result, validation.NewError("features.DeploymentsClient", "ValidateAtManagementGroupScope", err.Error())
  3496  	}
  3497  
  3498  	req, err := client.ValidateAtManagementGroupScopePreparer(ctx, groupID, deploymentName, parameters)
  3499  	if err != nil {
  3500  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ValidateAtManagementGroupScope", nil, "Failure preparing request")
  3501  		return
  3502  	}
  3503  
  3504  	resp, err := client.ValidateAtManagementGroupScopeSender(req)
  3505  	if err != nil {
  3506  		result.Response = autorest.Response{Response: resp}
  3507  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ValidateAtManagementGroupScope", resp, "Failure sending request")
  3508  		return
  3509  	}
  3510  
  3511  	result, err = client.ValidateAtManagementGroupScopeResponder(resp)
  3512  	if err != nil {
  3513  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ValidateAtManagementGroupScope", resp, "Failure responding to request")
  3514  		return
  3515  	}
  3516  
  3517  	return
  3518  }
  3519  
  3520  // ValidateAtManagementGroupScopePreparer prepares the ValidateAtManagementGroupScope request.
  3521  func (client DeploymentsClient) ValidateAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string, parameters Deployment) (*http.Request, error) {
  3522  	pathParameters := map[string]interface{}{
  3523  		"deploymentName": autorest.Encode("path", deploymentName),
  3524  		"groupId":        autorest.Encode("path", groupID),
  3525  	}
  3526  
  3527  	const APIVersion = "2019-07-01"
  3528  	queryParameters := map[string]interface{}{
  3529  		"api-version": APIVersion,
  3530  	}
  3531  
  3532  	preparer := autorest.CreatePreparer(
  3533  		autorest.AsContentType("application/json; charset=utf-8"),
  3534  		autorest.AsPost(),
  3535  		autorest.WithBaseURL(client.BaseURI),
  3536  		autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", pathParameters),
  3537  		autorest.WithJSON(parameters),
  3538  		autorest.WithQueryParameters(queryParameters))
  3539  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3540  }
  3541  
  3542  // ValidateAtManagementGroupScopeSender sends the ValidateAtManagementGroupScope request. The method will close the
  3543  // http.Response Body if it receives an error.
  3544  func (client DeploymentsClient) ValidateAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) {
  3545  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  3546  }
  3547  
  3548  // ValidateAtManagementGroupScopeResponder handles the response to the ValidateAtManagementGroupScope request. The method always
  3549  // closes the http.Response Body.
  3550  func (client DeploymentsClient) ValidateAtManagementGroupScopeResponder(resp *http.Response) (result DeploymentValidateResult, err error) {
  3551  	err = autorest.Respond(
  3552  		resp,
  3553  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest),
  3554  		autorest.ByUnmarshallingJSON(&result),
  3555  		autorest.ByClosing())
  3556  	result.Response = autorest.Response{Response: resp}
  3557  	return
  3558  }
  3559  
  3560  // ValidateAtScope validates whether the specified template is syntactically correct and will be accepted by Azure
  3561  // Resource Manager..
  3562  // Parameters:
  3563  // scope - the scope of a deployment.
  3564  // deploymentName - the name of the deployment.
  3565  // parameters - parameters to validate.
  3566  func (client DeploymentsClient) ValidateAtScope(ctx context.Context, scope string, deploymentName string, parameters Deployment) (result DeploymentValidateResult, err error) {
  3567  	if tracing.IsEnabled() {
  3568  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ValidateAtScope")
  3569  		defer func() {
  3570  			sc := -1
  3571  			if result.Response.Response != nil {
  3572  				sc = result.Response.Response.StatusCode
  3573  			}
  3574  			tracing.EndSpan(ctx, sc, err)
  3575  		}()
  3576  	}
  3577  	if err := validation.Validate([]validation.Validation{
  3578  		{TargetValue: deploymentName,
  3579  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  3580  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  3581  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  3582  		{TargetValue: parameters,
  3583  			Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true,
  3584  				Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false,
  3585  					Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  3586  					{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false,
  3587  						Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  3588  				}}}}}); err != nil {
  3589  		return result, validation.NewError("features.DeploymentsClient", "ValidateAtScope", err.Error())
  3590  	}
  3591  
  3592  	req, err := client.ValidateAtScopePreparer(ctx, scope, deploymentName, parameters)
  3593  	if err != nil {
  3594  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ValidateAtScope", nil, "Failure preparing request")
  3595  		return
  3596  	}
  3597  
  3598  	resp, err := client.ValidateAtScopeSender(req)
  3599  	if err != nil {
  3600  		result.Response = autorest.Response{Response: resp}
  3601  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ValidateAtScope", resp, "Failure sending request")
  3602  		return
  3603  	}
  3604  
  3605  	result, err = client.ValidateAtScopeResponder(resp)
  3606  	if err != nil {
  3607  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ValidateAtScope", resp, "Failure responding to request")
  3608  		return
  3609  	}
  3610  
  3611  	return
  3612  }
  3613  
  3614  // ValidateAtScopePreparer prepares the ValidateAtScope request.
  3615  func (client DeploymentsClient) ValidateAtScopePreparer(ctx context.Context, scope string, deploymentName string, parameters Deployment) (*http.Request, error) {
  3616  	pathParameters := map[string]interface{}{
  3617  		"deploymentName": autorest.Encode("path", deploymentName),
  3618  		"scope":          autorest.Encode("path", scope),
  3619  	}
  3620  
  3621  	const APIVersion = "2019-07-01"
  3622  	queryParameters := map[string]interface{}{
  3623  		"api-version": APIVersion,
  3624  	}
  3625  
  3626  	preparer := autorest.CreatePreparer(
  3627  		autorest.AsContentType("application/json; charset=utf-8"),
  3628  		autorest.AsPost(),
  3629  		autorest.WithBaseURL(client.BaseURI),
  3630  		autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", pathParameters),
  3631  		autorest.WithJSON(parameters),
  3632  		autorest.WithQueryParameters(queryParameters))
  3633  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3634  }
  3635  
  3636  // ValidateAtScopeSender sends the ValidateAtScope request. The method will close the
  3637  // http.Response Body if it receives an error.
  3638  func (client DeploymentsClient) ValidateAtScopeSender(req *http.Request) (*http.Response, error) {
  3639  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  3640  }
  3641  
  3642  // ValidateAtScopeResponder handles the response to the ValidateAtScope request. The method always
  3643  // closes the http.Response Body.
  3644  func (client DeploymentsClient) ValidateAtScopeResponder(resp *http.Response) (result DeploymentValidateResult, err error) {
  3645  	err = autorest.Respond(
  3646  		resp,
  3647  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest),
  3648  		autorest.ByUnmarshallingJSON(&result),
  3649  		autorest.ByClosing())
  3650  	result.Response = autorest.Response{Response: resp}
  3651  	return
  3652  }
  3653  
  3654  // ValidateAtSubscriptionScope validates whether the specified template is syntactically correct and will be accepted
  3655  // by Azure Resource Manager..
  3656  // Parameters:
  3657  // deploymentName - the name of the deployment.
  3658  // parameters - parameters to validate.
  3659  func (client DeploymentsClient) ValidateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters Deployment) (result DeploymentValidateResult, err error) {
  3660  	if tracing.IsEnabled() {
  3661  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ValidateAtSubscriptionScope")
  3662  		defer func() {
  3663  			sc := -1
  3664  			if result.Response.Response != nil {
  3665  				sc = result.Response.Response.StatusCode
  3666  			}
  3667  			tracing.EndSpan(ctx, sc, err)
  3668  		}()
  3669  	}
  3670  	if err := validation.Validate([]validation.Validation{
  3671  		{TargetValue: deploymentName,
  3672  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  3673  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  3674  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  3675  		{TargetValue: parameters,
  3676  			Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true,
  3677  				Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false,
  3678  					Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  3679  					{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false,
  3680  						Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  3681  				}}}}}); err != nil {
  3682  		return result, validation.NewError("features.DeploymentsClient", "ValidateAtSubscriptionScope", err.Error())
  3683  	}
  3684  
  3685  	req, err := client.ValidateAtSubscriptionScopePreparer(ctx, deploymentName, parameters)
  3686  	if err != nil {
  3687  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ValidateAtSubscriptionScope", nil, "Failure preparing request")
  3688  		return
  3689  	}
  3690  
  3691  	resp, err := client.ValidateAtSubscriptionScopeSender(req)
  3692  	if err != nil {
  3693  		result.Response = autorest.Response{Response: resp}
  3694  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ValidateAtSubscriptionScope", resp, "Failure sending request")
  3695  		return
  3696  	}
  3697  
  3698  	result, err = client.ValidateAtSubscriptionScopeResponder(resp)
  3699  	if err != nil {
  3700  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ValidateAtSubscriptionScope", resp, "Failure responding to request")
  3701  		return
  3702  	}
  3703  
  3704  	return
  3705  }
  3706  
  3707  // ValidateAtSubscriptionScopePreparer prepares the ValidateAtSubscriptionScope request.
  3708  func (client DeploymentsClient) ValidateAtSubscriptionScopePreparer(ctx context.Context, deploymentName string, parameters Deployment) (*http.Request, error) {
  3709  	pathParameters := map[string]interface{}{
  3710  		"deploymentName": autorest.Encode("path", deploymentName),
  3711  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
  3712  	}
  3713  
  3714  	const APIVersion = "2019-07-01"
  3715  	queryParameters := map[string]interface{}{
  3716  		"api-version": APIVersion,
  3717  	}
  3718  
  3719  	preparer := autorest.CreatePreparer(
  3720  		autorest.AsContentType("application/json; charset=utf-8"),
  3721  		autorest.AsPost(),
  3722  		autorest.WithBaseURL(client.BaseURI),
  3723  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", pathParameters),
  3724  		autorest.WithJSON(parameters),
  3725  		autorest.WithQueryParameters(queryParameters))
  3726  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3727  }
  3728  
  3729  // ValidateAtSubscriptionScopeSender sends the ValidateAtSubscriptionScope request. The method will close the
  3730  // http.Response Body if it receives an error.
  3731  func (client DeploymentsClient) ValidateAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) {
  3732  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  3733  }
  3734  
  3735  // ValidateAtSubscriptionScopeResponder handles the response to the ValidateAtSubscriptionScope request. The method always
  3736  // closes the http.Response Body.
  3737  func (client DeploymentsClient) ValidateAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentValidateResult, err error) {
  3738  	err = autorest.Respond(
  3739  		resp,
  3740  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest),
  3741  		autorest.ByUnmarshallingJSON(&result),
  3742  		autorest.ByClosing())
  3743  	result.Response = autorest.Response{Response: resp}
  3744  	return
  3745  }
  3746  
  3747  // ValidateAtTenantScope validates whether the specified template is syntactically correct and will be accepted by
  3748  // Azure Resource Manager..
  3749  // Parameters:
  3750  // deploymentName - the name of the deployment.
  3751  // parameters - parameters to validate.
  3752  func (client DeploymentsClient) ValidateAtTenantScope(ctx context.Context, deploymentName string, parameters Deployment) (result DeploymentValidateResult, err error) {
  3753  	if tracing.IsEnabled() {
  3754  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ValidateAtTenantScope")
  3755  		defer func() {
  3756  			sc := -1
  3757  			if result.Response.Response != nil {
  3758  				sc = result.Response.Response.StatusCode
  3759  			}
  3760  			tracing.EndSpan(ctx, sc, err)
  3761  		}()
  3762  	}
  3763  	if err := validation.Validate([]validation.Validation{
  3764  		{TargetValue: deploymentName,
  3765  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  3766  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  3767  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  3768  		{TargetValue: parameters,
  3769  			Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true,
  3770  				Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false,
  3771  					Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  3772  					{Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false,
  3773  						Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}},
  3774  				}}}}}); err != nil {
  3775  		return result, validation.NewError("features.DeploymentsClient", "ValidateAtTenantScope", err.Error())
  3776  	}
  3777  
  3778  	req, err := client.ValidateAtTenantScopePreparer(ctx, deploymentName, parameters)
  3779  	if err != nil {
  3780  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ValidateAtTenantScope", nil, "Failure preparing request")
  3781  		return
  3782  	}
  3783  
  3784  	resp, err := client.ValidateAtTenantScopeSender(req)
  3785  	if err != nil {
  3786  		result.Response = autorest.Response{Response: resp}
  3787  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ValidateAtTenantScope", resp, "Failure sending request")
  3788  		return
  3789  	}
  3790  
  3791  	result, err = client.ValidateAtTenantScopeResponder(resp)
  3792  	if err != nil {
  3793  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "ValidateAtTenantScope", resp, "Failure responding to request")
  3794  		return
  3795  	}
  3796  
  3797  	return
  3798  }
  3799  
  3800  // ValidateAtTenantScopePreparer prepares the ValidateAtTenantScope request.
  3801  func (client DeploymentsClient) ValidateAtTenantScopePreparer(ctx context.Context, deploymentName string, parameters Deployment) (*http.Request, error) {
  3802  	pathParameters := map[string]interface{}{
  3803  		"deploymentName": autorest.Encode("path", deploymentName),
  3804  	}
  3805  
  3806  	const APIVersion = "2019-07-01"
  3807  	queryParameters := map[string]interface{}{
  3808  		"api-version": APIVersion,
  3809  	}
  3810  
  3811  	preparer := autorest.CreatePreparer(
  3812  		autorest.AsContentType("application/json; charset=utf-8"),
  3813  		autorest.AsPost(),
  3814  		autorest.WithBaseURL(client.BaseURI),
  3815  		autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}/validate", pathParameters),
  3816  		autorest.WithJSON(parameters),
  3817  		autorest.WithQueryParameters(queryParameters))
  3818  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3819  }
  3820  
  3821  // ValidateAtTenantScopeSender sends the ValidateAtTenantScope request. The method will close the
  3822  // http.Response Body if it receives an error.
  3823  func (client DeploymentsClient) ValidateAtTenantScopeSender(req *http.Request) (*http.Response, error) {
  3824  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  3825  }
  3826  
  3827  // ValidateAtTenantScopeResponder handles the response to the ValidateAtTenantScope request. The method always
  3828  // closes the http.Response Body.
  3829  func (client DeploymentsClient) ValidateAtTenantScopeResponder(resp *http.Response) (result DeploymentValidateResult, err error) {
  3830  	err = autorest.Respond(
  3831  		resp,
  3832  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest),
  3833  		autorest.ByUnmarshallingJSON(&result),
  3834  		autorest.ByClosing())
  3835  	result.Response = autorest.Response{Response: resp}
  3836  	return
  3837  }
  3838  
  3839  // WhatIf returns changes that will be made by the deployment if executed at the scope of the resource group.
  3840  // Parameters:
  3841  // resourceGroupName - the name of the resource group the template will be deployed to. The name is case
  3842  // insensitive.
  3843  // deploymentName - the name of the deployment.
  3844  // parameters - parameters to validate.
  3845  func (client DeploymentsClient) WhatIf(ctx context.Context, resourceGroupName string, deploymentName string, parameters DeploymentWhatIf) (result DeploymentsWhatIfFuture, err error) {
  3846  	if tracing.IsEnabled() {
  3847  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.WhatIf")
  3848  		defer func() {
  3849  			sc := -1
  3850  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  3851  				sc = result.FutureAPI.Response().StatusCode
  3852  			}
  3853  			tracing.EndSpan(ctx, sc, err)
  3854  		}()
  3855  	}
  3856  	if err := validation.Validate([]validation.Validation{
  3857  		{TargetValue: resourceGroupName,
  3858  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  3859  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  3860  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}},
  3861  		{TargetValue: deploymentName,
  3862  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  3863  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  3864  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  3865  		{TargetValue: parameters,
  3866  			Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
  3867  		return result, validation.NewError("features.DeploymentsClient", "WhatIf", err.Error())
  3868  	}
  3869  
  3870  	req, err := client.WhatIfPreparer(ctx, resourceGroupName, deploymentName, parameters)
  3871  	if err != nil {
  3872  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "WhatIf", nil, "Failure preparing request")
  3873  		return
  3874  	}
  3875  
  3876  	result, err = client.WhatIfSender(req)
  3877  	if err != nil {
  3878  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "WhatIf", result.Response(), "Failure sending request")
  3879  		return
  3880  	}
  3881  
  3882  	return
  3883  }
  3884  
  3885  // WhatIfPreparer prepares the WhatIf request.
  3886  func (client DeploymentsClient) WhatIfPreparer(ctx context.Context, resourceGroupName string, deploymentName string, parameters DeploymentWhatIf) (*http.Request, error) {
  3887  	pathParameters := map[string]interface{}{
  3888  		"deploymentName":    autorest.Encode("path", deploymentName),
  3889  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  3890  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  3891  	}
  3892  
  3893  	const APIVersion = "2019-07-01"
  3894  	queryParameters := map[string]interface{}{
  3895  		"api-version": APIVersion,
  3896  	}
  3897  
  3898  	preparer := autorest.CreatePreparer(
  3899  		autorest.AsContentType("application/json; charset=utf-8"),
  3900  		autorest.AsPost(),
  3901  		autorest.WithBaseURL(client.BaseURI),
  3902  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", pathParameters),
  3903  		autorest.WithJSON(parameters),
  3904  		autorest.WithQueryParameters(queryParameters))
  3905  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3906  }
  3907  
  3908  // WhatIfSender sends the WhatIf request. The method will close the
  3909  // http.Response Body if it receives an error.
  3910  func (client DeploymentsClient) WhatIfSender(req *http.Request) (future DeploymentsWhatIfFuture, err error) {
  3911  	var resp *http.Response
  3912  	future.FutureAPI = &azure.Future{}
  3913  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  3914  	if err != nil {
  3915  		return
  3916  	}
  3917  	var azf azure.Future
  3918  	azf, err = azure.NewFutureFromResponse(resp)
  3919  	future.FutureAPI = &azf
  3920  	future.Result = future.result
  3921  	return
  3922  }
  3923  
  3924  // WhatIfResponder handles the response to the WhatIf request. The method always
  3925  // closes the http.Response Body.
  3926  func (client DeploymentsClient) WhatIfResponder(resp *http.Response) (result WhatIfOperationResult, err error) {
  3927  	err = autorest.Respond(
  3928  		resp,
  3929  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  3930  		autorest.ByUnmarshallingJSON(&result),
  3931  		autorest.ByClosing())
  3932  	result.Response = autorest.Response{Response: resp}
  3933  	return
  3934  }
  3935  
  3936  // WhatIfAtSubscriptionScope returns changes that will be made by the deployment if executed at the scope of the
  3937  // subscription.
  3938  // Parameters:
  3939  // deploymentName - the name of the deployment.
  3940  // parameters - parameters to What If.
  3941  func (client DeploymentsClient) WhatIfAtSubscriptionScope(ctx context.Context, deploymentName string, parameters DeploymentWhatIf) (result DeploymentsWhatIfAtSubscriptionScopeFuture, err error) {
  3942  	if tracing.IsEnabled() {
  3943  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.WhatIfAtSubscriptionScope")
  3944  		defer func() {
  3945  			sc := -1
  3946  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  3947  				sc = result.FutureAPI.Response().StatusCode
  3948  			}
  3949  			tracing.EndSpan(ctx, sc, err)
  3950  		}()
  3951  	}
  3952  	if err := validation.Validate([]validation.Validation{
  3953  		{TargetValue: deploymentName,
  3954  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  3955  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  3956  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  3957  		{TargetValue: parameters,
  3958  			Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
  3959  		return result, validation.NewError("features.DeploymentsClient", "WhatIfAtSubscriptionScope", err.Error())
  3960  	}
  3961  
  3962  	req, err := client.WhatIfAtSubscriptionScopePreparer(ctx, deploymentName, parameters)
  3963  	if err != nil {
  3964  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "WhatIfAtSubscriptionScope", nil, "Failure preparing request")
  3965  		return
  3966  	}
  3967  
  3968  	result, err = client.WhatIfAtSubscriptionScopeSender(req)
  3969  	if err != nil {
  3970  		err = autorest.NewErrorWithError(err, "features.DeploymentsClient", "WhatIfAtSubscriptionScope", result.Response(), "Failure sending request")
  3971  		return
  3972  	}
  3973  
  3974  	return
  3975  }
  3976  
  3977  // WhatIfAtSubscriptionScopePreparer prepares the WhatIfAtSubscriptionScope request.
  3978  func (client DeploymentsClient) WhatIfAtSubscriptionScopePreparer(ctx context.Context, deploymentName string, parameters DeploymentWhatIf) (*http.Request, error) {
  3979  	pathParameters := map[string]interface{}{
  3980  		"deploymentName": autorest.Encode("path", deploymentName),
  3981  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
  3982  	}
  3983  
  3984  	const APIVersion = "2019-07-01"
  3985  	queryParameters := map[string]interface{}{
  3986  		"api-version": APIVersion,
  3987  	}
  3988  
  3989  	preparer := autorest.CreatePreparer(
  3990  		autorest.AsContentType("application/json; charset=utf-8"),
  3991  		autorest.AsPost(),
  3992  		autorest.WithBaseURL(client.BaseURI),
  3993  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", pathParameters),
  3994  		autorest.WithJSON(parameters),
  3995  		autorest.WithQueryParameters(queryParameters))
  3996  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3997  }
  3998  
  3999  // WhatIfAtSubscriptionScopeSender sends the WhatIfAtSubscriptionScope request. The method will close the
  4000  // http.Response Body if it receives an error.
  4001  func (client DeploymentsClient) WhatIfAtSubscriptionScopeSender(req *http.Request) (future DeploymentsWhatIfAtSubscriptionScopeFuture, err error) {
  4002  	var resp *http.Response
  4003  	future.FutureAPI = &azure.Future{}
  4004  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  4005  	if err != nil {
  4006  		return
  4007  	}
  4008  	var azf azure.Future
  4009  	azf, err = azure.NewFutureFromResponse(resp)
  4010  	future.FutureAPI = &azf
  4011  	future.Result = future.result
  4012  	return
  4013  }
  4014  
  4015  // WhatIfAtSubscriptionScopeResponder handles the response to the WhatIfAtSubscriptionScope request. The method always
  4016  // closes the http.Response Body.
  4017  func (client DeploymentsClient) WhatIfAtSubscriptionScopeResponder(resp *http.Response) (result WhatIfOperationResult, err error) {
  4018  	err = autorest.Respond(
  4019  		resp,
  4020  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  4021  		autorest.ByUnmarshallingJSON(&result),
  4022  		autorest.ByClosing())
  4023  	result.Response = autorest.Response{Response: resp}
  4024  	return
  4025  }
  4026  

View as plain text