...

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

Documentation: github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-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 = "2018-08-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  // CreateOrUpdate creates or updates the specified application gateway.
   119  // Parameters:
   120  // resourceGroupName - the name of the resource group.
   121  // applicationGatewayName - the name of the application gateway.
   122  // parameters - parameters supplied to the create or update application gateway operation.
   123  func (client ApplicationGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway) (result ApplicationGatewaysCreateOrUpdateFuture, err error) {
   124  	if tracing.IsEnabled() {
   125  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.CreateOrUpdate")
   126  		defer func() {
   127  			sc := -1
   128  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   129  				sc = result.FutureAPI.Response().StatusCode
   130  			}
   131  			tracing.EndSpan(ctx, sc, err)
   132  		}()
   133  	}
   134  	if err := validation.Validate([]validation.Validation{
   135  		{TargetValue: parameters,
   136  			Constraints: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat", Name: validation.Null, Rule: false,
   137  				Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration", Name: validation.Null, Rule: false,
   138  					Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.Enabled", Name: validation.Null, Rule: true, Chain: nil},
   139  						{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetType", Name: validation.Null, Rule: true, Chain: nil},
   140  						{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetVersion", Name: validation.Null, Rule: true, Chain: nil},
   141  						{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySize", Name: validation.Null, Rule: false,
   142  							Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySize", Name: validation.InclusiveMaximum, Rule: int64(128), Chain: nil},
   143  								{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySize", Name: validation.InclusiveMinimum, Rule: int64(8), Chain: nil},
   144  							}},
   145  						{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySizeInKb", Name: validation.Null, Rule: false,
   146  							Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySizeInKb", Name: validation.InclusiveMaximum, Rule: int64(128), Chain: nil},
   147  								{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySizeInKb", Name: validation.InclusiveMinimum, Rule: int64(8), Chain: nil},
   148  							}},
   149  						{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.FileUploadLimitInMb", Name: validation.Null, Rule: false,
   150  							Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.FileUploadLimitInMb", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil},
   151  								{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.FileUploadLimitInMb", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil},
   152  							}},
   153  					}},
   154  					{Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration", Name: validation.Null, Rule: false,
   155  						Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration.MinCapacity", Name: validation.Null, Rule: true,
   156  							Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration.MinCapacity", Name: validation.InclusiveMinimum, Rule: int64(2), Chain: nil}}},
   157  						}},
   158  				}}}}}); err != nil {
   159  		return result, validation.NewError("network.ApplicationGatewaysClient", "CreateOrUpdate", err.Error())
   160  	}
   161  
   162  	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationGatewayName, parameters)
   163  	if err != nil {
   164  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request")
   165  		return
   166  	}
   167  
   168  	result, err = client.CreateOrUpdateSender(req)
   169  	if err != nil {
   170  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", result.Response(), "Failure sending request")
   171  		return
   172  	}
   173  
   174  	return
   175  }
   176  
   177  // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
   178  func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway) (*http.Request, error) {
   179  	pathParameters := map[string]interface{}{
   180  		"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
   181  		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
   182  		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
   183  	}
   184  
   185  	const APIVersion = "2018-08-01"
   186  	queryParameters := map[string]interface{}{
   187  		"api-version": APIVersion,
   188  	}
   189  
   190  	preparer := autorest.CreatePreparer(
   191  		autorest.AsContentType("application/json; charset=utf-8"),
   192  		autorest.AsPut(),
   193  		autorest.WithBaseURL(client.BaseURI),
   194  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters),
   195  		autorest.WithJSON(parameters),
   196  		autorest.WithQueryParameters(queryParameters))
   197  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   198  }
   199  
   200  // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
   201  // http.Response Body if it receives an error.
   202  func (client ApplicationGatewaysClient) CreateOrUpdateSender(req *http.Request) (future ApplicationGatewaysCreateOrUpdateFuture, err error) {
   203  	var resp *http.Response
   204  	future.FutureAPI = &azure.Future{}
   205  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   206  	if err != nil {
   207  		return
   208  	}
   209  	var azf azure.Future
   210  	azf, err = azure.NewFutureFromResponse(resp)
   211  	future.FutureAPI = &azf
   212  	future.Result = future.result
   213  	return
   214  }
   215  
   216  // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
   217  // closes the http.Response Body.
   218  func (client ApplicationGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationGateway, err error) {
   219  	err = autorest.Respond(
   220  		resp,
   221  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
   222  		autorest.ByUnmarshallingJSON(&result),
   223  		autorest.ByClosing())
   224  	result.Response = autorest.Response{Response: resp}
   225  	return
   226  }
   227  
   228  // Delete deletes the specified application gateway.
   229  // Parameters:
   230  // resourceGroupName - the name of the resource group.
   231  // applicationGatewayName - the name of the application gateway.
   232  func (client ApplicationGatewaysClient) Delete(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysDeleteFuture, err error) {
   233  	if tracing.IsEnabled() {
   234  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.Delete")
   235  		defer func() {
   236  			sc := -1
   237  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   238  				sc = result.FutureAPI.Response().StatusCode
   239  			}
   240  			tracing.EndSpan(ctx, sc, err)
   241  		}()
   242  	}
   243  	req, err := client.DeletePreparer(ctx, resourceGroupName, applicationGatewayName)
   244  	if err != nil {
   245  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", nil, "Failure preparing request")
   246  		return
   247  	}
   248  
   249  	result, err = client.DeleteSender(req)
   250  	if err != nil {
   251  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", result.Response(), "Failure sending request")
   252  		return
   253  	}
   254  
   255  	return
   256  }
   257  
   258  // DeletePreparer prepares the Delete request.
   259  func (client ApplicationGatewaysClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) {
   260  	pathParameters := map[string]interface{}{
   261  		"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
   262  		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
   263  		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
   264  	}
   265  
   266  	const APIVersion = "2018-08-01"
   267  	queryParameters := map[string]interface{}{
   268  		"api-version": APIVersion,
   269  	}
   270  
   271  	preparer := autorest.CreatePreparer(
   272  		autorest.AsDelete(),
   273  		autorest.WithBaseURL(client.BaseURI),
   274  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters),
   275  		autorest.WithQueryParameters(queryParameters))
   276  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   277  }
   278  
   279  // DeleteSender sends the Delete request. The method will close the
   280  // http.Response Body if it receives an error.
   281  func (client ApplicationGatewaysClient) DeleteSender(req *http.Request) (future ApplicationGatewaysDeleteFuture, err error) {
   282  	var resp *http.Response
   283  	future.FutureAPI = &azure.Future{}
   284  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   285  	if err != nil {
   286  		return
   287  	}
   288  	var azf azure.Future
   289  	azf, err = azure.NewFutureFromResponse(resp)
   290  	future.FutureAPI = &azf
   291  	future.Result = future.result
   292  	return
   293  }
   294  
   295  // DeleteResponder handles the response to the Delete request. The method always
   296  // closes the http.Response Body.
   297  func (client ApplicationGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
   298  	err = autorest.Respond(
   299  		resp,
   300  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
   301  		autorest.ByClosing())
   302  	result.Response = resp
   303  	return
   304  }
   305  
   306  // Get gets the specified application gateway.
   307  // Parameters:
   308  // resourceGroupName - the name of the resource group.
   309  // applicationGatewayName - the name of the application gateway.
   310  func (client ApplicationGatewaysClient) Get(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGateway, err error) {
   311  	if tracing.IsEnabled() {
   312  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.Get")
   313  		defer func() {
   314  			sc := -1
   315  			if result.Response.Response != nil {
   316  				sc = result.Response.Response.StatusCode
   317  			}
   318  			tracing.EndSpan(ctx, sc, err)
   319  		}()
   320  	}
   321  	req, err := client.GetPreparer(ctx, resourceGroupName, applicationGatewayName)
   322  	if err != nil {
   323  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", nil, "Failure preparing request")
   324  		return
   325  	}
   326  
   327  	resp, err := client.GetSender(req)
   328  	if err != nil {
   329  		result.Response = autorest.Response{Response: resp}
   330  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", resp, "Failure sending request")
   331  		return
   332  	}
   333  
   334  	result, err = client.GetResponder(resp)
   335  	if err != nil {
   336  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", resp, "Failure responding to request")
   337  		return
   338  	}
   339  
   340  	return
   341  }
   342  
   343  // GetPreparer prepares the Get request.
   344  func (client ApplicationGatewaysClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) {
   345  	pathParameters := map[string]interface{}{
   346  		"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
   347  		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
   348  		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
   349  	}
   350  
   351  	const APIVersion = "2018-08-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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters),
   360  		autorest.WithQueryParameters(queryParameters))
   361  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   362  }
   363  
   364  // GetSender sends the Get request. The method will close the
   365  // http.Response Body if it receives an error.
   366  func (client ApplicationGatewaysClient) GetSender(req *http.Request) (*http.Response, error) {
   367  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   368  }
   369  
   370  // GetResponder handles the response to the Get request. The method always
   371  // closes the http.Response Body.
   372  func (client ApplicationGatewaysClient) GetResponder(resp *http.Response) (result ApplicationGateway, 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  // GetSslPredefinedPolicy gets Ssl predefined policy with the specified policy name.
   383  // Parameters:
   384  // predefinedPolicyName - name of Ssl predefined policy.
   385  func (client ApplicationGatewaysClient) GetSslPredefinedPolicy(ctx context.Context, predefinedPolicyName string) (result ApplicationGatewaySslPredefinedPolicy, err error) {
   386  	if tracing.IsEnabled() {
   387  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.GetSslPredefinedPolicy")
   388  		defer func() {
   389  			sc := -1
   390  			if result.Response.Response != nil {
   391  				sc = result.Response.Response.StatusCode
   392  			}
   393  			tracing.EndSpan(ctx, sc, err)
   394  		}()
   395  	}
   396  	req, err := client.GetSslPredefinedPolicyPreparer(ctx, predefinedPolicyName)
   397  	if err != nil {
   398  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "GetSslPredefinedPolicy", nil, "Failure preparing request")
   399  		return
   400  	}
   401  
   402  	resp, err := client.GetSslPredefinedPolicySender(req)
   403  	if err != nil {
   404  		result.Response = autorest.Response{Response: resp}
   405  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "GetSslPredefinedPolicy", resp, "Failure sending request")
   406  		return
   407  	}
   408  
   409  	result, err = client.GetSslPredefinedPolicyResponder(resp)
   410  	if err != nil {
   411  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "GetSslPredefinedPolicy", resp, "Failure responding to request")
   412  		return
   413  	}
   414  
   415  	return
   416  }
   417  
   418  // GetSslPredefinedPolicyPreparer prepares the GetSslPredefinedPolicy request.
   419  func (client ApplicationGatewaysClient) GetSslPredefinedPolicyPreparer(ctx context.Context, predefinedPolicyName string) (*http.Request, error) {
   420  	pathParameters := map[string]interface{}{
   421  		"predefinedPolicyName": autorest.Encode("path", predefinedPolicyName),
   422  		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
   423  	}
   424  
   425  	const APIVersion = "2018-08-01"
   426  	queryParameters := map[string]interface{}{
   427  		"api-version": APIVersion,
   428  	}
   429  
   430  	preparer := autorest.CreatePreparer(
   431  		autorest.AsGet(),
   432  		autorest.WithBaseURL(client.BaseURI),
   433  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName}", pathParameters),
   434  		autorest.WithQueryParameters(queryParameters))
   435  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   436  }
   437  
   438  // GetSslPredefinedPolicySender sends the GetSslPredefinedPolicy request. The method will close the
   439  // http.Response Body if it receives an error.
   440  func (client ApplicationGatewaysClient) GetSslPredefinedPolicySender(req *http.Request) (*http.Response, error) {
   441  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   442  }
   443  
   444  // GetSslPredefinedPolicyResponder handles the response to the GetSslPredefinedPolicy request. The method always
   445  // closes the http.Response Body.
   446  func (client ApplicationGatewaysClient) GetSslPredefinedPolicyResponder(resp *http.Response) (result ApplicationGatewaySslPredefinedPolicy, err error) {
   447  	err = autorest.Respond(
   448  		resp,
   449  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   450  		autorest.ByUnmarshallingJSON(&result),
   451  		autorest.ByClosing())
   452  	result.Response = autorest.Response{Response: resp}
   453  	return
   454  }
   455  
   456  // List lists all application gateways in a resource group.
   457  // Parameters:
   458  // resourceGroupName - the name of the resource group.
   459  func (client ApplicationGatewaysClient) List(ctx context.Context, resourceGroupName string) (result ApplicationGatewayListResultPage, err error) {
   460  	if tracing.IsEnabled() {
   461  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.List")
   462  		defer func() {
   463  			sc := -1
   464  			if result.aglr.Response.Response != nil {
   465  				sc = result.aglr.Response.Response.StatusCode
   466  			}
   467  			tracing.EndSpan(ctx, sc, err)
   468  		}()
   469  	}
   470  	result.fn = client.listNextResults
   471  	req, err := client.ListPreparer(ctx, resourceGroupName)
   472  	if err != nil {
   473  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", nil, "Failure preparing request")
   474  		return
   475  	}
   476  
   477  	resp, err := client.ListSender(req)
   478  	if err != nil {
   479  		result.aglr.Response = autorest.Response{Response: resp}
   480  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure sending request")
   481  		return
   482  	}
   483  
   484  	result.aglr, err = client.ListResponder(resp)
   485  	if err != nil {
   486  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure responding to request")
   487  		return
   488  	}
   489  	if result.aglr.hasNextLink() && result.aglr.IsEmpty() {
   490  		err = result.NextWithContext(ctx)
   491  		return
   492  	}
   493  
   494  	return
   495  }
   496  
   497  // ListPreparer prepares the List request.
   498  func (client ApplicationGatewaysClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
   499  	pathParameters := map[string]interface{}{
   500  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   501  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   502  	}
   503  
   504  	const APIVersion = "2018-08-01"
   505  	queryParameters := map[string]interface{}{
   506  		"api-version": APIVersion,
   507  	}
   508  
   509  	preparer := autorest.CreatePreparer(
   510  		autorest.AsGet(),
   511  		autorest.WithBaseURL(client.BaseURI),
   512  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways", pathParameters),
   513  		autorest.WithQueryParameters(queryParameters))
   514  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   515  }
   516  
   517  // ListSender sends the List request. The method will close the
   518  // http.Response Body if it receives an error.
   519  func (client ApplicationGatewaysClient) ListSender(req *http.Request) (*http.Response, error) {
   520  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   521  }
   522  
   523  // ListResponder handles the response to the List request. The method always
   524  // closes the http.Response Body.
   525  func (client ApplicationGatewaysClient) ListResponder(resp *http.Response) (result ApplicationGatewayListResult, err error) {
   526  	err = autorest.Respond(
   527  		resp,
   528  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   529  		autorest.ByUnmarshallingJSON(&result),
   530  		autorest.ByClosing())
   531  	result.Response = autorest.Response{Response: resp}
   532  	return
   533  }
   534  
   535  // listNextResults retrieves the next set of results, if any.
   536  func (client ApplicationGatewaysClient) listNextResults(ctx context.Context, lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) {
   537  	req, err := lastResults.applicationGatewayListResultPreparer(ctx)
   538  	if err != nil {
   539  		return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listNextResults", nil, "Failure preparing next results request")
   540  	}
   541  	if req == nil {
   542  		return
   543  	}
   544  	resp, err := client.ListSender(req)
   545  	if err != nil {
   546  		result.Response = autorest.Response{Response: resp}
   547  		return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listNextResults", resp, "Failure sending next results request")
   548  	}
   549  	result, err = client.ListResponder(resp)
   550  	if err != nil {
   551  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listNextResults", resp, "Failure responding to next results request")
   552  	}
   553  	return
   554  }
   555  
   556  // ListComplete enumerates all values, automatically crossing page boundaries as required.
   557  func (client ApplicationGatewaysClient) ListComplete(ctx context.Context, resourceGroupName string) (result ApplicationGatewayListResultIterator, err error) {
   558  	if tracing.IsEnabled() {
   559  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.List")
   560  		defer func() {
   561  			sc := -1
   562  			if result.Response().Response.Response != nil {
   563  				sc = result.page.Response().Response.Response.StatusCode
   564  			}
   565  			tracing.EndSpan(ctx, sc, err)
   566  		}()
   567  	}
   568  	result.page, err = client.List(ctx, resourceGroupName)
   569  	return
   570  }
   571  
   572  // ListAll gets all the application gateways in a subscription.
   573  func (client ApplicationGatewaysClient) ListAll(ctx context.Context) (result ApplicationGatewayListResultPage, err error) {
   574  	if tracing.IsEnabled() {
   575  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAll")
   576  		defer func() {
   577  			sc := -1
   578  			if result.aglr.Response.Response != nil {
   579  				sc = result.aglr.Response.Response.StatusCode
   580  			}
   581  			tracing.EndSpan(ctx, sc, err)
   582  		}()
   583  	}
   584  	result.fn = client.listAllNextResults
   585  	req, err := client.ListAllPreparer(ctx)
   586  	if err != nil {
   587  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", nil, "Failure preparing request")
   588  		return
   589  	}
   590  
   591  	resp, err := client.ListAllSender(req)
   592  	if err != nil {
   593  		result.aglr.Response = autorest.Response{Response: resp}
   594  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure sending request")
   595  		return
   596  	}
   597  
   598  	result.aglr, err = client.ListAllResponder(resp)
   599  	if err != nil {
   600  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure responding to request")
   601  		return
   602  	}
   603  	if result.aglr.hasNextLink() && result.aglr.IsEmpty() {
   604  		err = result.NextWithContext(ctx)
   605  		return
   606  	}
   607  
   608  	return
   609  }
   610  
   611  // ListAllPreparer prepares the ListAll request.
   612  func (client ApplicationGatewaysClient) ListAllPreparer(ctx context.Context) (*http.Request, error) {
   613  	pathParameters := map[string]interface{}{
   614  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   615  	}
   616  
   617  	const APIVersion = "2018-08-01"
   618  	queryParameters := map[string]interface{}{
   619  		"api-version": APIVersion,
   620  	}
   621  
   622  	preparer := autorest.CreatePreparer(
   623  		autorest.AsGet(),
   624  		autorest.WithBaseURL(client.BaseURI),
   625  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways", pathParameters),
   626  		autorest.WithQueryParameters(queryParameters))
   627  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   628  }
   629  
   630  // ListAllSender sends the ListAll request. The method will close the
   631  // http.Response Body if it receives an error.
   632  func (client ApplicationGatewaysClient) ListAllSender(req *http.Request) (*http.Response, error) {
   633  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   634  }
   635  
   636  // ListAllResponder handles the response to the ListAll request. The method always
   637  // closes the http.Response Body.
   638  func (client ApplicationGatewaysClient) ListAllResponder(resp *http.Response) (result ApplicationGatewayListResult, err error) {
   639  	err = autorest.Respond(
   640  		resp,
   641  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   642  		autorest.ByUnmarshallingJSON(&result),
   643  		autorest.ByClosing())
   644  	result.Response = autorest.Response{Response: resp}
   645  	return
   646  }
   647  
   648  // listAllNextResults retrieves the next set of results, if any.
   649  func (client ApplicationGatewaysClient) listAllNextResults(ctx context.Context, lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) {
   650  	req, err := lastResults.applicationGatewayListResultPreparer(ctx)
   651  	if err != nil {
   652  		return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAllNextResults", nil, "Failure preparing next results request")
   653  	}
   654  	if req == nil {
   655  		return
   656  	}
   657  	resp, err := client.ListAllSender(req)
   658  	if err != nil {
   659  		result.Response = autorest.Response{Response: resp}
   660  		return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAllNextResults", resp, "Failure sending next results request")
   661  	}
   662  	result, err = client.ListAllResponder(resp)
   663  	if err != nil {
   664  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAllNextResults", resp, "Failure responding to next results request")
   665  	}
   666  	return
   667  }
   668  
   669  // ListAllComplete enumerates all values, automatically crossing page boundaries as required.
   670  func (client ApplicationGatewaysClient) ListAllComplete(ctx context.Context) (result ApplicationGatewayListResultIterator, err error) {
   671  	if tracing.IsEnabled() {
   672  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAll")
   673  		defer func() {
   674  			sc := -1
   675  			if result.Response().Response.Response != nil {
   676  				sc = result.page.Response().Response.Response.StatusCode
   677  			}
   678  			tracing.EndSpan(ctx, sc, err)
   679  		}()
   680  	}
   681  	result.page, err = client.ListAll(ctx)
   682  	return
   683  }
   684  
   685  // ListAvailableSslOptions lists available Ssl options for configuring Ssl policy.
   686  func (client ApplicationGatewaysClient) ListAvailableSslOptions(ctx context.Context) (result ApplicationGatewayAvailableSslOptions, err error) {
   687  	if tracing.IsEnabled() {
   688  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableSslOptions")
   689  		defer func() {
   690  			sc := -1
   691  			if result.Response.Response != nil {
   692  				sc = result.Response.Response.StatusCode
   693  			}
   694  			tracing.EndSpan(ctx, sc, err)
   695  		}()
   696  	}
   697  	req, err := client.ListAvailableSslOptionsPreparer(ctx)
   698  	if err != nil {
   699  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslOptions", nil, "Failure preparing request")
   700  		return
   701  	}
   702  
   703  	resp, err := client.ListAvailableSslOptionsSender(req)
   704  	if err != nil {
   705  		result.Response = autorest.Response{Response: resp}
   706  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslOptions", resp, "Failure sending request")
   707  		return
   708  	}
   709  
   710  	result, err = client.ListAvailableSslOptionsResponder(resp)
   711  	if err != nil {
   712  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslOptions", resp, "Failure responding to request")
   713  		return
   714  	}
   715  
   716  	return
   717  }
   718  
   719  // ListAvailableSslOptionsPreparer prepares the ListAvailableSslOptions request.
   720  func (client ApplicationGatewaysClient) ListAvailableSslOptionsPreparer(ctx context.Context) (*http.Request, error) {
   721  	pathParameters := map[string]interface{}{
   722  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   723  	}
   724  
   725  	const APIVersion = "2018-08-01"
   726  	queryParameters := map[string]interface{}{
   727  		"api-version": APIVersion,
   728  	}
   729  
   730  	preparer := autorest.CreatePreparer(
   731  		autorest.AsGet(),
   732  		autorest.WithBaseURL(client.BaseURI),
   733  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default", pathParameters),
   734  		autorest.WithQueryParameters(queryParameters))
   735  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   736  }
   737  
   738  // ListAvailableSslOptionsSender sends the ListAvailableSslOptions request. The method will close the
   739  // http.Response Body if it receives an error.
   740  func (client ApplicationGatewaysClient) ListAvailableSslOptionsSender(req *http.Request) (*http.Response, error) {
   741  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   742  }
   743  
   744  // ListAvailableSslOptionsResponder handles the response to the ListAvailableSslOptions request. The method always
   745  // closes the http.Response Body.
   746  func (client ApplicationGatewaysClient) ListAvailableSslOptionsResponder(resp *http.Response) (result ApplicationGatewayAvailableSslOptions, err error) {
   747  	err = autorest.Respond(
   748  		resp,
   749  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   750  		autorest.ByUnmarshallingJSON(&result),
   751  		autorest.ByClosing())
   752  	result.Response = autorest.Response{Response: resp}
   753  	return
   754  }
   755  
   756  // ListAvailableSslPredefinedPolicies lists all SSL predefined policies for configuring Ssl policy.
   757  func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPolicies(ctx context.Context) (result ApplicationGatewayAvailableSslPredefinedPoliciesPage, err error) {
   758  	if tracing.IsEnabled() {
   759  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableSslPredefinedPolicies")
   760  		defer func() {
   761  			sc := -1
   762  			if result.agaspp.Response.Response != nil {
   763  				sc = result.agaspp.Response.Response.StatusCode
   764  			}
   765  			tracing.EndSpan(ctx, sc, err)
   766  		}()
   767  	}
   768  	result.fn = client.listAvailableSslPredefinedPoliciesNextResults
   769  	req, err := client.ListAvailableSslPredefinedPoliciesPreparer(ctx)
   770  	if err != nil {
   771  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslPredefinedPolicies", nil, "Failure preparing request")
   772  		return
   773  	}
   774  
   775  	resp, err := client.ListAvailableSslPredefinedPoliciesSender(req)
   776  	if err != nil {
   777  		result.agaspp.Response = autorest.Response{Response: resp}
   778  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslPredefinedPolicies", resp, "Failure sending request")
   779  		return
   780  	}
   781  
   782  	result.agaspp, err = client.ListAvailableSslPredefinedPoliciesResponder(resp)
   783  	if err != nil {
   784  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslPredefinedPolicies", resp, "Failure responding to request")
   785  		return
   786  	}
   787  	if result.agaspp.hasNextLink() && result.agaspp.IsEmpty() {
   788  		err = result.NextWithContext(ctx)
   789  		return
   790  	}
   791  
   792  	return
   793  }
   794  
   795  // ListAvailableSslPredefinedPoliciesPreparer prepares the ListAvailableSslPredefinedPolicies request.
   796  func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesPreparer(ctx context.Context) (*http.Request, error) {
   797  	pathParameters := map[string]interface{}{
   798  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   799  	}
   800  
   801  	const APIVersion = "2018-08-01"
   802  	queryParameters := map[string]interface{}{
   803  		"api-version": APIVersion,
   804  	}
   805  
   806  	preparer := autorest.CreatePreparer(
   807  		autorest.AsGet(),
   808  		autorest.WithBaseURL(client.BaseURI),
   809  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies", pathParameters),
   810  		autorest.WithQueryParameters(queryParameters))
   811  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   812  }
   813  
   814  // ListAvailableSslPredefinedPoliciesSender sends the ListAvailableSslPredefinedPolicies request. The method will close the
   815  // http.Response Body if it receives an error.
   816  func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesSender(req *http.Request) (*http.Response, error) {
   817  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   818  }
   819  
   820  // ListAvailableSslPredefinedPoliciesResponder handles the response to the ListAvailableSslPredefinedPolicies request. The method always
   821  // closes the http.Response Body.
   822  func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesResponder(resp *http.Response) (result ApplicationGatewayAvailableSslPredefinedPolicies, err error) {
   823  	err = autorest.Respond(
   824  		resp,
   825  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   826  		autorest.ByUnmarshallingJSON(&result),
   827  		autorest.ByClosing())
   828  	result.Response = autorest.Response{Response: resp}
   829  	return
   830  }
   831  
   832  // listAvailableSslPredefinedPoliciesNextResults retrieves the next set of results, if any.
   833  func (client ApplicationGatewaysClient) listAvailableSslPredefinedPoliciesNextResults(ctx context.Context, lastResults ApplicationGatewayAvailableSslPredefinedPolicies) (result ApplicationGatewayAvailableSslPredefinedPolicies, err error) {
   834  	req, err := lastResults.applicationGatewayAvailableSslPredefinedPoliciesPreparer(ctx)
   835  	if err != nil {
   836  		return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAvailableSslPredefinedPoliciesNextResults", nil, "Failure preparing next results request")
   837  	}
   838  	if req == nil {
   839  		return
   840  	}
   841  	resp, err := client.ListAvailableSslPredefinedPoliciesSender(req)
   842  	if err != nil {
   843  		result.Response = autorest.Response{Response: resp}
   844  		return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAvailableSslPredefinedPoliciesNextResults", resp, "Failure sending next results request")
   845  	}
   846  	result, err = client.ListAvailableSslPredefinedPoliciesResponder(resp)
   847  	if err != nil {
   848  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAvailableSslPredefinedPoliciesNextResults", resp, "Failure responding to next results request")
   849  	}
   850  	return
   851  }
   852  
   853  // ListAvailableSslPredefinedPoliciesComplete enumerates all values, automatically crossing page boundaries as required.
   854  func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesComplete(ctx context.Context) (result ApplicationGatewayAvailableSslPredefinedPoliciesIterator, err error) {
   855  	if tracing.IsEnabled() {
   856  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableSslPredefinedPolicies")
   857  		defer func() {
   858  			sc := -1
   859  			if result.Response().Response.Response != nil {
   860  				sc = result.page.Response().Response.Response.StatusCode
   861  			}
   862  			tracing.EndSpan(ctx, sc, err)
   863  		}()
   864  	}
   865  	result.page, err = client.ListAvailableSslPredefinedPolicies(ctx)
   866  	return
   867  }
   868  
   869  // ListAvailableWafRuleSets lists all available web application firewall rule sets.
   870  func (client ApplicationGatewaysClient) ListAvailableWafRuleSets(ctx context.Context) (result ApplicationGatewayAvailableWafRuleSetsResult, err error) {
   871  	if tracing.IsEnabled() {
   872  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableWafRuleSets")
   873  		defer func() {
   874  			sc := -1
   875  			if result.Response.Response != nil {
   876  				sc = result.Response.Response.StatusCode
   877  			}
   878  			tracing.EndSpan(ctx, sc, err)
   879  		}()
   880  	}
   881  	req, err := client.ListAvailableWafRuleSetsPreparer(ctx)
   882  	if err != nil {
   883  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", nil, "Failure preparing request")
   884  		return
   885  	}
   886  
   887  	resp, err := client.ListAvailableWafRuleSetsSender(req)
   888  	if err != nil {
   889  		result.Response = autorest.Response{Response: resp}
   890  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", resp, "Failure sending request")
   891  		return
   892  	}
   893  
   894  	result, err = client.ListAvailableWafRuleSetsResponder(resp)
   895  	if err != nil {
   896  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", resp, "Failure responding to request")
   897  		return
   898  	}
   899  
   900  	return
   901  }
   902  
   903  // ListAvailableWafRuleSetsPreparer prepares the ListAvailableWafRuleSets request.
   904  func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsPreparer(ctx context.Context) (*http.Request, error) {
   905  	pathParameters := map[string]interface{}{
   906  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   907  	}
   908  
   909  	const APIVersion = "2018-08-01"
   910  	queryParameters := map[string]interface{}{
   911  		"api-version": APIVersion,
   912  	}
   913  
   914  	preparer := autorest.CreatePreparer(
   915  		autorest.AsGet(),
   916  		autorest.WithBaseURL(client.BaseURI),
   917  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets", pathParameters),
   918  		autorest.WithQueryParameters(queryParameters))
   919  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   920  }
   921  
   922  // ListAvailableWafRuleSetsSender sends the ListAvailableWafRuleSets request. The method will close the
   923  // http.Response Body if it receives an error.
   924  func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsSender(req *http.Request) (*http.Response, error) {
   925  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   926  }
   927  
   928  // ListAvailableWafRuleSetsResponder handles the response to the ListAvailableWafRuleSets request. The method always
   929  // closes the http.Response Body.
   930  func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsResponder(resp *http.Response) (result ApplicationGatewayAvailableWafRuleSetsResult, err error) {
   931  	err = autorest.Respond(
   932  		resp,
   933  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   934  		autorest.ByUnmarshallingJSON(&result),
   935  		autorest.ByClosing())
   936  	result.Response = autorest.Response{Response: resp}
   937  	return
   938  }
   939  
   940  // Start starts the specified application gateway.
   941  // Parameters:
   942  // resourceGroupName - the name of the resource group.
   943  // applicationGatewayName - the name of the application gateway.
   944  func (client ApplicationGatewaysClient) Start(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysStartFuture, err error) {
   945  	if tracing.IsEnabled() {
   946  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.Start")
   947  		defer func() {
   948  			sc := -1
   949  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   950  				sc = result.FutureAPI.Response().StatusCode
   951  			}
   952  			tracing.EndSpan(ctx, sc, err)
   953  		}()
   954  	}
   955  	req, err := client.StartPreparer(ctx, resourceGroupName, applicationGatewayName)
   956  	if err != nil {
   957  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", nil, "Failure preparing request")
   958  		return
   959  	}
   960  
   961  	result, err = client.StartSender(req)
   962  	if err != nil {
   963  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", result.Response(), "Failure sending request")
   964  		return
   965  	}
   966  
   967  	return
   968  }
   969  
   970  // StartPreparer prepares the Start request.
   971  func (client ApplicationGatewaysClient) StartPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) {
   972  	pathParameters := map[string]interface{}{
   973  		"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
   974  		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
   975  		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
   976  	}
   977  
   978  	const APIVersion = "2018-08-01"
   979  	queryParameters := map[string]interface{}{
   980  		"api-version": APIVersion,
   981  	}
   982  
   983  	preparer := autorest.CreatePreparer(
   984  		autorest.AsPost(),
   985  		autorest.WithBaseURL(client.BaseURI),
   986  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start", pathParameters),
   987  		autorest.WithQueryParameters(queryParameters))
   988  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   989  }
   990  
   991  // StartSender sends the Start request. The method will close the
   992  // http.Response Body if it receives an error.
   993  func (client ApplicationGatewaysClient) StartSender(req *http.Request) (future ApplicationGatewaysStartFuture, err error) {
   994  	var resp *http.Response
   995  	future.FutureAPI = &azure.Future{}
   996  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   997  	if err != nil {
   998  		return
   999  	}
  1000  	var azf azure.Future
  1001  	azf, err = azure.NewFutureFromResponse(resp)
  1002  	future.FutureAPI = &azf
  1003  	future.Result = future.result
  1004  	return
  1005  }
  1006  
  1007  // StartResponder handles the response to the Start request. The method always
  1008  // closes the http.Response Body.
  1009  func (client ApplicationGatewaysClient) StartResponder(resp *http.Response) (result autorest.Response, err error) {
  1010  	err = autorest.Respond(
  1011  		resp,
  1012  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1013  		autorest.ByClosing())
  1014  	result.Response = resp
  1015  	return
  1016  }
  1017  
  1018  // Stop stops the specified application gateway in a resource group.
  1019  // Parameters:
  1020  // resourceGroupName - the name of the resource group.
  1021  // applicationGatewayName - the name of the application gateway.
  1022  func (client ApplicationGatewaysClient) Stop(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysStopFuture, err error) {
  1023  	if tracing.IsEnabled() {
  1024  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.Stop")
  1025  		defer func() {
  1026  			sc := -1
  1027  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1028  				sc = result.FutureAPI.Response().StatusCode
  1029  			}
  1030  			tracing.EndSpan(ctx, sc, err)
  1031  		}()
  1032  	}
  1033  	req, err := client.StopPreparer(ctx, resourceGroupName, applicationGatewayName)
  1034  	if err != nil {
  1035  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", nil, "Failure preparing request")
  1036  		return
  1037  	}
  1038  
  1039  	result, err = client.StopSender(req)
  1040  	if err != nil {
  1041  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", result.Response(), "Failure sending request")
  1042  		return
  1043  	}
  1044  
  1045  	return
  1046  }
  1047  
  1048  // StopPreparer prepares the Stop request.
  1049  func (client ApplicationGatewaysClient) StopPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) {
  1050  	pathParameters := map[string]interface{}{
  1051  		"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
  1052  		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
  1053  		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
  1054  	}
  1055  
  1056  	const APIVersion = "2018-08-01"
  1057  	queryParameters := map[string]interface{}{
  1058  		"api-version": APIVersion,
  1059  	}
  1060  
  1061  	preparer := autorest.CreatePreparer(
  1062  		autorest.AsPost(),
  1063  		autorest.WithBaseURL(client.BaseURI),
  1064  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop", pathParameters),
  1065  		autorest.WithQueryParameters(queryParameters))
  1066  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1067  }
  1068  
  1069  // StopSender sends the Stop request. The method will close the
  1070  // http.Response Body if it receives an error.
  1071  func (client ApplicationGatewaysClient) StopSender(req *http.Request) (future ApplicationGatewaysStopFuture, err error) {
  1072  	var resp *http.Response
  1073  	future.FutureAPI = &azure.Future{}
  1074  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1075  	if err != nil {
  1076  		return
  1077  	}
  1078  	var azf azure.Future
  1079  	azf, err = azure.NewFutureFromResponse(resp)
  1080  	future.FutureAPI = &azf
  1081  	future.Result = future.result
  1082  	return
  1083  }
  1084  
  1085  // StopResponder handles the response to the Stop request. The method always
  1086  // closes the http.Response Body.
  1087  func (client ApplicationGatewaysClient) StopResponder(resp *http.Response) (result autorest.Response, err error) {
  1088  	err = autorest.Respond(
  1089  		resp,
  1090  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1091  		autorest.ByClosing())
  1092  	result.Response = resp
  1093  	return
  1094  }
  1095  
  1096  // UpdateTags updates the specified application gateway tags.
  1097  // Parameters:
  1098  // resourceGroupName - the name of the resource group.
  1099  // applicationGatewayName - the name of the application gateway.
  1100  // parameters - parameters supplied to update application gateway tags.
  1101  func (client ApplicationGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters TagsObject) (result ApplicationGatewaysUpdateTagsFuture, err error) {
  1102  	if tracing.IsEnabled() {
  1103  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.UpdateTags")
  1104  		defer func() {
  1105  			sc := -1
  1106  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1107  				sc = result.FutureAPI.Response().StatusCode
  1108  			}
  1109  			tracing.EndSpan(ctx, sc, err)
  1110  		}()
  1111  	}
  1112  	req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, applicationGatewayName, parameters)
  1113  	if err != nil {
  1114  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "UpdateTags", nil, "Failure preparing request")
  1115  		return
  1116  	}
  1117  
  1118  	result, err = client.UpdateTagsSender(req)
  1119  	if err != nil {
  1120  		err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "UpdateTags", result.Response(), "Failure sending request")
  1121  		return
  1122  	}
  1123  
  1124  	return
  1125  }
  1126  
  1127  // UpdateTagsPreparer prepares the UpdateTags request.
  1128  func (client ApplicationGatewaysClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters TagsObject) (*http.Request, error) {
  1129  	pathParameters := map[string]interface{}{
  1130  		"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
  1131  		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
  1132  		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
  1133  	}
  1134  
  1135  	const APIVersion = "2018-08-01"
  1136  	queryParameters := map[string]interface{}{
  1137  		"api-version": APIVersion,
  1138  	}
  1139  
  1140  	preparer := autorest.CreatePreparer(
  1141  		autorest.AsContentType("application/json; charset=utf-8"),
  1142  		autorest.AsPatch(),
  1143  		autorest.WithBaseURL(client.BaseURI),
  1144  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters),
  1145  		autorest.WithJSON(parameters),
  1146  		autorest.WithQueryParameters(queryParameters))
  1147  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1148  }
  1149  
  1150  // UpdateTagsSender sends the UpdateTags request. The method will close the
  1151  // http.Response Body if it receives an error.
  1152  func (client ApplicationGatewaysClient) UpdateTagsSender(req *http.Request) (future ApplicationGatewaysUpdateTagsFuture, err error) {
  1153  	var resp *http.Response
  1154  	future.FutureAPI = &azure.Future{}
  1155  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1156  	if err != nil {
  1157  		return
  1158  	}
  1159  	var azf azure.Future
  1160  	azf, err = azure.NewFutureFromResponse(resp)
  1161  	future.FutureAPI = &azf
  1162  	future.Result = future.result
  1163  	return
  1164  }
  1165  
  1166  // UpdateTagsResponder handles the response to the UpdateTags request. The method always
  1167  // closes the http.Response Body.
  1168  func (client ApplicationGatewaysClient) UpdateTagsResponder(resp *http.Response) (result ApplicationGateway, err error) {
  1169  	err = autorest.Respond(
  1170  		resp,
  1171  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1172  		autorest.ByUnmarshallingJSON(&result),
  1173  		autorest.ByClosing())
  1174  	result.Response = autorest.Response{Response: resp}
  1175  	return
  1176  }
  1177  

View as plain text