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