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