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