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