...

Source file src/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-05-01/network/applicationgateways.go

Documentation: github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-05-01/network

     1  package network
     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  // ApplicationGatewaysClient is the network Client
    19  type ApplicationGatewaysClient struct {
    20  	BaseClient
    21  }
    22  
    23  // NewApplicationGatewaysClient creates an instance of the ApplicationGatewaysClient client.
    24  func NewApplicationGatewaysClient(subscriptionID string) ApplicationGatewaysClient {
    25  	return NewApplicationGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID)
    26  }
    27  
    28  // NewApplicationGatewaysClientWithBaseURI creates an instance of the ApplicationGatewaysClient 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 NewApplicationGatewaysClientWithBaseURI(baseURI string, subscriptionID string) ApplicationGatewaysClient {
    32  	return ApplicationGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)}
    33  }
    34  
    35  // BackendHealth gets the backend health of the specified application gateway in a resource group.
    36  // Parameters:
    37  // resourceGroupName - the name of the resource group.
    38  // applicationGatewayName - the name of the application gateway.
    39  // expand - expands BackendAddressPool and BackendHttpSettings referenced in backend health.
    40  func (client ApplicationGatewaysClient) BackendHealth(ctx context.Context, resourceGroupName string, applicationGatewayName string, expand string) (result ApplicationGatewaysBackendHealthFuture, err error) {
    41  	if tracing.IsEnabled() {
    42  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.BackendHealth")
    43  		defer func() {
    44  			sc := -1
    45  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
    46  				sc = result.FutureAPI.Response().StatusCode
    47  			}
    48  			tracing.EndSpan(ctx, sc, err)
    49  		}()
    50  	}
    51  	req, err := client.BackendHealthPreparer(ctx, resourceGroupName, applicationGatewayName, expand)
    52  	if err != nil {
    53  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", nil, "Failure preparing request")
    54  		return
    55  	}
    56  
    57  	result, err = client.BackendHealthSender(req)
    58  	if err != nil {
    59  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", result.Response(), "Failure sending request")
    60  		return
    61  	}
    62  
    63  	return
    64  }
    65  
    66  // BackendHealthPreparer prepares the BackendHealth request.
    67  func (client ApplicationGatewaysClient) BackendHealthPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, expand string) (*http.Request, error) {
    68  	pathParameters := map[string]interface{}{
    69  		"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
    70  		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
    71  		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
    72  	}
    73  
    74  	const APIVersion = "2021-05-01"
    75  	queryParameters := map[string]interface{}{
    76  		"api-version": APIVersion,
    77  	}
    78  	if len(expand) > 0 {
    79  		queryParameters["$expand"] = autorest.Encode("query", expand)
    80  	}
    81  
    82  	preparer := autorest.CreatePreparer(
    83  		autorest.AsPost(),
    84  		autorest.WithBaseURL(client.BaseURI),
    85  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth", pathParameters),
    86  		autorest.WithQueryParameters(queryParameters))
    87  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
    88  }
    89  
    90  // BackendHealthSender sends the BackendHealth request. The method will close the
    91  // http.Response Body if it receives an error.
    92  func (client ApplicationGatewaysClient) BackendHealthSender(req *http.Request) (future ApplicationGatewaysBackendHealthFuture, err error) {
    93  	var resp *http.Response
    94  	future.FutureAPI = &azure.Future{}
    95  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
    96  	if err != nil {
    97  		return
    98  	}
    99  	var azf azure.Future
   100  	azf, err = azure.NewFutureFromResponse(resp)
   101  	future.FutureAPI = &azf
   102  	future.Result = future.result
   103  	return
   104  }
   105  
   106  // BackendHealthResponder handles the response to the BackendHealth request. The method always
   107  // closes the http.Response Body.
   108  func (client ApplicationGatewaysClient) BackendHealthResponder(resp *http.Response) (result ApplicationGatewayBackendHealth, err error) {
   109  	err = autorest.Respond(
   110  		resp,
   111  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   112  		autorest.ByUnmarshallingJSON(&result),
   113  		autorest.ByClosing())
   114  	result.Response = autorest.Response{Response: resp}
   115  	return
   116  }
   117  
   118  // BackendHealthOnDemand gets the backend health for given combination of backend pool and http setting of the
   119  // specified application gateway in a resource group.
   120  // Parameters:
   121  // resourceGroupName - the name of the resource group.
   122  // applicationGatewayName - the name of the application gateway.
   123  // probeRequest - request body for on-demand test probe operation.
   124  // expand - expands BackendAddressPool and BackendHttpSettings referenced in backend health.
   125  func (client ApplicationGatewaysClient) BackendHealthOnDemand(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest ApplicationGatewayOnDemandProbe, expand string) (result ApplicationGatewaysBackendHealthOnDemandFuture, err error) {
   126  	if tracing.IsEnabled() {
   127  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.BackendHealthOnDemand")
   128  		defer func() {
   129  			sc := -1
   130  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   131  				sc = result.FutureAPI.Response().StatusCode
   132  			}
   133  			tracing.EndSpan(ctx, sc, err)
   134  		}()
   135  	}
   136  	req, err := client.BackendHealthOnDemandPreparer(ctx, resourceGroupName, applicationGatewayName, probeRequest, expand)
   137  	if err != nil {
   138  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealthOnDemand", nil, "Failure preparing request")
   139  		return
   140  	}
   141  
   142  	result, err = client.BackendHealthOnDemandSender(req)
   143  	if err != nil {
   144  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealthOnDemand", result.Response(), "Failure sending request")
   145  		return
   146  	}
   147  
   148  	return
   149  }
   150  
   151  // BackendHealthOnDemandPreparer prepares the BackendHealthOnDemand request.
   152  func (client ApplicationGatewaysClient) BackendHealthOnDemandPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest ApplicationGatewayOnDemandProbe, expand string) (*http.Request, error) {
   153  	pathParameters := map[string]interface{}{
   154  		"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
   155  		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
   156  		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
   157  	}
   158  
   159  	const APIVersion = "2021-05-01"
   160  	queryParameters := map[string]interface{}{
   161  		"api-version": APIVersion,
   162  	}
   163  	if len(expand) > 0 {
   164  		queryParameters["$expand"] = autorest.Encode("query", expand)
   165  	}
   166  
   167  	preparer := autorest.CreatePreparer(
   168  		autorest.AsContentType("application/json; charset=utf-8"),
   169  		autorest.AsPost(),
   170  		autorest.WithBaseURL(client.BaseURI),
   171  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/getBackendHealthOnDemand", pathParameters),
   172  		autorest.WithJSON(probeRequest),
   173  		autorest.WithQueryParameters(queryParameters))
   174  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   175  }
   176  
   177  // BackendHealthOnDemandSender sends the BackendHealthOnDemand request. The method will close the
   178  // http.Response Body if it receives an error.
   179  func (client ApplicationGatewaysClient) BackendHealthOnDemandSender(req *http.Request) (future ApplicationGatewaysBackendHealthOnDemandFuture, err error) {
   180  	var resp *http.Response
   181  	future.FutureAPI = &azure.Future{}
   182  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   183  	if err != nil {
   184  		return
   185  	}
   186  	var azf azure.Future
   187  	azf, err = azure.NewFutureFromResponse(resp)
   188  	future.FutureAPI = &azf
   189  	future.Result = future.result
   190  	return
   191  }
   192  
   193  // BackendHealthOnDemandResponder handles the response to the BackendHealthOnDemand request. The method always
   194  // closes the http.Response Body.
   195  func (client ApplicationGatewaysClient) BackendHealthOnDemandResponder(resp *http.Response) (result ApplicationGatewayBackendHealthOnDemand, err error) {
   196  	err = autorest.Respond(
   197  		resp,
   198  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   199  		autorest.ByUnmarshallingJSON(&result),
   200  		autorest.ByClosing())
   201  	result.Response = autorest.Response{Response: resp}
   202  	return
   203  }
   204  
   205  // CreateOrUpdate creates or updates the specified application gateway.
   206  // Parameters:
   207  // resourceGroupName - the name of the resource group.
   208  // applicationGatewayName - the name of the application gateway.
   209  // parameters - parameters supplied to the create or update application gateway operation.
   210  func (client ApplicationGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway) (result ApplicationGatewaysCreateOrUpdateFuture, err error) {
   211  	if tracing.IsEnabled() {
   212  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.CreateOrUpdate")
   213  		defer func() {
   214  			sc := -1
   215  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   216  				sc = result.FutureAPI.Response().StatusCode
   217  			}
   218  			tracing.EndSpan(ctx, sc, err)
   219  		}()
   220  	}
   221  	if err := validation.Validate([]validation.Validation{
   222  		{TargetValue: parameters,
   223  			Constraints: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat", Name: validation.Null, Rule: false,
   224  				Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration", Name: validation.Null, Rule: false,
   225  					Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.Enabled", Name: validation.Null, Rule: true, Chain: nil},
   226  						{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetType", Name: validation.Null, Rule: true, Chain: nil},
   227  						{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetVersion", Name: validation.Null, Rule: true, Chain: nil},
   228  						{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySize", Name: validation.Null, Rule: false,
   229  							Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySize", Name: validation.InclusiveMaximum, Rule: int64(128), Chain: nil},
   230  								{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySize", Name: validation.InclusiveMinimum, Rule: int64(8), Chain: nil},
   231  							}},
   232  						{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySizeInKb", Name: validation.Null, Rule: false,
   233  							Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySizeInKb", Name: validation.InclusiveMaximum, Rule: int64(128), Chain: nil},
   234  								{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySizeInKb", Name: validation.InclusiveMinimum, Rule: int64(8), Chain: nil},
   235  							}},
   236  						{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.FileUploadLimitInMb", Name: validation.Null, Rule: false,
   237  							Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.FileUploadLimitInMb", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}},
   238  					}},
   239  					{Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration", Name: validation.Null, Rule: false,
   240  						Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration.MinCapacity", Name: validation.Null, Rule: true,
   241  							Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration.MinCapacity", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}},
   242  							{Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration.MaxCapacity", Name: validation.Null, Rule: false,
   243  								Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration.MaxCapacity", Name: validation.InclusiveMinimum, Rule: int64(2), Chain: nil}}},
   244  						}},
   245  				}}}}}); err != nil {
   246  		return result, validation.NewError("network.ApplicationGatewaysClient", "CreateOrUpdate", err.Error())
   247  	}
   248  
   249  	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationGatewayName, parameters)
   250  	if err != nil {
   251  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request")
   252  		return
   253  	}
   254  
   255  	result, err = client.CreateOrUpdateSender(req)
   256  	if err != nil {
   257  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", result.Response(), "Failure sending request")
   258  		return
   259  	}
   260  
   261  	return
   262  }
   263  
   264  // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
   265  func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway) (*http.Request, error) {
   266  	pathParameters := map[string]interface{}{
   267  		"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
   268  		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
   269  		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
   270  	}
   271  
   272  	const APIVersion = "2021-05-01"
   273  	queryParameters := map[string]interface{}{
   274  		"api-version": APIVersion,
   275  	}
   276  
   277  	parameters.Etag = nil
   278  	preparer := autorest.CreatePreparer(
   279  		autorest.AsContentType("application/json; charset=utf-8"),
   280  		autorest.AsPut(),
   281  		autorest.WithBaseURL(client.BaseURI),
   282  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters),
   283  		autorest.WithJSON(parameters),
   284  		autorest.WithQueryParameters(queryParameters))
   285  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   286  }
   287  
   288  // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
   289  // http.Response Body if it receives an error.
   290  func (client ApplicationGatewaysClient) CreateOrUpdateSender(req *http.Request) (future ApplicationGatewaysCreateOrUpdateFuture, err error) {
   291  	var resp *http.Response
   292  	future.FutureAPI = &azure.Future{}
   293  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   294  	if err != nil {
   295  		return
   296  	}
   297  	var azf azure.Future
   298  	azf, err = azure.NewFutureFromResponse(resp)
   299  	future.FutureAPI = &azf
   300  	future.Result = future.result
   301  	return
   302  }
   303  
   304  // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
   305  // closes the http.Response Body.
   306  func (client ApplicationGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationGateway, err error) {
   307  	err = autorest.Respond(
   308  		resp,
   309  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
   310  		autorest.ByUnmarshallingJSON(&result),
   311  		autorest.ByClosing())
   312  	result.Response = autorest.Response{Response: resp}
   313  	return
   314  }
   315  
   316  // Delete deletes the specified application gateway.
   317  // Parameters:
   318  // resourceGroupName - the name of the resource group.
   319  // applicationGatewayName - the name of the application gateway.
   320  func (client ApplicationGatewaysClient) Delete(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysDeleteFuture, err error) {
   321  	if tracing.IsEnabled() {
   322  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.Delete")
   323  		defer func() {
   324  			sc := -1
   325  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   326  				sc = result.FutureAPI.Response().StatusCode
   327  			}
   328  			tracing.EndSpan(ctx, sc, err)
   329  		}()
   330  	}
   331  	req, err := client.DeletePreparer(ctx, resourceGroupName, applicationGatewayName)
   332  	if err != nil {
   333  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", nil, "Failure preparing request")
   334  		return
   335  	}
   336  
   337  	result, err = client.DeleteSender(req)
   338  	if err != nil {
   339  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", result.Response(), "Failure sending request")
   340  		return
   341  	}
   342  
   343  	return
   344  }
   345  
   346  // DeletePreparer prepares the Delete request.
   347  func (client ApplicationGatewaysClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) {
   348  	pathParameters := map[string]interface{}{
   349  		"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
   350  		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
   351  		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
   352  	}
   353  
   354  	const APIVersion = "2021-05-01"
   355  	queryParameters := map[string]interface{}{
   356  		"api-version": APIVersion,
   357  	}
   358  
   359  	preparer := autorest.CreatePreparer(
   360  		autorest.AsDelete(),
   361  		autorest.WithBaseURL(client.BaseURI),
   362  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters),
   363  		autorest.WithQueryParameters(queryParameters))
   364  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   365  }
   366  
   367  // DeleteSender sends the Delete request. The method will close the
   368  // http.Response Body if it receives an error.
   369  func (client ApplicationGatewaysClient) DeleteSender(req *http.Request) (future ApplicationGatewaysDeleteFuture, err error) {
   370  	var resp *http.Response
   371  	future.FutureAPI = &azure.Future{}
   372  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   373  	if err != nil {
   374  		return
   375  	}
   376  	var azf azure.Future
   377  	azf, err = azure.NewFutureFromResponse(resp)
   378  	future.FutureAPI = &azf
   379  	future.Result = future.result
   380  	return
   381  }
   382  
   383  // DeleteResponder handles the response to the Delete request. The method always
   384  // closes the http.Response Body.
   385  func (client ApplicationGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
   386  	err = autorest.Respond(
   387  		resp,
   388  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
   389  		autorest.ByClosing())
   390  	result.Response = resp
   391  	return
   392  }
   393  
   394  // Get gets the specified application gateway.
   395  // Parameters:
   396  // resourceGroupName - the name of the resource group.
   397  // applicationGatewayName - the name of the application gateway.
   398  func (client ApplicationGatewaysClient) Get(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGateway, err error) {
   399  	if tracing.IsEnabled() {
   400  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.Get")
   401  		defer func() {
   402  			sc := -1
   403  			if result.Response.Response != nil {
   404  				sc = result.Response.Response.StatusCode
   405  			}
   406  			tracing.EndSpan(ctx, sc, err)
   407  		}()
   408  	}
   409  	req, err := client.GetPreparer(ctx, resourceGroupName, applicationGatewayName)
   410  	if err != nil {
   411  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", nil, "Failure preparing request")
   412  		return
   413  	}
   414  
   415  	resp, err := client.GetSender(req)
   416  	if err != nil {
   417  		result.Response = autorest.Response{Response: resp}
   418  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", resp, "Failure sending request")
   419  		return
   420  	}
   421  
   422  	result, err = client.GetResponder(resp)
   423  	if err != nil {
   424  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", resp, "Failure responding to request")
   425  		return
   426  	}
   427  
   428  	return
   429  }
   430  
   431  // GetPreparer prepares the Get request.
   432  func (client ApplicationGatewaysClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) {
   433  	pathParameters := map[string]interface{}{
   434  		"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
   435  		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
   436  		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
   437  	}
   438  
   439  	const APIVersion = "2021-05-01"
   440  	queryParameters := map[string]interface{}{
   441  		"api-version": APIVersion,
   442  	}
   443  
   444  	preparer := autorest.CreatePreparer(
   445  		autorest.AsGet(),
   446  		autorest.WithBaseURL(client.BaseURI),
   447  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters),
   448  		autorest.WithQueryParameters(queryParameters))
   449  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   450  }
   451  
   452  // GetSender sends the Get request. The method will close the
   453  // http.Response Body if it receives an error.
   454  func (client ApplicationGatewaysClient) GetSender(req *http.Request) (*http.Response, error) {
   455  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   456  }
   457  
   458  // GetResponder handles the response to the Get request. The method always
   459  // closes the http.Response Body.
   460  func (client ApplicationGatewaysClient) GetResponder(resp *http.Response) (result ApplicationGateway, err error) {
   461  	err = autorest.Respond(
   462  		resp,
   463  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   464  		autorest.ByUnmarshallingJSON(&result),
   465  		autorest.ByClosing())
   466  	result.Response = autorest.Response{Response: resp}
   467  	return
   468  }
   469  
   470  // GetSslPredefinedPolicy gets Ssl predefined policy with the specified policy name.
   471  // Parameters:
   472  // predefinedPolicyName - name of Ssl predefined policy.
   473  func (client ApplicationGatewaysClient) GetSslPredefinedPolicy(ctx context.Context, predefinedPolicyName string) (result ApplicationGatewaySslPredefinedPolicy, err error) {
   474  	if tracing.IsEnabled() {
   475  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.GetSslPredefinedPolicy")
   476  		defer func() {
   477  			sc := -1
   478  			if result.Response.Response != nil {
   479  				sc = result.Response.Response.StatusCode
   480  			}
   481  			tracing.EndSpan(ctx, sc, err)
   482  		}()
   483  	}
   484  	req, err := client.GetSslPredefinedPolicyPreparer(ctx, predefinedPolicyName)
   485  	if err != nil {
   486  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "GetSslPredefinedPolicy", nil, "Failure preparing request")
   487  		return
   488  	}
   489  
   490  	resp, err := client.GetSslPredefinedPolicySender(req)
   491  	if err != nil {
   492  		result.Response = autorest.Response{Response: resp}
   493  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "GetSslPredefinedPolicy", resp, "Failure sending request")
   494  		return
   495  	}
   496  
   497  	result, err = client.GetSslPredefinedPolicyResponder(resp)
   498  	if err != nil {
   499  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "GetSslPredefinedPolicy", resp, "Failure responding to request")
   500  		return
   501  	}
   502  
   503  	return
   504  }
   505  
   506  // GetSslPredefinedPolicyPreparer prepares the GetSslPredefinedPolicy request.
   507  func (client ApplicationGatewaysClient) GetSslPredefinedPolicyPreparer(ctx context.Context, predefinedPolicyName string) (*http.Request, error) {
   508  	pathParameters := map[string]interface{}{
   509  		"predefinedPolicyName": autorest.Encode("path", predefinedPolicyName),
   510  		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
   511  	}
   512  
   513  	const APIVersion = "2021-05-01"
   514  	queryParameters := map[string]interface{}{
   515  		"api-version": APIVersion,
   516  	}
   517  
   518  	preparer := autorest.CreatePreparer(
   519  		autorest.AsGet(),
   520  		autorest.WithBaseURL(client.BaseURI),
   521  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName}", pathParameters),
   522  		autorest.WithQueryParameters(queryParameters))
   523  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   524  }
   525  
   526  // GetSslPredefinedPolicySender sends the GetSslPredefinedPolicy request. The method will close the
   527  // http.Response Body if it receives an error.
   528  func (client ApplicationGatewaysClient) GetSslPredefinedPolicySender(req *http.Request) (*http.Response, error) {
   529  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   530  }
   531  
   532  // GetSslPredefinedPolicyResponder handles the response to the GetSslPredefinedPolicy request. The method always
   533  // closes the http.Response Body.
   534  func (client ApplicationGatewaysClient) GetSslPredefinedPolicyResponder(resp *http.Response) (result ApplicationGatewaySslPredefinedPolicy, err error) {
   535  	err = autorest.Respond(
   536  		resp,
   537  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   538  		autorest.ByUnmarshallingJSON(&result),
   539  		autorest.ByClosing())
   540  	result.Response = autorest.Response{Response: resp}
   541  	return
   542  }
   543  
   544  // List lists all application gateways in a resource group.
   545  // Parameters:
   546  // resourceGroupName - the name of the resource group.
   547  func (client ApplicationGatewaysClient) List(ctx context.Context, resourceGroupName string) (result ApplicationGatewayListResultPage, err error) {
   548  	if tracing.IsEnabled() {
   549  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.List")
   550  		defer func() {
   551  			sc := -1
   552  			if result.aglr.Response.Response != nil {
   553  				sc = result.aglr.Response.Response.StatusCode
   554  			}
   555  			tracing.EndSpan(ctx, sc, err)
   556  		}()
   557  	}
   558  	result.fn = client.listNextResults
   559  	req, err := client.ListPreparer(ctx, resourceGroupName)
   560  	if err != nil {
   561  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", nil, "Failure preparing request")
   562  		return
   563  	}
   564  
   565  	resp, err := client.ListSender(req)
   566  	if err != nil {
   567  		result.aglr.Response = autorest.Response{Response: resp}
   568  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure sending request")
   569  		return
   570  	}
   571  
   572  	result.aglr, err = client.ListResponder(resp)
   573  	if err != nil {
   574  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure responding to request")
   575  		return
   576  	}
   577  	if result.aglr.hasNextLink() && result.aglr.IsEmpty() {
   578  		err = result.NextWithContext(ctx)
   579  		return
   580  	}
   581  
   582  	return
   583  }
   584  
   585  // ListPreparer prepares the List request.
   586  func (client ApplicationGatewaysClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
   587  	pathParameters := map[string]interface{}{
   588  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   589  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   590  	}
   591  
   592  	const APIVersion = "2021-05-01"
   593  	queryParameters := map[string]interface{}{
   594  		"api-version": APIVersion,
   595  	}
   596  
   597  	preparer := autorest.CreatePreparer(
   598  		autorest.AsGet(),
   599  		autorest.WithBaseURL(client.BaseURI),
   600  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways", pathParameters),
   601  		autorest.WithQueryParameters(queryParameters))
   602  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   603  }
   604  
   605  // ListSender sends the List request. The method will close the
   606  // http.Response Body if it receives an error.
   607  func (client ApplicationGatewaysClient) ListSender(req *http.Request) (*http.Response, error) {
   608  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   609  }
   610  
   611  // ListResponder handles the response to the List request. The method always
   612  // closes the http.Response Body.
   613  func (client ApplicationGatewaysClient) ListResponder(resp *http.Response) (result ApplicationGatewayListResult, err error) {
   614  	err = autorest.Respond(
   615  		resp,
   616  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   617  		autorest.ByUnmarshallingJSON(&result),
   618  		autorest.ByClosing())
   619  	result.Response = autorest.Response{Response: resp}
   620  	return
   621  }
   622  
   623  // listNextResults retrieves the next set of results, if any.
   624  func (client ApplicationGatewaysClient) listNextResults(ctx context.Context, lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) {
   625  	req, err := lastResults.applicationGatewayListResultPreparer(ctx)
   626  	if err != nil {
   627  		return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listNextResults", nil, "Failure preparing next results request")
   628  	}
   629  	if req == nil {
   630  		return
   631  	}
   632  	resp, err := client.ListSender(req)
   633  	if err != nil {
   634  		result.Response = autorest.Response{Response: resp}
   635  		return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listNextResults", resp, "Failure sending next results request")
   636  	}
   637  	result, err = client.ListResponder(resp)
   638  	if err != nil {
   639  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listNextResults", resp, "Failure responding to next results request")
   640  	}
   641  	return
   642  }
   643  
   644  // ListComplete enumerates all values, automatically crossing page boundaries as required.
   645  func (client ApplicationGatewaysClient) ListComplete(ctx context.Context, resourceGroupName string) (result ApplicationGatewayListResultIterator, err error) {
   646  	if tracing.IsEnabled() {
   647  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.List")
   648  		defer func() {
   649  			sc := -1
   650  			if result.Response().Response.Response != nil {
   651  				sc = result.page.Response().Response.Response.StatusCode
   652  			}
   653  			tracing.EndSpan(ctx, sc, err)
   654  		}()
   655  	}
   656  	result.page, err = client.List(ctx, resourceGroupName)
   657  	return
   658  }
   659  
   660  // ListAll gets all the application gateways in a subscription.
   661  func (client ApplicationGatewaysClient) ListAll(ctx context.Context) (result ApplicationGatewayListResultPage, err error) {
   662  	if tracing.IsEnabled() {
   663  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAll")
   664  		defer func() {
   665  			sc := -1
   666  			if result.aglr.Response.Response != nil {
   667  				sc = result.aglr.Response.Response.StatusCode
   668  			}
   669  			tracing.EndSpan(ctx, sc, err)
   670  		}()
   671  	}
   672  	result.fn = client.listAllNextResults
   673  	req, err := client.ListAllPreparer(ctx)
   674  	if err != nil {
   675  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", nil, "Failure preparing request")
   676  		return
   677  	}
   678  
   679  	resp, err := client.ListAllSender(req)
   680  	if err != nil {
   681  		result.aglr.Response = autorest.Response{Response: resp}
   682  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure sending request")
   683  		return
   684  	}
   685  
   686  	result.aglr, err = client.ListAllResponder(resp)
   687  	if err != nil {
   688  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure responding to request")
   689  		return
   690  	}
   691  	if result.aglr.hasNextLink() && result.aglr.IsEmpty() {
   692  		err = result.NextWithContext(ctx)
   693  		return
   694  	}
   695  
   696  	return
   697  }
   698  
   699  // ListAllPreparer prepares the ListAll request.
   700  func (client ApplicationGatewaysClient) ListAllPreparer(ctx context.Context) (*http.Request, error) {
   701  	pathParameters := map[string]interface{}{
   702  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   703  	}
   704  
   705  	const APIVersion = "2021-05-01"
   706  	queryParameters := map[string]interface{}{
   707  		"api-version": APIVersion,
   708  	}
   709  
   710  	preparer := autorest.CreatePreparer(
   711  		autorest.AsGet(),
   712  		autorest.WithBaseURL(client.BaseURI),
   713  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways", pathParameters),
   714  		autorest.WithQueryParameters(queryParameters))
   715  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   716  }
   717  
   718  // ListAllSender sends the ListAll request. The method will close the
   719  // http.Response Body if it receives an error.
   720  func (client ApplicationGatewaysClient) ListAllSender(req *http.Request) (*http.Response, error) {
   721  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   722  }
   723  
   724  // ListAllResponder handles the response to the ListAll request. The method always
   725  // closes the http.Response Body.
   726  func (client ApplicationGatewaysClient) ListAllResponder(resp *http.Response) (result ApplicationGatewayListResult, err error) {
   727  	err = autorest.Respond(
   728  		resp,
   729  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   730  		autorest.ByUnmarshallingJSON(&result),
   731  		autorest.ByClosing())
   732  	result.Response = autorest.Response{Response: resp}
   733  	return
   734  }
   735  
   736  // listAllNextResults retrieves the next set of results, if any.
   737  func (client ApplicationGatewaysClient) listAllNextResults(ctx context.Context, lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) {
   738  	req, err := lastResults.applicationGatewayListResultPreparer(ctx)
   739  	if err != nil {
   740  		return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAllNextResults", nil, "Failure preparing next results request")
   741  	}
   742  	if req == nil {
   743  		return
   744  	}
   745  	resp, err := client.ListAllSender(req)
   746  	if err != nil {
   747  		result.Response = autorest.Response{Response: resp}
   748  		return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAllNextResults", resp, "Failure sending next results request")
   749  	}
   750  	result, err = client.ListAllResponder(resp)
   751  	if err != nil {
   752  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAllNextResults", resp, "Failure responding to next results request")
   753  	}
   754  	return
   755  }
   756  
   757  // ListAllComplete enumerates all values, automatically crossing page boundaries as required.
   758  func (client ApplicationGatewaysClient) ListAllComplete(ctx context.Context) (result ApplicationGatewayListResultIterator, err error) {
   759  	if tracing.IsEnabled() {
   760  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAll")
   761  		defer func() {
   762  			sc := -1
   763  			if result.Response().Response.Response != nil {
   764  				sc = result.page.Response().Response.Response.StatusCode
   765  			}
   766  			tracing.EndSpan(ctx, sc, err)
   767  		}()
   768  	}
   769  	result.page, err = client.ListAll(ctx)
   770  	return
   771  }
   772  
   773  // ListAvailableRequestHeaders lists all available request headers.
   774  func (client ApplicationGatewaysClient) ListAvailableRequestHeaders(ctx context.Context) (result ListString, err error) {
   775  	if tracing.IsEnabled() {
   776  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableRequestHeaders")
   777  		defer func() {
   778  			sc := -1
   779  			if result.Response.Response != nil {
   780  				sc = result.Response.Response.StatusCode
   781  			}
   782  			tracing.EndSpan(ctx, sc, err)
   783  		}()
   784  	}
   785  	req, err := client.ListAvailableRequestHeadersPreparer(ctx)
   786  	if err != nil {
   787  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableRequestHeaders", nil, "Failure preparing request")
   788  		return
   789  	}
   790  
   791  	resp, err := client.ListAvailableRequestHeadersSender(req)
   792  	if err != nil {
   793  		result.Response = autorest.Response{Response: resp}
   794  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableRequestHeaders", resp, "Failure sending request")
   795  		return
   796  	}
   797  
   798  	result, err = client.ListAvailableRequestHeadersResponder(resp)
   799  	if err != nil {
   800  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableRequestHeaders", resp, "Failure responding to request")
   801  		return
   802  	}
   803  
   804  	return
   805  }
   806  
   807  // ListAvailableRequestHeadersPreparer prepares the ListAvailableRequestHeaders request.
   808  func (client ApplicationGatewaysClient) ListAvailableRequestHeadersPreparer(ctx context.Context) (*http.Request, error) {
   809  	pathParameters := map[string]interface{}{
   810  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   811  	}
   812  
   813  	const APIVersion = "2021-05-01"
   814  	queryParameters := map[string]interface{}{
   815  		"api-version": APIVersion,
   816  	}
   817  
   818  	preparer := autorest.CreatePreparer(
   819  		autorest.AsGet(),
   820  		autorest.WithBaseURL(client.BaseURI),
   821  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableRequestHeaders", pathParameters),
   822  		autorest.WithQueryParameters(queryParameters))
   823  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   824  }
   825  
   826  // ListAvailableRequestHeadersSender sends the ListAvailableRequestHeaders request. The method will close the
   827  // http.Response Body if it receives an error.
   828  func (client ApplicationGatewaysClient) ListAvailableRequestHeadersSender(req *http.Request) (*http.Response, error) {
   829  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   830  }
   831  
   832  // ListAvailableRequestHeadersResponder handles the response to the ListAvailableRequestHeaders request. The method always
   833  // closes the http.Response Body.
   834  func (client ApplicationGatewaysClient) ListAvailableRequestHeadersResponder(resp *http.Response) (result ListString, err error) {
   835  	err = autorest.Respond(
   836  		resp,
   837  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   838  		autorest.ByUnmarshallingJSON(&result.Value),
   839  		autorest.ByClosing())
   840  	result.Response = autorest.Response{Response: resp}
   841  	return
   842  }
   843  
   844  // ListAvailableResponseHeaders lists all available response headers.
   845  func (client ApplicationGatewaysClient) ListAvailableResponseHeaders(ctx context.Context) (result ListString, err error) {
   846  	if tracing.IsEnabled() {
   847  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableResponseHeaders")
   848  		defer func() {
   849  			sc := -1
   850  			if result.Response.Response != nil {
   851  				sc = result.Response.Response.StatusCode
   852  			}
   853  			tracing.EndSpan(ctx, sc, err)
   854  		}()
   855  	}
   856  	req, err := client.ListAvailableResponseHeadersPreparer(ctx)
   857  	if err != nil {
   858  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableResponseHeaders", nil, "Failure preparing request")
   859  		return
   860  	}
   861  
   862  	resp, err := client.ListAvailableResponseHeadersSender(req)
   863  	if err != nil {
   864  		result.Response = autorest.Response{Response: resp}
   865  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableResponseHeaders", resp, "Failure sending request")
   866  		return
   867  	}
   868  
   869  	result, err = client.ListAvailableResponseHeadersResponder(resp)
   870  	if err != nil {
   871  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableResponseHeaders", resp, "Failure responding to request")
   872  		return
   873  	}
   874  
   875  	return
   876  }
   877  
   878  // ListAvailableResponseHeadersPreparer prepares the ListAvailableResponseHeaders request.
   879  func (client ApplicationGatewaysClient) ListAvailableResponseHeadersPreparer(ctx context.Context) (*http.Request, error) {
   880  	pathParameters := map[string]interface{}{
   881  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   882  	}
   883  
   884  	const APIVersion = "2021-05-01"
   885  	queryParameters := map[string]interface{}{
   886  		"api-version": APIVersion,
   887  	}
   888  
   889  	preparer := autorest.CreatePreparer(
   890  		autorest.AsGet(),
   891  		autorest.WithBaseURL(client.BaseURI),
   892  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableResponseHeaders", pathParameters),
   893  		autorest.WithQueryParameters(queryParameters))
   894  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   895  }
   896  
   897  // ListAvailableResponseHeadersSender sends the ListAvailableResponseHeaders request. The method will close the
   898  // http.Response Body if it receives an error.
   899  func (client ApplicationGatewaysClient) ListAvailableResponseHeadersSender(req *http.Request) (*http.Response, error) {
   900  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   901  }
   902  
   903  // ListAvailableResponseHeadersResponder handles the response to the ListAvailableResponseHeaders request. The method always
   904  // closes the http.Response Body.
   905  func (client ApplicationGatewaysClient) ListAvailableResponseHeadersResponder(resp *http.Response) (result ListString, err error) {
   906  	err = autorest.Respond(
   907  		resp,
   908  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   909  		autorest.ByUnmarshallingJSON(&result.Value),
   910  		autorest.ByClosing())
   911  	result.Response = autorest.Response{Response: resp}
   912  	return
   913  }
   914  
   915  // ListAvailableServerVariables lists all available server variables.
   916  func (client ApplicationGatewaysClient) ListAvailableServerVariables(ctx context.Context) (result ListString, err error) {
   917  	if tracing.IsEnabled() {
   918  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableServerVariables")
   919  		defer func() {
   920  			sc := -1
   921  			if result.Response.Response != nil {
   922  				sc = result.Response.Response.StatusCode
   923  			}
   924  			tracing.EndSpan(ctx, sc, err)
   925  		}()
   926  	}
   927  	req, err := client.ListAvailableServerVariablesPreparer(ctx)
   928  	if err != nil {
   929  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableServerVariables", nil, "Failure preparing request")
   930  		return
   931  	}
   932  
   933  	resp, err := client.ListAvailableServerVariablesSender(req)
   934  	if err != nil {
   935  		result.Response = autorest.Response{Response: resp}
   936  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableServerVariables", resp, "Failure sending request")
   937  		return
   938  	}
   939  
   940  	result, err = client.ListAvailableServerVariablesResponder(resp)
   941  	if err != nil {
   942  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableServerVariables", resp, "Failure responding to request")
   943  		return
   944  	}
   945  
   946  	return
   947  }
   948  
   949  // ListAvailableServerVariablesPreparer prepares the ListAvailableServerVariables request.
   950  func (client ApplicationGatewaysClient) ListAvailableServerVariablesPreparer(ctx context.Context) (*http.Request, error) {
   951  	pathParameters := map[string]interface{}{
   952  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   953  	}
   954  
   955  	const APIVersion = "2021-05-01"
   956  	queryParameters := map[string]interface{}{
   957  		"api-version": APIVersion,
   958  	}
   959  
   960  	preparer := autorest.CreatePreparer(
   961  		autorest.AsGet(),
   962  		autorest.WithBaseURL(client.BaseURI),
   963  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableServerVariables", pathParameters),
   964  		autorest.WithQueryParameters(queryParameters))
   965  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   966  }
   967  
   968  // ListAvailableServerVariablesSender sends the ListAvailableServerVariables request. The method will close the
   969  // http.Response Body if it receives an error.
   970  func (client ApplicationGatewaysClient) ListAvailableServerVariablesSender(req *http.Request) (*http.Response, error) {
   971  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   972  }
   973  
   974  // ListAvailableServerVariablesResponder handles the response to the ListAvailableServerVariables request. The method always
   975  // closes the http.Response Body.
   976  func (client ApplicationGatewaysClient) ListAvailableServerVariablesResponder(resp *http.Response) (result ListString, err error) {
   977  	err = autorest.Respond(
   978  		resp,
   979  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   980  		autorest.ByUnmarshallingJSON(&result.Value),
   981  		autorest.ByClosing())
   982  	result.Response = autorest.Response{Response: resp}
   983  	return
   984  }
   985  
   986  // ListAvailableSslOptions lists available Ssl options for configuring Ssl policy.
   987  func (client ApplicationGatewaysClient) ListAvailableSslOptions(ctx context.Context) (result ApplicationGatewayAvailableSslOptions, err error) {
   988  	if tracing.IsEnabled() {
   989  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableSslOptions")
   990  		defer func() {
   991  			sc := -1
   992  			if result.Response.Response != nil {
   993  				sc = result.Response.Response.StatusCode
   994  			}
   995  			tracing.EndSpan(ctx, sc, err)
   996  		}()
   997  	}
   998  	req, err := client.ListAvailableSslOptionsPreparer(ctx)
   999  	if err != nil {
  1000  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslOptions", nil, "Failure preparing request")
  1001  		return
  1002  	}
  1003  
  1004  	resp, err := client.ListAvailableSslOptionsSender(req)
  1005  	if err != nil {
  1006  		result.Response = autorest.Response{Response: resp}
  1007  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslOptions", resp, "Failure sending request")
  1008  		return
  1009  	}
  1010  
  1011  	result, err = client.ListAvailableSslOptionsResponder(resp)
  1012  	if err != nil {
  1013  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslOptions", resp, "Failure responding to request")
  1014  		return
  1015  	}
  1016  
  1017  	return
  1018  }
  1019  
  1020  // ListAvailableSslOptionsPreparer prepares the ListAvailableSslOptions request.
  1021  func (client ApplicationGatewaysClient) ListAvailableSslOptionsPreparer(ctx context.Context) (*http.Request, error) {
  1022  	pathParameters := map[string]interface{}{
  1023  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
  1024  	}
  1025  
  1026  	const APIVersion = "2021-05-01"
  1027  	queryParameters := map[string]interface{}{
  1028  		"api-version": APIVersion,
  1029  	}
  1030  
  1031  	preparer := autorest.CreatePreparer(
  1032  		autorest.AsGet(),
  1033  		autorest.WithBaseURL(client.BaseURI),
  1034  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default", pathParameters),
  1035  		autorest.WithQueryParameters(queryParameters))
  1036  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1037  }
  1038  
  1039  // ListAvailableSslOptionsSender sends the ListAvailableSslOptions request. The method will close the
  1040  // http.Response Body if it receives an error.
  1041  func (client ApplicationGatewaysClient) ListAvailableSslOptionsSender(req *http.Request) (*http.Response, error) {
  1042  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1043  }
  1044  
  1045  // ListAvailableSslOptionsResponder handles the response to the ListAvailableSslOptions request. The method always
  1046  // closes the http.Response Body.
  1047  func (client ApplicationGatewaysClient) ListAvailableSslOptionsResponder(resp *http.Response) (result ApplicationGatewayAvailableSslOptions, err error) {
  1048  	err = autorest.Respond(
  1049  		resp,
  1050  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1051  		autorest.ByUnmarshallingJSON(&result),
  1052  		autorest.ByClosing())
  1053  	result.Response = autorest.Response{Response: resp}
  1054  	return
  1055  }
  1056  
  1057  // ListAvailableSslPredefinedPolicies lists all SSL predefined policies for configuring Ssl policy.
  1058  func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPolicies(ctx context.Context) (result ApplicationGatewayAvailableSslPredefinedPoliciesPage, err error) {
  1059  	if tracing.IsEnabled() {
  1060  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableSslPredefinedPolicies")
  1061  		defer func() {
  1062  			sc := -1
  1063  			if result.agaspp.Response.Response != nil {
  1064  				sc = result.agaspp.Response.Response.StatusCode
  1065  			}
  1066  			tracing.EndSpan(ctx, sc, err)
  1067  		}()
  1068  	}
  1069  	result.fn = client.listAvailableSslPredefinedPoliciesNextResults
  1070  	req, err := client.ListAvailableSslPredefinedPoliciesPreparer(ctx)
  1071  	if err != nil {
  1072  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslPredefinedPolicies", nil, "Failure preparing request")
  1073  		return
  1074  	}
  1075  
  1076  	resp, err := client.ListAvailableSslPredefinedPoliciesSender(req)
  1077  	if err != nil {
  1078  		result.agaspp.Response = autorest.Response{Response: resp}
  1079  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslPredefinedPolicies", resp, "Failure sending request")
  1080  		return
  1081  	}
  1082  
  1083  	result.agaspp, err = client.ListAvailableSslPredefinedPoliciesResponder(resp)
  1084  	if err != nil {
  1085  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslPredefinedPolicies", resp, "Failure responding to request")
  1086  		return
  1087  	}
  1088  	if result.agaspp.hasNextLink() && result.agaspp.IsEmpty() {
  1089  		err = result.NextWithContext(ctx)
  1090  		return
  1091  	}
  1092  
  1093  	return
  1094  }
  1095  
  1096  // ListAvailableSslPredefinedPoliciesPreparer prepares the ListAvailableSslPredefinedPolicies request.
  1097  func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesPreparer(ctx context.Context) (*http.Request, error) {
  1098  	pathParameters := map[string]interface{}{
  1099  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
  1100  	}
  1101  
  1102  	const APIVersion = "2021-05-01"
  1103  	queryParameters := map[string]interface{}{
  1104  		"api-version": APIVersion,
  1105  	}
  1106  
  1107  	preparer := autorest.CreatePreparer(
  1108  		autorest.AsGet(),
  1109  		autorest.WithBaseURL(client.BaseURI),
  1110  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies", pathParameters),
  1111  		autorest.WithQueryParameters(queryParameters))
  1112  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1113  }
  1114  
  1115  // ListAvailableSslPredefinedPoliciesSender sends the ListAvailableSslPredefinedPolicies request. The method will close the
  1116  // http.Response Body if it receives an error.
  1117  func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesSender(req *http.Request) (*http.Response, error) {
  1118  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1119  }
  1120  
  1121  // ListAvailableSslPredefinedPoliciesResponder handles the response to the ListAvailableSslPredefinedPolicies request. The method always
  1122  // closes the http.Response Body.
  1123  func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesResponder(resp *http.Response) (result ApplicationGatewayAvailableSslPredefinedPolicies, err error) {
  1124  	err = autorest.Respond(
  1125  		resp,
  1126  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1127  		autorest.ByUnmarshallingJSON(&result),
  1128  		autorest.ByClosing())
  1129  	result.Response = autorest.Response{Response: resp}
  1130  	return
  1131  }
  1132  
  1133  // listAvailableSslPredefinedPoliciesNextResults retrieves the next set of results, if any.
  1134  func (client ApplicationGatewaysClient) listAvailableSslPredefinedPoliciesNextResults(ctx context.Context, lastResults ApplicationGatewayAvailableSslPredefinedPolicies) (result ApplicationGatewayAvailableSslPredefinedPolicies, err error) {
  1135  	req, err := lastResults.applicationGatewayAvailableSslPredefinedPoliciesPreparer(ctx)
  1136  	if err != nil {
  1137  		return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAvailableSslPredefinedPoliciesNextResults", nil, "Failure preparing next results request")
  1138  	}
  1139  	if req == nil {
  1140  		return
  1141  	}
  1142  	resp, err := client.ListAvailableSslPredefinedPoliciesSender(req)
  1143  	if err != nil {
  1144  		result.Response = autorest.Response{Response: resp}
  1145  		return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAvailableSslPredefinedPoliciesNextResults", resp, "Failure sending next results request")
  1146  	}
  1147  	result, err = client.ListAvailableSslPredefinedPoliciesResponder(resp)
  1148  	if err != nil {
  1149  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAvailableSslPredefinedPoliciesNextResults", resp, "Failure responding to next results request")
  1150  	}
  1151  	return
  1152  }
  1153  
  1154  // ListAvailableSslPredefinedPoliciesComplete enumerates all values, automatically crossing page boundaries as required.
  1155  func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesComplete(ctx context.Context) (result ApplicationGatewayAvailableSslPredefinedPoliciesIterator, err error) {
  1156  	if tracing.IsEnabled() {
  1157  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableSslPredefinedPolicies")
  1158  		defer func() {
  1159  			sc := -1
  1160  			if result.Response().Response.Response != nil {
  1161  				sc = result.page.Response().Response.Response.StatusCode
  1162  			}
  1163  			tracing.EndSpan(ctx, sc, err)
  1164  		}()
  1165  	}
  1166  	result.page, err = client.ListAvailableSslPredefinedPolicies(ctx)
  1167  	return
  1168  }
  1169  
  1170  // ListAvailableWafRuleSets lists all available web application firewall rule sets.
  1171  func (client ApplicationGatewaysClient) ListAvailableWafRuleSets(ctx context.Context) (result ApplicationGatewayAvailableWafRuleSetsResult, err error) {
  1172  	if tracing.IsEnabled() {
  1173  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableWafRuleSets")
  1174  		defer func() {
  1175  			sc := -1
  1176  			if result.Response.Response != nil {
  1177  				sc = result.Response.Response.StatusCode
  1178  			}
  1179  			tracing.EndSpan(ctx, sc, err)
  1180  		}()
  1181  	}
  1182  	req, err := client.ListAvailableWafRuleSetsPreparer(ctx)
  1183  	if err != nil {
  1184  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", nil, "Failure preparing request")
  1185  		return
  1186  	}
  1187  
  1188  	resp, err := client.ListAvailableWafRuleSetsSender(req)
  1189  	if err != nil {
  1190  		result.Response = autorest.Response{Response: resp}
  1191  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", resp, "Failure sending request")
  1192  		return
  1193  	}
  1194  
  1195  	result, err = client.ListAvailableWafRuleSetsResponder(resp)
  1196  	if err != nil {
  1197  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", resp, "Failure responding to request")
  1198  		return
  1199  	}
  1200  
  1201  	return
  1202  }
  1203  
  1204  // ListAvailableWafRuleSetsPreparer prepares the ListAvailableWafRuleSets request.
  1205  func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsPreparer(ctx context.Context) (*http.Request, error) {
  1206  	pathParameters := map[string]interface{}{
  1207  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
  1208  	}
  1209  
  1210  	const APIVersion = "2021-05-01"
  1211  	queryParameters := map[string]interface{}{
  1212  		"api-version": APIVersion,
  1213  	}
  1214  
  1215  	preparer := autorest.CreatePreparer(
  1216  		autorest.AsGet(),
  1217  		autorest.WithBaseURL(client.BaseURI),
  1218  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets", pathParameters),
  1219  		autorest.WithQueryParameters(queryParameters))
  1220  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1221  }
  1222  
  1223  // ListAvailableWafRuleSetsSender sends the ListAvailableWafRuleSets request. The method will close the
  1224  // http.Response Body if it receives an error.
  1225  func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsSender(req *http.Request) (*http.Response, error) {
  1226  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1227  }
  1228  
  1229  // ListAvailableWafRuleSetsResponder handles the response to the ListAvailableWafRuleSets request. The method always
  1230  // closes the http.Response Body.
  1231  func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsResponder(resp *http.Response) (result ApplicationGatewayAvailableWafRuleSetsResult, err error) {
  1232  	err = autorest.Respond(
  1233  		resp,
  1234  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1235  		autorest.ByUnmarshallingJSON(&result),
  1236  		autorest.ByClosing())
  1237  	result.Response = autorest.Response{Response: resp}
  1238  	return
  1239  }
  1240  
  1241  // Start starts the specified application gateway.
  1242  // Parameters:
  1243  // resourceGroupName - the name of the resource group.
  1244  // applicationGatewayName - the name of the application gateway.
  1245  func (client ApplicationGatewaysClient) Start(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysStartFuture, err error) {
  1246  	if tracing.IsEnabled() {
  1247  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.Start")
  1248  		defer func() {
  1249  			sc := -1
  1250  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1251  				sc = result.FutureAPI.Response().StatusCode
  1252  			}
  1253  			tracing.EndSpan(ctx, sc, err)
  1254  		}()
  1255  	}
  1256  	req, err := client.StartPreparer(ctx, resourceGroupName, applicationGatewayName)
  1257  	if err != nil {
  1258  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", nil, "Failure preparing request")
  1259  		return
  1260  	}
  1261  
  1262  	result, err = client.StartSender(req)
  1263  	if err != nil {
  1264  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", result.Response(), "Failure sending request")
  1265  		return
  1266  	}
  1267  
  1268  	return
  1269  }
  1270  
  1271  // StartPreparer prepares the Start request.
  1272  func (client ApplicationGatewaysClient) StartPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) {
  1273  	pathParameters := map[string]interface{}{
  1274  		"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
  1275  		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
  1276  		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
  1277  	}
  1278  
  1279  	const APIVersion = "2021-05-01"
  1280  	queryParameters := map[string]interface{}{
  1281  		"api-version": APIVersion,
  1282  	}
  1283  
  1284  	preparer := autorest.CreatePreparer(
  1285  		autorest.AsPost(),
  1286  		autorest.WithBaseURL(client.BaseURI),
  1287  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start", pathParameters),
  1288  		autorest.WithQueryParameters(queryParameters))
  1289  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1290  }
  1291  
  1292  // StartSender sends the Start request. The method will close the
  1293  // http.Response Body if it receives an error.
  1294  func (client ApplicationGatewaysClient) StartSender(req *http.Request) (future ApplicationGatewaysStartFuture, err error) {
  1295  	var resp *http.Response
  1296  	future.FutureAPI = &azure.Future{}
  1297  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1298  	if err != nil {
  1299  		return
  1300  	}
  1301  	var azf azure.Future
  1302  	azf, err = azure.NewFutureFromResponse(resp)
  1303  	future.FutureAPI = &azf
  1304  	future.Result = future.result
  1305  	return
  1306  }
  1307  
  1308  // StartResponder handles the response to the Start request. The method always
  1309  // closes the http.Response Body.
  1310  func (client ApplicationGatewaysClient) StartResponder(resp *http.Response) (result autorest.Response, err error) {
  1311  	err = autorest.Respond(
  1312  		resp,
  1313  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1314  		autorest.ByClosing())
  1315  	result.Response = resp
  1316  	return
  1317  }
  1318  
  1319  // Stop stops the specified application gateway in a resource group.
  1320  // Parameters:
  1321  // resourceGroupName - the name of the resource group.
  1322  // applicationGatewayName - the name of the application gateway.
  1323  func (client ApplicationGatewaysClient) Stop(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysStopFuture, err error) {
  1324  	if tracing.IsEnabled() {
  1325  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.Stop")
  1326  		defer func() {
  1327  			sc := -1
  1328  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1329  				sc = result.FutureAPI.Response().StatusCode
  1330  			}
  1331  			tracing.EndSpan(ctx, sc, err)
  1332  		}()
  1333  	}
  1334  	req, err := client.StopPreparer(ctx, resourceGroupName, applicationGatewayName)
  1335  	if err != nil {
  1336  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", nil, "Failure preparing request")
  1337  		return
  1338  	}
  1339  
  1340  	result, err = client.StopSender(req)
  1341  	if err != nil {
  1342  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", result.Response(), "Failure sending request")
  1343  		return
  1344  	}
  1345  
  1346  	return
  1347  }
  1348  
  1349  // StopPreparer prepares the Stop request.
  1350  func (client ApplicationGatewaysClient) StopPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) {
  1351  	pathParameters := map[string]interface{}{
  1352  		"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
  1353  		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
  1354  		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
  1355  	}
  1356  
  1357  	const APIVersion = "2021-05-01"
  1358  	queryParameters := map[string]interface{}{
  1359  		"api-version": APIVersion,
  1360  	}
  1361  
  1362  	preparer := autorest.CreatePreparer(
  1363  		autorest.AsPost(),
  1364  		autorest.WithBaseURL(client.BaseURI),
  1365  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop", pathParameters),
  1366  		autorest.WithQueryParameters(queryParameters))
  1367  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1368  }
  1369  
  1370  // StopSender sends the Stop request. The method will close the
  1371  // http.Response Body if it receives an error.
  1372  func (client ApplicationGatewaysClient) StopSender(req *http.Request) (future ApplicationGatewaysStopFuture, err error) {
  1373  	var resp *http.Response
  1374  	future.FutureAPI = &azure.Future{}
  1375  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1376  	if err != nil {
  1377  		return
  1378  	}
  1379  	var azf azure.Future
  1380  	azf, err = azure.NewFutureFromResponse(resp)
  1381  	future.FutureAPI = &azf
  1382  	future.Result = future.result
  1383  	return
  1384  }
  1385  
  1386  // StopResponder handles the response to the Stop request. The method always
  1387  // closes the http.Response Body.
  1388  func (client ApplicationGatewaysClient) StopResponder(resp *http.Response) (result autorest.Response, err error) {
  1389  	err = autorest.Respond(
  1390  		resp,
  1391  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1392  		autorest.ByClosing())
  1393  	result.Response = resp
  1394  	return
  1395  }
  1396  
  1397  // UpdateTags updates the specified application gateway tags.
  1398  // Parameters:
  1399  // resourceGroupName - the name of the resource group.
  1400  // applicationGatewayName - the name of the application gateway.
  1401  // parameters - parameters supplied to update application gateway tags.
  1402  func (client ApplicationGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters TagsObject) (result ApplicationGateway, err error) {
  1403  	if tracing.IsEnabled() {
  1404  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.UpdateTags")
  1405  		defer func() {
  1406  			sc := -1
  1407  			if result.Response.Response != nil {
  1408  				sc = result.Response.Response.StatusCode
  1409  			}
  1410  			tracing.EndSpan(ctx, sc, err)
  1411  		}()
  1412  	}
  1413  	req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, applicationGatewayName, parameters)
  1414  	if err != nil {
  1415  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "UpdateTags", nil, "Failure preparing request")
  1416  		return
  1417  	}
  1418  
  1419  	resp, err := client.UpdateTagsSender(req)
  1420  	if err != nil {
  1421  		result.Response = autorest.Response{Response: resp}
  1422  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "UpdateTags", resp, "Failure sending request")
  1423  		return
  1424  	}
  1425  
  1426  	result, err = client.UpdateTagsResponder(resp)
  1427  	if err != nil {
  1428  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "UpdateTags", resp, "Failure responding to request")
  1429  		return
  1430  	}
  1431  
  1432  	return
  1433  }
  1434  
  1435  // UpdateTagsPreparer prepares the UpdateTags request.
  1436  func (client ApplicationGatewaysClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters TagsObject) (*http.Request, error) {
  1437  	pathParameters := map[string]interface{}{
  1438  		"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
  1439  		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
  1440  		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
  1441  	}
  1442  
  1443  	const APIVersion = "2021-05-01"
  1444  	queryParameters := map[string]interface{}{
  1445  		"api-version": APIVersion,
  1446  	}
  1447  
  1448  	preparer := autorest.CreatePreparer(
  1449  		autorest.AsContentType("application/json; charset=utf-8"),
  1450  		autorest.AsPatch(),
  1451  		autorest.WithBaseURL(client.BaseURI),
  1452  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters),
  1453  		autorest.WithJSON(parameters),
  1454  		autorest.WithQueryParameters(queryParameters))
  1455  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1456  }
  1457  
  1458  // UpdateTagsSender sends the UpdateTags request. The method will close the
  1459  // http.Response Body if it receives an error.
  1460  func (client ApplicationGatewaysClient) UpdateTagsSender(req *http.Request) (*http.Response, error) {
  1461  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1462  }
  1463  
  1464  // UpdateTagsResponder handles the response to the UpdateTags request. The method always
  1465  // closes the http.Response Body.
  1466  func (client ApplicationGatewaysClient) UpdateTagsResponder(resp *http.Response) (result ApplicationGateway, err error) {
  1467  	err = autorest.Respond(
  1468  		resp,
  1469  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1470  		autorest.ByUnmarshallingJSON(&result),
  1471  		autorest.ByClosing())
  1472  	result.Response = autorest.Response{Response: resp}
  1473  	return
  1474  }
  1475  

View as plain text