...

Source file src/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network/virtualnetworkgateways.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  // VirtualNetworkGatewaysClient is the network Client
    19  type VirtualNetworkGatewaysClient struct {
    20  	BaseClient
    21  }
    22  
    23  // NewVirtualNetworkGatewaysClient creates an instance of the VirtualNetworkGatewaysClient client.
    24  func NewVirtualNetworkGatewaysClient(subscriptionID string) VirtualNetworkGatewaysClient {
    25  	return NewVirtualNetworkGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID)
    26  }
    27  
    28  // NewVirtualNetworkGatewaysClientWithBaseURI creates an instance of the VirtualNetworkGatewaysClient client using a
    29  // custom endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds,
    30  // Azure stack).
    31  func NewVirtualNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkGatewaysClient {
    32  	return VirtualNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)}
    33  }
    34  
    35  // CreateOrUpdate creates or updates a virtual network gateway in the specified resource group.
    36  // Parameters:
    37  // resourceGroupName - the name of the resource group.
    38  // virtualNetworkGatewayName - the name of the virtual network gateway.
    39  // parameters - parameters supplied to create or update virtual network gateway operation.
    40  func (client VirtualNetworkGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway) (result VirtualNetworkGatewaysCreateOrUpdateFuture, err error) {
    41  	if tracing.IsEnabled() {
    42  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.CreateOrUpdate")
    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  	if err := validation.Validate([]validation.Validation{
    52  		{TargetValue: parameters,
    53  			Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
    54  		return result, validation.NewError("network.VirtualNetworkGatewaysClient", "CreateOrUpdate", err.Error())
    55  	}
    56  
    57  	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters)
    58  	if err != nil {
    59  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request")
    60  		return
    61  	}
    62  
    63  	result, err = client.CreateOrUpdateSender(req)
    64  	if err != nil {
    65  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate", result.Response(), "Failure sending request")
    66  		return
    67  	}
    68  
    69  	return
    70  }
    71  
    72  // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
    73  func (client VirtualNetworkGatewaysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway) (*http.Request, error) {
    74  	pathParameters := map[string]interface{}{
    75  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
    76  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
    77  		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
    78  	}
    79  
    80  	const APIVersion = "2018-08-01"
    81  	queryParameters := map[string]interface{}{
    82  		"api-version": APIVersion,
    83  	}
    84  
    85  	preparer := autorest.CreatePreparer(
    86  		autorest.AsContentType("application/json; charset=utf-8"),
    87  		autorest.AsPut(),
    88  		autorest.WithBaseURL(client.BaseURI),
    89  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters),
    90  		autorest.WithJSON(parameters),
    91  		autorest.WithQueryParameters(queryParameters))
    92  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
    93  }
    94  
    95  // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
    96  // http.Response Body if it receives an error.
    97  func (client VirtualNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkGatewaysCreateOrUpdateFuture, err error) {
    98  	var resp *http.Response
    99  	future.FutureAPI = &azure.Future{}
   100  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   101  	if err != nil {
   102  		return
   103  	}
   104  	var azf azure.Future
   105  	azf, err = azure.NewFutureFromResponse(resp)
   106  	future.FutureAPI = &azf
   107  	future.Result = future.result
   108  	return
   109  }
   110  
   111  // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
   112  // closes the http.Response Body.
   113  func (client VirtualNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkGateway, err error) {
   114  	err = autorest.Respond(
   115  		resp,
   116  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
   117  		autorest.ByUnmarshallingJSON(&result),
   118  		autorest.ByClosing())
   119  	result.Response = autorest.Response{Response: resp}
   120  	return
   121  }
   122  
   123  // Delete deletes the specified virtual network gateway.
   124  // Parameters:
   125  // resourceGroupName - the name of the resource group.
   126  // virtualNetworkGatewayName - the name of the virtual network gateway.
   127  func (client VirtualNetworkGatewaysClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysDeleteFuture, err error) {
   128  	if tracing.IsEnabled() {
   129  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.Delete")
   130  		defer func() {
   131  			sc := -1
   132  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   133  				sc = result.FutureAPI.Response().StatusCode
   134  			}
   135  			tracing.EndSpan(ctx, sc, err)
   136  		}()
   137  	}
   138  	req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
   139  	if err != nil {
   140  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", nil, "Failure preparing request")
   141  		return
   142  	}
   143  
   144  	result, err = client.DeleteSender(req)
   145  	if err != nil {
   146  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", result.Response(), "Failure sending request")
   147  		return
   148  	}
   149  
   150  	return
   151  }
   152  
   153  // DeletePreparer prepares the Delete request.
   154  func (client VirtualNetworkGatewaysClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
   155  	pathParameters := map[string]interface{}{
   156  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
   157  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
   158  		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
   159  	}
   160  
   161  	const APIVersion = "2018-08-01"
   162  	queryParameters := map[string]interface{}{
   163  		"api-version": APIVersion,
   164  	}
   165  
   166  	preparer := autorest.CreatePreparer(
   167  		autorest.AsDelete(),
   168  		autorest.WithBaseURL(client.BaseURI),
   169  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters),
   170  		autorest.WithQueryParameters(queryParameters))
   171  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   172  }
   173  
   174  // DeleteSender sends the Delete request. The method will close the
   175  // http.Response Body if it receives an error.
   176  func (client VirtualNetworkGatewaysClient) DeleteSender(req *http.Request) (future VirtualNetworkGatewaysDeleteFuture, err error) {
   177  	var resp *http.Response
   178  	future.FutureAPI = &azure.Future{}
   179  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   180  	if err != nil {
   181  		return
   182  	}
   183  	var azf azure.Future
   184  	azf, err = azure.NewFutureFromResponse(resp)
   185  	future.FutureAPI = &azf
   186  	future.Result = future.result
   187  	return
   188  }
   189  
   190  // DeleteResponder handles the response to the Delete request. The method always
   191  // closes the http.Response Body.
   192  func (client VirtualNetworkGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
   193  	err = autorest.Respond(
   194  		resp,
   195  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
   196  		autorest.ByClosing())
   197  	result.Response = resp
   198  	return
   199  }
   200  
   201  // Generatevpnclientpackage generates VPN client package for P2S client of the virtual network gateway in the specified
   202  // resource group.
   203  // Parameters:
   204  // resourceGroupName - the name of the resource group.
   205  // virtualNetworkGatewayName - the name of the virtual network gateway.
   206  // parameters - parameters supplied to the generate virtual network gateway VPN client package operation.
   207  func (client VirtualNetworkGatewaysClient) Generatevpnclientpackage(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result VirtualNetworkGatewaysGeneratevpnclientpackageFuture, err error) {
   208  	if tracing.IsEnabled() {
   209  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.Generatevpnclientpackage")
   210  		defer func() {
   211  			sc := -1
   212  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   213  				sc = result.FutureAPI.Response().StatusCode
   214  			}
   215  			tracing.EndSpan(ctx, sc, err)
   216  		}()
   217  	}
   218  	req, err := client.GeneratevpnclientpackagePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters)
   219  	if err != nil {
   220  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", nil, "Failure preparing request")
   221  		return
   222  	}
   223  
   224  	result, err = client.GeneratevpnclientpackageSender(req)
   225  	if err != nil {
   226  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", result.Response(), "Failure sending request")
   227  		return
   228  	}
   229  
   230  	return
   231  }
   232  
   233  // GeneratevpnclientpackagePreparer prepares the Generatevpnclientpackage request.
   234  func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackagePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (*http.Request, error) {
   235  	pathParameters := map[string]interface{}{
   236  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
   237  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
   238  		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
   239  	}
   240  
   241  	const APIVersion = "2018-08-01"
   242  	queryParameters := map[string]interface{}{
   243  		"api-version": APIVersion,
   244  	}
   245  
   246  	preparer := autorest.CreatePreparer(
   247  		autorest.AsContentType("application/json; charset=utf-8"),
   248  		autorest.AsPost(),
   249  		autorest.WithBaseURL(client.BaseURI),
   250  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage", pathParameters),
   251  		autorest.WithJSON(parameters),
   252  		autorest.WithQueryParameters(queryParameters))
   253  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   254  }
   255  
   256  // GeneratevpnclientpackageSender sends the Generatevpnclientpackage request. The method will close the
   257  // http.Response Body if it receives an error.
   258  func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageSender(req *http.Request) (future VirtualNetworkGatewaysGeneratevpnclientpackageFuture, err error) {
   259  	var resp *http.Response
   260  	future.FutureAPI = &azure.Future{}
   261  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   262  	if err != nil {
   263  		return
   264  	}
   265  	var azf azure.Future
   266  	azf, err = azure.NewFutureFromResponse(resp)
   267  	future.FutureAPI = &azf
   268  	future.Result = future.result
   269  	return
   270  }
   271  
   272  // GeneratevpnclientpackageResponder handles the response to the Generatevpnclientpackage request. The method always
   273  // closes the http.Response Body.
   274  func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageResponder(resp *http.Response) (result String, err error) {
   275  	err = autorest.Respond(
   276  		resp,
   277  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   278  		autorest.ByUnmarshallingJSON(&result.Value),
   279  		autorest.ByClosing())
   280  	result.Response = autorest.Response{Response: resp}
   281  	return
   282  }
   283  
   284  // GenerateVpnProfile generates VPN profile for P2S client of the virtual network gateway in the specified resource
   285  // group. Used for IKEV2 and radius based authentication.
   286  // Parameters:
   287  // resourceGroupName - the name of the resource group.
   288  // virtualNetworkGatewayName - the name of the virtual network gateway.
   289  // parameters - parameters supplied to the generate virtual network gateway VPN client package operation.
   290  func (client VirtualNetworkGatewaysClient) GenerateVpnProfile(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result VirtualNetworkGatewaysGenerateVpnProfileFuture, err error) {
   291  	if tracing.IsEnabled() {
   292  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GenerateVpnProfile")
   293  		defer func() {
   294  			sc := -1
   295  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   296  				sc = result.FutureAPI.Response().StatusCode
   297  			}
   298  			tracing.EndSpan(ctx, sc, err)
   299  		}()
   300  	}
   301  	req, err := client.GenerateVpnProfilePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters)
   302  	if err != nil {
   303  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GenerateVpnProfile", nil, "Failure preparing request")
   304  		return
   305  	}
   306  
   307  	result, err = client.GenerateVpnProfileSender(req)
   308  	if err != nil {
   309  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GenerateVpnProfile", result.Response(), "Failure sending request")
   310  		return
   311  	}
   312  
   313  	return
   314  }
   315  
   316  // GenerateVpnProfilePreparer prepares the GenerateVpnProfile request.
   317  func (client VirtualNetworkGatewaysClient) GenerateVpnProfilePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (*http.Request, error) {
   318  	pathParameters := map[string]interface{}{
   319  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
   320  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
   321  		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
   322  	}
   323  
   324  	const APIVersion = "2018-08-01"
   325  	queryParameters := map[string]interface{}{
   326  		"api-version": APIVersion,
   327  	}
   328  
   329  	preparer := autorest.CreatePreparer(
   330  		autorest.AsContentType("application/json; charset=utf-8"),
   331  		autorest.AsPost(),
   332  		autorest.WithBaseURL(client.BaseURI),
   333  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile", pathParameters),
   334  		autorest.WithJSON(parameters),
   335  		autorest.WithQueryParameters(queryParameters))
   336  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   337  }
   338  
   339  // GenerateVpnProfileSender sends the GenerateVpnProfile request. The method will close the
   340  // http.Response Body if it receives an error.
   341  func (client VirtualNetworkGatewaysClient) GenerateVpnProfileSender(req *http.Request) (future VirtualNetworkGatewaysGenerateVpnProfileFuture, err error) {
   342  	var resp *http.Response
   343  	future.FutureAPI = &azure.Future{}
   344  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   345  	if err != nil {
   346  		return
   347  	}
   348  	var azf azure.Future
   349  	azf, err = azure.NewFutureFromResponse(resp)
   350  	future.FutureAPI = &azf
   351  	future.Result = future.result
   352  	return
   353  }
   354  
   355  // GenerateVpnProfileResponder handles the response to the GenerateVpnProfile request. The method always
   356  // closes the http.Response Body.
   357  func (client VirtualNetworkGatewaysClient) GenerateVpnProfileResponder(resp *http.Response) (result String, err error) {
   358  	err = autorest.Respond(
   359  		resp,
   360  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   361  		autorest.ByUnmarshallingJSON(&result.Value),
   362  		autorest.ByClosing())
   363  	result.Response = autorest.Response{Response: resp}
   364  	return
   365  }
   366  
   367  // Get gets the specified virtual network gateway by resource group.
   368  // Parameters:
   369  // resourceGroupName - the name of the resource group.
   370  // virtualNetworkGatewayName - the name of the virtual network gateway.
   371  func (client VirtualNetworkGatewaysClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGateway, err error) {
   372  	if tracing.IsEnabled() {
   373  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.Get")
   374  		defer func() {
   375  			sc := -1
   376  			if result.Response.Response != nil {
   377  				sc = result.Response.Response.StatusCode
   378  			}
   379  			tracing.EndSpan(ctx, sc, err)
   380  		}()
   381  	}
   382  	req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
   383  	if err != nil {
   384  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", nil, "Failure preparing request")
   385  		return
   386  	}
   387  
   388  	resp, err := client.GetSender(req)
   389  	if err != nil {
   390  		result.Response = autorest.Response{Response: resp}
   391  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", resp, "Failure sending request")
   392  		return
   393  	}
   394  
   395  	result, err = client.GetResponder(resp)
   396  	if err != nil {
   397  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", resp, "Failure responding to request")
   398  		return
   399  	}
   400  
   401  	return
   402  }
   403  
   404  // GetPreparer prepares the Get request.
   405  func (client VirtualNetworkGatewaysClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
   406  	pathParameters := map[string]interface{}{
   407  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
   408  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
   409  		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
   410  	}
   411  
   412  	const APIVersion = "2018-08-01"
   413  	queryParameters := map[string]interface{}{
   414  		"api-version": APIVersion,
   415  	}
   416  
   417  	preparer := autorest.CreatePreparer(
   418  		autorest.AsGet(),
   419  		autorest.WithBaseURL(client.BaseURI),
   420  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters),
   421  		autorest.WithQueryParameters(queryParameters))
   422  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   423  }
   424  
   425  // GetSender sends the Get request. The method will close the
   426  // http.Response Body if it receives an error.
   427  func (client VirtualNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) {
   428  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   429  }
   430  
   431  // GetResponder handles the response to the Get request. The method always
   432  // closes the http.Response Body.
   433  func (client VirtualNetworkGatewaysClient) GetResponder(resp *http.Response) (result VirtualNetworkGateway, err error) {
   434  	err = autorest.Respond(
   435  		resp,
   436  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   437  		autorest.ByUnmarshallingJSON(&result),
   438  		autorest.ByClosing())
   439  	result.Response = autorest.Response{Response: resp}
   440  	return
   441  }
   442  
   443  // GetAdvertisedRoutes this operation retrieves a list of routes the virtual network gateway is advertising to the
   444  // specified peer.
   445  // Parameters:
   446  // resourceGroupName - the name of the resource group.
   447  // virtualNetworkGatewayName - the name of the virtual network gateway.
   448  // peer - the IP address of the peer
   449  func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (result VirtualNetworkGatewaysGetAdvertisedRoutesFuture, err error) {
   450  	if tracing.IsEnabled() {
   451  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetAdvertisedRoutes")
   452  		defer func() {
   453  			sc := -1
   454  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   455  				sc = result.FutureAPI.Response().StatusCode
   456  			}
   457  			tracing.EndSpan(ctx, sc, err)
   458  		}()
   459  	}
   460  	req, err := client.GetAdvertisedRoutesPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, peer)
   461  	if err != nil {
   462  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetAdvertisedRoutes", nil, "Failure preparing request")
   463  		return
   464  	}
   465  
   466  	result, err = client.GetAdvertisedRoutesSender(req)
   467  	if err != nil {
   468  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetAdvertisedRoutes", result.Response(), "Failure sending request")
   469  		return
   470  	}
   471  
   472  	return
   473  }
   474  
   475  // GetAdvertisedRoutesPreparer prepares the GetAdvertisedRoutes request.
   476  func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (*http.Request, error) {
   477  	pathParameters := map[string]interface{}{
   478  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
   479  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
   480  		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
   481  	}
   482  
   483  	const APIVersion = "2018-08-01"
   484  	queryParameters := map[string]interface{}{
   485  		"api-version": APIVersion,
   486  		"peer":        autorest.Encode("query", peer),
   487  	}
   488  
   489  	preparer := autorest.CreatePreparer(
   490  		autorest.AsPost(),
   491  		autorest.WithBaseURL(client.BaseURI),
   492  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes", pathParameters),
   493  		autorest.WithQueryParameters(queryParameters))
   494  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   495  }
   496  
   497  // GetAdvertisedRoutesSender sends the GetAdvertisedRoutes request. The method will close the
   498  // http.Response Body if it receives an error.
   499  func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesSender(req *http.Request) (future VirtualNetworkGatewaysGetAdvertisedRoutesFuture, err error) {
   500  	var resp *http.Response
   501  	future.FutureAPI = &azure.Future{}
   502  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   503  	if err != nil {
   504  		return
   505  	}
   506  	var azf azure.Future
   507  	azf, err = azure.NewFutureFromResponse(resp)
   508  	future.FutureAPI = &azf
   509  	future.Result = future.result
   510  	return
   511  }
   512  
   513  // GetAdvertisedRoutesResponder handles the response to the GetAdvertisedRoutes request. The method always
   514  // closes the http.Response Body.
   515  func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesResponder(resp *http.Response) (result GatewayRouteListResult, err error) {
   516  	err = autorest.Respond(
   517  		resp,
   518  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   519  		autorest.ByUnmarshallingJSON(&result),
   520  		autorest.ByClosing())
   521  	result.Response = autorest.Response{Response: resp}
   522  	return
   523  }
   524  
   525  // GetBgpPeerStatus the GetBgpPeerStatus operation retrieves the status of all BGP peers.
   526  // Parameters:
   527  // resourceGroupName - the name of the resource group.
   528  // virtualNetworkGatewayName - the name of the virtual network gateway.
   529  // peer - the IP address of the peer to retrieve the status of.
   530  func (client VirtualNetworkGatewaysClient) GetBgpPeerStatus(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (result VirtualNetworkGatewaysGetBgpPeerStatusFuture, err error) {
   531  	if tracing.IsEnabled() {
   532  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetBgpPeerStatus")
   533  		defer func() {
   534  			sc := -1
   535  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   536  				sc = result.FutureAPI.Response().StatusCode
   537  			}
   538  			tracing.EndSpan(ctx, sc, err)
   539  		}()
   540  	}
   541  	req, err := client.GetBgpPeerStatusPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, peer)
   542  	if err != nil {
   543  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetBgpPeerStatus", nil, "Failure preparing request")
   544  		return
   545  	}
   546  
   547  	result, err = client.GetBgpPeerStatusSender(req)
   548  	if err != nil {
   549  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetBgpPeerStatus", result.Response(), "Failure sending request")
   550  		return
   551  	}
   552  
   553  	return
   554  }
   555  
   556  // GetBgpPeerStatusPreparer prepares the GetBgpPeerStatus request.
   557  func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (*http.Request, error) {
   558  	pathParameters := map[string]interface{}{
   559  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
   560  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
   561  		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
   562  	}
   563  
   564  	const APIVersion = "2018-08-01"
   565  	queryParameters := map[string]interface{}{
   566  		"api-version": APIVersion,
   567  	}
   568  	if len(peer) > 0 {
   569  		queryParameters["peer"] = autorest.Encode("query", peer)
   570  	}
   571  
   572  	preparer := autorest.CreatePreparer(
   573  		autorest.AsPost(),
   574  		autorest.WithBaseURL(client.BaseURI),
   575  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus", pathParameters),
   576  		autorest.WithQueryParameters(queryParameters))
   577  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   578  }
   579  
   580  // GetBgpPeerStatusSender sends the GetBgpPeerStatus request. The method will close the
   581  // http.Response Body if it receives an error.
   582  func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusSender(req *http.Request) (future VirtualNetworkGatewaysGetBgpPeerStatusFuture, err error) {
   583  	var resp *http.Response
   584  	future.FutureAPI = &azure.Future{}
   585  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   586  	if err != nil {
   587  		return
   588  	}
   589  	var azf azure.Future
   590  	azf, err = azure.NewFutureFromResponse(resp)
   591  	future.FutureAPI = &azf
   592  	future.Result = future.result
   593  	return
   594  }
   595  
   596  // GetBgpPeerStatusResponder handles the response to the GetBgpPeerStatus request. The method always
   597  // closes the http.Response Body.
   598  func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusResponder(resp *http.Response) (result BgpPeerStatusListResult, err error) {
   599  	err = autorest.Respond(
   600  		resp,
   601  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   602  		autorest.ByUnmarshallingJSON(&result),
   603  		autorest.ByClosing())
   604  	result.Response = autorest.Response{Response: resp}
   605  	return
   606  }
   607  
   608  // GetLearnedRoutes this operation retrieves a list of routes the virtual network gateway has learned, including routes
   609  // learned from BGP peers.
   610  // Parameters:
   611  // resourceGroupName - the name of the resource group.
   612  // virtualNetworkGatewayName - the name of the virtual network gateway.
   613  func (client VirtualNetworkGatewaysClient) GetLearnedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetLearnedRoutesFuture, err error) {
   614  	if tracing.IsEnabled() {
   615  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetLearnedRoutes")
   616  		defer func() {
   617  			sc := -1
   618  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   619  				sc = result.FutureAPI.Response().StatusCode
   620  			}
   621  			tracing.EndSpan(ctx, sc, err)
   622  		}()
   623  	}
   624  	req, err := client.GetLearnedRoutesPreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
   625  	if err != nil {
   626  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetLearnedRoutes", nil, "Failure preparing request")
   627  		return
   628  	}
   629  
   630  	result, err = client.GetLearnedRoutesSender(req)
   631  	if err != nil {
   632  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetLearnedRoutes", result.Response(), "Failure sending request")
   633  		return
   634  	}
   635  
   636  	return
   637  }
   638  
   639  // GetLearnedRoutesPreparer prepares the GetLearnedRoutes request.
   640  func (client VirtualNetworkGatewaysClient) GetLearnedRoutesPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
   641  	pathParameters := map[string]interface{}{
   642  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
   643  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
   644  		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
   645  	}
   646  
   647  	const APIVersion = "2018-08-01"
   648  	queryParameters := map[string]interface{}{
   649  		"api-version": APIVersion,
   650  	}
   651  
   652  	preparer := autorest.CreatePreparer(
   653  		autorest.AsPost(),
   654  		autorest.WithBaseURL(client.BaseURI),
   655  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes", pathParameters),
   656  		autorest.WithQueryParameters(queryParameters))
   657  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   658  }
   659  
   660  // GetLearnedRoutesSender sends the GetLearnedRoutes request. The method will close the
   661  // http.Response Body if it receives an error.
   662  func (client VirtualNetworkGatewaysClient) GetLearnedRoutesSender(req *http.Request) (future VirtualNetworkGatewaysGetLearnedRoutesFuture, err error) {
   663  	var resp *http.Response
   664  	future.FutureAPI = &azure.Future{}
   665  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   666  	if err != nil {
   667  		return
   668  	}
   669  	var azf azure.Future
   670  	azf, err = azure.NewFutureFromResponse(resp)
   671  	future.FutureAPI = &azf
   672  	future.Result = future.result
   673  	return
   674  }
   675  
   676  // GetLearnedRoutesResponder handles the response to the GetLearnedRoutes request. The method always
   677  // closes the http.Response Body.
   678  func (client VirtualNetworkGatewaysClient) GetLearnedRoutesResponder(resp *http.Response) (result GatewayRouteListResult, err error) {
   679  	err = autorest.Respond(
   680  		resp,
   681  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   682  		autorest.ByUnmarshallingJSON(&result),
   683  		autorest.ByClosing())
   684  	result.Response = autorest.Response{Response: resp}
   685  	return
   686  }
   687  
   688  // GetVpnclientIpsecParameters the Get VpnclientIpsecParameters operation retrieves information about the vpnclient
   689  // ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource
   690  // provider.
   691  // Parameters:
   692  // resourceGroupName - the name of the resource group.
   693  // virtualNetworkGatewayName - the virtual network gateway name.
   694  func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture, err error) {
   695  	if tracing.IsEnabled() {
   696  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetVpnclientIpsecParameters")
   697  		defer func() {
   698  			sc := -1
   699  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   700  				sc = result.FutureAPI.Response().StatusCode
   701  			}
   702  			tracing.EndSpan(ctx, sc, err)
   703  		}()
   704  	}
   705  	req, err := client.GetVpnclientIpsecParametersPreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
   706  	if err != nil {
   707  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnclientIpsecParameters", nil, "Failure preparing request")
   708  		return
   709  	}
   710  
   711  	result, err = client.GetVpnclientIpsecParametersSender(req)
   712  	if err != nil {
   713  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnclientIpsecParameters", result.Response(), "Failure sending request")
   714  		return
   715  	}
   716  
   717  	return
   718  }
   719  
   720  // GetVpnclientIpsecParametersPreparer prepares the GetVpnclientIpsecParameters request.
   721  func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParametersPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
   722  	pathParameters := map[string]interface{}{
   723  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
   724  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
   725  		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
   726  	}
   727  
   728  	const APIVersion = "2018-08-01"
   729  	queryParameters := map[string]interface{}{
   730  		"api-version": APIVersion,
   731  	}
   732  
   733  	preparer := autorest.CreatePreparer(
   734  		autorest.AsPost(),
   735  		autorest.WithBaseURL(client.BaseURI),
   736  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnclientipsecparameters", pathParameters),
   737  		autorest.WithQueryParameters(queryParameters))
   738  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   739  }
   740  
   741  // GetVpnclientIpsecParametersSender sends the GetVpnclientIpsecParameters request. The method will close the
   742  // http.Response Body if it receives an error.
   743  func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParametersSender(req *http.Request) (future VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture, err error) {
   744  	var resp *http.Response
   745  	future.FutureAPI = &azure.Future{}
   746  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   747  	if err != nil {
   748  		return
   749  	}
   750  	var azf azure.Future
   751  	azf, err = azure.NewFutureFromResponse(resp)
   752  	future.FutureAPI = &azf
   753  	future.Result = future.result
   754  	return
   755  }
   756  
   757  // GetVpnclientIpsecParametersResponder handles the response to the GetVpnclientIpsecParameters request. The method always
   758  // closes the http.Response Body.
   759  func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParametersResponder(resp *http.Response) (result VpnClientIPsecParameters, err error) {
   760  	err = autorest.Respond(
   761  		resp,
   762  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   763  		autorest.ByUnmarshallingJSON(&result),
   764  		autorest.ByClosing())
   765  	result.Response = autorest.Response{Response: resp}
   766  	return
   767  }
   768  
   769  // GetVpnProfilePackageURL gets pre-generated VPN profile for P2S client of the virtual network gateway in the
   770  // specified resource group. The profile needs to be generated first using generateVpnProfile.
   771  // Parameters:
   772  // resourceGroupName - the name of the resource group.
   773  // virtualNetworkGatewayName - the name of the virtual network gateway.
   774  func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURL(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetVpnProfilePackageURLFuture, err error) {
   775  	if tracing.IsEnabled() {
   776  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetVpnProfilePackageURL")
   777  		defer func() {
   778  			sc := -1
   779  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   780  				sc = result.FutureAPI.Response().StatusCode
   781  			}
   782  			tracing.EndSpan(ctx, sc, err)
   783  		}()
   784  	}
   785  	req, err := client.GetVpnProfilePackageURLPreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
   786  	if err != nil {
   787  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnProfilePackageURL", nil, "Failure preparing request")
   788  		return
   789  	}
   790  
   791  	result, err = client.GetVpnProfilePackageURLSender(req)
   792  	if err != nil {
   793  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnProfilePackageURL", result.Response(), "Failure sending request")
   794  		return
   795  	}
   796  
   797  	return
   798  }
   799  
   800  // GetVpnProfilePackageURLPreparer prepares the GetVpnProfilePackageURL request.
   801  func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
   802  	pathParameters := map[string]interface{}{
   803  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
   804  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
   805  		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
   806  	}
   807  
   808  	const APIVersion = "2018-08-01"
   809  	queryParameters := map[string]interface{}{
   810  		"api-version": APIVersion,
   811  	}
   812  
   813  	preparer := autorest.CreatePreparer(
   814  		autorest.AsPost(),
   815  		autorest.WithBaseURL(client.BaseURI),
   816  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl", pathParameters),
   817  		autorest.WithQueryParameters(queryParameters))
   818  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   819  }
   820  
   821  // GetVpnProfilePackageURLSender sends the GetVpnProfilePackageURL request. The method will close the
   822  // http.Response Body if it receives an error.
   823  func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLSender(req *http.Request) (future VirtualNetworkGatewaysGetVpnProfilePackageURLFuture, err error) {
   824  	var resp *http.Response
   825  	future.FutureAPI = &azure.Future{}
   826  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   827  	if err != nil {
   828  		return
   829  	}
   830  	var azf azure.Future
   831  	azf, err = azure.NewFutureFromResponse(resp)
   832  	future.FutureAPI = &azf
   833  	future.Result = future.result
   834  	return
   835  }
   836  
   837  // GetVpnProfilePackageURLResponder handles the response to the GetVpnProfilePackageURL request. The method always
   838  // closes the http.Response Body.
   839  func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLResponder(resp *http.Response) (result String, err error) {
   840  	err = autorest.Respond(
   841  		resp,
   842  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   843  		autorest.ByUnmarshallingJSON(&result.Value),
   844  		autorest.ByClosing())
   845  	result.Response = autorest.Response{Response: resp}
   846  	return
   847  }
   848  
   849  // List gets all virtual network gateways by resource group.
   850  // Parameters:
   851  // resourceGroupName - the name of the resource group.
   852  func (client VirtualNetworkGatewaysClient) List(ctx context.Context, resourceGroupName string) (result VirtualNetworkGatewayListResultPage, err error) {
   853  	if tracing.IsEnabled() {
   854  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.List")
   855  		defer func() {
   856  			sc := -1
   857  			if result.vnglr.Response.Response != nil {
   858  				sc = result.vnglr.Response.Response.StatusCode
   859  			}
   860  			tracing.EndSpan(ctx, sc, err)
   861  		}()
   862  	}
   863  	result.fn = client.listNextResults
   864  	req, err := client.ListPreparer(ctx, resourceGroupName)
   865  	if err != nil {
   866  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", nil, "Failure preparing request")
   867  		return
   868  	}
   869  
   870  	resp, err := client.ListSender(req)
   871  	if err != nil {
   872  		result.vnglr.Response = autorest.Response{Response: resp}
   873  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure sending request")
   874  		return
   875  	}
   876  
   877  	result.vnglr, err = client.ListResponder(resp)
   878  	if err != nil {
   879  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure responding to request")
   880  		return
   881  	}
   882  	if result.vnglr.hasNextLink() && result.vnglr.IsEmpty() {
   883  		err = result.NextWithContext(ctx)
   884  		return
   885  	}
   886  
   887  	return
   888  }
   889  
   890  // ListPreparer prepares the List request.
   891  func (client VirtualNetworkGatewaysClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
   892  	pathParameters := map[string]interface{}{
   893  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   894  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   895  	}
   896  
   897  	const APIVersion = "2018-08-01"
   898  	queryParameters := map[string]interface{}{
   899  		"api-version": APIVersion,
   900  	}
   901  
   902  	preparer := autorest.CreatePreparer(
   903  		autorest.AsGet(),
   904  		autorest.WithBaseURL(client.BaseURI),
   905  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways", pathParameters),
   906  		autorest.WithQueryParameters(queryParameters))
   907  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   908  }
   909  
   910  // ListSender sends the List request. The method will close the
   911  // http.Response Body if it receives an error.
   912  func (client VirtualNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) {
   913  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   914  }
   915  
   916  // ListResponder handles the response to the List request. The method always
   917  // closes the http.Response Body.
   918  func (client VirtualNetworkGatewaysClient) ListResponder(resp *http.Response) (result VirtualNetworkGatewayListResult, err error) {
   919  	err = autorest.Respond(
   920  		resp,
   921  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   922  		autorest.ByUnmarshallingJSON(&result),
   923  		autorest.ByClosing())
   924  	result.Response = autorest.Response{Response: resp}
   925  	return
   926  }
   927  
   928  // listNextResults retrieves the next set of results, if any.
   929  func (client VirtualNetworkGatewaysClient) listNextResults(ctx context.Context, lastResults VirtualNetworkGatewayListResult) (result VirtualNetworkGatewayListResult, err error) {
   930  	req, err := lastResults.virtualNetworkGatewayListResultPreparer(ctx)
   931  	if err != nil {
   932  		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listNextResults", nil, "Failure preparing next results request")
   933  	}
   934  	if req == nil {
   935  		return
   936  	}
   937  	resp, err := client.ListSender(req)
   938  	if err != nil {
   939  		result.Response = autorest.Response{Response: resp}
   940  		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listNextResults", resp, "Failure sending next results request")
   941  	}
   942  	result, err = client.ListResponder(resp)
   943  	if err != nil {
   944  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listNextResults", resp, "Failure responding to next results request")
   945  	}
   946  	return
   947  }
   948  
   949  // ListComplete enumerates all values, automatically crossing page boundaries as required.
   950  func (client VirtualNetworkGatewaysClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualNetworkGatewayListResultIterator, err error) {
   951  	if tracing.IsEnabled() {
   952  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.List")
   953  		defer func() {
   954  			sc := -1
   955  			if result.Response().Response.Response != nil {
   956  				sc = result.page.Response().Response.Response.StatusCode
   957  			}
   958  			tracing.EndSpan(ctx, sc, err)
   959  		}()
   960  	}
   961  	result.page, err = client.List(ctx, resourceGroupName)
   962  	return
   963  }
   964  
   965  // ListConnections gets all the connections in a virtual network gateway.
   966  // Parameters:
   967  // resourceGroupName - the name of the resource group.
   968  // virtualNetworkGatewayName - the name of the virtual network gateway.
   969  func (client VirtualNetworkGatewaysClient) ListConnections(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewayListConnectionsResultPage, err error) {
   970  	if tracing.IsEnabled() {
   971  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.ListConnections")
   972  		defer func() {
   973  			sc := -1
   974  			if result.vnglcr.Response.Response != nil {
   975  				sc = result.vnglcr.Response.Response.StatusCode
   976  			}
   977  			tracing.EndSpan(ctx, sc, err)
   978  		}()
   979  	}
   980  	result.fn = client.listConnectionsNextResults
   981  	req, err := client.ListConnectionsPreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
   982  	if err != nil {
   983  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ListConnections", nil, "Failure preparing request")
   984  		return
   985  	}
   986  
   987  	resp, err := client.ListConnectionsSender(req)
   988  	if err != nil {
   989  		result.vnglcr.Response = autorest.Response{Response: resp}
   990  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ListConnections", resp, "Failure sending request")
   991  		return
   992  	}
   993  
   994  	result.vnglcr, err = client.ListConnectionsResponder(resp)
   995  	if err != nil {
   996  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ListConnections", resp, "Failure responding to request")
   997  		return
   998  	}
   999  	if result.vnglcr.hasNextLink() && result.vnglcr.IsEmpty() {
  1000  		err = result.NextWithContext(ctx)
  1001  		return
  1002  	}
  1003  
  1004  	return
  1005  }
  1006  
  1007  // ListConnectionsPreparer prepares the ListConnections request.
  1008  func (client VirtualNetworkGatewaysClient) ListConnectionsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
  1009  	pathParameters := map[string]interface{}{
  1010  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
  1011  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
  1012  		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
  1013  	}
  1014  
  1015  	const APIVersion = "2018-08-01"
  1016  	queryParameters := map[string]interface{}{
  1017  		"api-version": APIVersion,
  1018  	}
  1019  
  1020  	preparer := autorest.CreatePreparer(
  1021  		autorest.AsGet(),
  1022  		autorest.WithBaseURL(client.BaseURI),
  1023  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/connections", pathParameters),
  1024  		autorest.WithQueryParameters(queryParameters))
  1025  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1026  }
  1027  
  1028  // ListConnectionsSender sends the ListConnections request. The method will close the
  1029  // http.Response Body if it receives an error.
  1030  func (client VirtualNetworkGatewaysClient) ListConnectionsSender(req *http.Request) (*http.Response, error) {
  1031  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1032  }
  1033  
  1034  // ListConnectionsResponder handles the response to the ListConnections request. The method always
  1035  // closes the http.Response Body.
  1036  func (client VirtualNetworkGatewaysClient) ListConnectionsResponder(resp *http.Response) (result VirtualNetworkGatewayListConnectionsResult, err error) {
  1037  	err = autorest.Respond(
  1038  		resp,
  1039  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1040  		autorest.ByUnmarshallingJSON(&result),
  1041  		autorest.ByClosing())
  1042  	result.Response = autorest.Response{Response: resp}
  1043  	return
  1044  }
  1045  
  1046  // listConnectionsNextResults retrieves the next set of results, if any.
  1047  func (client VirtualNetworkGatewaysClient) listConnectionsNextResults(ctx context.Context, lastResults VirtualNetworkGatewayListConnectionsResult) (result VirtualNetworkGatewayListConnectionsResult, err error) {
  1048  	req, err := lastResults.virtualNetworkGatewayListConnectionsResultPreparer(ctx)
  1049  	if err != nil {
  1050  		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listConnectionsNextResults", nil, "Failure preparing next results request")
  1051  	}
  1052  	if req == nil {
  1053  		return
  1054  	}
  1055  	resp, err := client.ListConnectionsSender(req)
  1056  	if err != nil {
  1057  		result.Response = autorest.Response{Response: resp}
  1058  		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listConnectionsNextResults", resp, "Failure sending next results request")
  1059  	}
  1060  	result, err = client.ListConnectionsResponder(resp)
  1061  	if err != nil {
  1062  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listConnectionsNextResults", resp, "Failure responding to next results request")
  1063  	}
  1064  	return
  1065  }
  1066  
  1067  // ListConnectionsComplete enumerates all values, automatically crossing page boundaries as required.
  1068  func (client VirtualNetworkGatewaysClient) ListConnectionsComplete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewayListConnectionsResultIterator, err error) {
  1069  	if tracing.IsEnabled() {
  1070  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.ListConnections")
  1071  		defer func() {
  1072  			sc := -1
  1073  			if result.Response().Response.Response != nil {
  1074  				sc = result.page.Response().Response.Response.StatusCode
  1075  			}
  1076  			tracing.EndSpan(ctx, sc, err)
  1077  		}()
  1078  	}
  1079  	result.page, err = client.ListConnections(ctx, resourceGroupName, virtualNetworkGatewayName)
  1080  	return
  1081  }
  1082  
  1083  // Reset resets the primary of the virtual network gateway in the specified resource group.
  1084  // Parameters:
  1085  // resourceGroupName - the name of the resource group.
  1086  // virtualNetworkGatewayName - the name of the virtual network gateway.
  1087  // gatewayVip - virtual network gateway vip address supplied to the begin reset of the active-active feature
  1088  // enabled gateway.
  1089  func (client VirtualNetworkGatewaysClient) Reset(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string) (result VirtualNetworkGatewaysResetFuture, err error) {
  1090  	if tracing.IsEnabled() {
  1091  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.Reset")
  1092  		defer func() {
  1093  			sc := -1
  1094  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1095  				sc = result.FutureAPI.Response().StatusCode
  1096  			}
  1097  			tracing.EndSpan(ctx, sc, err)
  1098  		}()
  1099  	}
  1100  	req, err := client.ResetPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, gatewayVip)
  1101  	if err != nil {
  1102  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", nil, "Failure preparing request")
  1103  		return
  1104  	}
  1105  
  1106  	result, err = client.ResetSender(req)
  1107  	if err != nil {
  1108  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", result.Response(), "Failure sending request")
  1109  		return
  1110  	}
  1111  
  1112  	return
  1113  }
  1114  
  1115  // ResetPreparer prepares the Reset request.
  1116  func (client VirtualNetworkGatewaysClient) ResetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string) (*http.Request, error) {
  1117  	pathParameters := map[string]interface{}{
  1118  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
  1119  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
  1120  		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
  1121  	}
  1122  
  1123  	const APIVersion = "2018-08-01"
  1124  	queryParameters := map[string]interface{}{
  1125  		"api-version": APIVersion,
  1126  	}
  1127  	if len(gatewayVip) > 0 {
  1128  		queryParameters["gatewayVip"] = autorest.Encode("query", gatewayVip)
  1129  	}
  1130  
  1131  	preparer := autorest.CreatePreparer(
  1132  		autorest.AsPost(),
  1133  		autorest.WithBaseURL(client.BaseURI),
  1134  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset", pathParameters),
  1135  		autorest.WithQueryParameters(queryParameters))
  1136  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1137  }
  1138  
  1139  // ResetSender sends the Reset request. The method will close the
  1140  // http.Response Body if it receives an error.
  1141  func (client VirtualNetworkGatewaysClient) ResetSender(req *http.Request) (future VirtualNetworkGatewaysResetFuture, err error) {
  1142  	var resp *http.Response
  1143  	future.FutureAPI = &azure.Future{}
  1144  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1145  	if err != nil {
  1146  		return
  1147  	}
  1148  	var azf azure.Future
  1149  	azf, err = azure.NewFutureFromResponse(resp)
  1150  	future.FutureAPI = &azf
  1151  	future.Result = future.result
  1152  	return
  1153  }
  1154  
  1155  // ResetResponder handles the response to the Reset request. The method always
  1156  // closes the http.Response Body.
  1157  func (client VirtualNetworkGatewaysClient) ResetResponder(resp *http.Response) (result VirtualNetworkGateway, err error) {
  1158  	err = autorest.Respond(
  1159  		resp,
  1160  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1161  		autorest.ByUnmarshallingJSON(&result),
  1162  		autorest.ByClosing())
  1163  	result.Response = autorest.Response{Response: resp}
  1164  	return
  1165  }
  1166  
  1167  // ResetVpnClientSharedKey resets the VPN client shared key of the virtual network gateway in the specified resource
  1168  // group.
  1169  // Parameters:
  1170  // resourceGroupName - the name of the resource group.
  1171  // virtualNetworkGatewayName - the name of the virtual network gateway.
  1172  func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysResetVpnClientSharedKeyFuture, err error) {
  1173  	if tracing.IsEnabled() {
  1174  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.ResetVpnClientSharedKey")
  1175  		defer func() {
  1176  			sc := -1
  1177  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1178  				sc = result.FutureAPI.Response().StatusCode
  1179  			}
  1180  			tracing.EndSpan(ctx, sc, err)
  1181  		}()
  1182  	}
  1183  	req, err := client.ResetVpnClientSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
  1184  	if err != nil {
  1185  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ResetVpnClientSharedKey", nil, "Failure preparing request")
  1186  		return
  1187  	}
  1188  
  1189  	result, err = client.ResetVpnClientSharedKeySender(req)
  1190  	if err != nil {
  1191  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ResetVpnClientSharedKey", result.Response(), "Failure sending request")
  1192  		return
  1193  	}
  1194  
  1195  	return
  1196  }
  1197  
  1198  // ResetVpnClientSharedKeyPreparer prepares the ResetVpnClientSharedKey request.
  1199  func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKeyPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
  1200  	pathParameters := map[string]interface{}{
  1201  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
  1202  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
  1203  		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
  1204  	}
  1205  
  1206  	const APIVersion = "2018-08-01"
  1207  	queryParameters := map[string]interface{}{
  1208  		"api-version": APIVersion,
  1209  	}
  1210  
  1211  	preparer := autorest.CreatePreparer(
  1212  		autorest.AsPost(),
  1213  		autorest.WithBaseURL(client.BaseURI),
  1214  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/resetvpnclientsharedkey", pathParameters),
  1215  		autorest.WithQueryParameters(queryParameters))
  1216  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1217  }
  1218  
  1219  // ResetVpnClientSharedKeySender sends the ResetVpnClientSharedKey request. The method will close the
  1220  // http.Response Body if it receives an error.
  1221  func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKeySender(req *http.Request) (future VirtualNetworkGatewaysResetVpnClientSharedKeyFuture, err error) {
  1222  	var resp *http.Response
  1223  	future.FutureAPI = &azure.Future{}
  1224  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1225  	if err != nil {
  1226  		return
  1227  	}
  1228  	var azf azure.Future
  1229  	azf, err = azure.NewFutureFromResponse(resp)
  1230  	future.FutureAPI = &azf
  1231  	future.Result = future.result
  1232  	return
  1233  }
  1234  
  1235  // ResetVpnClientSharedKeyResponder handles the response to the ResetVpnClientSharedKey request. The method always
  1236  // closes the http.Response Body.
  1237  func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKeyResponder(resp *http.Response) (result autorest.Response, err error) {
  1238  	err = autorest.Respond(
  1239  		resp,
  1240  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1241  		autorest.ByClosing())
  1242  	result.Response = resp
  1243  	return
  1244  }
  1245  
  1246  // SetVpnclientIpsecParameters the Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S
  1247  // client of virtual network gateway in the specified resource group through Network resource provider.
  1248  // Parameters:
  1249  // resourceGroupName - the name of the resource group.
  1250  // virtualNetworkGatewayName - the name of the virtual network gateway.
  1251  // vpnclientIpsecParams - parameters supplied to the Begin Set vpnclient ipsec parameters of Virtual Network
  1252  // Gateway P2S client operation through Network resource provider.
  1253  func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIpsecParams VpnClientIPsecParameters) (result VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture, err error) {
  1254  	if tracing.IsEnabled() {
  1255  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.SetVpnclientIpsecParameters")
  1256  		defer func() {
  1257  			sc := -1
  1258  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1259  				sc = result.FutureAPI.Response().StatusCode
  1260  			}
  1261  			tracing.EndSpan(ctx, sc, err)
  1262  		}()
  1263  	}
  1264  	if err := validation.Validate([]validation.Validation{
  1265  		{TargetValue: vpnclientIpsecParams,
  1266  			Constraints: []validation.Constraint{{Target: "vpnclientIpsecParams.SaLifeTimeSeconds", Name: validation.Null, Rule: true, Chain: nil},
  1267  				{Target: "vpnclientIpsecParams.SaDataSizeKilobytes", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
  1268  		return result, validation.NewError("network.VirtualNetworkGatewaysClient", "SetVpnclientIpsecParameters", err.Error())
  1269  	}
  1270  
  1271  	req, err := client.SetVpnclientIpsecParametersPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams)
  1272  	if err != nil {
  1273  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SetVpnclientIpsecParameters", nil, "Failure preparing request")
  1274  		return
  1275  	}
  1276  
  1277  	result, err = client.SetVpnclientIpsecParametersSender(req)
  1278  	if err != nil {
  1279  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SetVpnclientIpsecParameters", result.Response(), "Failure sending request")
  1280  		return
  1281  	}
  1282  
  1283  	return
  1284  }
  1285  
  1286  // SetVpnclientIpsecParametersPreparer prepares the SetVpnclientIpsecParameters request.
  1287  func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParametersPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIpsecParams VpnClientIPsecParameters) (*http.Request, error) {
  1288  	pathParameters := map[string]interface{}{
  1289  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
  1290  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
  1291  		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
  1292  	}
  1293  
  1294  	const APIVersion = "2018-08-01"
  1295  	queryParameters := map[string]interface{}{
  1296  		"api-version": APIVersion,
  1297  	}
  1298  
  1299  	preparer := autorest.CreatePreparer(
  1300  		autorest.AsContentType("application/json; charset=utf-8"),
  1301  		autorest.AsPost(),
  1302  		autorest.WithBaseURL(client.BaseURI),
  1303  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/setvpnclientipsecparameters", pathParameters),
  1304  		autorest.WithJSON(vpnclientIpsecParams),
  1305  		autorest.WithQueryParameters(queryParameters))
  1306  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1307  }
  1308  
  1309  // SetVpnclientIpsecParametersSender sends the SetVpnclientIpsecParameters request. The method will close the
  1310  // http.Response Body if it receives an error.
  1311  func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParametersSender(req *http.Request) (future VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture, err error) {
  1312  	var resp *http.Response
  1313  	future.FutureAPI = &azure.Future{}
  1314  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1315  	if err != nil {
  1316  		return
  1317  	}
  1318  	var azf azure.Future
  1319  	azf, err = azure.NewFutureFromResponse(resp)
  1320  	future.FutureAPI = &azf
  1321  	future.Result = future.result
  1322  	return
  1323  }
  1324  
  1325  // SetVpnclientIpsecParametersResponder handles the response to the SetVpnclientIpsecParameters request. The method always
  1326  // closes the http.Response Body.
  1327  func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParametersResponder(resp *http.Response) (result VpnClientIPsecParameters, err error) {
  1328  	err = autorest.Respond(
  1329  		resp,
  1330  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1331  		autorest.ByUnmarshallingJSON(&result),
  1332  		autorest.ByClosing())
  1333  	result.Response = autorest.Response{Response: resp}
  1334  	return
  1335  }
  1336  
  1337  // SupportedVpnDevices gets a xml format representation for supported vpn devices.
  1338  // Parameters:
  1339  // resourceGroupName - the name of the resource group.
  1340  // virtualNetworkGatewayName - the name of the virtual network gateway.
  1341  func (client VirtualNetworkGatewaysClient) SupportedVpnDevices(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result String, err error) {
  1342  	if tracing.IsEnabled() {
  1343  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.SupportedVpnDevices")
  1344  		defer func() {
  1345  			sc := -1
  1346  			if result.Response.Response != nil {
  1347  				sc = result.Response.Response.StatusCode
  1348  			}
  1349  			tracing.EndSpan(ctx, sc, err)
  1350  		}()
  1351  	}
  1352  	req, err := client.SupportedVpnDevicesPreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
  1353  	if err != nil {
  1354  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SupportedVpnDevices", nil, "Failure preparing request")
  1355  		return
  1356  	}
  1357  
  1358  	resp, err := client.SupportedVpnDevicesSender(req)
  1359  	if err != nil {
  1360  		result.Response = autorest.Response{Response: resp}
  1361  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SupportedVpnDevices", resp, "Failure sending request")
  1362  		return
  1363  	}
  1364  
  1365  	result, err = client.SupportedVpnDevicesResponder(resp)
  1366  	if err != nil {
  1367  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SupportedVpnDevices", resp, "Failure responding to request")
  1368  		return
  1369  	}
  1370  
  1371  	return
  1372  }
  1373  
  1374  // SupportedVpnDevicesPreparer prepares the SupportedVpnDevices request.
  1375  func (client VirtualNetworkGatewaysClient) SupportedVpnDevicesPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
  1376  	pathParameters := map[string]interface{}{
  1377  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
  1378  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
  1379  		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
  1380  	}
  1381  
  1382  	const APIVersion = "2018-08-01"
  1383  	queryParameters := map[string]interface{}{
  1384  		"api-version": APIVersion,
  1385  	}
  1386  
  1387  	preparer := autorest.CreatePreparer(
  1388  		autorest.AsPost(),
  1389  		autorest.WithBaseURL(client.BaseURI),
  1390  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/supportedvpndevices", pathParameters),
  1391  		autorest.WithQueryParameters(queryParameters))
  1392  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1393  }
  1394  
  1395  // SupportedVpnDevicesSender sends the SupportedVpnDevices request. The method will close the
  1396  // http.Response Body if it receives an error.
  1397  func (client VirtualNetworkGatewaysClient) SupportedVpnDevicesSender(req *http.Request) (*http.Response, error) {
  1398  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1399  }
  1400  
  1401  // SupportedVpnDevicesResponder handles the response to the SupportedVpnDevices request. The method always
  1402  // closes the http.Response Body.
  1403  func (client VirtualNetworkGatewaysClient) SupportedVpnDevicesResponder(resp *http.Response) (result String, err error) {
  1404  	err = autorest.Respond(
  1405  		resp,
  1406  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1407  		autorest.ByUnmarshallingJSON(&result.Value),
  1408  		autorest.ByClosing())
  1409  	result.Response = autorest.Response{Response: resp}
  1410  	return
  1411  }
  1412  
  1413  // UpdateTags updates a virtual network gateway tags.
  1414  // Parameters:
  1415  // resourceGroupName - the name of the resource group.
  1416  // virtualNetworkGatewayName - the name of the virtual network gateway.
  1417  // parameters - parameters supplied to update virtual network gateway tags.
  1418  func (client VirtualNetworkGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters TagsObject) (result VirtualNetworkGatewaysUpdateTagsFuture, err error) {
  1419  	if tracing.IsEnabled() {
  1420  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.UpdateTags")
  1421  		defer func() {
  1422  			sc := -1
  1423  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1424  				sc = result.FutureAPI.Response().StatusCode
  1425  			}
  1426  			tracing.EndSpan(ctx, sc, err)
  1427  		}()
  1428  	}
  1429  	req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters)
  1430  	if err != nil {
  1431  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "UpdateTags", nil, "Failure preparing request")
  1432  		return
  1433  	}
  1434  
  1435  	result, err = client.UpdateTagsSender(req)
  1436  	if err != nil {
  1437  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "UpdateTags", result.Response(), "Failure sending request")
  1438  		return
  1439  	}
  1440  
  1441  	return
  1442  }
  1443  
  1444  // UpdateTagsPreparer prepares the UpdateTags request.
  1445  func (client VirtualNetworkGatewaysClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters TagsObject) (*http.Request, error) {
  1446  	pathParameters := map[string]interface{}{
  1447  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
  1448  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
  1449  		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
  1450  	}
  1451  
  1452  	const APIVersion = "2018-08-01"
  1453  	queryParameters := map[string]interface{}{
  1454  		"api-version": APIVersion,
  1455  	}
  1456  
  1457  	preparer := autorest.CreatePreparer(
  1458  		autorest.AsContentType("application/json; charset=utf-8"),
  1459  		autorest.AsPatch(),
  1460  		autorest.WithBaseURL(client.BaseURI),
  1461  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters),
  1462  		autorest.WithJSON(parameters),
  1463  		autorest.WithQueryParameters(queryParameters))
  1464  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1465  }
  1466  
  1467  // UpdateTagsSender sends the UpdateTags request. The method will close the
  1468  // http.Response Body if it receives an error.
  1469  func (client VirtualNetworkGatewaysClient) UpdateTagsSender(req *http.Request) (future VirtualNetworkGatewaysUpdateTagsFuture, err error) {
  1470  	var resp *http.Response
  1471  	future.FutureAPI = &azure.Future{}
  1472  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1473  	if err != nil {
  1474  		return
  1475  	}
  1476  	var azf azure.Future
  1477  	azf, err = azure.NewFutureFromResponse(resp)
  1478  	future.FutureAPI = &azf
  1479  	future.Result = future.result
  1480  	return
  1481  }
  1482  
  1483  // UpdateTagsResponder handles the response to the UpdateTags request. The method always
  1484  // closes the http.Response Body.
  1485  func (client VirtualNetworkGatewaysClient) UpdateTagsResponder(resp *http.Response) (result VirtualNetworkGateway, err error) {
  1486  	err = autorest.Respond(
  1487  		resp,
  1488  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1489  		autorest.ByUnmarshallingJSON(&result),
  1490  		autorest.ByClosing())
  1491  	result.Response = autorest.Response{Response: resp}
  1492  	return
  1493  }
  1494  
  1495  // VpnDeviceConfigurationScript gets a xml format representation for vpn device configuration script.
  1496  // Parameters:
  1497  // resourceGroupName - the name of the resource group.
  1498  // virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection for which the
  1499  // configuration script is generated.
  1500  // parameters - parameters supplied to the generate vpn device script operation.
  1501  func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScript(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VpnDeviceScriptParameters) (result String, err error) {
  1502  	if tracing.IsEnabled() {
  1503  		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.VpnDeviceConfigurationScript")
  1504  		defer func() {
  1505  			sc := -1
  1506  			if result.Response.Response != nil {
  1507  				sc = result.Response.Response.StatusCode
  1508  			}
  1509  			tracing.EndSpan(ctx, sc, err)
  1510  		}()
  1511  	}
  1512  	req, err := client.VpnDeviceConfigurationScriptPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters)
  1513  	if err != nil {
  1514  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "VpnDeviceConfigurationScript", nil, "Failure preparing request")
  1515  		return
  1516  	}
  1517  
  1518  	resp, err := client.VpnDeviceConfigurationScriptSender(req)
  1519  	if err != nil {
  1520  		result.Response = autorest.Response{Response: resp}
  1521  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "VpnDeviceConfigurationScript", resp, "Failure sending request")
  1522  		return
  1523  	}
  1524  
  1525  	result, err = client.VpnDeviceConfigurationScriptResponder(resp)
  1526  	if err != nil {
  1527  		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "VpnDeviceConfigurationScript", resp, "Failure responding to request")
  1528  		return
  1529  	}
  1530  
  1531  	return
  1532  }
  1533  
  1534  // VpnDeviceConfigurationScriptPreparer prepares the VpnDeviceConfigurationScript request.
  1535  func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScriptPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VpnDeviceScriptParameters) (*http.Request, error) {
  1536  	pathParameters := map[string]interface{}{
  1537  		"resourceGroupName":                   autorest.Encode("path", resourceGroupName),
  1538  		"subscriptionId":                      autorest.Encode("path", client.SubscriptionID),
  1539  		"virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName),
  1540  	}
  1541  
  1542  	const APIVersion = "2018-08-01"
  1543  	queryParameters := map[string]interface{}{
  1544  		"api-version": APIVersion,
  1545  	}
  1546  
  1547  	preparer := autorest.CreatePreparer(
  1548  		autorest.AsContentType("application/json; charset=utf-8"),
  1549  		autorest.AsPost(),
  1550  		autorest.WithBaseURL(client.BaseURI),
  1551  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/vpndeviceconfigurationscript", pathParameters),
  1552  		autorest.WithJSON(parameters),
  1553  		autorest.WithQueryParameters(queryParameters))
  1554  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1555  }
  1556  
  1557  // VpnDeviceConfigurationScriptSender sends the VpnDeviceConfigurationScript request. The method will close the
  1558  // http.Response Body if it receives an error.
  1559  func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScriptSender(req *http.Request) (*http.Response, error) {
  1560  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1561  }
  1562  
  1563  // VpnDeviceConfigurationScriptResponder handles the response to the VpnDeviceConfigurationScript request. The method always
  1564  // closes the http.Response Body.
  1565  func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScriptResponder(resp *http.Response) (result String, err error) {
  1566  	err = autorest.Respond(
  1567  		resp,
  1568  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1569  		autorest.ByUnmarshallingJSON(&result.Value),
  1570  		autorest.ByClosing())
  1571  	result.Response = autorest.Response{Response: resp}
  1572  	return
  1573  }
  1574  

View as plain text