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", nil, "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	var azf azure.Future
123	azf, err = azure.NewFutureFromResponse(resp)
124	future.FutureAPI = &azf
125	future.Result = func(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) {
126		var done bool
127		done, err = future.DoneWithContext(context.Background(), client)
128		if err != nil {
129			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
130			return
131		}
132		if !done {
133			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysCreateOrUpdateFuture")
134			return
135		}
136		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
137		if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent {
138			vng, err = client.CreateOrUpdateResponder(vng.Response.Response)
139			if err != nil {
140				err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", vng.Response.Response, "Failure responding to request")
141			}
142		}
143		return
144	}
145	return
146}
147
148// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
149// closes the http.Response Body.
150func (client VirtualNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkGateway, err error) {
151	err = autorest.Respond(
152		resp,
153		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
154		autorest.ByUnmarshallingJSON(&result),
155		autorest.ByClosing())
156	result.Response = autorest.Response{Response: resp}
157	return
158}
159
160// Delete deletes the specified virtual network gateway.
161// Parameters:
162// resourceGroupName - the name of the resource group.
163// virtualNetworkGatewayName - the name of the virtual network gateway.
164func (client VirtualNetworkGatewaysClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysDeleteFuture, err error) {
165	if tracing.IsEnabled() {
166		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.Delete")
167		defer func() {
168			sc := -1
169			if result.Response() != nil {
170				sc = result.Response().StatusCode
171			}
172			tracing.EndSpan(ctx, sc, err)
173		}()
174	}
175	req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
176	if err != nil {
177		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", nil, "Failure preparing request")
178		return
179	}
180
181	result, err = client.DeleteSender(req)
182	if err != nil {
183		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", nil, "Failure sending request")
184		return
185	}
186
187	return
188}
189
190// DeletePreparer prepares the Delete request.
191func (client VirtualNetworkGatewaysClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
192	pathParameters := map[string]interface{}{
193		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
194		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
195		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
196	}
197
198	const APIVersion = "2020-05-01"
199	queryParameters := map[string]interface{}{
200		"api-version": APIVersion,
201	}
202
203	preparer := autorest.CreatePreparer(
204		autorest.AsDelete(),
205		autorest.WithBaseURL(client.BaseURI),
206		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters),
207		autorest.WithQueryParameters(queryParameters))
208	return preparer.Prepare((&http.Request{}).WithContext(ctx))
209}
210
211// DeleteSender sends the Delete request. The method will close the
212// http.Response Body if it receives an error.
213func (client VirtualNetworkGatewaysClient) DeleteSender(req *http.Request) (future VirtualNetworkGatewaysDeleteFuture, err error) {
214	var resp *http.Response
215	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
216	if err != nil {
217		return
218	}
219	var azf azure.Future
220	azf, err = azure.NewFutureFromResponse(resp)
221	future.FutureAPI = &azf
222	future.Result = func(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) {
223		var done bool
224		done, err = future.DoneWithContext(context.Background(), client)
225		if err != nil {
226			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysDeleteFuture", "Result", future.Response(), "Polling failure")
227			return
228		}
229		if !done {
230			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysDeleteFuture")
231			return
232		}
233		ar.Response = future.Response()
234		return
235	}
236	return
237}
238
239// DeleteResponder handles the response to the Delete request. The method always
240// closes the http.Response Body.
241func (client VirtualNetworkGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
242	err = autorest.Respond(
243		resp,
244		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
245		autorest.ByClosing())
246	result.Response = resp
247	return
248}
249
250// DisconnectVirtualNetworkGatewayVpnConnections disconnect vpn connections of virtual network gateway in the specified
251// resource group.
252// Parameters:
253// resourceGroupName - the name of the resource group.
254// virtualNetworkGatewayName - the name of the virtual network gateway.
255// request - the parameters are supplied to disconnect vpn connections.
256func (client VirtualNetworkGatewaysClient) DisconnectVirtualNetworkGatewayVpnConnections(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, request P2SVpnConnectionRequest) (result VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture, err error) {
257	if tracing.IsEnabled() {
258		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.DisconnectVirtualNetworkGatewayVpnConnections")
259		defer func() {
260			sc := -1
261			if result.Response() != nil {
262				sc = result.Response().StatusCode
263			}
264			tracing.EndSpan(ctx, sc, err)
265		}()
266	}
267	req, err := client.DisconnectVirtualNetworkGatewayVpnConnectionsPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, request)
268	if err != nil {
269		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "DisconnectVirtualNetworkGatewayVpnConnections", nil, "Failure preparing request")
270		return
271	}
272
273	result, err = client.DisconnectVirtualNetworkGatewayVpnConnectionsSender(req)
274	if err != nil {
275		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "DisconnectVirtualNetworkGatewayVpnConnections", nil, "Failure sending request")
276		return
277	}
278
279	return
280}
281
282// DisconnectVirtualNetworkGatewayVpnConnectionsPreparer prepares the DisconnectVirtualNetworkGatewayVpnConnections request.
283func (client VirtualNetworkGatewaysClient) DisconnectVirtualNetworkGatewayVpnConnectionsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, request P2SVpnConnectionRequest) (*http.Request, error) {
284	pathParameters := map[string]interface{}{
285		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
286		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
287		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
288	}
289
290	const APIVersion = "2020-05-01"
291	queryParameters := map[string]interface{}{
292		"api-version": APIVersion,
293	}
294
295	preparer := autorest.CreatePreparer(
296		autorest.AsContentType("application/json; charset=utf-8"),
297		autorest.AsPost(),
298		autorest.WithBaseURL(client.BaseURI),
299		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/disconnectVirtualNetworkGatewayVpnConnections", pathParameters),
300		autorest.WithJSON(request),
301		autorest.WithQueryParameters(queryParameters))
302	return preparer.Prepare((&http.Request{}).WithContext(ctx))
303}
304
305// DisconnectVirtualNetworkGatewayVpnConnectionsSender sends the DisconnectVirtualNetworkGatewayVpnConnections request. The method will close the
306// http.Response Body if it receives an error.
307func (client VirtualNetworkGatewaysClient) DisconnectVirtualNetworkGatewayVpnConnectionsSender(req *http.Request) (future VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture, err error) {
308	var resp *http.Response
309	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
310	if err != nil {
311		return
312	}
313	var azf azure.Future
314	azf, err = azure.NewFutureFromResponse(resp)
315	future.FutureAPI = &azf
316	future.Result = func(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) {
317		var done bool
318		done, err = future.DoneWithContext(context.Background(), client)
319		if err != nil {
320			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture", "Result", future.Response(), "Polling failure")
321			return
322		}
323		if !done {
324			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture")
325			return
326		}
327		ar.Response = future.Response()
328		return
329	}
330	return
331}
332
333// DisconnectVirtualNetworkGatewayVpnConnectionsResponder handles the response to the DisconnectVirtualNetworkGatewayVpnConnections request. The method always
334// closes the http.Response Body.
335func (client VirtualNetworkGatewaysClient) DisconnectVirtualNetworkGatewayVpnConnectionsResponder(resp *http.Response) (result autorest.Response, err error) {
336	err = autorest.Respond(
337		resp,
338		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
339		autorest.ByClosing())
340	result.Response = resp
341	return
342}
343
344// Generatevpnclientpackage generates VPN client package for P2S client of the virtual network gateway in the specified
345// resource group.
346// Parameters:
347// resourceGroupName - the name of the resource group.
348// virtualNetworkGatewayName - the name of the virtual network gateway.
349// parameters - parameters supplied to the generate virtual network gateway VPN client package operation.
350func (client VirtualNetworkGatewaysClient) Generatevpnclientpackage(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result VirtualNetworkGatewaysGeneratevpnclientpackageFuture, err error) {
351	if tracing.IsEnabled() {
352		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.Generatevpnclientpackage")
353		defer func() {
354			sc := -1
355			if result.Response() != nil {
356				sc = result.Response().StatusCode
357			}
358			tracing.EndSpan(ctx, sc, err)
359		}()
360	}
361	req, err := client.GeneratevpnclientpackagePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters)
362	if err != nil {
363		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", nil, "Failure preparing request")
364		return
365	}
366
367	result, err = client.GeneratevpnclientpackageSender(req)
368	if err != nil {
369		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", nil, "Failure sending request")
370		return
371	}
372
373	return
374}
375
376// GeneratevpnclientpackagePreparer prepares the Generatevpnclientpackage request.
377func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackagePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (*http.Request, error) {
378	pathParameters := map[string]interface{}{
379		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
380		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
381		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
382	}
383
384	const APIVersion = "2020-05-01"
385	queryParameters := map[string]interface{}{
386		"api-version": APIVersion,
387	}
388
389	preparer := autorest.CreatePreparer(
390		autorest.AsContentType("application/json; charset=utf-8"),
391		autorest.AsPost(),
392		autorest.WithBaseURL(client.BaseURI),
393		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage", pathParameters),
394		autorest.WithJSON(parameters),
395		autorest.WithQueryParameters(queryParameters))
396	return preparer.Prepare((&http.Request{}).WithContext(ctx))
397}
398
399// GeneratevpnclientpackageSender sends the Generatevpnclientpackage request. The method will close the
400// http.Response Body if it receives an error.
401func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageSender(req *http.Request) (future VirtualNetworkGatewaysGeneratevpnclientpackageFuture, err error) {
402	var resp *http.Response
403	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
404	if err != nil {
405		return
406	}
407	var azf azure.Future
408	azf, err = azure.NewFutureFromResponse(resp)
409	future.FutureAPI = &azf
410	future.Result = func(client VirtualNetworkGatewaysClient) (s String, err error) {
411		var done bool
412		done, err = future.DoneWithContext(context.Background(), client)
413		if err != nil {
414			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", future.Response(), "Polling failure")
415			return
416		}
417		if !done {
418			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture")
419			return
420		}
421		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
422		if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
423			s, err = client.GeneratevpnclientpackageResponder(s.Response.Response)
424			if err != nil {
425				err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", s.Response.Response, "Failure responding to request")
426			}
427		}
428		return
429	}
430	return
431}
432
433// GeneratevpnclientpackageResponder handles the response to the Generatevpnclientpackage request. The method always
434// closes the http.Response Body.
435func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageResponder(resp *http.Response) (result String, err error) {
436	err = autorest.Respond(
437		resp,
438		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
439		autorest.ByUnmarshallingJSON(&result),
440		autorest.ByClosing())
441	result.Response = autorest.Response{Response: resp}
442	return
443}
444
445// GenerateVpnProfile generates VPN profile for P2S client of the virtual network gateway in the specified resource
446// group. Used for IKEV2 and radius based authentication.
447// Parameters:
448// resourceGroupName - the name of the resource group.
449// virtualNetworkGatewayName - the name of the virtual network gateway.
450// parameters - parameters supplied to the generate virtual network gateway VPN client package operation.
451func (client VirtualNetworkGatewaysClient) GenerateVpnProfile(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result VirtualNetworkGatewaysGenerateVpnProfileFuture, err error) {
452	if tracing.IsEnabled() {
453		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GenerateVpnProfile")
454		defer func() {
455			sc := -1
456			if result.Response() != nil {
457				sc = result.Response().StatusCode
458			}
459			tracing.EndSpan(ctx, sc, err)
460		}()
461	}
462	req, err := client.GenerateVpnProfilePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters)
463	if err != nil {
464		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GenerateVpnProfile", nil, "Failure preparing request")
465		return
466	}
467
468	result, err = client.GenerateVpnProfileSender(req)
469	if err != nil {
470		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GenerateVpnProfile", nil, "Failure sending request")
471		return
472	}
473
474	return
475}
476
477// GenerateVpnProfilePreparer prepares the GenerateVpnProfile request.
478func (client VirtualNetworkGatewaysClient) GenerateVpnProfilePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (*http.Request, error) {
479	pathParameters := map[string]interface{}{
480		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
481		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
482		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
483	}
484
485	const APIVersion = "2020-05-01"
486	queryParameters := map[string]interface{}{
487		"api-version": APIVersion,
488	}
489
490	preparer := autorest.CreatePreparer(
491		autorest.AsContentType("application/json; charset=utf-8"),
492		autorest.AsPost(),
493		autorest.WithBaseURL(client.BaseURI),
494		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile", pathParameters),
495		autorest.WithJSON(parameters),
496		autorest.WithQueryParameters(queryParameters))
497	return preparer.Prepare((&http.Request{}).WithContext(ctx))
498}
499
500// GenerateVpnProfileSender sends the GenerateVpnProfile request. The method will close the
501// http.Response Body if it receives an error.
502func (client VirtualNetworkGatewaysClient) GenerateVpnProfileSender(req *http.Request) (future VirtualNetworkGatewaysGenerateVpnProfileFuture, err error) {
503	var resp *http.Response
504	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
505	if err != nil {
506		return
507	}
508	var azf azure.Future
509	azf, err = azure.NewFutureFromResponse(resp)
510	future.FutureAPI = &azf
511	future.Result = func(client VirtualNetworkGatewaysClient) (s String, err error) {
512		var done bool
513		done, err = future.DoneWithContext(context.Background(), client)
514		if err != nil {
515			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGenerateVpnProfileFuture", "Result", future.Response(), "Polling failure")
516			return
517		}
518		if !done {
519			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGenerateVpnProfileFuture")
520			return
521		}
522		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
523		if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
524			s, err = client.GenerateVpnProfileResponder(s.Response.Response)
525			if err != nil {
526				err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGenerateVpnProfileFuture", "Result", s.Response.Response, "Failure responding to request")
527			}
528		}
529		return
530	}
531	return
532}
533
534// GenerateVpnProfileResponder handles the response to the GenerateVpnProfile request. The method always
535// closes the http.Response Body.
536func (client VirtualNetworkGatewaysClient) GenerateVpnProfileResponder(resp *http.Response) (result String, err error) {
537	err = autorest.Respond(
538		resp,
539		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
540		autorest.ByUnmarshallingJSON(&result),
541		autorest.ByClosing())
542	result.Response = autorest.Response{Response: resp}
543	return
544}
545
546// Get gets the specified virtual network gateway by resource group.
547// Parameters:
548// resourceGroupName - the name of the resource group.
549// virtualNetworkGatewayName - the name of the virtual network gateway.
550func (client VirtualNetworkGatewaysClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGateway, err error) {
551	if tracing.IsEnabled() {
552		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.Get")
553		defer func() {
554			sc := -1
555			if result.Response.Response != nil {
556				sc = result.Response.Response.StatusCode
557			}
558			tracing.EndSpan(ctx, sc, err)
559		}()
560	}
561	req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
562	if err != nil {
563		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", nil, "Failure preparing request")
564		return
565	}
566
567	resp, err := client.GetSender(req)
568	if err != nil {
569		result.Response = autorest.Response{Response: resp}
570		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", resp, "Failure sending request")
571		return
572	}
573
574	result, err = client.GetResponder(resp)
575	if err != nil {
576		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", resp, "Failure responding to request")
577		return
578	}
579
580	return
581}
582
583// GetPreparer prepares the Get request.
584func (client VirtualNetworkGatewaysClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
585	pathParameters := map[string]interface{}{
586		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
587		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
588		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
589	}
590
591	const APIVersion = "2020-05-01"
592	queryParameters := map[string]interface{}{
593		"api-version": APIVersion,
594	}
595
596	preparer := autorest.CreatePreparer(
597		autorest.AsGet(),
598		autorest.WithBaseURL(client.BaseURI),
599		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters),
600		autorest.WithQueryParameters(queryParameters))
601	return preparer.Prepare((&http.Request{}).WithContext(ctx))
602}
603
604// GetSender sends the Get request. The method will close the
605// http.Response Body if it receives an error.
606func (client VirtualNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) {
607	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
608}
609
610// GetResponder handles the response to the Get request. The method always
611// closes the http.Response Body.
612func (client VirtualNetworkGatewaysClient) GetResponder(resp *http.Response) (result VirtualNetworkGateway, err error) {
613	err = autorest.Respond(
614		resp,
615		azure.WithErrorUnlessStatusCode(http.StatusOK),
616		autorest.ByUnmarshallingJSON(&result),
617		autorest.ByClosing())
618	result.Response = autorest.Response{Response: resp}
619	return
620}
621
622// GetAdvertisedRoutes this operation retrieves a list of routes the virtual network gateway is advertising to the
623// specified peer.
624// Parameters:
625// resourceGroupName - the name of the resource group.
626// virtualNetworkGatewayName - the name of the virtual network gateway.
627// peer - the IP address of the peer.
628func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (result VirtualNetworkGatewaysGetAdvertisedRoutesFuture, err error) {
629	if tracing.IsEnabled() {
630		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetAdvertisedRoutes")
631		defer func() {
632			sc := -1
633			if result.Response() != nil {
634				sc = result.Response().StatusCode
635			}
636			tracing.EndSpan(ctx, sc, err)
637		}()
638	}
639	req, err := client.GetAdvertisedRoutesPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, peer)
640	if err != nil {
641		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetAdvertisedRoutes", nil, "Failure preparing request")
642		return
643	}
644
645	result, err = client.GetAdvertisedRoutesSender(req)
646	if err != nil {
647		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetAdvertisedRoutes", nil, "Failure sending request")
648		return
649	}
650
651	return
652}
653
654// GetAdvertisedRoutesPreparer prepares the GetAdvertisedRoutes request.
655func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (*http.Request, error) {
656	pathParameters := map[string]interface{}{
657		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
658		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
659		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
660	}
661
662	const APIVersion = "2020-05-01"
663	queryParameters := map[string]interface{}{
664		"api-version": APIVersion,
665		"peer":        autorest.Encode("query", peer),
666	}
667
668	preparer := autorest.CreatePreparer(
669		autorest.AsPost(),
670		autorest.WithBaseURL(client.BaseURI),
671		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes", pathParameters),
672		autorest.WithQueryParameters(queryParameters))
673	return preparer.Prepare((&http.Request{}).WithContext(ctx))
674}
675
676// GetAdvertisedRoutesSender sends the GetAdvertisedRoutes request. The method will close the
677// http.Response Body if it receives an error.
678func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesSender(req *http.Request) (future VirtualNetworkGatewaysGetAdvertisedRoutesFuture, err error) {
679	var resp *http.Response
680	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
681	if err != nil {
682		return
683	}
684	var azf azure.Future
685	azf, err = azure.NewFutureFromResponse(resp)
686	future.FutureAPI = &azf
687	future.Result = func(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) {
688		var done bool
689		done, err = future.DoneWithContext(context.Background(), client)
690		if err != nil {
691			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture", "Result", future.Response(), "Polling failure")
692			return
693		}
694		if !done {
695			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture")
696			return
697		}
698		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
699		if grlr.Response.Response, err = future.GetResult(sender); err == nil && grlr.Response.Response.StatusCode != http.StatusNoContent {
700			grlr, err = client.GetAdvertisedRoutesResponder(grlr.Response.Response)
701			if err != nil {
702				err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture", "Result", grlr.Response.Response, "Failure responding to request")
703			}
704		}
705		return
706	}
707	return
708}
709
710// GetAdvertisedRoutesResponder handles the response to the GetAdvertisedRoutes request. The method always
711// closes the http.Response Body.
712func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesResponder(resp *http.Response) (result GatewayRouteListResult, err error) {
713	err = autorest.Respond(
714		resp,
715		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
716		autorest.ByUnmarshallingJSON(&result),
717		autorest.ByClosing())
718	result.Response = autorest.Response{Response: resp}
719	return
720}
721
722// GetBgpPeerStatus the GetBgpPeerStatus operation retrieves the status of all BGP peers.
723// Parameters:
724// resourceGroupName - the name of the resource group.
725// virtualNetworkGatewayName - the name of the virtual network gateway.
726// peer - the IP address of the peer to retrieve the status of.
727func (client VirtualNetworkGatewaysClient) GetBgpPeerStatus(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (result VirtualNetworkGatewaysGetBgpPeerStatusFuture, err error) {
728	if tracing.IsEnabled() {
729		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetBgpPeerStatus")
730		defer func() {
731			sc := -1
732			if result.Response() != nil {
733				sc = result.Response().StatusCode
734			}
735			tracing.EndSpan(ctx, sc, err)
736		}()
737	}
738	req, err := client.GetBgpPeerStatusPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, peer)
739	if err != nil {
740		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetBgpPeerStatus", nil, "Failure preparing request")
741		return
742	}
743
744	result, err = client.GetBgpPeerStatusSender(req)
745	if err != nil {
746		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetBgpPeerStatus", nil, "Failure sending request")
747		return
748	}
749
750	return
751}
752
753// GetBgpPeerStatusPreparer prepares the GetBgpPeerStatus request.
754func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (*http.Request, error) {
755	pathParameters := map[string]interface{}{
756		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
757		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
758		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
759	}
760
761	const APIVersion = "2020-05-01"
762	queryParameters := map[string]interface{}{
763		"api-version": APIVersion,
764	}
765	if len(peer) > 0 {
766		queryParameters["peer"] = autorest.Encode("query", peer)
767	}
768
769	preparer := autorest.CreatePreparer(
770		autorest.AsPost(),
771		autorest.WithBaseURL(client.BaseURI),
772		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus", pathParameters),
773		autorest.WithQueryParameters(queryParameters))
774	return preparer.Prepare((&http.Request{}).WithContext(ctx))
775}
776
777// GetBgpPeerStatusSender sends the GetBgpPeerStatus request. The method will close the
778// http.Response Body if it receives an error.
779func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusSender(req *http.Request) (future VirtualNetworkGatewaysGetBgpPeerStatusFuture, err error) {
780	var resp *http.Response
781	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
782	if err != nil {
783		return
784	}
785	var azf azure.Future
786	azf, err = azure.NewFutureFromResponse(resp)
787	future.FutureAPI = &azf
788	future.Result = func(client VirtualNetworkGatewaysClient) (bpslr BgpPeerStatusListResult, err error) {
789		var done bool
790		done, err = future.DoneWithContext(context.Background(), client)
791		if err != nil {
792			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetBgpPeerStatusFuture", "Result", future.Response(), "Polling failure")
793			return
794		}
795		if !done {
796			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetBgpPeerStatusFuture")
797			return
798		}
799		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
800		if bpslr.Response.Response, err = future.GetResult(sender); err == nil && bpslr.Response.Response.StatusCode != http.StatusNoContent {
801			bpslr, err = client.GetBgpPeerStatusResponder(bpslr.Response.Response)
802			if err != nil {
803				err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetBgpPeerStatusFuture", "Result", bpslr.Response.Response, "Failure responding to request")
804			}
805		}
806		return
807	}
808	return
809}
810
811// GetBgpPeerStatusResponder handles the response to the GetBgpPeerStatus request. The method always
812// closes the http.Response Body.
813func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusResponder(resp *http.Response) (result BgpPeerStatusListResult, err error) {
814	err = autorest.Respond(
815		resp,
816		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
817		autorest.ByUnmarshallingJSON(&result),
818		autorest.ByClosing())
819	result.Response = autorest.Response{Response: resp}
820	return
821}
822
823// GetLearnedRoutes this operation retrieves a list of routes the virtual network gateway has learned, including routes
824// learned from BGP peers.
825// Parameters:
826// resourceGroupName - the name of the resource group.
827// virtualNetworkGatewayName - the name of the virtual network gateway.
828func (client VirtualNetworkGatewaysClient) GetLearnedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetLearnedRoutesFuture, err error) {
829	if tracing.IsEnabled() {
830		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetLearnedRoutes")
831		defer func() {
832			sc := -1
833			if result.Response() != nil {
834				sc = result.Response().StatusCode
835			}
836			tracing.EndSpan(ctx, sc, err)
837		}()
838	}
839	req, err := client.GetLearnedRoutesPreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
840	if err != nil {
841		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetLearnedRoutes", nil, "Failure preparing request")
842		return
843	}
844
845	result, err = client.GetLearnedRoutesSender(req)
846	if err != nil {
847		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetLearnedRoutes", nil, "Failure sending request")
848		return
849	}
850
851	return
852}
853
854// GetLearnedRoutesPreparer prepares the GetLearnedRoutes request.
855func (client VirtualNetworkGatewaysClient) GetLearnedRoutesPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
856	pathParameters := map[string]interface{}{
857		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
858		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
859		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
860	}
861
862	const APIVersion = "2020-05-01"
863	queryParameters := map[string]interface{}{
864		"api-version": APIVersion,
865	}
866
867	preparer := autorest.CreatePreparer(
868		autorest.AsPost(),
869		autorest.WithBaseURL(client.BaseURI),
870		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes", pathParameters),
871		autorest.WithQueryParameters(queryParameters))
872	return preparer.Prepare((&http.Request{}).WithContext(ctx))
873}
874
875// GetLearnedRoutesSender sends the GetLearnedRoutes request. The method will close the
876// http.Response Body if it receives an error.
877func (client VirtualNetworkGatewaysClient) GetLearnedRoutesSender(req *http.Request) (future VirtualNetworkGatewaysGetLearnedRoutesFuture, err error) {
878	var resp *http.Response
879	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
880	if err != nil {
881		return
882	}
883	var azf azure.Future
884	azf, err = azure.NewFutureFromResponse(resp)
885	future.FutureAPI = &azf
886	future.Result = func(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) {
887		var done bool
888		done, err = future.DoneWithContext(context.Background(), client)
889		if err != nil {
890			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetLearnedRoutesFuture", "Result", future.Response(), "Polling failure")
891			return
892		}
893		if !done {
894			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetLearnedRoutesFuture")
895			return
896		}
897		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
898		if grlr.Response.Response, err = future.GetResult(sender); err == nil && grlr.Response.Response.StatusCode != http.StatusNoContent {
899			grlr, err = client.GetLearnedRoutesResponder(grlr.Response.Response)
900			if err != nil {
901				err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetLearnedRoutesFuture", "Result", grlr.Response.Response, "Failure responding to request")
902			}
903		}
904		return
905	}
906	return
907}
908
909// GetLearnedRoutesResponder handles the response to the GetLearnedRoutes request. The method always
910// closes the http.Response Body.
911func (client VirtualNetworkGatewaysClient) GetLearnedRoutesResponder(resp *http.Response) (result GatewayRouteListResult, err error) {
912	err = autorest.Respond(
913		resp,
914		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
915		autorest.ByUnmarshallingJSON(&result),
916		autorest.ByClosing())
917	result.Response = autorest.Response{Response: resp}
918	return
919}
920
921// GetVpnclientConnectionHealth get VPN client connection health detail per P2S client connection of the virtual
922// network gateway in the specified resource group.
923// Parameters:
924// resourceGroupName - the name of the resource group.
925// virtualNetworkGatewayName - the name of the virtual network gateway.
926func (client VirtualNetworkGatewaysClient) GetVpnclientConnectionHealth(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture, err error) {
927	if tracing.IsEnabled() {
928		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetVpnclientConnectionHealth")
929		defer func() {
930			sc := -1
931			if result.Response() != nil {
932				sc = result.Response().StatusCode
933			}
934			tracing.EndSpan(ctx, sc, err)
935		}()
936	}
937	req, err := client.GetVpnclientConnectionHealthPreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
938	if err != nil {
939		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnclientConnectionHealth", nil, "Failure preparing request")
940		return
941	}
942
943	result, err = client.GetVpnclientConnectionHealthSender(req)
944	if err != nil {
945		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnclientConnectionHealth", nil, "Failure sending request")
946		return
947	}
948
949	return
950}
951
952// GetVpnclientConnectionHealthPreparer prepares the GetVpnclientConnectionHealth request.
953func (client VirtualNetworkGatewaysClient) GetVpnclientConnectionHealthPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
954	pathParameters := map[string]interface{}{
955		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
956		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
957		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
958	}
959
960	const APIVersion = "2020-05-01"
961	queryParameters := map[string]interface{}{
962		"api-version": APIVersion,
963	}
964
965	preparer := autorest.CreatePreparer(
966		autorest.AsPost(),
967		autorest.WithBaseURL(client.BaseURI),
968		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getVpnClientConnectionHealth", pathParameters),
969		autorest.WithQueryParameters(queryParameters))
970	return preparer.Prepare((&http.Request{}).WithContext(ctx))
971}
972
973// GetVpnclientConnectionHealthSender sends the GetVpnclientConnectionHealth request. The method will close the
974// http.Response Body if it receives an error.
975func (client VirtualNetworkGatewaysClient) GetVpnclientConnectionHealthSender(req *http.Request) (future VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture, err error) {
976	var resp *http.Response
977	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
978	if err != nil {
979		return
980	}
981	var azf azure.Future
982	azf, err = azure.NewFutureFromResponse(resp)
983	future.FutureAPI = &azf
984	future.Result = func(client VirtualNetworkGatewaysClient) (vcchdlr VpnClientConnectionHealthDetailListResult, err error) {
985		var done bool
986		done, err = future.DoneWithContext(context.Background(), client)
987		if err != nil {
988			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture", "Result", future.Response(), "Polling failure")
989			return
990		}
991		if !done {
992			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture")
993			return
994		}
995		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
996		if vcchdlr.Response.Response, err = future.GetResult(sender); err == nil && vcchdlr.Response.Response.StatusCode != http.StatusNoContent {
997			vcchdlr, err = client.GetVpnclientConnectionHealthResponder(vcchdlr.Response.Response)
998			if err != nil {
999				err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture", "Result", vcchdlr.Response.Response, "Failure responding to request")
1000			}
1001		}
1002		return
1003	}
1004	return
1005}
1006
1007// GetVpnclientConnectionHealthResponder handles the response to the GetVpnclientConnectionHealth request. The method always
1008// closes the http.Response Body.
1009func (client VirtualNetworkGatewaysClient) GetVpnclientConnectionHealthResponder(resp *http.Response) (result VpnClientConnectionHealthDetailListResult, err error) {
1010	err = autorest.Respond(
1011		resp,
1012		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1013		autorest.ByUnmarshallingJSON(&result),
1014		autorest.ByClosing())
1015	result.Response = autorest.Response{Response: resp}
1016	return
1017}
1018
1019// GetVpnclientIpsecParameters the Get VpnclientIpsecParameters operation retrieves information about the vpnclient
1020// ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource
1021// provider.
1022// Parameters:
1023// resourceGroupName - the name of the resource group.
1024// virtualNetworkGatewayName - the virtual network gateway name.
1025func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture, err error) {
1026	if tracing.IsEnabled() {
1027		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetVpnclientIpsecParameters")
1028		defer func() {
1029			sc := -1
1030			if result.Response() != nil {
1031				sc = result.Response().StatusCode
1032			}
1033			tracing.EndSpan(ctx, sc, err)
1034		}()
1035	}
1036	req, err := client.GetVpnclientIpsecParametersPreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
1037	if err != nil {
1038		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnclientIpsecParameters", nil, "Failure preparing request")
1039		return
1040	}
1041
1042	result, err = client.GetVpnclientIpsecParametersSender(req)
1043	if err != nil {
1044		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnclientIpsecParameters", nil, "Failure sending request")
1045		return
1046	}
1047
1048	return
1049}
1050
1051// GetVpnclientIpsecParametersPreparer prepares the GetVpnclientIpsecParameters request.
1052func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParametersPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
1053	pathParameters := map[string]interface{}{
1054		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
1055		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
1056		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
1057	}
1058
1059	const APIVersion = "2020-05-01"
1060	queryParameters := map[string]interface{}{
1061		"api-version": APIVersion,
1062	}
1063
1064	preparer := autorest.CreatePreparer(
1065		autorest.AsPost(),
1066		autorest.WithBaseURL(client.BaseURI),
1067		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnclientipsecparameters", pathParameters),
1068		autorest.WithQueryParameters(queryParameters))
1069	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1070}
1071
1072// GetVpnclientIpsecParametersSender sends the GetVpnclientIpsecParameters request. The method will close the
1073// http.Response Body if it receives an error.
1074func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParametersSender(req *http.Request) (future VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture, err error) {
1075	var resp *http.Response
1076	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1077	if err != nil {
1078		return
1079	}
1080	var azf azure.Future
1081	azf, err = azure.NewFutureFromResponse(resp)
1082	future.FutureAPI = &azf
1083	future.Result = func(client VirtualNetworkGatewaysClient) (vcipp VpnClientIPsecParameters, err error) {
1084		var done bool
1085		done, err = future.DoneWithContext(context.Background(), client)
1086		if err != nil {
1087			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture", "Result", future.Response(), "Polling failure")
1088			return
1089		}
1090		if !done {
1091			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture")
1092			return
1093		}
1094		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1095		if vcipp.Response.Response, err = future.GetResult(sender); err == nil && vcipp.Response.Response.StatusCode != http.StatusNoContent {
1096			vcipp, err = client.GetVpnclientIpsecParametersResponder(vcipp.Response.Response)
1097			if err != nil {
1098				err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture", "Result", vcipp.Response.Response, "Failure responding to request")
1099			}
1100		}
1101		return
1102	}
1103	return
1104}
1105
1106// GetVpnclientIpsecParametersResponder handles the response to the GetVpnclientIpsecParameters request. The method always
1107// closes the http.Response Body.
1108func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParametersResponder(resp *http.Response) (result VpnClientIPsecParameters, err error) {
1109	err = autorest.Respond(
1110		resp,
1111		azure.WithErrorUnlessStatusCode(http.StatusOK),
1112		autorest.ByUnmarshallingJSON(&result),
1113		autorest.ByClosing())
1114	result.Response = autorest.Response{Response: resp}
1115	return
1116}
1117
1118// GetVpnProfilePackageURL gets pre-generated VPN profile for P2S client of the virtual network gateway in the
1119// specified resource group. The profile needs to be generated first using generateVpnProfile.
1120// Parameters:
1121// resourceGroupName - the name of the resource group.
1122// virtualNetworkGatewayName - the name of the virtual network gateway.
1123func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURL(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetVpnProfilePackageURLFuture, err error) {
1124	if tracing.IsEnabled() {
1125		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetVpnProfilePackageURL")
1126		defer func() {
1127			sc := -1
1128			if result.Response() != nil {
1129				sc = result.Response().StatusCode
1130			}
1131			tracing.EndSpan(ctx, sc, err)
1132		}()
1133	}
1134	req, err := client.GetVpnProfilePackageURLPreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
1135	if err != nil {
1136		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnProfilePackageURL", nil, "Failure preparing request")
1137		return
1138	}
1139
1140	result, err = client.GetVpnProfilePackageURLSender(req)
1141	if err != nil {
1142		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnProfilePackageURL", nil, "Failure sending request")
1143		return
1144	}
1145
1146	return
1147}
1148
1149// GetVpnProfilePackageURLPreparer prepares the GetVpnProfilePackageURL request.
1150func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
1151	pathParameters := map[string]interface{}{
1152		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
1153		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
1154		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
1155	}
1156
1157	const APIVersion = "2020-05-01"
1158	queryParameters := map[string]interface{}{
1159		"api-version": APIVersion,
1160	}
1161
1162	preparer := autorest.CreatePreparer(
1163		autorest.AsPost(),
1164		autorest.WithBaseURL(client.BaseURI),
1165		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl", pathParameters),
1166		autorest.WithQueryParameters(queryParameters))
1167	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1168}
1169
1170// GetVpnProfilePackageURLSender sends the GetVpnProfilePackageURL request. The method will close the
1171// http.Response Body if it receives an error.
1172func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLSender(req *http.Request) (future VirtualNetworkGatewaysGetVpnProfilePackageURLFuture, err error) {
1173	var resp *http.Response
1174	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1175	if err != nil {
1176		return
1177	}
1178	var azf azure.Future
1179	azf, err = azure.NewFutureFromResponse(resp)
1180	future.FutureAPI = &azf
1181	future.Result = func(client VirtualNetworkGatewaysClient) (s String, err error) {
1182		var done bool
1183		done, err = future.DoneWithContext(context.Background(), client)
1184		if err != nil {
1185			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", future.Response(), "Polling failure")
1186			return
1187		}
1188		if !done {
1189			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture")
1190			return
1191		}
1192		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1193		if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
1194			s, err = client.GetVpnProfilePackageURLResponder(s.Response.Response)
1195			if err != nil {
1196				err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", s.Response.Response, "Failure responding to request")
1197			}
1198		}
1199		return
1200	}
1201	return
1202}
1203
1204// GetVpnProfilePackageURLResponder handles the response to the GetVpnProfilePackageURL request. The method always
1205// closes the http.Response Body.
1206func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLResponder(resp *http.Response) (result String, err error) {
1207	err = autorest.Respond(
1208		resp,
1209		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1210		autorest.ByUnmarshallingJSON(&result),
1211		autorest.ByClosing())
1212	result.Response = autorest.Response{Response: resp}
1213	return
1214}
1215
1216// List gets all virtual network gateways by resource group.
1217// Parameters:
1218// resourceGroupName - the name of the resource group.
1219func (client VirtualNetworkGatewaysClient) List(ctx context.Context, resourceGroupName string) (result VirtualNetworkGatewayListResultPage, err error) {
1220	if tracing.IsEnabled() {
1221		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.List")
1222		defer func() {
1223			sc := -1
1224			if result.vnglr.Response.Response != nil {
1225				sc = result.vnglr.Response.Response.StatusCode
1226			}
1227			tracing.EndSpan(ctx, sc, err)
1228		}()
1229	}
1230	result.fn = client.listNextResults
1231	req, err := client.ListPreparer(ctx, resourceGroupName)
1232	if err != nil {
1233		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", nil, "Failure preparing request")
1234		return
1235	}
1236
1237	resp, err := client.ListSender(req)
1238	if err != nil {
1239		result.vnglr.Response = autorest.Response{Response: resp}
1240		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure sending request")
1241		return
1242	}
1243
1244	result.vnglr, err = client.ListResponder(resp)
1245	if err != nil {
1246		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure responding to request")
1247		return
1248	}
1249	if result.vnglr.hasNextLink() && result.vnglr.IsEmpty() {
1250		err = result.NextWithContext(ctx)
1251		return
1252	}
1253
1254	return
1255}
1256
1257// ListPreparer prepares the List request.
1258func (client VirtualNetworkGatewaysClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
1259	pathParameters := map[string]interface{}{
1260		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1261		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1262	}
1263
1264	const APIVersion = "2020-05-01"
1265	queryParameters := map[string]interface{}{
1266		"api-version": APIVersion,
1267	}
1268
1269	preparer := autorest.CreatePreparer(
1270		autorest.AsGet(),
1271		autorest.WithBaseURL(client.BaseURI),
1272		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways", pathParameters),
1273		autorest.WithQueryParameters(queryParameters))
1274	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1275}
1276
1277// ListSender sends the List request. The method will close the
1278// http.Response Body if it receives an error.
1279func (client VirtualNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) {
1280	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1281}
1282
1283// ListResponder handles the response to the List request. The method always
1284// closes the http.Response Body.
1285func (client VirtualNetworkGatewaysClient) ListResponder(resp *http.Response) (result VirtualNetworkGatewayListResult, err error) {
1286	err = autorest.Respond(
1287		resp,
1288		azure.WithErrorUnlessStatusCode(http.StatusOK),
1289		autorest.ByUnmarshallingJSON(&result),
1290		autorest.ByClosing())
1291	result.Response = autorest.Response{Response: resp}
1292	return
1293}
1294
1295// listNextResults retrieves the next set of results, if any.
1296func (client VirtualNetworkGatewaysClient) listNextResults(ctx context.Context, lastResults VirtualNetworkGatewayListResult) (result VirtualNetworkGatewayListResult, err error) {
1297	req, err := lastResults.virtualNetworkGatewayListResultPreparer(ctx)
1298	if err != nil {
1299		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listNextResults", nil, "Failure preparing next results request")
1300	}
1301	if req == nil {
1302		return
1303	}
1304	resp, err := client.ListSender(req)
1305	if err != nil {
1306		result.Response = autorest.Response{Response: resp}
1307		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listNextResults", resp, "Failure sending next results request")
1308	}
1309	result, err = client.ListResponder(resp)
1310	if err != nil {
1311		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listNextResults", resp, "Failure responding to next results request")
1312	}
1313	return
1314}
1315
1316// ListComplete enumerates all values, automatically crossing page boundaries as required.
1317func (client VirtualNetworkGatewaysClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualNetworkGatewayListResultIterator, err error) {
1318	if tracing.IsEnabled() {
1319		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.List")
1320		defer func() {
1321			sc := -1
1322			if result.Response().Response.Response != nil {
1323				sc = result.page.Response().Response.Response.StatusCode
1324			}
1325			tracing.EndSpan(ctx, sc, err)
1326		}()
1327	}
1328	result.page, err = client.List(ctx, resourceGroupName)
1329	return
1330}
1331
1332// ListConnections gets all the connections in a virtual network gateway.
1333// Parameters:
1334// resourceGroupName - the name of the resource group.
1335// virtualNetworkGatewayName - the name of the virtual network gateway.
1336func (client VirtualNetworkGatewaysClient) ListConnections(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewayListConnectionsResultPage, err error) {
1337	if tracing.IsEnabled() {
1338		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.ListConnections")
1339		defer func() {
1340			sc := -1
1341			if result.vnglcr.Response.Response != nil {
1342				sc = result.vnglcr.Response.Response.StatusCode
1343			}
1344			tracing.EndSpan(ctx, sc, err)
1345		}()
1346	}
1347	result.fn = client.listConnectionsNextResults
1348	req, err := client.ListConnectionsPreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
1349	if err != nil {
1350		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ListConnections", nil, "Failure preparing request")
1351		return
1352	}
1353
1354	resp, err := client.ListConnectionsSender(req)
1355	if err != nil {
1356		result.vnglcr.Response = autorest.Response{Response: resp}
1357		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ListConnections", resp, "Failure sending request")
1358		return
1359	}
1360
1361	result.vnglcr, err = client.ListConnectionsResponder(resp)
1362	if err != nil {
1363		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ListConnections", resp, "Failure responding to request")
1364		return
1365	}
1366	if result.vnglcr.hasNextLink() && result.vnglcr.IsEmpty() {
1367		err = result.NextWithContext(ctx)
1368		return
1369	}
1370
1371	return
1372}
1373
1374// ListConnectionsPreparer prepares the ListConnections request.
1375func (client VirtualNetworkGatewaysClient) ListConnectionsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
1376	pathParameters := map[string]interface{}{
1377		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
1378		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
1379		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
1380	}
1381
1382	const APIVersion = "2020-05-01"
1383	queryParameters := map[string]interface{}{
1384		"api-version": APIVersion,
1385	}
1386
1387	preparer := autorest.CreatePreparer(
1388		autorest.AsGet(),
1389		autorest.WithBaseURL(client.BaseURI),
1390		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/connections", pathParameters),
1391		autorest.WithQueryParameters(queryParameters))
1392	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1393}
1394
1395// ListConnectionsSender sends the ListConnections request. The method will close the
1396// http.Response Body if it receives an error.
1397func (client VirtualNetworkGatewaysClient) ListConnectionsSender(req *http.Request) (*http.Response, error) {
1398	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1399}
1400
1401// ListConnectionsResponder handles the response to the ListConnections request. The method always
1402// closes the http.Response Body.
1403func (client VirtualNetworkGatewaysClient) ListConnectionsResponder(resp *http.Response) (result VirtualNetworkGatewayListConnectionsResult, err error) {
1404	err = autorest.Respond(
1405		resp,
1406		azure.WithErrorUnlessStatusCode(http.StatusOK),
1407		autorest.ByUnmarshallingJSON(&result),
1408		autorest.ByClosing())
1409	result.Response = autorest.Response{Response: resp}
1410	return
1411}
1412
1413// listConnectionsNextResults retrieves the next set of results, if any.
1414func (client VirtualNetworkGatewaysClient) listConnectionsNextResults(ctx context.Context, lastResults VirtualNetworkGatewayListConnectionsResult) (result VirtualNetworkGatewayListConnectionsResult, err error) {
1415	req, err := lastResults.virtualNetworkGatewayListConnectionsResultPreparer(ctx)
1416	if err != nil {
1417		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listConnectionsNextResults", nil, "Failure preparing next results request")
1418	}
1419	if req == nil {
1420		return
1421	}
1422	resp, err := client.ListConnectionsSender(req)
1423	if err != nil {
1424		result.Response = autorest.Response{Response: resp}
1425		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listConnectionsNextResults", resp, "Failure sending next results request")
1426	}
1427	result, err = client.ListConnectionsResponder(resp)
1428	if err != nil {
1429		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listConnectionsNextResults", resp, "Failure responding to next results request")
1430	}
1431	return
1432}
1433
1434// ListConnectionsComplete enumerates all values, automatically crossing page boundaries as required.
1435func (client VirtualNetworkGatewaysClient) ListConnectionsComplete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewayListConnectionsResultIterator, err error) {
1436	if tracing.IsEnabled() {
1437		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.ListConnections")
1438		defer func() {
1439			sc := -1
1440			if result.Response().Response.Response != nil {
1441				sc = result.page.Response().Response.Response.StatusCode
1442			}
1443			tracing.EndSpan(ctx, sc, err)
1444		}()
1445	}
1446	result.page, err = client.ListConnections(ctx, resourceGroupName, virtualNetworkGatewayName)
1447	return
1448}
1449
1450// Reset resets the primary of the virtual network gateway in the specified resource group.
1451// Parameters:
1452// resourceGroupName - the name of the resource group.
1453// virtualNetworkGatewayName - the name of the virtual network gateway.
1454// gatewayVip - virtual network gateway vip address supplied to the begin reset of the active-active feature
1455// enabled gateway.
1456func (client VirtualNetworkGatewaysClient) Reset(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string) (result VirtualNetworkGatewaysResetFuture, err error) {
1457	if tracing.IsEnabled() {
1458		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.Reset")
1459		defer func() {
1460			sc := -1
1461			if result.Response() != nil {
1462				sc = result.Response().StatusCode
1463			}
1464			tracing.EndSpan(ctx, sc, err)
1465		}()
1466	}
1467	req, err := client.ResetPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, gatewayVip)
1468	if err != nil {
1469		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", nil, "Failure preparing request")
1470		return
1471	}
1472
1473	result, err = client.ResetSender(req)
1474	if err != nil {
1475		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", nil, "Failure sending request")
1476		return
1477	}
1478
1479	return
1480}
1481
1482// ResetPreparer prepares the Reset request.
1483func (client VirtualNetworkGatewaysClient) ResetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string) (*http.Request, error) {
1484	pathParameters := map[string]interface{}{
1485		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
1486		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
1487		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
1488	}
1489
1490	const APIVersion = "2020-05-01"
1491	queryParameters := map[string]interface{}{
1492		"api-version": APIVersion,
1493	}
1494	if len(gatewayVip) > 0 {
1495		queryParameters["gatewayVip"] = autorest.Encode("query", gatewayVip)
1496	}
1497
1498	preparer := autorest.CreatePreparer(
1499		autorest.AsPost(),
1500		autorest.WithBaseURL(client.BaseURI),
1501		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset", pathParameters),
1502		autorest.WithQueryParameters(queryParameters))
1503	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1504}
1505
1506// ResetSender sends the Reset request. The method will close the
1507// http.Response Body if it receives an error.
1508func (client VirtualNetworkGatewaysClient) ResetSender(req *http.Request) (future VirtualNetworkGatewaysResetFuture, err error) {
1509	var resp *http.Response
1510	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1511	if err != nil {
1512		return
1513	}
1514	var azf azure.Future
1515	azf, err = azure.NewFutureFromResponse(resp)
1516	future.FutureAPI = &azf
1517	future.Result = func(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) {
1518		var done bool
1519		done, err = future.DoneWithContext(context.Background(), client)
1520		if err != nil {
1521			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", future.Response(), "Polling failure")
1522			return
1523		}
1524		if !done {
1525			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysResetFuture")
1526			return
1527		}
1528		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1529		if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent {
1530			vng, err = client.ResetResponder(vng.Response.Response)
1531			if err != nil {
1532				err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", vng.Response.Response, "Failure responding to request")
1533			}
1534		}
1535		return
1536	}
1537	return
1538}
1539
1540// ResetResponder handles the response to the Reset request. The method always
1541// closes the http.Response Body.
1542func (client VirtualNetworkGatewaysClient) ResetResponder(resp *http.Response) (result VirtualNetworkGateway, err error) {
1543	err = autorest.Respond(
1544		resp,
1545		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1546		autorest.ByUnmarshallingJSON(&result),
1547		autorest.ByClosing())
1548	result.Response = autorest.Response{Response: resp}
1549	return
1550}
1551
1552// ResetVpnClientSharedKey resets the VPN client shared key of the virtual network gateway in the specified resource
1553// group.
1554// Parameters:
1555// resourceGroupName - the name of the resource group.
1556// virtualNetworkGatewayName - the name of the virtual network gateway.
1557func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysResetVpnClientSharedKeyFuture, err error) {
1558	if tracing.IsEnabled() {
1559		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.ResetVpnClientSharedKey")
1560		defer func() {
1561			sc := -1
1562			if result.Response() != nil {
1563				sc = result.Response().StatusCode
1564			}
1565			tracing.EndSpan(ctx, sc, err)
1566		}()
1567	}
1568	req, err := client.ResetVpnClientSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
1569	if err != nil {
1570		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ResetVpnClientSharedKey", nil, "Failure preparing request")
1571		return
1572	}
1573
1574	result, err = client.ResetVpnClientSharedKeySender(req)
1575	if err != nil {
1576		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ResetVpnClientSharedKey", nil, "Failure sending request")
1577		return
1578	}
1579
1580	return
1581}
1582
1583// ResetVpnClientSharedKeyPreparer prepares the ResetVpnClientSharedKey request.
1584func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKeyPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
1585	pathParameters := map[string]interface{}{
1586		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
1587		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
1588		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
1589	}
1590
1591	const APIVersion = "2020-05-01"
1592	queryParameters := map[string]interface{}{
1593		"api-version": APIVersion,
1594	}
1595
1596	preparer := autorest.CreatePreparer(
1597		autorest.AsPost(),
1598		autorest.WithBaseURL(client.BaseURI),
1599		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/resetvpnclientsharedkey", pathParameters),
1600		autorest.WithQueryParameters(queryParameters))
1601	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1602}
1603
1604// ResetVpnClientSharedKeySender sends the ResetVpnClientSharedKey request. The method will close the
1605// http.Response Body if it receives an error.
1606func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKeySender(req *http.Request) (future VirtualNetworkGatewaysResetVpnClientSharedKeyFuture, 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	var azf azure.Future
1613	azf, err = azure.NewFutureFromResponse(resp)
1614	future.FutureAPI = &azf
1615	future.Result = func(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) {
1616		var done bool
1617		done, err = future.DoneWithContext(context.Background(), client)
1618		if err != nil {
1619			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetVpnClientSharedKeyFuture", "Result", future.Response(), "Polling failure")
1620			return
1621		}
1622		if !done {
1623			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysResetVpnClientSharedKeyFuture")
1624			return
1625		}
1626		ar.Response = future.Response()
1627		return
1628	}
1629	return
1630}
1631
1632// ResetVpnClientSharedKeyResponder handles the response to the ResetVpnClientSharedKey request. The method always
1633// closes the http.Response Body.
1634func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKeyResponder(resp *http.Response) (result autorest.Response, err error) {
1635	err = autorest.Respond(
1636		resp,
1637		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1638		autorest.ByClosing())
1639	result.Response = resp
1640	return
1641}
1642
1643// SetVpnclientIpsecParameters the Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S
1644// client of virtual network gateway in the specified resource group through Network resource provider.
1645// Parameters:
1646// resourceGroupName - the name of the resource group.
1647// virtualNetworkGatewayName - the name of the virtual network gateway.
1648// vpnclientIpsecParams - parameters supplied to the Begin Set vpnclient ipsec parameters of Virtual Network
1649// Gateway P2S client operation through Network resource provider.
1650func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIpsecParams VpnClientIPsecParameters) (result VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture, err error) {
1651	if tracing.IsEnabled() {
1652		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.SetVpnclientIpsecParameters")
1653		defer func() {
1654			sc := -1
1655			if result.Response() != nil {
1656				sc = result.Response().StatusCode
1657			}
1658			tracing.EndSpan(ctx, sc, err)
1659		}()
1660	}
1661	if err := validation.Validate([]validation.Validation{
1662		{TargetValue: vpnclientIpsecParams,
1663			Constraints: []validation.Constraint{{Target: "vpnclientIpsecParams.SaLifeTimeSeconds", Name: validation.Null, Rule: true, Chain: nil},
1664				{Target: "vpnclientIpsecParams.SaDataSizeKilobytes", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
1665		return result, validation.NewError("network.VirtualNetworkGatewaysClient", "SetVpnclientIpsecParameters", err.Error())
1666	}
1667
1668	req, err := client.SetVpnclientIpsecParametersPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams)
1669	if err != nil {
1670		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SetVpnclientIpsecParameters", nil, "Failure preparing request")
1671		return
1672	}
1673
1674	result, err = client.SetVpnclientIpsecParametersSender(req)
1675	if err != nil {
1676		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SetVpnclientIpsecParameters", nil, "Failure sending request")
1677		return
1678	}
1679
1680	return
1681}
1682
1683// SetVpnclientIpsecParametersPreparer prepares the SetVpnclientIpsecParameters request.
1684func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParametersPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIpsecParams VpnClientIPsecParameters) (*http.Request, error) {
1685	pathParameters := map[string]interface{}{
1686		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
1687		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
1688		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
1689	}
1690
1691	const APIVersion = "2020-05-01"
1692	queryParameters := map[string]interface{}{
1693		"api-version": APIVersion,
1694	}
1695
1696	preparer := autorest.CreatePreparer(
1697		autorest.AsContentType("application/json; charset=utf-8"),
1698		autorest.AsPost(),
1699		autorest.WithBaseURL(client.BaseURI),
1700		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/setvpnclientipsecparameters", pathParameters),
1701		autorest.WithJSON(vpnclientIpsecParams),
1702		autorest.WithQueryParameters(queryParameters))
1703	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1704}
1705
1706// SetVpnclientIpsecParametersSender sends the SetVpnclientIpsecParameters request. The method will close the
1707// http.Response Body if it receives an error.
1708func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParametersSender(req *http.Request) (future VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture, err error) {
1709	var resp *http.Response
1710	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1711	if err != nil {
1712		return
1713	}
1714	var azf azure.Future
1715	azf, err = azure.NewFutureFromResponse(resp)
1716	future.FutureAPI = &azf
1717	future.Result = func(client VirtualNetworkGatewaysClient) (vcipp VpnClientIPsecParameters, err error) {
1718		var done bool
1719		done, err = future.DoneWithContext(context.Background(), client)
1720		if err != nil {
1721			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture", "Result", future.Response(), "Polling failure")
1722			return
1723		}
1724		if !done {
1725			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture")
1726			return
1727		}
1728		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1729		if vcipp.Response.Response, err = future.GetResult(sender); err == nil && vcipp.Response.Response.StatusCode != http.StatusNoContent {
1730			vcipp, err = client.SetVpnclientIpsecParametersResponder(vcipp.Response.Response)
1731			if err != nil {
1732				err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture", "Result", vcipp.Response.Response, "Failure responding to request")
1733			}
1734		}
1735		return
1736	}
1737	return
1738}
1739
1740// SetVpnclientIpsecParametersResponder handles the response to the SetVpnclientIpsecParameters request. The method always
1741// closes the http.Response Body.
1742func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParametersResponder(resp *http.Response) (result VpnClientIPsecParameters, err error) {
1743	err = autorest.Respond(
1744		resp,
1745		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1746		autorest.ByUnmarshallingJSON(&result),
1747		autorest.ByClosing())
1748	result.Response = autorest.Response{Response: resp}
1749	return
1750}
1751
1752// StartPacketCapture starts packet capture on virtual network gateway in the specified resource group.
1753// Parameters:
1754// resourceGroupName - the name of the resource group.
1755// virtualNetworkGatewayName - the name of the virtual network gateway.
1756// parameters - virtual network gateway packet capture parameters supplied to start packet capture on gateway.
1757func (client VirtualNetworkGatewaysClient) StartPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters *VpnPacketCaptureStartParameters) (result VirtualNetworkGatewaysStartPacketCaptureFuture, err error) {
1758	if tracing.IsEnabled() {
1759		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.StartPacketCapture")
1760		defer func() {
1761			sc := -1
1762			if result.Response() != nil {
1763				sc = result.Response().StatusCode
1764			}
1765			tracing.EndSpan(ctx, sc, err)
1766		}()
1767	}
1768	req, err := client.StartPacketCapturePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters)
1769	if err != nil {
1770		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "StartPacketCapture", nil, "Failure preparing request")
1771		return
1772	}
1773
1774	result, err = client.StartPacketCaptureSender(req)
1775	if err != nil {
1776		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "StartPacketCapture", nil, "Failure sending request")
1777		return
1778	}
1779
1780	return
1781}
1782
1783// StartPacketCapturePreparer prepares the StartPacketCapture request.
1784func (client VirtualNetworkGatewaysClient) StartPacketCapturePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters *VpnPacketCaptureStartParameters) (*http.Request, error) {
1785	pathParameters := map[string]interface{}{
1786		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
1787		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
1788		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
1789	}
1790
1791	const APIVersion = "2020-05-01"
1792	queryParameters := map[string]interface{}{
1793		"api-version": APIVersion,
1794	}
1795
1796	preparer := autorest.CreatePreparer(
1797		autorest.AsContentType("application/json; charset=utf-8"),
1798		autorest.AsPost(),
1799		autorest.WithBaseURL(client.BaseURI),
1800		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/startPacketCapture", pathParameters),
1801		autorest.WithQueryParameters(queryParameters))
1802	if parameters != nil {
1803		preparer = autorest.DecoratePreparer(preparer,
1804			autorest.WithJSON(parameters))
1805	}
1806	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1807}
1808
1809// StartPacketCaptureSender sends the StartPacketCapture request. The method will close the
1810// http.Response Body if it receives an error.
1811func (client VirtualNetworkGatewaysClient) StartPacketCaptureSender(req *http.Request) (future VirtualNetworkGatewaysStartPacketCaptureFuture, err error) {
1812	var resp *http.Response
1813	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1814	if err != nil {
1815		return
1816	}
1817	var azf azure.Future
1818	azf, err = azure.NewFutureFromResponse(resp)
1819	future.FutureAPI = &azf
1820	future.Result = func(client VirtualNetworkGatewaysClient) (s String, err error) {
1821		var done bool
1822		done, err = future.DoneWithContext(context.Background(), client)
1823		if err != nil {
1824			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStartPacketCaptureFuture", "Result", future.Response(), "Polling failure")
1825			return
1826		}
1827		if !done {
1828			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysStartPacketCaptureFuture")
1829			return
1830		}
1831		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1832		if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
1833			s, err = client.StartPacketCaptureResponder(s.Response.Response)
1834			if err != nil {
1835				err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStartPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request")
1836			}
1837		}
1838		return
1839	}
1840	return
1841}
1842
1843// StartPacketCaptureResponder handles the response to the StartPacketCapture request. The method always
1844// closes the http.Response Body.
1845func (client VirtualNetworkGatewaysClient) StartPacketCaptureResponder(resp *http.Response) (result String, err error) {
1846	err = autorest.Respond(
1847		resp,
1848		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1849		autorest.ByUnmarshallingJSON(&result),
1850		autorest.ByClosing())
1851	result.Response = autorest.Response{Response: resp}
1852	return
1853}
1854
1855// StopPacketCapture stops packet capture on virtual network gateway in the specified resource group.
1856// Parameters:
1857// resourceGroupName - the name of the resource group.
1858// virtualNetworkGatewayName - the name of the virtual network gateway.
1859// parameters - virtual network gateway packet capture parameters supplied to stop packet capture on gateway.
1860func (client VirtualNetworkGatewaysClient) StopPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnPacketCaptureStopParameters) (result VirtualNetworkGatewaysStopPacketCaptureFuture, err error) {
1861	if tracing.IsEnabled() {
1862		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.StopPacketCapture")
1863		defer func() {
1864			sc := -1
1865			if result.Response() != nil {
1866				sc = result.Response().StatusCode
1867			}
1868			tracing.EndSpan(ctx, sc, err)
1869		}()
1870	}
1871	req, err := client.StopPacketCapturePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters)
1872	if err != nil {
1873		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "StopPacketCapture", nil, "Failure preparing request")
1874		return
1875	}
1876
1877	result, err = client.StopPacketCaptureSender(req)
1878	if err != nil {
1879		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "StopPacketCapture", nil, "Failure sending request")
1880		return
1881	}
1882
1883	return
1884}
1885
1886// StopPacketCapturePreparer prepares the StopPacketCapture request.
1887func (client VirtualNetworkGatewaysClient) StopPacketCapturePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnPacketCaptureStopParameters) (*http.Request, error) {
1888	pathParameters := map[string]interface{}{
1889		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
1890		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
1891		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
1892	}
1893
1894	const APIVersion = "2020-05-01"
1895	queryParameters := map[string]interface{}{
1896		"api-version": APIVersion,
1897	}
1898
1899	preparer := autorest.CreatePreparer(
1900		autorest.AsContentType("application/json; charset=utf-8"),
1901		autorest.AsPost(),
1902		autorest.WithBaseURL(client.BaseURI),
1903		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/stopPacketCapture", pathParameters),
1904		autorest.WithJSON(parameters),
1905		autorest.WithQueryParameters(queryParameters))
1906	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1907}
1908
1909// StopPacketCaptureSender sends the StopPacketCapture request. The method will close the
1910// http.Response Body if it receives an error.
1911func (client VirtualNetworkGatewaysClient) StopPacketCaptureSender(req *http.Request) (future VirtualNetworkGatewaysStopPacketCaptureFuture, err error) {
1912	var resp *http.Response
1913	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1914	if err != nil {
1915		return
1916	}
1917	var azf azure.Future
1918	azf, err = azure.NewFutureFromResponse(resp)
1919	future.FutureAPI = &azf
1920	future.Result = func(client VirtualNetworkGatewaysClient) (s String, err error) {
1921		var done bool
1922		done, err = future.DoneWithContext(context.Background(), client)
1923		if err != nil {
1924			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStopPacketCaptureFuture", "Result", future.Response(), "Polling failure")
1925			return
1926		}
1927		if !done {
1928			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysStopPacketCaptureFuture")
1929			return
1930		}
1931		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1932		if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
1933			s, err = client.StopPacketCaptureResponder(s.Response.Response)
1934			if err != nil {
1935				err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStopPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request")
1936			}
1937		}
1938		return
1939	}
1940	return
1941}
1942
1943// StopPacketCaptureResponder handles the response to the StopPacketCapture request. The method always
1944// closes the http.Response Body.
1945func (client VirtualNetworkGatewaysClient) StopPacketCaptureResponder(resp *http.Response) (result String, err error) {
1946	err = autorest.Respond(
1947		resp,
1948		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1949		autorest.ByUnmarshallingJSON(&result),
1950		autorest.ByClosing())
1951	result.Response = autorest.Response{Response: resp}
1952	return
1953}
1954
1955// SupportedVpnDevices gets a xml format representation for supported vpn devices.
1956// Parameters:
1957// resourceGroupName - the name of the resource group.
1958// virtualNetworkGatewayName - the name of the virtual network gateway.
1959func (client VirtualNetworkGatewaysClient) SupportedVpnDevices(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result String, err error) {
1960	if tracing.IsEnabled() {
1961		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.SupportedVpnDevices")
1962		defer func() {
1963			sc := -1
1964			if result.Response.Response != nil {
1965				sc = result.Response.Response.StatusCode
1966			}
1967			tracing.EndSpan(ctx, sc, err)
1968		}()
1969	}
1970	req, err := client.SupportedVpnDevicesPreparer(ctx, resourceGroupName, virtualNetworkGatewayName)
1971	if err != nil {
1972		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SupportedVpnDevices", nil, "Failure preparing request")
1973		return
1974	}
1975
1976	resp, err := client.SupportedVpnDevicesSender(req)
1977	if err != nil {
1978		result.Response = autorest.Response{Response: resp}
1979		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SupportedVpnDevices", resp, "Failure sending request")
1980		return
1981	}
1982
1983	result, err = client.SupportedVpnDevicesResponder(resp)
1984	if err != nil {
1985		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SupportedVpnDevices", resp, "Failure responding to request")
1986		return
1987	}
1988
1989	return
1990}
1991
1992// SupportedVpnDevicesPreparer prepares the SupportedVpnDevices request.
1993func (client VirtualNetworkGatewaysClient) SupportedVpnDevicesPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
1994	pathParameters := map[string]interface{}{
1995		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
1996		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
1997		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
1998	}
1999
2000	const APIVersion = "2020-05-01"
2001	queryParameters := map[string]interface{}{
2002		"api-version": APIVersion,
2003	}
2004
2005	preparer := autorest.CreatePreparer(
2006		autorest.AsPost(),
2007		autorest.WithBaseURL(client.BaseURI),
2008		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/supportedvpndevices", pathParameters),
2009		autorest.WithQueryParameters(queryParameters))
2010	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2011}
2012
2013// SupportedVpnDevicesSender sends the SupportedVpnDevices request. The method will close the
2014// http.Response Body if it receives an error.
2015func (client VirtualNetworkGatewaysClient) SupportedVpnDevicesSender(req *http.Request) (*http.Response, error) {
2016	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
2017}
2018
2019// SupportedVpnDevicesResponder handles the response to the SupportedVpnDevices request. The method always
2020// closes the http.Response Body.
2021func (client VirtualNetworkGatewaysClient) SupportedVpnDevicesResponder(resp *http.Response) (result String, err error) {
2022	err = autorest.Respond(
2023		resp,
2024		azure.WithErrorUnlessStatusCode(http.StatusOK),
2025		autorest.ByUnmarshallingJSON(&result.Value),
2026		autorest.ByClosing())
2027	result.Response = autorest.Response{Response: resp}
2028	return
2029}
2030
2031// UpdateTags updates a virtual network gateway tags.
2032// Parameters:
2033// resourceGroupName - the name of the resource group.
2034// virtualNetworkGatewayName - the name of the virtual network gateway.
2035// parameters - parameters supplied to update virtual network gateway tags.
2036func (client VirtualNetworkGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters TagsObject) (result VirtualNetworkGatewaysUpdateTagsFuture, err error) {
2037	if tracing.IsEnabled() {
2038		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.UpdateTags")
2039		defer func() {
2040			sc := -1
2041			if result.Response() != nil {
2042				sc = result.Response().StatusCode
2043			}
2044			tracing.EndSpan(ctx, sc, err)
2045		}()
2046	}
2047	req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters)
2048	if err != nil {
2049		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "UpdateTags", nil, "Failure preparing request")
2050		return
2051	}
2052
2053	result, err = client.UpdateTagsSender(req)
2054	if err != nil {
2055		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "UpdateTags", nil, "Failure sending request")
2056		return
2057	}
2058
2059	return
2060}
2061
2062// UpdateTagsPreparer prepares the UpdateTags request.
2063func (client VirtualNetworkGatewaysClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters TagsObject) (*http.Request, error) {
2064	pathParameters := map[string]interface{}{
2065		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
2066		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
2067		"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
2068	}
2069
2070	const APIVersion = "2020-05-01"
2071	queryParameters := map[string]interface{}{
2072		"api-version": APIVersion,
2073	}
2074
2075	preparer := autorest.CreatePreparer(
2076		autorest.AsContentType("application/json; charset=utf-8"),
2077		autorest.AsPatch(),
2078		autorest.WithBaseURL(client.BaseURI),
2079		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters),
2080		autorest.WithJSON(parameters),
2081		autorest.WithQueryParameters(queryParameters))
2082	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2083}
2084
2085// UpdateTagsSender sends the UpdateTags request. The method will close the
2086// http.Response Body if it receives an error.
2087func (client VirtualNetworkGatewaysClient) UpdateTagsSender(req *http.Request) (future VirtualNetworkGatewaysUpdateTagsFuture, err error) {
2088	var resp *http.Response
2089	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
2090	if err != nil {
2091		return
2092	}
2093	var azf azure.Future
2094	azf, err = azure.NewFutureFromResponse(resp)
2095	future.FutureAPI = &azf
2096	future.Result = func(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) {
2097		var done bool
2098		done, err = future.DoneWithContext(context.Background(), client)
2099		if err != nil {
2100			err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", future.Response(), "Polling failure")
2101			return
2102		}
2103		if !done {
2104			err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysUpdateTagsFuture")
2105			return
2106		}
2107		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2108		if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent {
2109			vng, err = client.UpdateTagsResponder(vng.Response.Response)
2110			if err != nil {
2111				err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", vng.Response.Response, "Failure responding to request")
2112			}
2113		}
2114		return
2115	}
2116	return
2117}
2118
2119// UpdateTagsResponder handles the response to the UpdateTags request. The method always
2120// closes the http.Response Body.
2121func (client VirtualNetworkGatewaysClient) UpdateTagsResponder(resp *http.Response) (result VirtualNetworkGateway, err error) {
2122	err = autorest.Respond(
2123		resp,
2124		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
2125		autorest.ByUnmarshallingJSON(&result),
2126		autorest.ByClosing())
2127	result.Response = autorest.Response{Response: resp}
2128	return
2129}
2130
2131// VpnDeviceConfigurationScript gets a xml format representation for vpn device configuration script.
2132// Parameters:
2133// resourceGroupName - the name of the resource group.
2134// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection for which the
2135// configuration script is generated.
2136// parameters - parameters supplied to the generate vpn device script operation.
2137func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScript(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VpnDeviceScriptParameters) (result String, err error) {
2138	if tracing.IsEnabled() {
2139		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.VpnDeviceConfigurationScript")
2140		defer func() {
2141			sc := -1
2142			if result.Response.Response != nil {
2143				sc = result.Response.Response.StatusCode
2144			}
2145			tracing.EndSpan(ctx, sc, err)
2146		}()
2147	}
2148	req, err := client.VpnDeviceConfigurationScriptPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters)
2149	if err != nil {
2150		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "VpnDeviceConfigurationScript", nil, "Failure preparing request")
2151		return
2152	}
2153
2154	resp, err := client.VpnDeviceConfigurationScriptSender(req)
2155	if err != nil {
2156		result.Response = autorest.Response{Response: resp}
2157		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "VpnDeviceConfigurationScript", resp, "Failure sending request")
2158		return
2159	}
2160
2161	result, err = client.VpnDeviceConfigurationScriptResponder(resp)
2162	if err != nil {
2163		err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "VpnDeviceConfigurationScript", resp, "Failure responding to request")
2164		return
2165	}
2166
2167	return
2168}
2169
2170// VpnDeviceConfigurationScriptPreparer prepares the VpnDeviceConfigurationScript request.
2171func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScriptPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VpnDeviceScriptParameters) (*http.Request, error) {
2172	pathParameters := map[string]interface{}{
2173		"resourceGroupName":                   autorest.Encode("path", resourceGroupName),
2174		"subscriptionId":                      autorest.Encode("path", client.SubscriptionID),
2175		"virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName),
2176	}
2177
2178	const APIVersion = "2020-05-01"
2179	queryParameters := map[string]interface{}{
2180		"api-version": APIVersion,
2181	}
2182
2183	preparer := autorest.CreatePreparer(
2184		autorest.AsContentType("application/json; charset=utf-8"),
2185		autorest.AsPost(),
2186		autorest.WithBaseURL(client.BaseURI),
2187		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/vpndeviceconfigurationscript", pathParameters),
2188		autorest.WithJSON(parameters),
2189		autorest.WithQueryParameters(queryParameters))
2190	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2191}
2192
2193// VpnDeviceConfigurationScriptSender sends the VpnDeviceConfigurationScript request. The method will close the
2194// http.Response Body if it receives an error.
2195func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScriptSender(req *http.Request) (*http.Response, error) {
2196	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
2197}
2198
2199// VpnDeviceConfigurationScriptResponder handles the response to the VpnDeviceConfigurationScript request. The method always
2200// closes the http.Response Body.
2201func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScriptResponder(resp *http.Response) (result String, err error) {
2202	err = autorest.Respond(
2203		resp,
2204		azure.WithErrorUnlessStatusCode(http.StatusOK),
2205		autorest.ByUnmarshallingJSON(&result.Value),
2206		autorest.ByClosing())
2207	result.Response = autorest.Response{Response: resp}
2208	return
2209}
2210