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