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