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