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// VirtualNetworkGatewayConnectionsClient is the network Client 19type VirtualNetworkGatewayConnectionsClient struct { 20 BaseClient 21} 22 23// NewVirtualNetworkGatewayConnectionsClient creates an instance of the VirtualNetworkGatewayConnectionsClient client. 24func NewVirtualNetworkGatewayConnectionsClient(subscriptionID string) VirtualNetworkGatewayConnectionsClient { 25 return NewVirtualNetworkGatewayConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) 26} 27 28// NewVirtualNetworkGatewayConnectionsClientWithBaseURI creates an instance of the 29// VirtualNetworkGatewayConnectionsClient client using a custom endpoint. Use this when interacting with an Azure 30// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). 31func NewVirtualNetworkGatewayConnectionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkGatewayConnectionsClient { 32 return VirtualNetworkGatewayConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} 33} 34 35// CreateOrUpdate creates or updates a virtual network gateway connection in the specified resource group. 36// Parameters: 37// resourceGroupName - the name of the resource group. 38// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection. 39// parameters - parameters supplied to the create or update virtual network gateway connection operation. 40func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection) (result VirtualNetworkGatewayConnectionsCreateOrUpdateFuture, err error) { 41 if tracing.IsEnabled() { 42 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.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.VirtualNetworkGatewayConnectionPropertiesFormat", Name: validation.Null, Rule: true, 54 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1", Name: validation.Null, Rule: true, 55 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, 56 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat.BgpSettings", Name: validation.Null, Rule: false, 57 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.Null, Rule: false, 58 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, 59 {Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, 60 }}, 61 }}, 62 }}, 63 }}, 64 {Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2", Name: validation.Null, Rule: false, 65 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, 66 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat.BgpSettings", Name: validation.Null, Rule: false, 67 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.Null, Rule: false, 68 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, 69 {Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, 70 }}, 71 }}, 72 }}, 73 }}, 74 {Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2", Name: validation.Null, Rule: false, 75 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, 76 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat.BgpSettings", Name: validation.Null, Rule: false, 77 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.Null, Rule: false, 78 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, 79 {Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, 80 }}, 81 }}, 82 }}, 83 }}, 84 }}}}}); err != nil { 85 return result, validation.NewError("network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", err.Error()) 86 } 87 88 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) 89 if err != nil { 90 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") 91 return 92 } 93 94 result, err = client.CreateOrUpdateSender(req) 95 if err != nil { 96 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", nil, "Failure sending request") 97 return 98 } 99 100 return 101} 102 103// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 104func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection) (*http.Request, error) { 105 pathParameters := map[string]interface{}{ 106 "resourceGroupName": autorest.Encode("path", resourceGroupName), 107 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 108 "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), 109 } 110 111 const APIVersion = "2021-03-01" 112 queryParameters := map[string]interface{}{ 113 "api-version": APIVersion, 114 } 115 116 parameters.Etag = nil 117 preparer := autorest.CreatePreparer( 118 autorest.AsContentType("application/json; charset=utf-8"), 119 autorest.AsPut(), 120 autorest.WithBaseURL(client.BaseURI), 121 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), 122 autorest.WithJSON(parameters), 123 autorest.WithQueryParameters(queryParameters)) 124 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 125} 126 127// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 128// http.Response Body if it receives an error. 129func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkGatewayConnectionsCreateOrUpdateFuture, err error) { 130 var resp *http.Response 131 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 132 if err != nil { 133 return 134 } 135 var azf azure.Future 136 azf, err = azure.NewFutureFromResponse(resp) 137 future.FutureAPI = &azf 138 future.Result = future.result 139 return 140} 141 142// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 143// closes the http.Response Body. 144func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkGatewayConnection, err error) { 145 err = autorest.Respond( 146 resp, 147 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 148 autorest.ByUnmarshallingJSON(&result), 149 autorest.ByClosing()) 150 result.Response = autorest.Response{Response: resp} 151 return 152} 153 154// Delete deletes the specified virtual network Gateway connection. 155// Parameters: 156// resourceGroupName - the name of the resource group. 157// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection. 158func (client VirtualNetworkGatewayConnectionsClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnectionsDeleteFuture, err error) { 159 if tracing.IsEnabled() { 160 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.Delete") 161 defer func() { 162 sc := -1 163 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 164 sc = result.FutureAPI.Response().StatusCode 165 } 166 tracing.EndSpan(ctx, sc, err) 167 }() 168 } 169 req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName) 170 if err != nil { 171 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", nil, "Failure preparing request") 172 return 173 } 174 175 result, err = client.DeleteSender(req) 176 if err != nil { 177 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", nil, "Failure sending request") 178 return 179 } 180 181 return 182} 183 184// DeletePreparer prepares the Delete request. 185func (client VirtualNetworkGatewayConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) { 186 pathParameters := map[string]interface{}{ 187 "resourceGroupName": autorest.Encode("path", resourceGroupName), 188 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 189 "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), 190 } 191 192 const APIVersion = "2021-03-01" 193 queryParameters := map[string]interface{}{ 194 "api-version": APIVersion, 195 } 196 197 preparer := autorest.CreatePreparer( 198 autorest.AsDelete(), 199 autorest.WithBaseURL(client.BaseURI), 200 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), 201 autorest.WithQueryParameters(queryParameters)) 202 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 203} 204 205// DeleteSender sends the Delete request. The method will close the 206// http.Response Body if it receives an error. 207func (client VirtualNetworkGatewayConnectionsClient) DeleteSender(req *http.Request) (future VirtualNetworkGatewayConnectionsDeleteFuture, err error) { 208 var resp *http.Response 209 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 210 if err != nil { 211 return 212 } 213 var azf azure.Future 214 azf, err = azure.NewFutureFromResponse(resp) 215 future.FutureAPI = &azf 216 future.Result = future.result 217 return 218} 219 220// DeleteResponder handles the response to the Delete request. The method always 221// closes the http.Response Body. 222func (client VirtualNetworkGatewayConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 223 err = autorest.Respond( 224 resp, 225 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), 226 autorest.ByClosing()) 227 result.Response = resp 228 return 229} 230 231// Get gets the specified virtual network gateway connection by resource group. 232// Parameters: 233// resourceGroupName - the name of the resource group. 234// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection. 235func (client VirtualNetworkGatewayConnectionsClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnection, err error) { 236 if tracing.IsEnabled() { 237 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.Get") 238 defer func() { 239 sc := -1 240 if result.Response.Response != nil { 241 sc = result.Response.Response.StatusCode 242 } 243 tracing.EndSpan(ctx, sc, err) 244 }() 245 } 246 req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName) 247 if err != nil { 248 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", nil, "Failure preparing request") 249 return 250 } 251 252 resp, err := client.GetSender(req) 253 if err != nil { 254 result.Response = autorest.Response{Response: resp} 255 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", resp, "Failure sending request") 256 return 257 } 258 259 result, err = client.GetResponder(resp) 260 if err != nil { 261 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", resp, "Failure responding to request") 262 return 263 } 264 265 return 266} 267 268// GetPreparer prepares the Get request. 269func (client VirtualNetworkGatewayConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) { 270 pathParameters := map[string]interface{}{ 271 "resourceGroupName": autorest.Encode("path", resourceGroupName), 272 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 273 "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), 274 } 275 276 const APIVersion = "2021-03-01" 277 queryParameters := map[string]interface{}{ 278 "api-version": APIVersion, 279 } 280 281 preparer := autorest.CreatePreparer( 282 autorest.AsGet(), 283 autorest.WithBaseURL(client.BaseURI), 284 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), 285 autorest.WithQueryParameters(queryParameters)) 286 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 287} 288 289// GetSender sends the Get request. The method will close the 290// http.Response Body if it receives an error. 291func (client VirtualNetworkGatewayConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { 292 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 293} 294 295// GetResponder handles the response to the Get request. The method always 296// closes the http.Response Body. 297func (client VirtualNetworkGatewayConnectionsClient) GetResponder(resp *http.Response) (result VirtualNetworkGatewayConnection, err error) { 298 err = autorest.Respond( 299 resp, 300 azure.WithErrorUnlessStatusCode(http.StatusOK), 301 autorest.ByUnmarshallingJSON(&result), 302 autorest.ByClosing()) 303 result.Response = autorest.Response{Response: resp} 304 return 305} 306 307// GetIkeSas lists IKE Security Associations for the virtual network gateway connection in the specified resource 308// group. 309// Parameters: 310// resourceGroupName - the name of the resource group. 311// virtualNetworkGatewayConnectionName - the name of the virtual network gateway Connection. 312func (client VirtualNetworkGatewayConnectionsClient) GetIkeSas(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnectionsGetIkeSasFuture, err error) { 313 if tracing.IsEnabled() { 314 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.GetIkeSas") 315 defer func() { 316 sc := -1 317 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 318 sc = result.FutureAPI.Response().StatusCode 319 } 320 tracing.EndSpan(ctx, sc, err) 321 }() 322 } 323 req, err := client.GetIkeSasPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName) 324 if err != nil { 325 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetIkeSas", nil, "Failure preparing request") 326 return 327 } 328 329 result, err = client.GetIkeSasSender(req) 330 if err != nil { 331 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetIkeSas", nil, "Failure sending request") 332 return 333 } 334 335 return 336} 337 338// GetIkeSasPreparer prepares the GetIkeSas request. 339func (client VirtualNetworkGatewayConnectionsClient) GetIkeSasPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) { 340 pathParameters := map[string]interface{}{ 341 "resourceGroupName": autorest.Encode("path", resourceGroupName), 342 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 343 "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), 344 } 345 346 const APIVersion = "2021-03-01" 347 queryParameters := map[string]interface{}{ 348 "api-version": APIVersion, 349 } 350 351 preparer := autorest.CreatePreparer( 352 autorest.AsPost(), 353 autorest.WithBaseURL(client.BaseURI), 354 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/getikesas", pathParameters), 355 autorest.WithQueryParameters(queryParameters)) 356 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 357} 358 359// GetIkeSasSender sends the GetIkeSas request. The method will close the 360// http.Response Body if it receives an error. 361func (client VirtualNetworkGatewayConnectionsClient) GetIkeSasSender(req *http.Request) (future VirtualNetworkGatewayConnectionsGetIkeSasFuture, err error) { 362 var resp *http.Response 363 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 364 if err != nil { 365 return 366 } 367 var azf azure.Future 368 azf, err = azure.NewFutureFromResponse(resp) 369 future.FutureAPI = &azf 370 future.Result = future.result 371 return 372} 373 374// GetIkeSasResponder handles the response to the GetIkeSas request. The method always 375// closes the http.Response Body. 376func (client VirtualNetworkGatewayConnectionsClient) GetIkeSasResponder(resp *http.Response) (result String, err error) { 377 err = autorest.Respond( 378 resp, 379 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 380 autorest.ByUnmarshallingJSON(&result), 381 autorest.ByClosing()) 382 result.Response = autorest.Response{Response: resp} 383 return 384} 385 386// GetSharedKey the Get VirtualNetworkGatewayConnectionSharedKey operation retrieves information about the specified 387// virtual network gateway connection shared key through Network resource provider. 388// Parameters: 389// resourceGroupName - the name of the resource group. 390// virtualNetworkGatewayConnectionName - the virtual network gateway connection shared key name. 391func (client VirtualNetworkGatewayConnectionsClient) GetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result ConnectionSharedKey, err error) { 392 if tracing.IsEnabled() { 393 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.GetSharedKey") 394 defer func() { 395 sc := -1 396 if result.Response.Response != nil { 397 sc = result.Response.Response.StatusCode 398 } 399 tracing.EndSpan(ctx, sc, err) 400 }() 401 } 402 req, err := client.GetSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName) 403 if err != nil { 404 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", nil, "Failure preparing request") 405 return 406 } 407 408 resp, err := client.GetSharedKeySender(req) 409 if err != nil { 410 result.Response = autorest.Response{Response: resp} 411 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", resp, "Failure sending request") 412 return 413 } 414 415 result, err = client.GetSharedKeyResponder(resp) 416 if err != nil { 417 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", resp, "Failure responding to request") 418 return 419 } 420 421 return 422} 423 424// GetSharedKeyPreparer prepares the GetSharedKey request. 425func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) { 426 pathParameters := map[string]interface{}{ 427 "resourceGroupName": autorest.Encode("path", resourceGroupName), 428 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 429 "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), 430 } 431 432 const APIVersion = "2021-03-01" 433 queryParameters := map[string]interface{}{ 434 "api-version": APIVersion, 435 } 436 437 preparer := autorest.CreatePreparer( 438 autorest.AsGet(), 439 autorest.WithBaseURL(client.BaseURI), 440 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey", pathParameters), 441 autorest.WithQueryParameters(queryParameters)) 442 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 443} 444 445// GetSharedKeySender sends the GetSharedKey request. The method will close the 446// http.Response Body if it receives an error. 447func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeySender(req *http.Request) (*http.Response, error) { 448 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 449} 450 451// GetSharedKeyResponder handles the response to the GetSharedKey request. The method always 452// closes the http.Response Body. 453func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyResponder(resp *http.Response) (result ConnectionSharedKey, err error) { 454 err = autorest.Respond( 455 resp, 456 azure.WithErrorUnlessStatusCode(http.StatusOK), 457 autorest.ByUnmarshallingJSON(&result), 458 autorest.ByClosing()) 459 result.Response = autorest.Response{Response: resp} 460 return 461} 462 463// List the List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways connections 464// created. 465// Parameters: 466// resourceGroupName - the name of the resource group. 467func (client VirtualNetworkGatewayConnectionsClient) List(ctx context.Context, resourceGroupName string) (result VirtualNetworkGatewayConnectionListResultPage, err error) { 468 if tracing.IsEnabled() { 469 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.List") 470 defer func() { 471 sc := -1 472 if result.vngclr.Response.Response != nil { 473 sc = result.vngclr.Response.Response.StatusCode 474 } 475 tracing.EndSpan(ctx, sc, err) 476 }() 477 } 478 result.fn = client.listNextResults 479 req, err := client.ListPreparer(ctx, resourceGroupName) 480 if err != nil { 481 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", nil, "Failure preparing request") 482 return 483 } 484 485 resp, err := client.ListSender(req) 486 if err != nil { 487 result.vngclr.Response = autorest.Response{Response: resp} 488 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure sending request") 489 return 490 } 491 492 result.vngclr, err = client.ListResponder(resp) 493 if err != nil { 494 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure responding to request") 495 return 496 } 497 if result.vngclr.hasNextLink() && result.vngclr.IsEmpty() { 498 err = result.NextWithContext(ctx) 499 return 500 } 501 502 return 503} 504 505// ListPreparer prepares the List request. 506func (client VirtualNetworkGatewayConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { 507 pathParameters := map[string]interface{}{ 508 "resourceGroupName": autorest.Encode("path", resourceGroupName), 509 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 510 } 511 512 const APIVersion = "2021-03-01" 513 queryParameters := map[string]interface{}{ 514 "api-version": APIVersion, 515 } 516 517 preparer := autorest.CreatePreparer( 518 autorest.AsGet(), 519 autorest.WithBaseURL(client.BaseURI), 520 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections", pathParameters), 521 autorest.WithQueryParameters(queryParameters)) 522 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 523} 524 525// ListSender sends the List request. The method will close the 526// http.Response Body if it receives an error. 527func (client VirtualNetworkGatewayConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { 528 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 529} 530 531// ListResponder handles the response to the List request. The method always 532// closes the http.Response Body. 533func (client VirtualNetworkGatewayConnectionsClient) ListResponder(resp *http.Response) (result VirtualNetworkGatewayConnectionListResult, err error) { 534 err = autorest.Respond( 535 resp, 536 azure.WithErrorUnlessStatusCode(http.StatusOK), 537 autorest.ByUnmarshallingJSON(&result), 538 autorest.ByClosing()) 539 result.Response = autorest.Response{Response: resp} 540 return 541} 542 543// listNextResults retrieves the next set of results, if any. 544func (client VirtualNetworkGatewayConnectionsClient) listNextResults(ctx context.Context, lastResults VirtualNetworkGatewayConnectionListResult) (result VirtualNetworkGatewayConnectionListResult, err error) { 545 req, err := lastResults.virtualNetworkGatewayConnectionListResultPreparer(ctx) 546 if err != nil { 547 return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "listNextResults", nil, "Failure preparing next results request") 548 } 549 if req == nil { 550 return 551 } 552 resp, err := client.ListSender(req) 553 if err != nil { 554 result.Response = autorest.Response{Response: resp} 555 return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "listNextResults", resp, "Failure sending next results request") 556 } 557 result, err = client.ListResponder(resp) 558 if err != nil { 559 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "listNextResults", resp, "Failure responding to next results request") 560 } 561 return 562} 563 564// ListComplete enumerates all values, automatically crossing page boundaries as required. 565func (client VirtualNetworkGatewayConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualNetworkGatewayConnectionListResultIterator, err error) { 566 if tracing.IsEnabled() { 567 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.List") 568 defer func() { 569 sc := -1 570 if result.Response().Response.Response != nil { 571 sc = result.page.Response().Response.Response.StatusCode 572 } 573 tracing.EndSpan(ctx, sc, err) 574 }() 575 } 576 result.page, err = client.List(ctx, resourceGroupName) 577 return 578} 579 580// ResetConnection resets the virtual network gateway connection specified. 581// Parameters: 582// resourceGroupName - the name of the resource group. 583// virtualNetworkGatewayConnectionName - the name of the virtual network gateway Connection. 584func (client VirtualNetworkGatewayConnectionsClient) ResetConnection(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnectionsResetConnectionFuture, err error) { 585 if tracing.IsEnabled() { 586 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.ResetConnection") 587 defer func() { 588 sc := -1 589 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 590 sc = result.FutureAPI.Response().StatusCode 591 } 592 tracing.EndSpan(ctx, sc, err) 593 }() 594 } 595 req, err := client.ResetConnectionPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName) 596 if err != nil { 597 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetConnection", nil, "Failure preparing request") 598 return 599 } 600 601 result, err = client.ResetConnectionSender(req) 602 if err != nil { 603 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetConnection", nil, "Failure sending request") 604 return 605 } 606 607 return 608} 609 610// ResetConnectionPreparer prepares the ResetConnection request. 611func (client VirtualNetworkGatewayConnectionsClient) ResetConnectionPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) { 612 pathParameters := map[string]interface{}{ 613 "resourceGroupName": autorest.Encode("path", resourceGroupName), 614 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 615 "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), 616 } 617 618 const APIVersion = "2021-03-01" 619 queryParameters := map[string]interface{}{ 620 "api-version": APIVersion, 621 } 622 623 preparer := autorest.CreatePreparer( 624 autorest.AsPost(), 625 autorest.WithBaseURL(client.BaseURI), 626 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/resetconnection", pathParameters), 627 autorest.WithQueryParameters(queryParameters)) 628 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 629} 630 631// ResetConnectionSender sends the ResetConnection request. The method will close the 632// http.Response Body if it receives an error. 633func (client VirtualNetworkGatewayConnectionsClient) ResetConnectionSender(req *http.Request) (future VirtualNetworkGatewayConnectionsResetConnectionFuture, err error) { 634 var resp *http.Response 635 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 636 if err != nil { 637 return 638 } 639 var azf azure.Future 640 azf, err = azure.NewFutureFromResponse(resp) 641 future.FutureAPI = &azf 642 future.Result = future.result 643 return 644} 645 646// ResetConnectionResponder handles the response to the ResetConnection request. The method always 647// closes the http.Response Body. 648func (client VirtualNetworkGatewayConnectionsClient) ResetConnectionResponder(resp *http.Response) (result autorest.Response, err error) { 649 err = autorest.Respond( 650 resp, 651 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 652 autorest.ByClosing()) 653 result.Response = resp 654 return 655} 656 657// ResetSharedKey the VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway 658// connection shared key for passed virtual network gateway connection in the specified resource group through Network 659// resource provider. 660// Parameters: 661// resourceGroupName - the name of the resource group. 662// virtualNetworkGatewayConnectionName - the virtual network gateway connection reset shared key Name. 663// parameters - parameters supplied to the begin reset virtual network gateway connection shared key operation 664// through network resource provider. 665func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey) (result VirtualNetworkGatewayConnectionsResetSharedKeyFuture, err error) { 666 if tracing.IsEnabled() { 667 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.ResetSharedKey") 668 defer func() { 669 sc := -1 670 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 671 sc = result.FutureAPI.Response().StatusCode 672 } 673 tracing.EndSpan(ctx, sc, err) 674 }() 675 } 676 if err := validation.Validate([]validation.Validation{ 677 {TargetValue: parameters, 678 Constraints: []validation.Constraint{{Target: "parameters.KeyLength", Name: validation.Null, Rule: true, 679 Chain: []validation.Constraint{{Target: "parameters.KeyLength", Name: validation.InclusiveMaximum, Rule: int64(128), Chain: nil}, 680 {Target: "parameters.KeyLength", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 681 }}}}}); err != nil { 682 return result, validation.NewError("network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", err.Error()) 683 } 684 685 req, err := client.ResetSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) 686 if err != nil { 687 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", nil, "Failure preparing request") 688 return 689 } 690 691 result, err = client.ResetSharedKeySender(req) 692 if err != nil { 693 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", nil, "Failure sending request") 694 return 695 } 696 697 return 698} 699 700// ResetSharedKeyPreparer prepares the ResetSharedKey request. 701func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey) (*http.Request, error) { 702 pathParameters := map[string]interface{}{ 703 "resourceGroupName": autorest.Encode("path", resourceGroupName), 704 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 705 "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), 706 } 707 708 const APIVersion = "2021-03-01" 709 queryParameters := map[string]interface{}{ 710 "api-version": APIVersion, 711 } 712 713 preparer := autorest.CreatePreparer( 714 autorest.AsContentType("application/json; charset=utf-8"), 715 autorest.AsPost(), 716 autorest.WithBaseURL(client.BaseURI), 717 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey/reset", pathParameters), 718 autorest.WithJSON(parameters), 719 autorest.WithQueryParameters(queryParameters)) 720 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 721} 722 723// ResetSharedKeySender sends the ResetSharedKey request. The method will close the 724// http.Response Body if it receives an error. 725func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeySender(req *http.Request) (future VirtualNetworkGatewayConnectionsResetSharedKeyFuture, err error) { 726 var resp *http.Response 727 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 728 if err != nil { 729 return 730 } 731 var azf azure.Future 732 azf, err = azure.NewFutureFromResponse(resp) 733 future.FutureAPI = &azf 734 future.Result = future.result 735 return 736} 737 738// ResetSharedKeyResponder handles the response to the ResetSharedKey request. The method always 739// closes the http.Response Body. 740func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyResponder(resp *http.Response) (result ConnectionResetSharedKey, err error) { 741 err = autorest.Respond( 742 resp, 743 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 744 autorest.ByUnmarshallingJSON(&result), 745 autorest.ByClosing()) 746 result.Response = autorest.Response{Response: resp} 747 return 748} 749 750// SetSharedKey the Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection 751// shared key for passed virtual network gateway connection in the specified resource group through Network resource 752// provider. 753// Parameters: 754// resourceGroupName - the name of the resource group. 755// virtualNetworkGatewayConnectionName - the virtual network gateway connection name. 756// parameters - parameters supplied to the Begin Set Virtual Network Gateway connection Shared key operation 757// throughNetwork resource provider. 758func (client VirtualNetworkGatewayConnectionsClient) SetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey) (result VirtualNetworkGatewayConnectionsSetSharedKeyFuture, err error) { 759 if tracing.IsEnabled() { 760 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.SetSharedKey") 761 defer func() { 762 sc := -1 763 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 764 sc = result.FutureAPI.Response().StatusCode 765 } 766 tracing.EndSpan(ctx, sc, err) 767 }() 768 } 769 if err := validation.Validate([]validation.Validation{ 770 {TargetValue: parameters, 771 Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 772 return result, validation.NewError("network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", err.Error()) 773 } 774 775 req, err := client.SetSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) 776 if err != nil { 777 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", nil, "Failure preparing request") 778 return 779 } 780 781 result, err = client.SetSharedKeySender(req) 782 if err != nil { 783 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", nil, "Failure sending request") 784 return 785 } 786 787 return 788} 789 790// SetSharedKeyPreparer prepares the SetSharedKey request. 791func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey) (*http.Request, error) { 792 pathParameters := map[string]interface{}{ 793 "resourceGroupName": autorest.Encode("path", resourceGroupName), 794 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 795 "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), 796 } 797 798 const APIVersion = "2021-03-01" 799 queryParameters := map[string]interface{}{ 800 "api-version": APIVersion, 801 } 802 803 preparer := autorest.CreatePreparer( 804 autorest.AsContentType("application/json; charset=utf-8"), 805 autorest.AsPut(), 806 autorest.WithBaseURL(client.BaseURI), 807 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey", pathParameters), 808 autorest.WithJSON(parameters), 809 autorest.WithQueryParameters(queryParameters)) 810 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 811} 812 813// SetSharedKeySender sends the SetSharedKey request. The method will close the 814// http.Response Body if it receives an error. 815func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeySender(req *http.Request) (future VirtualNetworkGatewayConnectionsSetSharedKeyFuture, err error) { 816 var resp *http.Response 817 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 818 if err != nil { 819 return 820 } 821 var azf azure.Future 822 azf, err = azure.NewFutureFromResponse(resp) 823 future.FutureAPI = &azf 824 future.Result = future.result 825 return 826} 827 828// SetSharedKeyResponder handles the response to the SetSharedKey request. The method always 829// closes the http.Response Body. 830func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyResponder(resp *http.Response) (result ConnectionSharedKey, err error) { 831 err = autorest.Respond( 832 resp, 833 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 834 autorest.ByUnmarshallingJSON(&result), 835 autorest.ByClosing()) 836 result.Response = autorest.Response{Response: resp} 837 return 838} 839 840// StartPacketCapture starts packet capture on virtual network gateway connection in the specified resource group. 841// Parameters: 842// resourceGroupName - the name of the resource group. 843// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection. 844// parameters - virtual network gateway packet capture parameters supplied to start packet capture on gateway 845// connection. 846func (client VirtualNetworkGatewayConnectionsClient) StartPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters *VpnPacketCaptureStartParameters) (result VirtualNetworkGatewayConnectionsStartPacketCaptureFuture, err error) { 847 if tracing.IsEnabled() { 848 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.StartPacketCapture") 849 defer func() { 850 sc := -1 851 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 852 sc = result.FutureAPI.Response().StatusCode 853 } 854 tracing.EndSpan(ctx, sc, err) 855 }() 856 } 857 req, err := client.StartPacketCapturePreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) 858 if err != nil { 859 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "StartPacketCapture", nil, "Failure preparing request") 860 return 861 } 862 863 result, err = client.StartPacketCaptureSender(req) 864 if err != nil { 865 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "StartPacketCapture", nil, "Failure sending request") 866 return 867 } 868 869 return 870} 871 872// StartPacketCapturePreparer prepares the StartPacketCapture request. 873func (client VirtualNetworkGatewayConnectionsClient) StartPacketCapturePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters *VpnPacketCaptureStartParameters) (*http.Request, error) { 874 pathParameters := map[string]interface{}{ 875 "resourceGroupName": autorest.Encode("path", resourceGroupName), 876 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 877 "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), 878 } 879 880 const APIVersion = "2021-03-01" 881 queryParameters := map[string]interface{}{ 882 "api-version": APIVersion, 883 } 884 885 preparer := autorest.CreatePreparer( 886 autorest.AsContentType("application/json; charset=utf-8"), 887 autorest.AsPost(), 888 autorest.WithBaseURL(client.BaseURI), 889 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/startPacketCapture", pathParameters), 890 autorest.WithQueryParameters(queryParameters)) 891 if parameters != nil { 892 preparer = autorest.DecoratePreparer(preparer, 893 autorest.WithJSON(parameters)) 894 } 895 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 896} 897 898// StartPacketCaptureSender sends the StartPacketCapture request. The method will close the 899// http.Response Body if it receives an error. 900func (client VirtualNetworkGatewayConnectionsClient) StartPacketCaptureSender(req *http.Request) (future VirtualNetworkGatewayConnectionsStartPacketCaptureFuture, err error) { 901 var resp *http.Response 902 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 903 if err != nil { 904 return 905 } 906 var azf azure.Future 907 azf, err = azure.NewFutureFromResponse(resp) 908 future.FutureAPI = &azf 909 future.Result = future.result 910 return 911} 912 913// StartPacketCaptureResponder handles the response to the StartPacketCapture request. The method always 914// closes the http.Response Body. 915func (client VirtualNetworkGatewayConnectionsClient) StartPacketCaptureResponder(resp *http.Response) (result String, err error) { 916 err = autorest.Respond( 917 resp, 918 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 919 autorest.ByUnmarshallingJSON(&result), 920 autorest.ByClosing()) 921 result.Response = autorest.Response{Response: resp} 922 return 923} 924 925// StopPacketCapture stops packet capture on virtual network gateway connection in the specified resource group. 926// Parameters: 927// resourceGroupName - the name of the resource group. 928// virtualNetworkGatewayConnectionName - the name of the virtual network gateway Connection. 929// parameters - virtual network gateway packet capture parameters supplied to stop packet capture on gateway 930// connection. 931func (client VirtualNetworkGatewayConnectionsClient) StopPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VpnPacketCaptureStopParameters) (result VirtualNetworkGatewayConnectionsStopPacketCaptureFuture, err error) { 932 if tracing.IsEnabled() { 933 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.StopPacketCapture") 934 defer func() { 935 sc := -1 936 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 937 sc = result.FutureAPI.Response().StatusCode 938 } 939 tracing.EndSpan(ctx, sc, err) 940 }() 941 } 942 req, err := client.StopPacketCapturePreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) 943 if err != nil { 944 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "StopPacketCapture", nil, "Failure preparing request") 945 return 946 } 947 948 result, err = client.StopPacketCaptureSender(req) 949 if err != nil { 950 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "StopPacketCapture", nil, "Failure sending request") 951 return 952 } 953 954 return 955} 956 957// StopPacketCapturePreparer prepares the StopPacketCapture request. 958func (client VirtualNetworkGatewayConnectionsClient) StopPacketCapturePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VpnPacketCaptureStopParameters) (*http.Request, error) { 959 pathParameters := map[string]interface{}{ 960 "resourceGroupName": autorest.Encode("path", resourceGroupName), 961 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 962 "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), 963 } 964 965 const APIVersion = "2021-03-01" 966 queryParameters := map[string]interface{}{ 967 "api-version": APIVersion, 968 } 969 970 preparer := autorest.CreatePreparer( 971 autorest.AsContentType("application/json; charset=utf-8"), 972 autorest.AsPost(), 973 autorest.WithBaseURL(client.BaseURI), 974 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/stopPacketCapture", pathParameters), 975 autorest.WithJSON(parameters), 976 autorest.WithQueryParameters(queryParameters)) 977 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 978} 979 980// StopPacketCaptureSender sends the StopPacketCapture request. The method will close the 981// http.Response Body if it receives an error. 982func (client VirtualNetworkGatewayConnectionsClient) StopPacketCaptureSender(req *http.Request) (future VirtualNetworkGatewayConnectionsStopPacketCaptureFuture, err error) { 983 var resp *http.Response 984 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 985 if err != nil { 986 return 987 } 988 var azf azure.Future 989 azf, err = azure.NewFutureFromResponse(resp) 990 future.FutureAPI = &azf 991 future.Result = future.result 992 return 993} 994 995// StopPacketCaptureResponder handles the response to the StopPacketCapture request. The method always 996// closes the http.Response Body. 997func (client VirtualNetworkGatewayConnectionsClient) StopPacketCaptureResponder(resp *http.Response) (result String, err error) { 998 err = autorest.Respond( 999 resp, 1000 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1001 autorest.ByUnmarshallingJSON(&result), 1002 autorest.ByClosing()) 1003 result.Response = autorest.Response{Response: resp} 1004 return 1005} 1006 1007// UpdateTags updates a virtual network gateway connection tags. 1008// Parameters: 1009// resourceGroupName - the name of the resource group. 1010// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection. 1011// parameters - parameters supplied to update virtual network gateway connection tags. 1012func (client VirtualNetworkGatewayConnectionsClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters TagsObject) (result VirtualNetworkGatewayConnectionsUpdateTagsFuture, err error) { 1013 if tracing.IsEnabled() { 1014 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.UpdateTags") 1015 defer func() { 1016 sc := -1 1017 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 1018 sc = result.FutureAPI.Response().StatusCode 1019 } 1020 tracing.EndSpan(ctx, sc, err) 1021 }() 1022 } 1023 req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) 1024 if err != nil { 1025 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "UpdateTags", nil, "Failure preparing request") 1026 return 1027 } 1028 1029 result, err = client.UpdateTagsSender(req) 1030 if err != nil { 1031 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "UpdateTags", nil, "Failure sending request") 1032 return 1033 } 1034 1035 return 1036} 1037 1038// UpdateTagsPreparer prepares the UpdateTags request. 1039func (client VirtualNetworkGatewayConnectionsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters TagsObject) (*http.Request, error) { 1040 pathParameters := map[string]interface{}{ 1041 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1042 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1043 "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), 1044 } 1045 1046 const APIVersion = "2021-03-01" 1047 queryParameters := map[string]interface{}{ 1048 "api-version": APIVersion, 1049 } 1050 1051 preparer := autorest.CreatePreparer( 1052 autorest.AsContentType("application/json; charset=utf-8"), 1053 autorest.AsPatch(), 1054 autorest.WithBaseURL(client.BaseURI), 1055 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), 1056 autorest.WithJSON(parameters), 1057 autorest.WithQueryParameters(queryParameters)) 1058 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1059} 1060 1061// UpdateTagsSender sends the UpdateTags request. The method will close the 1062// http.Response Body if it receives an error. 1063func (client VirtualNetworkGatewayConnectionsClient) UpdateTagsSender(req *http.Request) (future VirtualNetworkGatewayConnectionsUpdateTagsFuture, err error) { 1064 var resp *http.Response 1065 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1066 if err != nil { 1067 return 1068 } 1069 var azf azure.Future 1070 azf, err = azure.NewFutureFromResponse(resp) 1071 future.FutureAPI = &azf 1072 future.Result = future.result 1073 return 1074} 1075 1076// UpdateTagsResponder handles the response to the UpdateTags request. The method always 1077// closes the http.Response Body. 1078func (client VirtualNetworkGatewayConnectionsClient) UpdateTagsResponder(resp *http.Response) (result VirtualNetworkGatewayConnection, err error) { 1079 err = autorest.Respond( 1080 resp, 1081 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1082 autorest.ByUnmarshallingJSON(&result), 1083 autorest.ByClosing()) 1084 result.Response = autorest.Response{Response: resp} 1085 return 1086} 1087