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