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