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