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