...

Source file src/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/features/deploymentoperations.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  // DeploymentOperationsClient is the provides operations for working with resources and resource groups.
    19  type DeploymentOperationsClient struct {
    20  	BaseClient
    21  }
    22  
    23  // NewDeploymentOperationsClient creates an instance of the DeploymentOperationsClient client.
    24  func NewDeploymentOperationsClient(subscriptionID string) DeploymentOperationsClient {
    25  	return NewDeploymentOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
    26  }
    27  
    28  // NewDeploymentOperationsClientWithBaseURI creates an instance of the DeploymentOperationsClient client using a custom
    29  // endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure
    30  // stack).
    31  func NewDeploymentOperationsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentOperationsClient {
    32  	return DeploymentOperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
    33  }
    34  
    35  // Get gets a deployments operation.
    36  // Parameters:
    37  // resourceGroupName - the name of the resource group. The name is case insensitive.
    38  // deploymentName - the name of the deployment.
    39  // operationID - the ID of the operation to get.
    40  func (client DeploymentOperationsClient) Get(ctx context.Context, resourceGroupName string, deploymentName string, operationID string) (result DeploymentOperation, err error) {
    41  	if tracing.IsEnabled() {
    42  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.Get")
    43  		defer func() {
    44  			sc := -1
    45  			if result.Response.Response != nil {
    46  				sc = result.Response.Response.StatusCode
    47  			}
    48  			tracing.EndSpan(ctx, sc, err)
    49  		}()
    50  	}
    51  	if err := validation.Validate([]validation.Validation{
    52  		{TargetValue: resourceGroupName,
    53  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
    54  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
    55  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}},
    56  		{TargetValue: deploymentName,
    57  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
    58  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
    59  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
    60  		return result, validation.NewError("features.DeploymentOperationsClient", "Get", err.Error())
    61  	}
    62  
    63  	req, err := client.GetPreparer(ctx, resourceGroupName, deploymentName, operationID)
    64  	if err != nil {
    65  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "Get", nil, "Failure preparing request")
    66  		return
    67  	}
    68  
    69  	resp, err := client.GetSender(req)
    70  	if err != nil {
    71  		result.Response = autorest.Response{Response: resp}
    72  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "Get", resp, "Failure sending request")
    73  		return
    74  	}
    75  
    76  	result, err = client.GetResponder(resp)
    77  	if err != nil {
    78  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "Get", resp, "Failure responding to request")
    79  		return
    80  	}
    81  
    82  	return
    83  }
    84  
    85  // GetPreparer prepares the Get request.
    86  func (client DeploymentOperationsClient) GetPreparer(ctx context.Context, resourceGroupName string, deploymentName string, operationID string) (*http.Request, error) {
    87  	pathParameters := map[string]interface{}{
    88  		"deploymentName":    autorest.Encode("path", deploymentName),
    89  		"operationId":       autorest.Encode("path", operationID),
    90  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
    91  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
    92  	}
    93  
    94  	const APIVersion = "2019-07-01"
    95  	queryParameters := map[string]interface{}{
    96  		"api-version": APIVersion,
    97  	}
    98  
    99  	preparer := autorest.CreatePreparer(
   100  		autorest.AsGet(),
   101  		autorest.WithBaseURL(client.BaseURI),
   102  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", pathParameters),
   103  		autorest.WithQueryParameters(queryParameters))
   104  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   105  }
   106  
   107  // GetSender sends the Get request. The method will close the
   108  // http.Response Body if it receives an error.
   109  func (client DeploymentOperationsClient) GetSender(req *http.Request) (*http.Response, error) {
   110  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   111  }
   112  
   113  // GetResponder handles the response to the Get request. The method always
   114  // closes the http.Response Body.
   115  func (client DeploymentOperationsClient) GetResponder(resp *http.Response) (result DeploymentOperation, err error) {
   116  	err = autorest.Respond(
   117  		resp,
   118  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   119  		autorest.ByUnmarshallingJSON(&result),
   120  		autorest.ByClosing())
   121  	result.Response = autorest.Response{Response: resp}
   122  	return
   123  }
   124  
   125  // GetAtManagementGroupScope gets a deployments operation.
   126  // Parameters:
   127  // groupID - the management group ID.
   128  // deploymentName - the name of the deployment.
   129  // operationID - the ID of the operation to get.
   130  func (client DeploymentOperationsClient) GetAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, operationID string) (result DeploymentOperation, err error) {
   131  	if tracing.IsEnabled() {
   132  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.GetAtManagementGroupScope")
   133  		defer func() {
   134  			sc := -1
   135  			if result.Response.Response != nil {
   136  				sc = result.Response.Response.StatusCode
   137  			}
   138  			tracing.EndSpan(ctx, sc, err)
   139  		}()
   140  	}
   141  	if err := validation.Validate([]validation.Validation{
   142  		{TargetValue: groupID,
   143  			Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil},
   144  				{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   145  		{TargetValue: deploymentName,
   146  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   147  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   148  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   149  		return result, validation.NewError("features.DeploymentOperationsClient", "GetAtManagementGroupScope", err.Error())
   150  	}
   151  
   152  	req, err := client.GetAtManagementGroupScopePreparer(ctx, groupID, deploymentName, operationID)
   153  	if err != nil {
   154  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "GetAtManagementGroupScope", nil, "Failure preparing request")
   155  		return
   156  	}
   157  
   158  	resp, err := client.GetAtManagementGroupScopeSender(req)
   159  	if err != nil {
   160  		result.Response = autorest.Response{Response: resp}
   161  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "GetAtManagementGroupScope", resp, "Failure sending request")
   162  		return
   163  	}
   164  
   165  	result, err = client.GetAtManagementGroupScopeResponder(resp)
   166  	if err != nil {
   167  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "GetAtManagementGroupScope", resp, "Failure responding to request")
   168  		return
   169  	}
   170  
   171  	return
   172  }
   173  
   174  // GetAtManagementGroupScopePreparer prepares the GetAtManagementGroupScope request.
   175  func (client DeploymentOperationsClient) GetAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string, operationID string) (*http.Request, error) {
   176  	pathParameters := map[string]interface{}{
   177  		"deploymentName": autorest.Encode("path", deploymentName),
   178  		"groupId":        autorest.Encode("path", groupID),
   179  		"operationId":    autorest.Encode("path", operationID),
   180  	}
   181  
   182  	const APIVersion = "2019-07-01"
   183  	queryParameters := map[string]interface{}{
   184  		"api-version": APIVersion,
   185  	}
   186  
   187  	preparer := autorest.CreatePreparer(
   188  		autorest.AsGet(),
   189  		autorest.WithBaseURL(client.BaseURI),
   190  		autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", pathParameters),
   191  		autorest.WithQueryParameters(queryParameters))
   192  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   193  }
   194  
   195  // GetAtManagementGroupScopeSender sends the GetAtManagementGroupScope request. The method will close the
   196  // http.Response Body if it receives an error.
   197  func (client DeploymentOperationsClient) GetAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) {
   198  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   199  }
   200  
   201  // GetAtManagementGroupScopeResponder handles the response to the GetAtManagementGroupScope request. The method always
   202  // closes the http.Response Body.
   203  func (client DeploymentOperationsClient) GetAtManagementGroupScopeResponder(resp *http.Response) (result DeploymentOperation, err error) {
   204  	err = autorest.Respond(
   205  		resp,
   206  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   207  		autorest.ByUnmarshallingJSON(&result),
   208  		autorest.ByClosing())
   209  	result.Response = autorest.Response{Response: resp}
   210  	return
   211  }
   212  
   213  // GetAtScope gets a deployments operation.
   214  // Parameters:
   215  // scope - the scope of a deployment.
   216  // deploymentName - the name of the deployment.
   217  // operationID - the ID of the operation to get.
   218  func (client DeploymentOperationsClient) GetAtScope(ctx context.Context, scope string, deploymentName string, operationID string) (result DeploymentOperation, err error) {
   219  	if tracing.IsEnabled() {
   220  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.GetAtScope")
   221  		defer func() {
   222  			sc := -1
   223  			if result.Response.Response != nil {
   224  				sc = result.Response.Response.StatusCode
   225  			}
   226  			tracing.EndSpan(ctx, sc, err)
   227  		}()
   228  	}
   229  	if err := validation.Validate([]validation.Validation{
   230  		{TargetValue: deploymentName,
   231  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   232  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   233  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   234  		return result, validation.NewError("features.DeploymentOperationsClient", "GetAtScope", err.Error())
   235  	}
   236  
   237  	req, err := client.GetAtScopePreparer(ctx, scope, deploymentName, operationID)
   238  	if err != nil {
   239  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "GetAtScope", nil, "Failure preparing request")
   240  		return
   241  	}
   242  
   243  	resp, err := client.GetAtScopeSender(req)
   244  	if err != nil {
   245  		result.Response = autorest.Response{Response: resp}
   246  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "GetAtScope", resp, "Failure sending request")
   247  		return
   248  	}
   249  
   250  	result, err = client.GetAtScopeResponder(resp)
   251  	if err != nil {
   252  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "GetAtScope", resp, "Failure responding to request")
   253  		return
   254  	}
   255  
   256  	return
   257  }
   258  
   259  // GetAtScopePreparer prepares the GetAtScope request.
   260  func (client DeploymentOperationsClient) GetAtScopePreparer(ctx context.Context, scope string, deploymentName string, operationID string) (*http.Request, error) {
   261  	pathParameters := map[string]interface{}{
   262  		"deploymentName": autorest.Encode("path", deploymentName),
   263  		"operationId":    autorest.Encode("path", operationID),
   264  		"scope":          autorest.Encode("path", scope),
   265  	}
   266  
   267  	const APIVersion = "2019-07-01"
   268  	queryParameters := map[string]interface{}{
   269  		"api-version": APIVersion,
   270  	}
   271  
   272  	preparer := autorest.CreatePreparer(
   273  		autorest.AsGet(),
   274  		autorest.WithBaseURL(client.BaseURI),
   275  		autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", pathParameters),
   276  		autorest.WithQueryParameters(queryParameters))
   277  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   278  }
   279  
   280  // GetAtScopeSender sends the GetAtScope request. The method will close the
   281  // http.Response Body if it receives an error.
   282  func (client DeploymentOperationsClient) GetAtScopeSender(req *http.Request) (*http.Response, error) {
   283  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   284  }
   285  
   286  // GetAtScopeResponder handles the response to the GetAtScope request. The method always
   287  // closes the http.Response Body.
   288  func (client DeploymentOperationsClient) GetAtScopeResponder(resp *http.Response) (result DeploymentOperation, err error) {
   289  	err = autorest.Respond(
   290  		resp,
   291  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   292  		autorest.ByUnmarshallingJSON(&result),
   293  		autorest.ByClosing())
   294  	result.Response = autorest.Response{Response: resp}
   295  	return
   296  }
   297  
   298  // GetAtSubscriptionScope gets a deployments operation.
   299  // Parameters:
   300  // deploymentName - the name of the deployment.
   301  // operationID - the ID of the operation to get.
   302  func (client DeploymentOperationsClient) GetAtSubscriptionScope(ctx context.Context, deploymentName string, operationID string) (result DeploymentOperation, err error) {
   303  	if tracing.IsEnabled() {
   304  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.GetAtSubscriptionScope")
   305  		defer func() {
   306  			sc := -1
   307  			if result.Response.Response != nil {
   308  				sc = result.Response.Response.StatusCode
   309  			}
   310  			tracing.EndSpan(ctx, sc, err)
   311  		}()
   312  	}
   313  	if err := validation.Validate([]validation.Validation{
   314  		{TargetValue: deploymentName,
   315  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   316  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   317  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   318  		return result, validation.NewError("features.DeploymentOperationsClient", "GetAtSubscriptionScope", err.Error())
   319  	}
   320  
   321  	req, err := client.GetAtSubscriptionScopePreparer(ctx, deploymentName, operationID)
   322  	if err != nil {
   323  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "GetAtSubscriptionScope", nil, "Failure preparing request")
   324  		return
   325  	}
   326  
   327  	resp, err := client.GetAtSubscriptionScopeSender(req)
   328  	if err != nil {
   329  		result.Response = autorest.Response{Response: resp}
   330  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "GetAtSubscriptionScope", resp, "Failure sending request")
   331  		return
   332  	}
   333  
   334  	result, err = client.GetAtSubscriptionScopeResponder(resp)
   335  	if err != nil {
   336  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "GetAtSubscriptionScope", resp, "Failure responding to request")
   337  		return
   338  	}
   339  
   340  	return
   341  }
   342  
   343  // GetAtSubscriptionScopePreparer prepares the GetAtSubscriptionScope request.
   344  func (client DeploymentOperationsClient) GetAtSubscriptionScopePreparer(ctx context.Context, deploymentName string, operationID string) (*http.Request, error) {
   345  	pathParameters := map[string]interface{}{
   346  		"deploymentName": autorest.Encode("path", deploymentName),
   347  		"operationId":    autorest.Encode("path", operationID),
   348  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   349  	}
   350  
   351  	const APIVersion = "2019-07-01"
   352  	queryParameters := map[string]interface{}{
   353  		"api-version": APIVersion,
   354  	}
   355  
   356  	preparer := autorest.CreatePreparer(
   357  		autorest.AsGet(),
   358  		autorest.WithBaseURL(client.BaseURI),
   359  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", pathParameters),
   360  		autorest.WithQueryParameters(queryParameters))
   361  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   362  }
   363  
   364  // GetAtSubscriptionScopeSender sends the GetAtSubscriptionScope request. The method will close the
   365  // http.Response Body if it receives an error.
   366  func (client DeploymentOperationsClient) GetAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) {
   367  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   368  }
   369  
   370  // GetAtSubscriptionScopeResponder handles the response to the GetAtSubscriptionScope request. The method always
   371  // closes the http.Response Body.
   372  func (client DeploymentOperationsClient) GetAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentOperation, err error) {
   373  	err = autorest.Respond(
   374  		resp,
   375  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   376  		autorest.ByUnmarshallingJSON(&result),
   377  		autorest.ByClosing())
   378  	result.Response = autorest.Response{Response: resp}
   379  	return
   380  }
   381  
   382  // GetAtTenantScope gets a deployments operation.
   383  // Parameters:
   384  // deploymentName - the name of the deployment.
   385  // operationID - the ID of the operation to get.
   386  func (client DeploymentOperationsClient) GetAtTenantScope(ctx context.Context, deploymentName string, operationID string) (result DeploymentOperation, err error) {
   387  	if tracing.IsEnabled() {
   388  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.GetAtTenantScope")
   389  		defer func() {
   390  			sc := -1
   391  			if result.Response.Response != nil {
   392  				sc = result.Response.Response.StatusCode
   393  			}
   394  			tracing.EndSpan(ctx, sc, err)
   395  		}()
   396  	}
   397  	if err := validation.Validate([]validation.Validation{
   398  		{TargetValue: deploymentName,
   399  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   400  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   401  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   402  		return result, validation.NewError("features.DeploymentOperationsClient", "GetAtTenantScope", err.Error())
   403  	}
   404  
   405  	req, err := client.GetAtTenantScopePreparer(ctx, deploymentName, operationID)
   406  	if err != nil {
   407  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "GetAtTenantScope", nil, "Failure preparing request")
   408  		return
   409  	}
   410  
   411  	resp, err := client.GetAtTenantScopeSender(req)
   412  	if err != nil {
   413  		result.Response = autorest.Response{Response: resp}
   414  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "GetAtTenantScope", resp, "Failure sending request")
   415  		return
   416  	}
   417  
   418  	result, err = client.GetAtTenantScopeResponder(resp)
   419  	if err != nil {
   420  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "GetAtTenantScope", resp, "Failure responding to request")
   421  		return
   422  	}
   423  
   424  	return
   425  }
   426  
   427  // GetAtTenantScopePreparer prepares the GetAtTenantScope request.
   428  func (client DeploymentOperationsClient) GetAtTenantScopePreparer(ctx context.Context, deploymentName string, operationID string) (*http.Request, error) {
   429  	pathParameters := map[string]interface{}{
   430  		"deploymentName": autorest.Encode("path", deploymentName),
   431  		"operationId":    autorest.Encode("path", operationID),
   432  	}
   433  
   434  	const APIVersion = "2019-07-01"
   435  	queryParameters := map[string]interface{}{
   436  		"api-version": APIVersion,
   437  	}
   438  
   439  	preparer := autorest.CreatePreparer(
   440  		autorest.AsGet(),
   441  		autorest.WithBaseURL(client.BaseURI),
   442  		autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", pathParameters),
   443  		autorest.WithQueryParameters(queryParameters))
   444  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   445  }
   446  
   447  // GetAtTenantScopeSender sends the GetAtTenantScope request. The method will close the
   448  // http.Response Body if it receives an error.
   449  func (client DeploymentOperationsClient) GetAtTenantScopeSender(req *http.Request) (*http.Response, error) {
   450  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   451  }
   452  
   453  // GetAtTenantScopeResponder handles the response to the GetAtTenantScope request. The method always
   454  // closes the http.Response Body.
   455  func (client DeploymentOperationsClient) GetAtTenantScopeResponder(resp *http.Response) (result DeploymentOperation, err error) {
   456  	err = autorest.Respond(
   457  		resp,
   458  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   459  		autorest.ByUnmarshallingJSON(&result),
   460  		autorest.ByClosing())
   461  	result.Response = autorest.Response{Response: resp}
   462  	return
   463  }
   464  
   465  // List gets all deployments operations for a deployment.
   466  // Parameters:
   467  // resourceGroupName - the name of the resource group. The name is case insensitive.
   468  // deploymentName - the name of the deployment.
   469  // top - the number of results to return.
   470  func (client DeploymentOperationsClient) List(ctx context.Context, resourceGroupName string, deploymentName string, top *int32) (result DeploymentOperationsListResultPage, err error) {
   471  	if tracing.IsEnabled() {
   472  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.List")
   473  		defer func() {
   474  			sc := -1
   475  			if result.dolr.Response.Response != nil {
   476  				sc = result.dolr.Response.Response.StatusCode
   477  			}
   478  			tracing.EndSpan(ctx, sc, err)
   479  		}()
   480  	}
   481  	if err := validation.Validate([]validation.Validation{
   482  		{TargetValue: resourceGroupName,
   483  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   484  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
   485  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}},
   486  		{TargetValue: deploymentName,
   487  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   488  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   489  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   490  		return result, validation.NewError("features.DeploymentOperationsClient", "List", err.Error())
   491  	}
   492  
   493  	result.fn = client.listNextResults
   494  	req, err := client.ListPreparer(ctx, resourceGroupName, deploymentName, top)
   495  	if err != nil {
   496  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "List", nil, "Failure preparing request")
   497  		return
   498  	}
   499  
   500  	resp, err := client.ListSender(req)
   501  	if err != nil {
   502  		result.dolr.Response = autorest.Response{Response: resp}
   503  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "List", resp, "Failure sending request")
   504  		return
   505  	}
   506  
   507  	result.dolr, err = client.ListResponder(resp)
   508  	if err != nil {
   509  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "List", resp, "Failure responding to request")
   510  		return
   511  	}
   512  	if result.dolr.hasNextLink() && result.dolr.IsEmpty() {
   513  		err = result.NextWithContext(ctx)
   514  		return
   515  	}
   516  
   517  	return
   518  }
   519  
   520  // ListPreparer prepares the List request.
   521  func (client DeploymentOperationsClient) ListPreparer(ctx context.Context, resourceGroupName string, deploymentName string, top *int32) (*http.Request, error) {
   522  	pathParameters := map[string]interface{}{
   523  		"deploymentName":    autorest.Encode("path", deploymentName),
   524  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   525  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   526  	}
   527  
   528  	const APIVersion = "2019-07-01"
   529  	queryParameters := map[string]interface{}{
   530  		"api-version": APIVersion,
   531  	}
   532  	if top != nil {
   533  		queryParameters["$top"] = autorest.Encode("query", *top)
   534  	}
   535  
   536  	preparer := autorest.CreatePreparer(
   537  		autorest.AsGet(),
   538  		autorest.WithBaseURL(client.BaseURI),
   539  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", pathParameters),
   540  		autorest.WithQueryParameters(queryParameters))
   541  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   542  }
   543  
   544  // ListSender sends the List request. The method will close the
   545  // http.Response Body if it receives an error.
   546  func (client DeploymentOperationsClient) ListSender(req *http.Request) (*http.Response, error) {
   547  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   548  }
   549  
   550  // ListResponder handles the response to the List request. The method always
   551  // closes the http.Response Body.
   552  func (client DeploymentOperationsClient) ListResponder(resp *http.Response) (result DeploymentOperationsListResult, err error) {
   553  	err = autorest.Respond(
   554  		resp,
   555  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   556  		autorest.ByUnmarshallingJSON(&result),
   557  		autorest.ByClosing())
   558  	result.Response = autorest.Response{Response: resp}
   559  	return
   560  }
   561  
   562  // listNextResults retrieves the next set of results, if any.
   563  func (client DeploymentOperationsClient) listNextResults(ctx context.Context, lastResults DeploymentOperationsListResult) (result DeploymentOperationsListResult, err error) {
   564  	req, err := lastResults.deploymentOperationsListResultPreparer(ctx)
   565  	if err != nil {
   566  		return result, autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "listNextResults", nil, "Failure preparing next results request")
   567  	}
   568  	if req == nil {
   569  		return
   570  	}
   571  	resp, err := client.ListSender(req)
   572  	if err != nil {
   573  		result.Response = autorest.Response{Response: resp}
   574  		return result, autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "listNextResults", resp, "Failure sending next results request")
   575  	}
   576  	result, err = client.ListResponder(resp)
   577  	if err != nil {
   578  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "listNextResults", resp, "Failure responding to next results request")
   579  	}
   580  	return
   581  }
   582  
   583  // ListComplete enumerates all values, automatically crossing page boundaries as required.
   584  func (client DeploymentOperationsClient) ListComplete(ctx context.Context, resourceGroupName string, deploymentName string, top *int32) (result DeploymentOperationsListResultIterator, err error) {
   585  	if tracing.IsEnabled() {
   586  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.List")
   587  		defer func() {
   588  			sc := -1
   589  			if result.Response().Response.Response != nil {
   590  				sc = result.page.Response().Response.Response.StatusCode
   591  			}
   592  			tracing.EndSpan(ctx, sc, err)
   593  		}()
   594  	}
   595  	result.page, err = client.List(ctx, resourceGroupName, deploymentName, top)
   596  	return
   597  }
   598  
   599  // ListAtManagementGroupScope gets all deployments operations for a deployment.
   600  // Parameters:
   601  // groupID - the management group ID.
   602  // deploymentName - the name of the deployment.
   603  // top - the number of results to return.
   604  func (client DeploymentOperationsClient) ListAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, top *int32) (result DeploymentOperationsListResultPage, err error) {
   605  	if tracing.IsEnabled() {
   606  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtManagementGroupScope")
   607  		defer func() {
   608  			sc := -1
   609  			if result.dolr.Response.Response != nil {
   610  				sc = result.dolr.Response.Response.StatusCode
   611  			}
   612  			tracing.EndSpan(ctx, sc, err)
   613  		}()
   614  	}
   615  	if err := validation.Validate([]validation.Validation{
   616  		{TargetValue: groupID,
   617  			Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 90, Chain: nil},
   618  				{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   619  		{TargetValue: deploymentName,
   620  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   621  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   622  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   623  		return result, validation.NewError("features.DeploymentOperationsClient", "ListAtManagementGroupScope", err.Error())
   624  	}
   625  
   626  	result.fn = client.listAtManagementGroupScopeNextResults
   627  	req, err := client.ListAtManagementGroupScopePreparer(ctx, groupID, deploymentName, top)
   628  	if err != nil {
   629  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "ListAtManagementGroupScope", nil, "Failure preparing request")
   630  		return
   631  	}
   632  
   633  	resp, err := client.ListAtManagementGroupScopeSender(req)
   634  	if err != nil {
   635  		result.dolr.Response = autorest.Response{Response: resp}
   636  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "ListAtManagementGroupScope", resp, "Failure sending request")
   637  		return
   638  	}
   639  
   640  	result.dolr, err = client.ListAtManagementGroupScopeResponder(resp)
   641  	if err != nil {
   642  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "ListAtManagementGroupScope", resp, "Failure responding to request")
   643  		return
   644  	}
   645  	if result.dolr.hasNextLink() && result.dolr.IsEmpty() {
   646  		err = result.NextWithContext(ctx)
   647  		return
   648  	}
   649  
   650  	return
   651  }
   652  
   653  // ListAtManagementGroupScopePreparer prepares the ListAtManagementGroupScope request.
   654  func (client DeploymentOperationsClient) ListAtManagementGroupScopePreparer(ctx context.Context, groupID string, deploymentName string, top *int32) (*http.Request, error) {
   655  	pathParameters := map[string]interface{}{
   656  		"deploymentName": autorest.Encode("path", deploymentName),
   657  		"groupId":        autorest.Encode("path", groupID),
   658  	}
   659  
   660  	const APIVersion = "2019-07-01"
   661  	queryParameters := map[string]interface{}{
   662  		"api-version": APIVersion,
   663  	}
   664  	if top != nil {
   665  		queryParameters["$top"] = autorest.Encode("query", *top)
   666  	}
   667  
   668  	preparer := autorest.CreatePreparer(
   669  		autorest.AsGet(),
   670  		autorest.WithBaseURL(client.BaseURI),
   671  		autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", pathParameters),
   672  		autorest.WithQueryParameters(queryParameters))
   673  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   674  }
   675  
   676  // ListAtManagementGroupScopeSender sends the ListAtManagementGroupScope request. The method will close the
   677  // http.Response Body if it receives an error.
   678  func (client DeploymentOperationsClient) ListAtManagementGroupScopeSender(req *http.Request) (*http.Response, error) {
   679  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   680  }
   681  
   682  // ListAtManagementGroupScopeResponder handles the response to the ListAtManagementGroupScope request. The method always
   683  // closes the http.Response Body.
   684  func (client DeploymentOperationsClient) ListAtManagementGroupScopeResponder(resp *http.Response) (result DeploymentOperationsListResult, err error) {
   685  	err = autorest.Respond(
   686  		resp,
   687  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   688  		autorest.ByUnmarshallingJSON(&result),
   689  		autorest.ByClosing())
   690  	result.Response = autorest.Response{Response: resp}
   691  	return
   692  }
   693  
   694  // listAtManagementGroupScopeNextResults retrieves the next set of results, if any.
   695  func (client DeploymentOperationsClient) listAtManagementGroupScopeNextResults(ctx context.Context, lastResults DeploymentOperationsListResult) (result DeploymentOperationsListResult, err error) {
   696  	req, err := lastResults.deploymentOperationsListResultPreparer(ctx)
   697  	if err != nil {
   698  		return result, autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "listAtManagementGroupScopeNextResults", nil, "Failure preparing next results request")
   699  	}
   700  	if req == nil {
   701  		return
   702  	}
   703  	resp, err := client.ListAtManagementGroupScopeSender(req)
   704  	if err != nil {
   705  		result.Response = autorest.Response{Response: resp}
   706  		return result, autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "listAtManagementGroupScopeNextResults", resp, "Failure sending next results request")
   707  	}
   708  	result, err = client.ListAtManagementGroupScopeResponder(resp)
   709  	if err != nil {
   710  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "listAtManagementGroupScopeNextResults", resp, "Failure responding to next results request")
   711  	}
   712  	return
   713  }
   714  
   715  // ListAtManagementGroupScopeComplete enumerates all values, automatically crossing page boundaries as required.
   716  func (client DeploymentOperationsClient) ListAtManagementGroupScopeComplete(ctx context.Context, groupID string, deploymentName string, top *int32) (result DeploymentOperationsListResultIterator, err error) {
   717  	if tracing.IsEnabled() {
   718  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtManagementGroupScope")
   719  		defer func() {
   720  			sc := -1
   721  			if result.Response().Response.Response != nil {
   722  				sc = result.page.Response().Response.Response.StatusCode
   723  			}
   724  			tracing.EndSpan(ctx, sc, err)
   725  		}()
   726  	}
   727  	result.page, err = client.ListAtManagementGroupScope(ctx, groupID, deploymentName, top)
   728  	return
   729  }
   730  
   731  // ListAtScope gets all deployments operations for a deployment.
   732  // Parameters:
   733  // scope - the scope of a deployment.
   734  // deploymentName - the name of the deployment.
   735  // top - the number of results to return.
   736  func (client DeploymentOperationsClient) ListAtScope(ctx context.Context, scope string, deploymentName string, top *int32) (result DeploymentOperationsListResultPage, err error) {
   737  	if tracing.IsEnabled() {
   738  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtScope")
   739  		defer func() {
   740  			sc := -1
   741  			if result.dolr.Response.Response != nil {
   742  				sc = result.dolr.Response.Response.StatusCode
   743  			}
   744  			tracing.EndSpan(ctx, sc, err)
   745  		}()
   746  	}
   747  	if err := validation.Validate([]validation.Validation{
   748  		{TargetValue: deploymentName,
   749  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   750  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   751  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   752  		return result, validation.NewError("features.DeploymentOperationsClient", "ListAtScope", err.Error())
   753  	}
   754  
   755  	result.fn = client.listAtScopeNextResults
   756  	req, err := client.ListAtScopePreparer(ctx, scope, deploymentName, top)
   757  	if err != nil {
   758  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "ListAtScope", nil, "Failure preparing request")
   759  		return
   760  	}
   761  
   762  	resp, err := client.ListAtScopeSender(req)
   763  	if err != nil {
   764  		result.dolr.Response = autorest.Response{Response: resp}
   765  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "ListAtScope", resp, "Failure sending request")
   766  		return
   767  	}
   768  
   769  	result.dolr, err = client.ListAtScopeResponder(resp)
   770  	if err != nil {
   771  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "ListAtScope", resp, "Failure responding to request")
   772  		return
   773  	}
   774  	if result.dolr.hasNextLink() && result.dolr.IsEmpty() {
   775  		err = result.NextWithContext(ctx)
   776  		return
   777  	}
   778  
   779  	return
   780  }
   781  
   782  // ListAtScopePreparer prepares the ListAtScope request.
   783  func (client DeploymentOperationsClient) ListAtScopePreparer(ctx context.Context, scope string, deploymentName string, top *int32) (*http.Request, error) {
   784  	pathParameters := map[string]interface{}{
   785  		"deploymentName": autorest.Encode("path", deploymentName),
   786  		"scope":          autorest.Encode("path", scope),
   787  	}
   788  
   789  	const APIVersion = "2019-07-01"
   790  	queryParameters := map[string]interface{}{
   791  		"api-version": APIVersion,
   792  	}
   793  	if top != nil {
   794  		queryParameters["$top"] = autorest.Encode("query", *top)
   795  	}
   796  
   797  	preparer := autorest.CreatePreparer(
   798  		autorest.AsGet(),
   799  		autorest.WithBaseURL(client.BaseURI),
   800  		autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", pathParameters),
   801  		autorest.WithQueryParameters(queryParameters))
   802  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   803  }
   804  
   805  // ListAtScopeSender sends the ListAtScope request. The method will close the
   806  // http.Response Body if it receives an error.
   807  func (client DeploymentOperationsClient) ListAtScopeSender(req *http.Request) (*http.Response, error) {
   808  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   809  }
   810  
   811  // ListAtScopeResponder handles the response to the ListAtScope request. The method always
   812  // closes the http.Response Body.
   813  func (client DeploymentOperationsClient) ListAtScopeResponder(resp *http.Response) (result DeploymentOperationsListResult, err error) {
   814  	err = autorest.Respond(
   815  		resp,
   816  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   817  		autorest.ByUnmarshallingJSON(&result),
   818  		autorest.ByClosing())
   819  	result.Response = autorest.Response{Response: resp}
   820  	return
   821  }
   822  
   823  // listAtScopeNextResults retrieves the next set of results, if any.
   824  func (client DeploymentOperationsClient) listAtScopeNextResults(ctx context.Context, lastResults DeploymentOperationsListResult) (result DeploymentOperationsListResult, err error) {
   825  	req, err := lastResults.deploymentOperationsListResultPreparer(ctx)
   826  	if err != nil {
   827  		return result, autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "listAtScopeNextResults", nil, "Failure preparing next results request")
   828  	}
   829  	if req == nil {
   830  		return
   831  	}
   832  	resp, err := client.ListAtScopeSender(req)
   833  	if err != nil {
   834  		result.Response = autorest.Response{Response: resp}
   835  		return result, autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "listAtScopeNextResults", resp, "Failure sending next results request")
   836  	}
   837  	result, err = client.ListAtScopeResponder(resp)
   838  	if err != nil {
   839  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "listAtScopeNextResults", resp, "Failure responding to next results request")
   840  	}
   841  	return
   842  }
   843  
   844  // ListAtScopeComplete enumerates all values, automatically crossing page boundaries as required.
   845  func (client DeploymentOperationsClient) ListAtScopeComplete(ctx context.Context, scope string, deploymentName string, top *int32) (result DeploymentOperationsListResultIterator, err error) {
   846  	if tracing.IsEnabled() {
   847  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtScope")
   848  		defer func() {
   849  			sc := -1
   850  			if result.Response().Response.Response != nil {
   851  				sc = result.page.Response().Response.Response.StatusCode
   852  			}
   853  			tracing.EndSpan(ctx, sc, err)
   854  		}()
   855  	}
   856  	result.page, err = client.ListAtScope(ctx, scope, deploymentName, top)
   857  	return
   858  }
   859  
   860  // ListAtSubscriptionScope gets all deployments operations for a deployment.
   861  // Parameters:
   862  // deploymentName - the name of the deployment.
   863  // top - the number of results to return.
   864  func (client DeploymentOperationsClient) ListAtSubscriptionScope(ctx context.Context, deploymentName string, top *int32) (result DeploymentOperationsListResultPage, err error) {
   865  	if tracing.IsEnabled() {
   866  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtSubscriptionScope")
   867  		defer func() {
   868  			sc := -1
   869  			if result.dolr.Response.Response != nil {
   870  				sc = result.dolr.Response.Response.StatusCode
   871  			}
   872  			tracing.EndSpan(ctx, sc, err)
   873  		}()
   874  	}
   875  	if err := validation.Validate([]validation.Validation{
   876  		{TargetValue: deploymentName,
   877  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   878  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
   879  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
   880  		return result, validation.NewError("features.DeploymentOperationsClient", "ListAtSubscriptionScope", err.Error())
   881  	}
   882  
   883  	result.fn = client.listAtSubscriptionScopeNextResults
   884  	req, err := client.ListAtSubscriptionScopePreparer(ctx, deploymentName, top)
   885  	if err != nil {
   886  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "ListAtSubscriptionScope", nil, "Failure preparing request")
   887  		return
   888  	}
   889  
   890  	resp, err := client.ListAtSubscriptionScopeSender(req)
   891  	if err != nil {
   892  		result.dolr.Response = autorest.Response{Response: resp}
   893  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "ListAtSubscriptionScope", resp, "Failure sending request")
   894  		return
   895  	}
   896  
   897  	result.dolr, err = client.ListAtSubscriptionScopeResponder(resp)
   898  	if err != nil {
   899  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "ListAtSubscriptionScope", resp, "Failure responding to request")
   900  		return
   901  	}
   902  	if result.dolr.hasNextLink() && result.dolr.IsEmpty() {
   903  		err = result.NextWithContext(ctx)
   904  		return
   905  	}
   906  
   907  	return
   908  }
   909  
   910  // ListAtSubscriptionScopePreparer prepares the ListAtSubscriptionScope request.
   911  func (client DeploymentOperationsClient) ListAtSubscriptionScopePreparer(ctx context.Context, deploymentName string, top *int32) (*http.Request, error) {
   912  	pathParameters := map[string]interface{}{
   913  		"deploymentName": autorest.Encode("path", deploymentName),
   914  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   915  	}
   916  
   917  	const APIVersion = "2019-07-01"
   918  	queryParameters := map[string]interface{}{
   919  		"api-version": APIVersion,
   920  	}
   921  	if top != nil {
   922  		queryParameters["$top"] = autorest.Encode("query", *top)
   923  	}
   924  
   925  	preparer := autorest.CreatePreparer(
   926  		autorest.AsGet(),
   927  		autorest.WithBaseURL(client.BaseURI),
   928  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", pathParameters),
   929  		autorest.WithQueryParameters(queryParameters))
   930  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   931  }
   932  
   933  // ListAtSubscriptionScopeSender sends the ListAtSubscriptionScope request. The method will close the
   934  // http.Response Body if it receives an error.
   935  func (client DeploymentOperationsClient) ListAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) {
   936  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   937  }
   938  
   939  // ListAtSubscriptionScopeResponder handles the response to the ListAtSubscriptionScope request. The method always
   940  // closes the http.Response Body.
   941  func (client DeploymentOperationsClient) ListAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentOperationsListResult, err error) {
   942  	err = autorest.Respond(
   943  		resp,
   944  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   945  		autorest.ByUnmarshallingJSON(&result),
   946  		autorest.ByClosing())
   947  	result.Response = autorest.Response{Response: resp}
   948  	return
   949  }
   950  
   951  // listAtSubscriptionScopeNextResults retrieves the next set of results, if any.
   952  func (client DeploymentOperationsClient) listAtSubscriptionScopeNextResults(ctx context.Context, lastResults DeploymentOperationsListResult) (result DeploymentOperationsListResult, err error) {
   953  	req, err := lastResults.deploymentOperationsListResultPreparer(ctx)
   954  	if err != nil {
   955  		return result, autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "listAtSubscriptionScopeNextResults", nil, "Failure preparing next results request")
   956  	}
   957  	if req == nil {
   958  		return
   959  	}
   960  	resp, err := client.ListAtSubscriptionScopeSender(req)
   961  	if err != nil {
   962  		result.Response = autorest.Response{Response: resp}
   963  		return result, autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "listAtSubscriptionScopeNextResults", resp, "Failure sending next results request")
   964  	}
   965  	result, err = client.ListAtSubscriptionScopeResponder(resp)
   966  	if err != nil {
   967  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "listAtSubscriptionScopeNextResults", resp, "Failure responding to next results request")
   968  	}
   969  	return
   970  }
   971  
   972  // ListAtSubscriptionScopeComplete enumerates all values, automatically crossing page boundaries as required.
   973  func (client DeploymentOperationsClient) ListAtSubscriptionScopeComplete(ctx context.Context, deploymentName string, top *int32) (result DeploymentOperationsListResultIterator, err error) {
   974  	if tracing.IsEnabled() {
   975  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtSubscriptionScope")
   976  		defer func() {
   977  			sc := -1
   978  			if result.Response().Response.Response != nil {
   979  				sc = result.page.Response().Response.Response.StatusCode
   980  			}
   981  			tracing.EndSpan(ctx, sc, err)
   982  		}()
   983  	}
   984  	result.page, err = client.ListAtSubscriptionScope(ctx, deploymentName, top)
   985  	return
   986  }
   987  
   988  // ListAtTenantScope gets all deployments operations for a deployment.
   989  // Parameters:
   990  // deploymentName - the name of the deployment.
   991  // top - the number of results to return.
   992  func (client DeploymentOperationsClient) ListAtTenantScope(ctx context.Context, deploymentName string, top *int32) (result DeploymentOperationsListResultPage, err error) {
   993  	if tracing.IsEnabled() {
   994  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtTenantScope")
   995  		defer func() {
   996  			sc := -1
   997  			if result.dolr.Response.Response != nil {
   998  				sc = result.dolr.Response.Response.StatusCode
   999  			}
  1000  			tracing.EndSpan(ctx, sc, err)
  1001  		}()
  1002  	}
  1003  	if err := validation.Validate([]validation.Validation{
  1004  		{TargetValue: deploymentName,
  1005  			Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil},
  1006  				{Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1007  				{Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
  1008  		return result, validation.NewError("features.DeploymentOperationsClient", "ListAtTenantScope", err.Error())
  1009  	}
  1010  
  1011  	result.fn = client.listAtTenantScopeNextResults
  1012  	req, err := client.ListAtTenantScopePreparer(ctx, deploymentName, top)
  1013  	if err != nil {
  1014  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "ListAtTenantScope", nil, "Failure preparing request")
  1015  		return
  1016  	}
  1017  
  1018  	resp, err := client.ListAtTenantScopeSender(req)
  1019  	if err != nil {
  1020  		result.dolr.Response = autorest.Response{Response: resp}
  1021  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "ListAtTenantScope", resp, "Failure sending request")
  1022  		return
  1023  	}
  1024  
  1025  	result.dolr, err = client.ListAtTenantScopeResponder(resp)
  1026  	if err != nil {
  1027  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "ListAtTenantScope", resp, "Failure responding to request")
  1028  		return
  1029  	}
  1030  	if result.dolr.hasNextLink() && result.dolr.IsEmpty() {
  1031  		err = result.NextWithContext(ctx)
  1032  		return
  1033  	}
  1034  
  1035  	return
  1036  }
  1037  
  1038  // ListAtTenantScopePreparer prepares the ListAtTenantScope request.
  1039  func (client DeploymentOperationsClient) ListAtTenantScopePreparer(ctx context.Context, deploymentName string, top *int32) (*http.Request, error) {
  1040  	pathParameters := map[string]interface{}{
  1041  		"deploymentName": autorest.Encode("path", deploymentName),
  1042  	}
  1043  
  1044  	const APIVersion = "2019-07-01"
  1045  	queryParameters := map[string]interface{}{
  1046  		"api-version": APIVersion,
  1047  	}
  1048  	if top != nil {
  1049  		queryParameters["$top"] = autorest.Encode("query", *top)
  1050  	}
  1051  
  1052  	preparer := autorest.CreatePreparer(
  1053  		autorest.AsGet(),
  1054  		autorest.WithBaseURL(client.BaseURI),
  1055  		autorest.WithPathParameters("/providers/Microsoft.Resources/deployments/{deploymentName}/operations", pathParameters),
  1056  		autorest.WithQueryParameters(queryParameters))
  1057  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1058  }
  1059  
  1060  // ListAtTenantScopeSender sends the ListAtTenantScope request. The method will close the
  1061  // http.Response Body if it receives an error.
  1062  func (client DeploymentOperationsClient) ListAtTenantScopeSender(req *http.Request) (*http.Response, error) {
  1063  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1064  }
  1065  
  1066  // ListAtTenantScopeResponder handles the response to the ListAtTenantScope request. The method always
  1067  // closes the http.Response Body.
  1068  func (client DeploymentOperationsClient) ListAtTenantScopeResponder(resp *http.Response) (result DeploymentOperationsListResult, err error) {
  1069  	err = autorest.Respond(
  1070  		resp,
  1071  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1072  		autorest.ByUnmarshallingJSON(&result),
  1073  		autorest.ByClosing())
  1074  	result.Response = autorest.Response{Response: resp}
  1075  	return
  1076  }
  1077  
  1078  // listAtTenantScopeNextResults retrieves the next set of results, if any.
  1079  func (client DeploymentOperationsClient) listAtTenantScopeNextResults(ctx context.Context, lastResults DeploymentOperationsListResult) (result DeploymentOperationsListResult, err error) {
  1080  	req, err := lastResults.deploymentOperationsListResultPreparer(ctx)
  1081  	if err != nil {
  1082  		return result, autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "listAtTenantScopeNextResults", nil, "Failure preparing next results request")
  1083  	}
  1084  	if req == nil {
  1085  		return
  1086  	}
  1087  	resp, err := client.ListAtTenantScopeSender(req)
  1088  	if err != nil {
  1089  		result.Response = autorest.Response{Response: resp}
  1090  		return result, autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "listAtTenantScopeNextResults", resp, "Failure sending next results request")
  1091  	}
  1092  	result, err = client.ListAtTenantScopeResponder(resp)
  1093  	if err != nil {
  1094  		err = autorest.NewErrorWithError(err, "features.DeploymentOperationsClient", "listAtTenantScopeNextResults", resp, "Failure responding to next results request")
  1095  	}
  1096  	return
  1097  }
  1098  
  1099  // ListAtTenantScopeComplete enumerates all values, automatically crossing page boundaries as required.
  1100  func (client DeploymentOperationsClient) ListAtTenantScopeComplete(ctx context.Context, deploymentName string, top *int32) (result DeploymentOperationsListResultIterator, err error) {
  1101  	if tracing.IsEnabled() {
  1102  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtTenantScope")
  1103  		defer func() {
  1104  			sc := -1
  1105  			if result.Response().Response.Response != nil {
  1106  				sc = result.page.Response().Response.Response.StatusCode
  1107  			}
  1108  			tracing.EndSpan(ctx, sc, err)
  1109  		}()
  1110  	}
  1111  	result.page, err = client.ListAtTenantScope(ctx, deploymentName, top)
  1112  	return
  1113  }
  1114  

View as plain text