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 = "2019-07-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 = "2019-07-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 = "2019-07-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 = "2019-07-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 = "2019-07-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 = "2019-07-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 = "2019-07-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 = "2019-07-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// GetVpnclientConnectionHealth get VPN client connection health detail per P2S client connection of the virtual 820// network gateway in the specified resource group. 821// Parameters: 822// resourceGroupName - the name of the resource group. 823// virtualNetworkGatewayName - the name of the virtual network gateway. 824func (client VirtualNetworkGatewaysClient) GetVpnclientConnectionHealth(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture, err error) { 825 if tracing.IsEnabled() { 826 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetVpnclientConnectionHealth") 827 defer func() { 828 sc := -1 829 if result.Response() != nil { 830 sc = result.Response().StatusCode 831 } 832 tracing.EndSpan(ctx, sc, err) 833 }() 834 } 835 req, err := client.GetVpnclientConnectionHealthPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) 836 if err != nil { 837 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnclientConnectionHealth", nil, "Failure preparing request") 838 return 839 } 840 841 result, err = client.GetVpnclientConnectionHealthSender(req) 842 if err != nil { 843 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnclientConnectionHealth", nil, "Failure sending request") 844 return 845 } 846 847 return 848} 849 850// GetVpnclientConnectionHealthPreparer prepares the GetVpnclientConnectionHealth request. 851func (client VirtualNetworkGatewaysClient) GetVpnclientConnectionHealthPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { 852 pathParameters := map[string]interface{}{ 853 "resourceGroupName": autorest.Encode("path", resourceGroupName), 854 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 855 "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), 856 } 857 858 const APIVersion = "2019-07-01" 859 queryParameters := map[string]interface{}{ 860 "api-version": APIVersion, 861 } 862 863 preparer := autorest.CreatePreparer( 864 autorest.AsPost(), 865 autorest.WithBaseURL(client.BaseURI), 866 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getVpnClientConnectionHealth", pathParameters), 867 autorest.WithQueryParameters(queryParameters)) 868 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 869} 870 871// GetVpnclientConnectionHealthSender sends the GetVpnclientConnectionHealth request. The method will close the 872// http.Response Body if it receives an error. 873func (client VirtualNetworkGatewaysClient) GetVpnclientConnectionHealthSender(req *http.Request) (future VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture, err error) { 874 var resp *http.Response 875 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 876 if err != nil { 877 return 878 } 879 var azf azure.Future 880 azf, err = azure.NewFutureFromResponse(resp) 881 future.FutureAPI = &azf 882 future.Result = func(client VirtualNetworkGatewaysClient) (vcchdlr VpnClientConnectionHealthDetailListResult, err error) { 883 var done bool 884 done, err = future.DoneWithContext(context.Background(), client) 885 if err != nil { 886 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture", "Result", future.Response(), "Polling failure") 887 return 888 } 889 if !done { 890 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture") 891 return 892 } 893 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 894 if vcchdlr.Response.Response, err = future.GetResult(sender); err == nil && vcchdlr.Response.Response.StatusCode != http.StatusNoContent { 895 vcchdlr, err = client.GetVpnclientConnectionHealthResponder(vcchdlr.Response.Response) 896 if err != nil { 897 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture", "Result", vcchdlr.Response.Response, "Failure responding to request") 898 } 899 } 900 return 901 } 902 return 903} 904 905// GetVpnclientConnectionHealthResponder handles the response to the GetVpnclientConnectionHealth request. The method always 906// closes the http.Response Body. 907func (client VirtualNetworkGatewaysClient) GetVpnclientConnectionHealthResponder(resp *http.Response) (result VpnClientConnectionHealthDetailListResult, err error) { 908 err = autorest.Respond( 909 resp, 910 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 911 autorest.ByUnmarshallingJSON(&result), 912 autorest.ByClosing()) 913 result.Response = autorest.Response{Response: resp} 914 return 915} 916 917// GetVpnclientIpsecParameters the Get VpnclientIpsecParameters operation retrieves information about the vpnclient 918// ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource 919// provider. 920// Parameters: 921// resourceGroupName - the name of the resource group. 922// virtualNetworkGatewayName - the virtual network gateway name. 923func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture, err error) { 924 if tracing.IsEnabled() { 925 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetVpnclientIpsecParameters") 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.GetVpnclientIpsecParametersPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) 935 if err != nil { 936 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnclientIpsecParameters", nil, "Failure preparing request") 937 return 938 } 939 940 result, err = client.GetVpnclientIpsecParametersSender(req) 941 if err != nil { 942 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnclientIpsecParameters", nil, "Failure sending request") 943 return 944 } 945 946 return 947} 948 949// GetVpnclientIpsecParametersPreparer prepares the GetVpnclientIpsecParameters request. 950func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParametersPreparer(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 = "2019-07-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}/getvpnclientipsecparameters", pathParameters), 966 autorest.WithQueryParameters(queryParameters)) 967 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 968} 969 970// GetVpnclientIpsecParametersSender sends the GetVpnclientIpsecParameters request. The method will close the 971// http.Response Body if it receives an error. 972func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParametersSender(req *http.Request) (future VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture, 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) (vcipp VpnClientIPsecParameters, err error) { 982 var done bool 983 done, err = future.DoneWithContext(context.Background(), client) 984 if err != nil { 985 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture", "Result", future.Response(), "Polling failure") 986 return 987 } 988 if !done { 989 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture") 990 return 991 } 992 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 993 if vcipp.Response.Response, err = future.GetResult(sender); err == nil && vcipp.Response.Response.StatusCode != http.StatusNoContent { 994 vcipp, err = client.GetVpnclientIpsecParametersResponder(vcipp.Response.Response) 995 if err != nil { 996 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture", "Result", vcipp.Response.Response, "Failure responding to request") 997 } 998 } 999 return 1000 } 1001 return 1002} 1003 1004// GetVpnclientIpsecParametersResponder handles the response to the GetVpnclientIpsecParameters request. The method always 1005// closes the http.Response Body. 1006func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParametersResponder(resp *http.Response) (result VpnClientIPsecParameters, err error) { 1007 err = autorest.Respond( 1008 resp, 1009 azure.WithErrorUnlessStatusCode(http.StatusOK), 1010 autorest.ByUnmarshallingJSON(&result), 1011 autorest.ByClosing()) 1012 result.Response = autorest.Response{Response: resp} 1013 return 1014} 1015 1016// GetVpnProfilePackageURL gets pre-generated VPN profile for P2S client of the virtual network gateway in the 1017// specified resource group. The profile needs to be generated first using generateVpnProfile. 1018// Parameters: 1019// resourceGroupName - the name of the resource group. 1020// virtualNetworkGatewayName - the name of the virtual network gateway. 1021func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURL(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetVpnProfilePackageURLFuture, err error) { 1022 if tracing.IsEnabled() { 1023 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetVpnProfilePackageURL") 1024 defer func() { 1025 sc := -1 1026 if result.Response() != nil { 1027 sc = result.Response().StatusCode 1028 } 1029 tracing.EndSpan(ctx, sc, err) 1030 }() 1031 } 1032 req, err := client.GetVpnProfilePackageURLPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) 1033 if err != nil { 1034 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnProfilePackageURL", nil, "Failure preparing request") 1035 return 1036 } 1037 1038 result, err = client.GetVpnProfilePackageURLSender(req) 1039 if err != nil { 1040 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnProfilePackageURL", nil, "Failure sending request") 1041 return 1042 } 1043 1044 return 1045} 1046 1047// GetVpnProfilePackageURLPreparer prepares the GetVpnProfilePackageURL request. 1048func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { 1049 pathParameters := map[string]interface{}{ 1050 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1051 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1052 "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), 1053 } 1054 1055 const APIVersion = "2019-07-01" 1056 queryParameters := map[string]interface{}{ 1057 "api-version": APIVersion, 1058 } 1059 1060 preparer := autorest.CreatePreparer( 1061 autorest.AsPost(), 1062 autorest.WithBaseURL(client.BaseURI), 1063 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl", pathParameters), 1064 autorest.WithQueryParameters(queryParameters)) 1065 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1066} 1067 1068// GetVpnProfilePackageURLSender sends the GetVpnProfilePackageURL request. The method will close the 1069// http.Response Body if it receives an error. 1070func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLSender(req *http.Request) (future VirtualNetworkGatewaysGetVpnProfilePackageURLFuture, err error) { 1071 var resp *http.Response 1072 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1073 if err != nil { 1074 return 1075 } 1076 var azf azure.Future 1077 azf, err = azure.NewFutureFromResponse(resp) 1078 future.FutureAPI = &azf 1079 future.Result = func(client VirtualNetworkGatewaysClient) (s String, err error) { 1080 var done bool 1081 done, err = future.DoneWithContext(context.Background(), client) 1082 if err != nil { 1083 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", future.Response(), "Polling failure") 1084 return 1085 } 1086 if !done { 1087 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture") 1088 return 1089 } 1090 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1091 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { 1092 s, err = client.GetVpnProfilePackageURLResponder(s.Response.Response) 1093 if err != nil { 1094 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", s.Response.Response, "Failure responding to request") 1095 } 1096 } 1097 return 1098 } 1099 return 1100} 1101 1102// GetVpnProfilePackageURLResponder handles the response to the GetVpnProfilePackageURL request. The method always 1103// closes the http.Response Body. 1104func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLResponder(resp *http.Response) (result String, err error) { 1105 err = autorest.Respond( 1106 resp, 1107 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1108 autorest.ByUnmarshallingJSON(&result), 1109 autorest.ByClosing()) 1110 result.Response = autorest.Response{Response: resp} 1111 return 1112} 1113 1114// List gets all virtual network gateways by resource group. 1115// Parameters: 1116// resourceGroupName - the name of the resource group. 1117func (client VirtualNetworkGatewaysClient) List(ctx context.Context, resourceGroupName string) (result VirtualNetworkGatewayListResultPage, err error) { 1118 if tracing.IsEnabled() { 1119 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.List") 1120 defer func() { 1121 sc := -1 1122 if result.vnglr.Response.Response != nil { 1123 sc = result.vnglr.Response.Response.StatusCode 1124 } 1125 tracing.EndSpan(ctx, sc, err) 1126 }() 1127 } 1128 result.fn = client.listNextResults 1129 req, err := client.ListPreparer(ctx, resourceGroupName) 1130 if err != nil { 1131 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", nil, "Failure preparing request") 1132 return 1133 } 1134 1135 resp, err := client.ListSender(req) 1136 if err != nil { 1137 result.vnglr.Response = autorest.Response{Response: resp} 1138 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure sending request") 1139 return 1140 } 1141 1142 result.vnglr, err = client.ListResponder(resp) 1143 if err != nil { 1144 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure responding to request") 1145 return 1146 } 1147 if result.vnglr.hasNextLink() && result.vnglr.IsEmpty() { 1148 err = result.NextWithContext(ctx) 1149 return 1150 } 1151 1152 return 1153} 1154 1155// ListPreparer prepares the List request. 1156func (client VirtualNetworkGatewaysClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { 1157 pathParameters := map[string]interface{}{ 1158 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1159 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1160 } 1161 1162 const APIVersion = "2019-07-01" 1163 queryParameters := map[string]interface{}{ 1164 "api-version": APIVersion, 1165 } 1166 1167 preparer := autorest.CreatePreparer( 1168 autorest.AsGet(), 1169 autorest.WithBaseURL(client.BaseURI), 1170 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways", pathParameters), 1171 autorest.WithQueryParameters(queryParameters)) 1172 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1173} 1174 1175// ListSender sends the List request. The method will close the 1176// http.Response Body if it receives an error. 1177func (client VirtualNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { 1178 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1179} 1180 1181// ListResponder handles the response to the List request. The method always 1182// closes the http.Response Body. 1183func (client VirtualNetworkGatewaysClient) ListResponder(resp *http.Response) (result VirtualNetworkGatewayListResult, err error) { 1184 err = autorest.Respond( 1185 resp, 1186 azure.WithErrorUnlessStatusCode(http.StatusOK), 1187 autorest.ByUnmarshallingJSON(&result), 1188 autorest.ByClosing()) 1189 result.Response = autorest.Response{Response: resp} 1190 return 1191} 1192 1193// listNextResults retrieves the next set of results, if any. 1194func (client VirtualNetworkGatewaysClient) listNextResults(ctx context.Context, lastResults VirtualNetworkGatewayListResult) (result VirtualNetworkGatewayListResult, err error) { 1195 req, err := lastResults.virtualNetworkGatewayListResultPreparer(ctx) 1196 if err != nil { 1197 return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listNextResults", nil, "Failure preparing next results request") 1198 } 1199 if req == nil { 1200 return 1201 } 1202 resp, err := client.ListSender(req) 1203 if err != nil { 1204 result.Response = autorest.Response{Response: resp} 1205 return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listNextResults", resp, "Failure sending next results request") 1206 } 1207 result, err = client.ListResponder(resp) 1208 if err != nil { 1209 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listNextResults", resp, "Failure responding to next results request") 1210 } 1211 return 1212} 1213 1214// ListComplete enumerates all values, automatically crossing page boundaries as required. 1215func (client VirtualNetworkGatewaysClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualNetworkGatewayListResultIterator, err error) { 1216 if tracing.IsEnabled() { 1217 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.List") 1218 defer func() { 1219 sc := -1 1220 if result.Response().Response.Response != nil { 1221 sc = result.page.Response().Response.Response.StatusCode 1222 } 1223 tracing.EndSpan(ctx, sc, err) 1224 }() 1225 } 1226 result.page, err = client.List(ctx, resourceGroupName) 1227 return 1228} 1229 1230// ListConnections gets all the connections in a virtual network gateway. 1231// Parameters: 1232// resourceGroupName - the name of the resource group. 1233// virtualNetworkGatewayName - the name of the virtual network gateway. 1234func (client VirtualNetworkGatewaysClient) ListConnections(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewayListConnectionsResultPage, err error) { 1235 if tracing.IsEnabled() { 1236 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.ListConnections") 1237 defer func() { 1238 sc := -1 1239 if result.vnglcr.Response.Response != nil { 1240 sc = result.vnglcr.Response.Response.StatusCode 1241 } 1242 tracing.EndSpan(ctx, sc, err) 1243 }() 1244 } 1245 result.fn = client.listConnectionsNextResults 1246 req, err := client.ListConnectionsPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) 1247 if err != nil { 1248 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ListConnections", nil, "Failure preparing request") 1249 return 1250 } 1251 1252 resp, err := client.ListConnectionsSender(req) 1253 if err != nil { 1254 result.vnglcr.Response = autorest.Response{Response: resp} 1255 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ListConnections", resp, "Failure sending request") 1256 return 1257 } 1258 1259 result.vnglcr, err = client.ListConnectionsResponder(resp) 1260 if err != nil { 1261 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ListConnections", resp, "Failure responding to request") 1262 return 1263 } 1264 if result.vnglcr.hasNextLink() && result.vnglcr.IsEmpty() { 1265 err = result.NextWithContext(ctx) 1266 return 1267 } 1268 1269 return 1270} 1271 1272// ListConnectionsPreparer prepares the ListConnections request. 1273func (client VirtualNetworkGatewaysClient) ListConnectionsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { 1274 pathParameters := map[string]interface{}{ 1275 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1276 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1277 "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), 1278 } 1279 1280 const APIVersion = "2019-07-01" 1281 queryParameters := map[string]interface{}{ 1282 "api-version": APIVersion, 1283 } 1284 1285 preparer := autorest.CreatePreparer( 1286 autorest.AsGet(), 1287 autorest.WithBaseURL(client.BaseURI), 1288 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/connections", pathParameters), 1289 autorest.WithQueryParameters(queryParameters)) 1290 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1291} 1292 1293// ListConnectionsSender sends the ListConnections request. The method will close the 1294// http.Response Body if it receives an error. 1295func (client VirtualNetworkGatewaysClient) ListConnectionsSender(req *http.Request) (*http.Response, error) { 1296 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1297} 1298 1299// ListConnectionsResponder handles the response to the ListConnections request. The method always 1300// closes the http.Response Body. 1301func (client VirtualNetworkGatewaysClient) ListConnectionsResponder(resp *http.Response) (result VirtualNetworkGatewayListConnectionsResult, err error) { 1302 err = autorest.Respond( 1303 resp, 1304 azure.WithErrorUnlessStatusCode(http.StatusOK), 1305 autorest.ByUnmarshallingJSON(&result), 1306 autorest.ByClosing()) 1307 result.Response = autorest.Response{Response: resp} 1308 return 1309} 1310 1311// listConnectionsNextResults retrieves the next set of results, if any. 1312func (client VirtualNetworkGatewaysClient) listConnectionsNextResults(ctx context.Context, lastResults VirtualNetworkGatewayListConnectionsResult) (result VirtualNetworkGatewayListConnectionsResult, err error) { 1313 req, err := lastResults.virtualNetworkGatewayListConnectionsResultPreparer(ctx) 1314 if err != nil { 1315 return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listConnectionsNextResults", nil, "Failure preparing next results request") 1316 } 1317 if req == nil { 1318 return 1319 } 1320 resp, err := client.ListConnectionsSender(req) 1321 if err != nil { 1322 result.Response = autorest.Response{Response: resp} 1323 return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listConnectionsNextResults", resp, "Failure sending next results request") 1324 } 1325 result, err = client.ListConnectionsResponder(resp) 1326 if err != nil { 1327 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listConnectionsNextResults", resp, "Failure responding to next results request") 1328 } 1329 return 1330} 1331 1332// ListConnectionsComplete enumerates all values, automatically crossing page boundaries as required. 1333func (client VirtualNetworkGatewaysClient) ListConnectionsComplete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewayListConnectionsResultIterator, err error) { 1334 if tracing.IsEnabled() { 1335 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.ListConnections") 1336 defer func() { 1337 sc := -1 1338 if result.Response().Response.Response != nil { 1339 sc = result.page.Response().Response.Response.StatusCode 1340 } 1341 tracing.EndSpan(ctx, sc, err) 1342 }() 1343 } 1344 result.page, err = client.ListConnections(ctx, resourceGroupName, virtualNetworkGatewayName) 1345 return 1346} 1347 1348// Reset resets the primary of the virtual network gateway in the specified resource group. 1349// Parameters: 1350// resourceGroupName - the name of the resource group. 1351// virtualNetworkGatewayName - the name of the virtual network gateway. 1352// gatewayVip - virtual network gateway vip address supplied to the begin reset of the active-active feature 1353// enabled gateway. 1354func (client VirtualNetworkGatewaysClient) Reset(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string) (result VirtualNetworkGatewaysResetFuture, err error) { 1355 if tracing.IsEnabled() { 1356 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.Reset") 1357 defer func() { 1358 sc := -1 1359 if result.Response() != nil { 1360 sc = result.Response().StatusCode 1361 } 1362 tracing.EndSpan(ctx, sc, err) 1363 }() 1364 } 1365 req, err := client.ResetPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, gatewayVip) 1366 if err != nil { 1367 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", nil, "Failure preparing request") 1368 return 1369 } 1370 1371 result, err = client.ResetSender(req) 1372 if err != nil { 1373 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", nil, "Failure sending request") 1374 return 1375 } 1376 1377 return 1378} 1379 1380// ResetPreparer prepares the Reset request. 1381func (client VirtualNetworkGatewaysClient) ResetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string) (*http.Request, error) { 1382 pathParameters := map[string]interface{}{ 1383 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1384 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1385 "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), 1386 } 1387 1388 const APIVersion = "2019-07-01" 1389 queryParameters := map[string]interface{}{ 1390 "api-version": APIVersion, 1391 } 1392 if len(gatewayVip) > 0 { 1393 queryParameters["gatewayVip"] = autorest.Encode("query", gatewayVip) 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}/reset", pathParameters), 1400 autorest.WithQueryParameters(queryParameters)) 1401 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1402} 1403 1404// ResetSender sends the Reset request. The method will close the 1405// http.Response Body if it receives an error. 1406func (client VirtualNetworkGatewaysClient) ResetSender(req *http.Request) (future VirtualNetworkGatewaysResetFuture, 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) (vng VirtualNetworkGateway, err error) { 1416 var done bool 1417 done, err = future.DoneWithContext(context.Background(), client) 1418 if err != nil { 1419 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", future.Response(), "Polling failure") 1420 return 1421 } 1422 if !done { 1423 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysResetFuture") 1424 return 1425 } 1426 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1427 if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent { 1428 vng, err = client.ResetResponder(vng.Response.Response) 1429 if err != nil { 1430 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", vng.Response.Response, "Failure responding to request") 1431 } 1432 } 1433 return 1434 } 1435 return 1436} 1437 1438// ResetResponder handles the response to the Reset request. The method always 1439// closes the http.Response Body. 1440func (client VirtualNetworkGatewaysClient) ResetResponder(resp *http.Response) (result VirtualNetworkGateway, err error) { 1441 err = autorest.Respond( 1442 resp, 1443 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1444 autorest.ByUnmarshallingJSON(&result), 1445 autorest.ByClosing()) 1446 result.Response = autorest.Response{Response: resp} 1447 return 1448} 1449 1450// ResetVpnClientSharedKey resets the VPN client shared key of the virtual network gateway in the specified resource 1451// group. 1452// Parameters: 1453// resourceGroupName - the name of the resource group. 1454// virtualNetworkGatewayName - the name of the virtual network gateway. 1455func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysResetVpnClientSharedKeyFuture, err error) { 1456 if tracing.IsEnabled() { 1457 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.ResetVpnClientSharedKey") 1458 defer func() { 1459 sc := -1 1460 if result.Response() != nil { 1461 sc = result.Response().StatusCode 1462 } 1463 tracing.EndSpan(ctx, sc, err) 1464 }() 1465 } 1466 req, err := client.ResetVpnClientSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) 1467 if err != nil { 1468 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ResetVpnClientSharedKey", nil, "Failure preparing request") 1469 return 1470 } 1471 1472 result, err = client.ResetVpnClientSharedKeySender(req) 1473 if err != nil { 1474 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ResetVpnClientSharedKey", nil, "Failure sending request") 1475 return 1476 } 1477 1478 return 1479} 1480 1481// ResetVpnClientSharedKeyPreparer prepares the ResetVpnClientSharedKey request. 1482func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKeyPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { 1483 pathParameters := map[string]interface{}{ 1484 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1485 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1486 "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), 1487 } 1488 1489 const APIVersion = "2019-07-01" 1490 queryParameters := map[string]interface{}{ 1491 "api-version": APIVersion, 1492 } 1493 1494 preparer := autorest.CreatePreparer( 1495 autorest.AsPost(), 1496 autorest.WithBaseURL(client.BaseURI), 1497 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/resetvpnclientsharedkey", pathParameters), 1498 autorest.WithQueryParameters(queryParameters)) 1499 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1500} 1501 1502// ResetVpnClientSharedKeySender sends the ResetVpnClientSharedKey request. The method will close the 1503// http.Response Body if it receives an error. 1504func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKeySender(req *http.Request) (future VirtualNetworkGatewaysResetVpnClientSharedKeyFuture, err error) { 1505 var resp *http.Response 1506 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1507 if err != nil { 1508 return 1509 } 1510 var azf azure.Future 1511 azf, err = azure.NewFutureFromResponse(resp) 1512 future.FutureAPI = &azf 1513 future.Result = func(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) { 1514 var done bool 1515 done, err = future.DoneWithContext(context.Background(), client) 1516 if err != nil { 1517 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetVpnClientSharedKeyFuture", "Result", future.Response(), "Polling failure") 1518 return 1519 } 1520 if !done { 1521 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysResetVpnClientSharedKeyFuture") 1522 return 1523 } 1524 ar.Response = future.Response() 1525 return 1526 } 1527 return 1528} 1529 1530// ResetVpnClientSharedKeyResponder handles the response to the ResetVpnClientSharedKey request. The method always 1531// closes the http.Response Body. 1532func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKeyResponder(resp *http.Response) (result autorest.Response, err error) { 1533 err = autorest.Respond( 1534 resp, 1535 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1536 autorest.ByClosing()) 1537 result.Response = resp 1538 return 1539} 1540 1541// SetVpnclientIpsecParameters the Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S 1542// client of virtual network gateway in the specified resource group through Network resource provider. 1543// Parameters: 1544// resourceGroupName - the name of the resource group. 1545// virtualNetworkGatewayName - the name of the virtual network gateway. 1546// vpnclientIpsecParams - parameters supplied to the Begin Set vpnclient ipsec parameters of Virtual Network 1547// Gateway P2S client operation through Network resource provider. 1548func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIpsecParams VpnClientIPsecParameters) (result VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture, err error) { 1549 if tracing.IsEnabled() { 1550 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.SetVpnclientIpsecParameters") 1551 defer func() { 1552 sc := -1 1553 if result.Response() != nil { 1554 sc = result.Response().StatusCode 1555 } 1556 tracing.EndSpan(ctx, sc, err) 1557 }() 1558 } 1559 if err := validation.Validate([]validation.Validation{ 1560 {TargetValue: vpnclientIpsecParams, 1561 Constraints: []validation.Constraint{{Target: "vpnclientIpsecParams.SaLifeTimeSeconds", Name: validation.Null, Rule: true, Chain: nil}, 1562 {Target: "vpnclientIpsecParams.SaDataSizeKilobytes", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 1563 return result, validation.NewError("network.VirtualNetworkGatewaysClient", "SetVpnclientIpsecParameters", err.Error()) 1564 } 1565 1566 req, err := client.SetVpnclientIpsecParametersPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams) 1567 if err != nil { 1568 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SetVpnclientIpsecParameters", nil, "Failure preparing request") 1569 return 1570 } 1571 1572 result, err = client.SetVpnclientIpsecParametersSender(req) 1573 if err != nil { 1574 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SetVpnclientIpsecParameters", nil, "Failure sending request") 1575 return 1576 } 1577 1578 return 1579} 1580 1581// SetVpnclientIpsecParametersPreparer prepares the SetVpnclientIpsecParameters request. 1582func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParametersPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIpsecParams VpnClientIPsecParameters) (*http.Request, error) { 1583 pathParameters := map[string]interface{}{ 1584 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1585 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1586 "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), 1587 } 1588 1589 const APIVersion = "2019-07-01" 1590 queryParameters := map[string]interface{}{ 1591 "api-version": APIVersion, 1592 } 1593 1594 preparer := autorest.CreatePreparer( 1595 autorest.AsContentType("application/json; charset=utf-8"), 1596 autorest.AsPost(), 1597 autorest.WithBaseURL(client.BaseURI), 1598 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/setvpnclientipsecparameters", pathParameters), 1599 autorest.WithJSON(vpnclientIpsecParams), 1600 autorest.WithQueryParameters(queryParameters)) 1601 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1602} 1603 1604// SetVpnclientIpsecParametersSender sends the SetVpnclientIpsecParameters request. The method will close the 1605// http.Response Body if it receives an error. 1606func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParametersSender(req *http.Request) (future VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture, err error) { 1607 var resp *http.Response 1608 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1609 if err != nil { 1610 return 1611 } 1612 var azf azure.Future 1613 azf, err = azure.NewFutureFromResponse(resp) 1614 future.FutureAPI = &azf 1615 future.Result = func(client VirtualNetworkGatewaysClient) (vcipp VpnClientIPsecParameters, err error) { 1616 var done bool 1617 done, err = future.DoneWithContext(context.Background(), client) 1618 if err != nil { 1619 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture", "Result", future.Response(), "Polling failure") 1620 return 1621 } 1622 if !done { 1623 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture") 1624 return 1625 } 1626 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1627 if vcipp.Response.Response, err = future.GetResult(sender); err == nil && vcipp.Response.Response.StatusCode != http.StatusNoContent { 1628 vcipp, err = client.SetVpnclientIpsecParametersResponder(vcipp.Response.Response) 1629 if err != nil { 1630 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture", "Result", vcipp.Response.Response, "Failure responding to request") 1631 } 1632 } 1633 return 1634 } 1635 return 1636} 1637 1638// SetVpnclientIpsecParametersResponder handles the response to the SetVpnclientIpsecParameters request. The method always 1639// closes the http.Response Body. 1640func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParametersResponder(resp *http.Response) (result VpnClientIPsecParameters, err error) { 1641 err = autorest.Respond( 1642 resp, 1643 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1644 autorest.ByUnmarshallingJSON(&result), 1645 autorest.ByClosing()) 1646 result.Response = autorest.Response{Response: resp} 1647 return 1648} 1649 1650// StartPacketCapture starts packet capture on virtual network gateway in the specified resource group. 1651// Parameters: 1652// resourceGroupName - the name of the resource group. 1653// virtualNetworkGatewayName - the name of the virtual network gateway. 1654// parameters - virtual network gateway packet capture parameters supplied to start packet capture on gateway. 1655func (client VirtualNetworkGatewaysClient) StartPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters *VpnPacketCaptureStartParameters) (result VirtualNetworkGatewaysStartPacketCaptureFuture, err error) { 1656 if tracing.IsEnabled() { 1657 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.StartPacketCapture") 1658 defer func() { 1659 sc := -1 1660 if result.Response() != nil { 1661 sc = result.Response().StatusCode 1662 } 1663 tracing.EndSpan(ctx, sc, err) 1664 }() 1665 } 1666 req, err := client.StartPacketCapturePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters) 1667 if err != nil { 1668 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "StartPacketCapture", nil, "Failure preparing request") 1669 return 1670 } 1671 1672 result, err = client.StartPacketCaptureSender(req) 1673 if err != nil { 1674 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "StartPacketCapture", nil, "Failure sending request") 1675 return 1676 } 1677 1678 return 1679} 1680 1681// StartPacketCapturePreparer prepares the StartPacketCapture request. 1682func (client VirtualNetworkGatewaysClient) StartPacketCapturePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters *VpnPacketCaptureStartParameters) (*http.Request, error) { 1683 pathParameters := map[string]interface{}{ 1684 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1685 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1686 "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), 1687 } 1688 1689 const APIVersion = "2019-07-01" 1690 queryParameters := map[string]interface{}{ 1691 "api-version": APIVersion, 1692 } 1693 1694 preparer := autorest.CreatePreparer( 1695 autorest.AsContentType("application/json; charset=utf-8"), 1696 autorest.AsPost(), 1697 autorest.WithBaseURL(client.BaseURI), 1698 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/startPacketCapture", pathParameters), 1699 autorest.WithQueryParameters(queryParameters)) 1700 if parameters != nil { 1701 preparer = autorest.DecoratePreparer(preparer, 1702 autorest.WithJSON(parameters)) 1703 } 1704 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1705} 1706 1707// StartPacketCaptureSender sends the StartPacketCapture request. The method will close the 1708// http.Response Body if it receives an error. 1709func (client VirtualNetworkGatewaysClient) StartPacketCaptureSender(req *http.Request) (future VirtualNetworkGatewaysStartPacketCaptureFuture, err error) { 1710 var resp *http.Response 1711 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1712 if err != nil { 1713 return 1714 } 1715 var azf azure.Future 1716 azf, err = azure.NewFutureFromResponse(resp) 1717 future.FutureAPI = &azf 1718 future.Result = func(client VirtualNetworkGatewaysClient) (s String, err error) { 1719 var done bool 1720 done, err = future.DoneWithContext(context.Background(), client) 1721 if err != nil { 1722 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStartPacketCaptureFuture", "Result", future.Response(), "Polling failure") 1723 return 1724 } 1725 if !done { 1726 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysStartPacketCaptureFuture") 1727 return 1728 } 1729 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1730 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { 1731 s, err = client.StartPacketCaptureResponder(s.Response.Response) 1732 if err != nil { 1733 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStartPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") 1734 } 1735 } 1736 return 1737 } 1738 return 1739} 1740 1741// StartPacketCaptureResponder handles the response to the StartPacketCapture request. The method always 1742// closes the http.Response Body. 1743func (client VirtualNetworkGatewaysClient) StartPacketCaptureResponder(resp *http.Response) (result String, err error) { 1744 err = autorest.Respond( 1745 resp, 1746 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1747 autorest.ByUnmarshallingJSON(&result), 1748 autorest.ByClosing()) 1749 result.Response = autorest.Response{Response: resp} 1750 return 1751} 1752 1753// StopPacketCapture stops packet capture on virtual network gateway in the specified resource group. 1754// Parameters: 1755// resourceGroupName - the name of the resource group. 1756// virtualNetworkGatewayName - the name of the virtual network gateway. 1757// parameters - virtual network gateway packet capture parameters supplied to stop packet capture on gateway. 1758func (client VirtualNetworkGatewaysClient) StopPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnPacketCaptureStopParameters) (result VirtualNetworkGatewaysStopPacketCaptureFuture, err error) { 1759 if tracing.IsEnabled() { 1760 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.StopPacketCapture") 1761 defer func() { 1762 sc := -1 1763 if result.Response() != nil { 1764 sc = result.Response().StatusCode 1765 } 1766 tracing.EndSpan(ctx, sc, err) 1767 }() 1768 } 1769 req, err := client.StopPacketCapturePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters) 1770 if err != nil { 1771 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "StopPacketCapture", nil, "Failure preparing request") 1772 return 1773 } 1774 1775 result, err = client.StopPacketCaptureSender(req) 1776 if err != nil { 1777 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "StopPacketCapture", nil, "Failure sending request") 1778 return 1779 } 1780 1781 return 1782} 1783 1784// StopPacketCapturePreparer prepares the StopPacketCapture request. 1785func (client VirtualNetworkGatewaysClient) StopPacketCapturePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnPacketCaptureStopParameters) (*http.Request, error) { 1786 pathParameters := map[string]interface{}{ 1787 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1788 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1789 "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), 1790 } 1791 1792 const APIVersion = "2019-07-01" 1793 queryParameters := map[string]interface{}{ 1794 "api-version": APIVersion, 1795 } 1796 1797 preparer := autorest.CreatePreparer( 1798 autorest.AsContentType("application/json; charset=utf-8"), 1799 autorest.AsPost(), 1800 autorest.WithBaseURL(client.BaseURI), 1801 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/stopPacketCapture", pathParameters), 1802 autorest.WithJSON(parameters), 1803 autorest.WithQueryParameters(queryParameters)) 1804 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1805} 1806 1807// StopPacketCaptureSender sends the StopPacketCapture request. The method will close the 1808// http.Response Body if it receives an error. 1809func (client VirtualNetworkGatewaysClient) StopPacketCaptureSender(req *http.Request) (future VirtualNetworkGatewaysStopPacketCaptureFuture, err error) { 1810 var resp *http.Response 1811 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1812 if err != nil { 1813 return 1814 } 1815 var azf azure.Future 1816 azf, err = azure.NewFutureFromResponse(resp) 1817 future.FutureAPI = &azf 1818 future.Result = func(client VirtualNetworkGatewaysClient) (s String, err error) { 1819 var done bool 1820 done, err = future.DoneWithContext(context.Background(), client) 1821 if err != nil { 1822 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStopPacketCaptureFuture", "Result", future.Response(), "Polling failure") 1823 return 1824 } 1825 if !done { 1826 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysStopPacketCaptureFuture") 1827 return 1828 } 1829 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1830 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { 1831 s, err = client.StopPacketCaptureResponder(s.Response.Response) 1832 if err != nil { 1833 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStopPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") 1834 } 1835 } 1836 return 1837 } 1838 return 1839} 1840 1841// StopPacketCaptureResponder handles the response to the StopPacketCapture request. The method always 1842// closes the http.Response Body. 1843func (client VirtualNetworkGatewaysClient) StopPacketCaptureResponder(resp *http.Response) (result String, err error) { 1844 err = autorest.Respond( 1845 resp, 1846 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1847 autorest.ByUnmarshallingJSON(&result), 1848 autorest.ByClosing()) 1849 result.Response = autorest.Response{Response: resp} 1850 return 1851} 1852 1853// SupportedVpnDevices gets a xml format representation for supported vpn devices. 1854// Parameters: 1855// resourceGroupName - the name of the resource group. 1856// virtualNetworkGatewayName - the name of the virtual network gateway. 1857func (client VirtualNetworkGatewaysClient) SupportedVpnDevices(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result String, err error) { 1858 if tracing.IsEnabled() { 1859 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.SupportedVpnDevices") 1860 defer func() { 1861 sc := -1 1862 if result.Response.Response != nil { 1863 sc = result.Response.Response.StatusCode 1864 } 1865 tracing.EndSpan(ctx, sc, err) 1866 }() 1867 } 1868 req, err := client.SupportedVpnDevicesPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) 1869 if err != nil { 1870 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SupportedVpnDevices", nil, "Failure preparing request") 1871 return 1872 } 1873 1874 resp, err := client.SupportedVpnDevicesSender(req) 1875 if err != nil { 1876 result.Response = autorest.Response{Response: resp} 1877 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SupportedVpnDevices", resp, "Failure sending request") 1878 return 1879 } 1880 1881 result, err = client.SupportedVpnDevicesResponder(resp) 1882 if err != nil { 1883 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SupportedVpnDevices", resp, "Failure responding to request") 1884 return 1885 } 1886 1887 return 1888} 1889 1890// SupportedVpnDevicesPreparer prepares the SupportedVpnDevices request. 1891func (client VirtualNetworkGatewaysClient) SupportedVpnDevicesPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { 1892 pathParameters := map[string]interface{}{ 1893 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1894 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1895 "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), 1896 } 1897 1898 const APIVersion = "2019-07-01" 1899 queryParameters := map[string]interface{}{ 1900 "api-version": APIVersion, 1901 } 1902 1903 preparer := autorest.CreatePreparer( 1904 autorest.AsPost(), 1905 autorest.WithBaseURL(client.BaseURI), 1906 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/supportedvpndevices", pathParameters), 1907 autorest.WithQueryParameters(queryParameters)) 1908 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1909} 1910 1911// SupportedVpnDevicesSender sends the SupportedVpnDevices request. The method will close the 1912// http.Response Body if it receives an error. 1913func (client VirtualNetworkGatewaysClient) SupportedVpnDevicesSender(req *http.Request) (*http.Response, error) { 1914 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1915} 1916 1917// SupportedVpnDevicesResponder handles the response to the SupportedVpnDevices request. The method always 1918// closes the http.Response Body. 1919func (client VirtualNetworkGatewaysClient) SupportedVpnDevicesResponder(resp *http.Response) (result String, err error) { 1920 err = autorest.Respond( 1921 resp, 1922 azure.WithErrorUnlessStatusCode(http.StatusOK), 1923 autorest.ByUnmarshallingJSON(&result.Value), 1924 autorest.ByClosing()) 1925 result.Response = autorest.Response{Response: resp} 1926 return 1927} 1928 1929// UpdateTags updates a virtual network gateway tags. 1930// Parameters: 1931// resourceGroupName - the name of the resource group. 1932// virtualNetworkGatewayName - the name of the virtual network gateway. 1933// parameters - parameters supplied to update virtual network gateway tags. 1934func (client VirtualNetworkGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters TagsObject) (result VirtualNetworkGatewaysUpdateTagsFuture, err error) { 1935 if tracing.IsEnabled() { 1936 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.UpdateTags") 1937 defer func() { 1938 sc := -1 1939 if result.Response() != nil { 1940 sc = result.Response().StatusCode 1941 } 1942 tracing.EndSpan(ctx, sc, err) 1943 }() 1944 } 1945 req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters) 1946 if err != nil { 1947 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "UpdateTags", nil, "Failure preparing request") 1948 return 1949 } 1950 1951 result, err = client.UpdateTagsSender(req) 1952 if err != nil { 1953 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "UpdateTags", nil, "Failure sending request") 1954 return 1955 } 1956 1957 return 1958} 1959 1960// UpdateTagsPreparer prepares the UpdateTags request. 1961func (client VirtualNetworkGatewaysClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters TagsObject) (*http.Request, error) { 1962 pathParameters := map[string]interface{}{ 1963 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1964 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1965 "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), 1966 } 1967 1968 const APIVersion = "2019-07-01" 1969 queryParameters := map[string]interface{}{ 1970 "api-version": APIVersion, 1971 } 1972 1973 preparer := autorest.CreatePreparer( 1974 autorest.AsContentType("application/json; charset=utf-8"), 1975 autorest.AsPatch(), 1976 autorest.WithBaseURL(client.BaseURI), 1977 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters), 1978 autorest.WithJSON(parameters), 1979 autorest.WithQueryParameters(queryParameters)) 1980 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1981} 1982 1983// UpdateTagsSender sends the UpdateTags request. The method will close the 1984// http.Response Body if it receives an error. 1985func (client VirtualNetworkGatewaysClient) UpdateTagsSender(req *http.Request) (future VirtualNetworkGatewaysUpdateTagsFuture, err error) { 1986 var resp *http.Response 1987 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1988 if err != nil { 1989 return 1990 } 1991 var azf azure.Future 1992 azf, err = azure.NewFutureFromResponse(resp) 1993 future.FutureAPI = &azf 1994 future.Result = func(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { 1995 var done bool 1996 done, err = future.DoneWithContext(context.Background(), client) 1997 if err != nil { 1998 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", future.Response(), "Polling failure") 1999 return 2000 } 2001 if !done { 2002 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysUpdateTagsFuture") 2003 return 2004 } 2005 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2006 if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent { 2007 vng, err = client.UpdateTagsResponder(vng.Response.Response) 2008 if err != nil { 2009 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", vng.Response.Response, "Failure responding to request") 2010 } 2011 } 2012 return 2013 } 2014 return 2015} 2016 2017// UpdateTagsResponder handles the response to the UpdateTags request. The method always 2018// closes the http.Response Body. 2019func (client VirtualNetworkGatewaysClient) UpdateTagsResponder(resp *http.Response) (result VirtualNetworkGateway, err error) { 2020 err = autorest.Respond( 2021 resp, 2022 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 2023 autorest.ByUnmarshallingJSON(&result), 2024 autorest.ByClosing()) 2025 result.Response = autorest.Response{Response: resp} 2026 return 2027} 2028 2029// VpnDeviceConfigurationScript gets a xml format representation for vpn device configuration script. 2030// Parameters: 2031// resourceGroupName - the name of the resource group. 2032// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection for which the 2033// configuration script is generated. 2034// parameters - parameters supplied to the generate vpn device script operation. 2035func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScript(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VpnDeviceScriptParameters) (result String, err error) { 2036 if tracing.IsEnabled() { 2037 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.VpnDeviceConfigurationScript") 2038 defer func() { 2039 sc := -1 2040 if result.Response.Response != nil { 2041 sc = result.Response.Response.StatusCode 2042 } 2043 tracing.EndSpan(ctx, sc, err) 2044 }() 2045 } 2046 req, err := client.VpnDeviceConfigurationScriptPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) 2047 if err != nil { 2048 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "VpnDeviceConfigurationScript", nil, "Failure preparing request") 2049 return 2050 } 2051 2052 resp, err := client.VpnDeviceConfigurationScriptSender(req) 2053 if err != nil { 2054 result.Response = autorest.Response{Response: resp} 2055 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "VpnDeviceConfigurationScript", resp, "Failure sending request") 2056 return 2057 } 2058 2059 result, err = client.VpnDeviceConfigurationScriptResponder(resp) 2060 if err != nil { 2061 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "VpnDeviceConfigurationScript", resp, "Failure responding to request") 2062 return 2063 } 2064 2065 return 2066} 2067 2068// VpnDeviceConfigurationScriptPreparer prepares the VpnDeviceConfigurationScript request. 2069func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScriptPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VpnDeviceScriptParameters) (*http.Request, error) { 2070 pathParameters := map[string]interface{}{ 2071 "resourceGroupName": autorest.Encode("path", resourceGroupName), 2072 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 2073 "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), 2074 } 2075 2076 const APIVersion = "2019-07-01" 2077 queryParameters := map[string]interface{}{ 2078 "api-version": APIVersion, 2079 } 2080 2081 preparer := autorest.CreatePreparer( 2082 autorest.AsContentType("application/json; charset=utf-8"), 2083 autorest.AsPost(), 2084 autorest.WithBaseURL(client.BaseURI), 2085 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/vpndeviceconfigurationscript", pathParameters), 2086 autorest.WithJSON(parameters), 2087 autorest.WithQueryParameters(queryParameters)) 2088 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2089} 2090 2091// VpnDeviceConfigurationScriptSender sends the VpnDeviceConfigurationScript request. The method will close the 2092// http.Response Body if it receives an error. 2093func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScriptSender(req *http.Request) (*http.Response, error) { 2094 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 2095} 2096 2097// VpnDeviceConfigurationScriptResponder handles the response to the VpnDeviceConfigurationScript request. The method always 2098// closes the http.Response Body. 2099func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScriptResponder(resp *http.Response) (result String, err error) { 2100 err = autorest.Respond( 2101 resp, 2102 azure.WithErrorUnlessStatusCode(http.StatusOK), 2103 autorest.ByUnmarshallingJSON(&result.Value), 2104 autorest.ByClosing()) 2105 result.Response = autorest.Response{Response: resp} 2106 return 2107} 2108