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/tracing" 14 "net/http" 15) 16 17// VpnConnectionsClient is the network Client 18type VpnConnectionsClient struct { 19 BaseClient 20} 21 22// NewVpnConnectionsClient creates an instance of the VpnConnectionsClient client. 23func NewVpnConnectionsClient(subscriptionID string) VpnConnectionsClient { 24 return NewVpnConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) 25} 26 27// NewVpnConnectionsClientWithBaseURI creates an instance of the VpnConnectionsClient client using a custom endpoint. 28// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). 29func NewVpnConnectionsClientWithBaseURI(baseURI string, subscriptionID string) VpnConnectionsClient { 30 return VpnConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} 31} 32 33// CreateOrUpdate creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the existing 34// connection. 35// Parameters: 36// resourceGroupName - the resource group name of the VpnGateway. 37// gatewayName - the name of the gateway. 38// connectionName - the name of the connection. 39// vpnConnectionParameters - parameters supplied to create or Update a VPN Connection. 40func (client VpnConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, vpnConnectionParameters VpnConnection) (result VpnConnectionsCreateOrUpdateFuture, err error) { 41 if tracing.IsEnabled() { 42 ctx = tracing.StartSpan(ctx, fqdn+"/VpnConnectionsClient.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 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, gatewayName, connectionName, vpnConnectionParameters) 52 if err != nil { 53 err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") 54 return 55 } 56 57 result, err = client.CreateOrUpdateSender(req) 58 if err != nil { 59 err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "CreateOrUpdate", nil, "Failure sending request") 60 return 61 } 62 63 return 64} 65 66// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 67func (client VpnConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, vpnConnectionParameters VpnConnection) (*http.Request, error) { 68 pathParameters := map[string]interface{}{ 69 "connectionName": autorest.Encode("path", connectionName), 70 "gatewayName": autorest.Encode("path", gatewayName), 71 "resourceGroupName": autorest.Encode("path", resourceGroupName), 72 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 73 } 74 75 const APIVersion = "2020-11-01" 76 queryParameters := map[string]interface{}{ 77 "api-version": APIVersion, 78 } 79 80 vpnConnectionParameters.Etag = nil 81 preparer := autorest.CreatePreparer( 82 autorest.AsContentType("application/json; charset=utf-8"), 83 autorest.AsPut(), 84 autorest.WithBaseURL(client.BaseURI), 85 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}", pathParameters), 86 autorest.WithJSON(vpnConnectionParameters), 87 autorest.WithQueryParameters(queryParameters)) 88 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 89} 90 91// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 92// http.Response Body if it receives an error. 93func (client VpnConnectionsClient) CreateOrUpdateSender(req *http.Request) (future VpnConnectionsCreateOrUpdateFuture, err error) { 94 var resp *http.Response 95 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 96 if err != nil { 97 return 98 } 99 var azf azure.Future 100 azf, err = azure.NewFutureFromResponse(resp) 101 future.FutureAPI = &azf 102 future.Result = future.result 103 return 104} 105 106// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 107// closes the http.Response Body. 108func (client VpnConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result VpnConnection, err error) { 109 err = autorest.Respond( 110 resp, 111 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 112 autorest.ByUnmarshallingJSON(&result), 113 autorest.ByClosing()) 114 result.Response = autorest.Response{Response: resp} 115 return 116} 117 118// Delete deletes a vpn connection. 119// Parameters: 120// resourceGroupName - the resource group name of the VpnGateway. 121// gatewayName - the name of the gateway. 122// connectionName - the name of the connection. 123func (client VpnConnectionsClient) Delete(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string) (result VpnConnectionsDeleteFuture, err error) { 124 if tracing.IsEnabled() { 125 ctx = tracing.StartSpan(ctx, fqdn+"/VpnConnectionsClient.Delete") 126 defer func() { 127 sc := -1 128 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 129 sc = result.FutureAPI.Response().StatusCode 130 } 131 tracing.EndSpan(ctx, sc, err) 132 }() 133 } 134 req, err := client.DeletePreparer(ctx, resourceGroupName, gatewayName, connectionName) 135 if err != nil { 136 err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "Delete", nil, "Failure preparing request") 137 return 138 } 139 140 result, err = client.DeleteSender(req) 141 if err != nil { 142 err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "Delete", nil, "Failure sending request") 143 return 144 } 145 146 return 147} 148 149// DeletePreparer prepares the Delete request. 150func (client VpnConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string) (*http.Request, error) { 151 pathParameters := map[string]interface{}{ 152 "connectionName": autorest.Encode("path", connectionName), 153 "gatewayName": autorest.Encode("path", gatewayName), 154 "resourceGroupName": autorest.Encode("path", resourceGroupName), 155 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 156 } 157 158 const APIVersion = "2020-11-01" 159 queryParameters := map[string]interface{}{ 160 "api-version": APIVersion, 161 } 162 163 preparer := autorest.CreatePreparer( 164 autorest.AsDelete(), 165 autorest.WithBaseURL(client.BaseURI), 166 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}", pathParameters), 167 autorest.WithQueryParameters(queryParameters)) 168 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 169} 170 171// DeleteSender sends the Delete request. The method will close the 172// http.Response Body if it receives an error. 173func (client VpnConnectionsClient) DeleteSender(req *http.Request) (future VpnConnectionsDeleteFuture, err error) { 174 var resp *http.Response 175 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 176 if err != nil { 177 return 178 } 179 var azf azure.Future 180 azf, err = azure.NewFutureFromResponse(resp) 181 future.FutureAPI = &azf 182 future.Result = future.result 183 return 184} 185 186// DeleteResponder handles the response to the Delete request. The method always 187// closes the http.Response Body. 188func (client VpnConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 189 err = autorest.Respond( 190 resp, 191 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), 192 autorest.ByClosing()) 193 result.Response = resp 194 return 195} 196 197// Get retrieves the details of a vpn connection. 198// Parameters: 199// resourceGroupName - the resource group name of the VpnGateway. 200// gatewayName - the name of the gateway. 201// connectionName - the name of the vpn connection. 202func (client VpnConnectionsClient) Get(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string) (result VpnConnection, err error) { 203 if tracing.IsEnabled() { 204 ctx = tracing.StartSpan(ctx, fqdn+"/VpnConnectionsClient.Get") 205 defer func() { 206 sc := -1 207 if result.Response.Response != nil { 208 sc = result.Response.Response.StatusCode 209 } 210 tracing.EndSpan(ctx, sc, err) 211 }() 212 } 213 req, err := client.GetPreparer(ctx, resourceGroupName, gatewayName, connectionName) 214 if err != nil { 215 err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "Get", nil, "Failure preparing request") 216 return 217 } 218 219 resp, err := client.GetSender(req) 220 if err != nil { 221 result.Response = autorest.Response{Response: resp} 222 err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "Get", resp, "Failure sending request") 223 return 224 } 225 226 result, err = client.GetResponder(resp) 227 if err != nil { 228 err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "Get", resp, "Failure responding to request") 229 return 230 } 231 232 return 233} 234 235// GetPreparer prepares the Get request. 236func (client VpnConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string) (*http.Request, error) { 237 pathParameters := map[string]interface{}{ 238 "connectionName": autorest.Encode("path", connectionName), 239 "gatewayName": autorest.Encode("path", gatewayName), 240 "resourceGroupName": autorest.Encode("path", resourceGroupName), 241 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 242 } 243 244 const APIVersion = "2020-11-01" 245 queryParameters := map[string]interface{}{ 246 "api-version": APIVersion, 247 } 248 249 preparer := autorest.CreatePreparer( 250 autorest.AsGet(), 251 autorest.WithBaseURL(client.BaseURI), 252 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}", pathParameters), 253 autorest.WithQueryParameters(queryParameters)) 254 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 255} 256 257// GetSender sends the Get request. The method will close the 258// http.Response Body if it receives an error. 259func (client VpnConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { 260 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 261} 262 263// GetResponder handles the response to the Get request. The method always 264// closes the http.Response Body. 265func (client VpnConnectionsClient) GetResponder(resp *http.Response) (result VpnConnection, err error) { 266 err = autorest.Respond( 267 resp, 268 azure.WithErrorUnlessStatusCode(http.StatusOK), 269 autorest.ByUnmarshallingJSON(&result), 270 autorest.ByClosing()) 271 result.Response = autorest.Response{Response: resp} 272 return 273} 274 275// ListByVpnGateway retrieves all vpn connections for a particular virtual wan vpn gateway. 276// Parameters: 277// resourceGroupName - the resource group name of the VpnGateway. 278// gatewayName - the name of the gateway. 279func (client VpnConnectionsClient) ListByVpnGateway(ctx context.Context, resourceGroupName string, gatewayName string) (result ListVpnConnectionsResultPage, err error) { 280 if tracing.IsEnabled() { 281 ctx = tracing.StartSpan(ctx, fqdn+"/VpnConnectionsClient.ListByVpnGateway") 282 defer func() { 283 sc := -1 284 if result.lvcr.Response.Response != nil { 285 sc = result.lvcr.Response.Response.StatusCode 286 } 287 tracing.EndSpan(ctx, sc, err) 288 }() 289 } 290 result.fn = client.listByVpnGatewayNextResults 291 req, err := client.ListByVpnGatewayPreparer(ctx, resourceGroupName, gatewayName) 292 if err != nil { 293 err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "ListByVpnGateway", nil, "Failure preparing request") 294 return 295 } 296 297 resp, err := client.ListByVpnGatewaySender(req) 298 if err != nil { 299 result.lvcr.Response = autorest.Response{Response: resp} 300 err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "ListByVpnGateway", resp, "Failure sending request") 301 return 302 } 303 304 result.lvcr, err = client.ListByVpnGatewayResponder(resp) 305 if err != nil { 306 err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "ListByVpnGateway", resp, "Failure responding to request") 307 return 308 } 309 if result.lvcr.hasNextLink() && result.lvcr.IsEmpty() { 310 err = result.NextWithContext(ctx) 311 return 312 } 313 314 return 315} 316 317// ListByVpnGatewayPreparer prepares the ListByVpnGateway request. 318func (client VpnConnectionsClient) ListByVpnGatewayPreparer(ctx context.Context, resourceGroupName string, gatewayName string) (*http.Request, error) { 319 pathParameters := map[string]interface{}{ 320 "gatewayName": autorest.Encode("path", gatewayName), 321 "resourceGroupName": autorest.Encode("path", resourceGroupName), 322 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 323 } 324 325 const APIVersion = "2020-11-01" 326 queryParameters := map[string]interface{}{ 327 "api-version": APIVersion, 328 } 329 330 preparer := autorest.CreatePreparer( 331 autorest.AsGet(), 332 autorest.WithBaseURL(client.BaseURI), 333 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections", pathParameters), 334 autorest.WithQueryParameters(queryParameters)) 335 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 336} 337 338// ListByVpnGatewaySender sends the ListByVpnGateway request. The method will close the 339// http.Response Body if it receives an error. 340func (client VpnConnectionsClient) ListByVpnGatewaySender(req *http.Request) (*http.Response, error) { 341 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 342} 343 344// ListByVpnGatewayResponder handles the response to the ListByVpnGateway request. The method always 345// closes the http.Response Body. 346func (client VpnConnectionsClient) ListByVpnGatewayResponder(resp *http.Response) (result ListVpnConnectionsResult, err error) { 347 err = autorest.Respond( 348 resp, 349 azure.WithErrorUnlessStatusCode(http.StatusOK), 350 autorest.ByUnmarshallingJSON(&result), 351 autorest.ByClosing()) 352 result.Response = autorest.Response{Response: resp} 353 return 354} 355 356// listByVpnGatewayNextResults retrieves the next set of results, if any. 357func (client VpnConnectionsClient) listByVpnGatewayNextResults(ctx context.Context, lastResults ListVpnConnectionsResult) (result ListVpnConnectionsResult, err error) { 358 req, err := lastResults.listVpnConnectionsResultPreparer(ctx) 359 if err != nil { 360 return result, autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "listByVpnGatewayNextResults", nil, "Failure preparing next results request") 361 } 362 if req == nil { 363 return 364 } 365 resp, err := client.ListByVpnGatewaySender(req) 366 if err != nil { 367 result.Response = autorest.Response{Response: resp} 368 return result, autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "listByVpnGatewayNextResults", resp, "Failure sending next results request") 369 } 370 result, err = client.ListByVpnGatewayResponder(resp) 371 if err != nil { 372 err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "listByVpnGatewayNextResults", resp, "Failure responding to next results request") 373 } 374 return 375} 376 377// ListByVpnGatewayComplete enumerates all values, automatically crossing page boundaries as required. 378func (client VpnConnectionsClient) ListByVpnGatewayComplete(ctx context.Context, resourceGroupName string, gatewayName string) (result ListVpnConnectionsResultIterator, err error) { 379 if tracing.IsEnabled() { 380 ctx = tracing.StartSpan(ctx, fqdn+"/VpnConnectionsClient.ListByVpnGateway") 381 defer func() { 382 sc := -1 383 if result.Response().Response.Response != nil { 384 sc = result.page.Response().Response.Response.StatusCode 385 } 386 tracing.EndSpan(ctx, sc, err) 387 }() 388 } 389 result.page, err = client.ListByVpnGateway(ctx, resourceGroupName, gatewayName) 390 return 391} 392 393// StartPacketCapture starts packet capture on Vpn connection in the specified resource group. 394// Parameters: 395// resourceGroupName - the name of the resource group. 396// gatewayName - the name of the gateway. 397// vpnConnectionName - the name of the vpn connection. 398// parameters - vpn Connection packet capture parameters supplied to start packet capture on gateway 399// connection. 400func (client VpnConnectionsClient) StartPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, parameters *VpnConnectionPacketCaptureStartParameters) (result VpnConnectionsStartPacketCaptureFuture, err error) { 401 if tracing.IsEnabled() { 402 ctx = tracing.StartSpan(ctx, fqdn+"/VpnConnectionsClient.StartPacketCapture") 403 defer func() { 404 sc := -1 405 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 406 sc = result.FutureAPI.Response().StatusCode 407 } 408 tracing.EndSpan(ctx, sc, err) 409 }() 410 } 411 req, err := client.StartPacketCapturePreparer(ctx, resourceGroupName, gatewayName, vpnConnectionName, parameters) 412 if err != nil { 413 err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "StartPacketCapture", nil, "Failure preparing request") 414 return 415 } 416 417 result, err = client.StartPacketCaptureSender(req) 418 if err != nil { 419 err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "StartPacketCapture", nil, "Failure sending request") 420 return 421 } 422 423 return 424} 425 426// StartPacketCapturePreparer prepares the StartPacketCapture request. 427func (client VpnConnectionsClient) StartPacketCapturePreparer(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, parameters *VpnConnectionPacketCaptureStartParameters) (*http.Request, error) { 428 pathParameters := map[string]interface{}{ 429 "gatewayName": autorest.Encode("path", gatewayName), 430 "resourceGroupName": autorest.Encode("path", resourceGroupName), 431 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 432 "vpnConnectionName": autorest.Encode("path", vpnConnectionName), 433 } 434 435 const APIVersion = "2020-11-01" 436 queryParameters := map[string]interface{}{ 437 "api-version": APIVersion, 438 } 439 440 preparer := autorest.CreatePreparer( 441 autorest.AsContentType("application/json; charset=utf-8"), 442 autorest.AsPost(), 443 autorest.WithBaseURL(client.BaseURI), 444 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/startpacketcapture", pathParameters), 445 autorest.WithQueryParameters(queryParameters)) 446 if parameters != nil { 447 preparer = autorest.DecoratePreparer(preparer, 448 autorest.WithJSON(parameters)) 449 } 450 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 451} 452 453// StartPacketCaptureSender sends the StartPacketCapture request. The method will close the 454// http.Response Body if it receives an error. 455func (client VpnConnectionsClient) StartPacketCaptureSender(req *http.Request) (future VpnConnectionsStartPacketCaptureFuture, err error) { 456 var resp *http.Response 457 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 458 if err != nil { 459 return 460 } 461 var azf azure.Future 462 azf, err = azure.NewFutureFromResponse(resp) 463 future.FutureAPI = &azf 464 future.Result = future.result 465 return 466} 467 468// StartPacketCaptureResponder handles the response to the StartPacketCapture request. The method always 469// closes the http.Response Body. 470func (client VpnConnectionsClient) StartPacketCaptureResponder(resp *http.Response) (result String, err error) { 471 err = autorest.Respond( 472 resp, 473 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 474 autorest.ByUnmarshallingJSON(&result), 475 autorest.ByClosing()) 476 result.Response = autorest.Response{Response: resp} 477 return 478} 479 480// StopPacketCapture stops packet capture on Vpn connection in the specified resource group. 481// Parameters: 482// resourceGroupName - the name of the resource group. 483// gatewayName - the name of the gateway. 484// vpnConnectionName - the name of the vpn connection. 485// parameters - vpn Connection packet capture parameters supplied to stop packet capture on gateway connection. 486func (client VpnConnectionsClient) StopPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, parameters *VpnConnectionPacketCaptureStopParameters) (result VpnConnectionsStopPacketCaptureFuture, err error) { 487 if tracing.IsEnabled() { 488 ctx = tracing.StartSpan(ctx, fqdn+"/VpnConnectionsClient.StopPacketCapture") 489 defer func() { 490 sc := -1 491 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 492 sc = result.FutureAPI.Response().StatusCode 493 } 494 tracing.EndSpan(ctx, sc, err) 495 }() 496 } 497 req, err := client.StopPacketCapturePreparer(ctx, resourceGroupName, gatewayName, vpnConnectionName, parameters) 498 if err != nil { 499 err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "StopPacketCapture", nil, "Failure preparing request") 500 return 501 } 502 503 result, err = client.StopPacketCaptureSender(req) 504 if err != nil { 505 err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "StopPacketCapture", nil, "Failure sending request") 506 return 507 } 508 509 return 510} 511 512// StopPacketCapturePreparer prepares the StopPacketCapture request. 513func (client VpnConnectionsClient) StopPacketCapturePreparer(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, parameters *VpnConnectionPacketCaptureStopParameters) (*http.Request, error) { 514 pathParameters := map[string]interface{}{ 515 "gatewayName": autorest.Encode("path", gatewayName), 516 "resourceGroupName": autorest.Encode("path", resourceGroupName), 517 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 518 "vpnConnectionName": autorest.Encode("path", vpnConnectionName), 519 } 520 521 const APIVersion = "2020-11-01" 522 queryParameters := map[string]interface{}{ 523 "api-version": APIVersion, 524 } 525 526 preparer := autorest.CreatePreparer( 527 autorest.AsContentType("application/json; charset=utf-8"), 528 autorest.AsPost(), 529 autorest.WithBaseURL(client.BaseURI), 530 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/stoppacketcapture", pathParameters), 531 autorest.WithQueryParameters(queryParameters)) 532 if parameters != nil { 533 preparer = autorest.DecoratePreparer(preparer, 534 autorest.WithJSON(parameters)) 535 } 536 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 537} 538 539// StopPacketCaptureSender sends the StopPacketCapture request. The method will close the 540// http.Response Body if it receives an error. 541func (client VpnConnectionsClient) StopPacketCaptureSender(req *http.Request) (future VpnConnectionsStopPacketCaptureFuture, err error) { 542 var resp *http.Response 543 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 544 if err != nil { 545 return 546 } 547 var azf azure.Future 548 azf, err = azure.NewFutureFromResponse(resp) 549 future.FutureAPI = &azf 550 future.Result = future.result 551 return 552} 553 554// StopPacketCaptureResponder handles the response to the StopPacketCapture request. The method always 555// closes the http.Response Body. 556func (client VpnConnectionsClient) StopPacketCaptureResponder(resp *http.Response) (result String, err error) { 557 err = autorest.Respond( 558 resp, 559 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 560 autorest.ByUnmarshallingJSON(&result), 561 autorest.ByClosing()) 562 result.Response = autorest.Response{Response: resp} 563 return 564} 565