1package network 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "github.com/Azure/go-autorest/autorest" 12 "github.com/Azure/go-autorest/autorest/azure" 13 "github.com/Azure/go-autorest/autorest/validation" 14 "github.com/Azure/go-autorest/tracing" 15 "net/http" 16) 17 18// ApplicationGatewaysClient is the network Client 19type ApplicationGatewaysClient struct { 20 BaseClient 21} 22 23// NewApplicationGatewaysClient creates an instance of the ApplicationGatewaysClient client. 24func NewApplicationGatewaysClient(subscriptionID string) ApplicationGatewaysClient { 25 return NewApplicationGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID) 26} 27 28// NewApplicationGatewaysClientWithBaseURI creates an instance of the ApplicationGatewaysClient client using a custom 29// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure 30// stack). 31func NewApplicationGatewaysClientWithBaseURI(baseURI string, subscriptionID string) ApplicationGatewaysClient { 32 return ApplicationGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} 33} 34 35// BackendHealth gets the backend health of the specified application gateway in a resource group. 36// Parameters: 37// resourceGroupName - the name of the resource group. 38// applicationGatewayName - the name of the application gateway. 39// expand - expands BackendAddressPool and BackendHttpSettings referenced in backend health. 40func (client ApplicationGatewaysClient) BackendHealth(ctx context.Context, resourceGroupName string, applicationGatewayName string, expand string) (result ApplicationGatewaysBackendHealthFuture, err error) { 41 if tracing.IsEnabled() { 42 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.BackendHealth") 43 defer func() { 44 sc := -1 45 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 46 sc = result.FutureAPI.Response().StatusCode 47 } 48 tracing.EndSpan(ctx, sc, err) 49 }() 50 } 51 req, err := client.BackendHealthPreparer(ctx, resourceGroupName, applicationGatewayName, expand) 52 if err != nil { 53 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", nil, "Failure preparing request") 54 return 55 } 56 57 result, err = client.BackendHealthSender(req) 58 if err != nil { 59 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", nil, "Failure sending request") 60 return 61 } 62 63 return 64} 65 66// BackendHealthPreparer prepares the BackendHealth request. 67func (client ApplicationGatewaysClient) BackendHealthPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, expand string) (*http.Request, error) { 68 pathParameters := map[string]interface{}{ 69 "applicationGatewayName": autorest.Encode("path", applicationGatewayName), 70 "resourceGroupName": autorest.Encode("path", resourceGroupName), 71 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 72 } 73 74 const APIVersion = "2019-09-01" 75 queryParameters := map[string]interface{}{ 76 "api-version": APIVersion, 77 } 78 if len(expand) > 0 { 79 queryParameters["$expand"] = autorest.Encode("query", expand) 80 } 81 82 preparer := autorest.CreatePreparer( 83 autorest.AsPost(), 84 autorest.WithBaseURL(client.BaseURI), 85 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth", pathParameters), 86 autorest.WithQueryParameters(queryParameters)) 87 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 88} 89 90// BackendHealthSender sends the BackendHealth request. The method will close the 91// http.Response Body if it receives an error. 92func (client ApplicationGatewaysClient) BackendHealthSender(req *http.Request) (future ApplicationGatewaysBackendHealthFuture, err error) { 93 var resp *http.Response 94 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 95 if err != nil { 96 return 97 } 98 var azf azure.Future 99 azf, err = azure.NewFutureFromResponse(resp) 100 future.FutureAPI = &azf 101 future.Result = future.result 102 return 103} 104 105// BackendHealthResponder handles the response to the BackendHealth request. The method always 106// closes the http.Response Body. 107func (client ApplicationGatewaysClient) BackendHealthResponder(resp *http.Response) (result ApplicationGatewayBackendHealth, err error) { 108 err = autorest.Respond( 109 resp, 110 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 111 autorest.ByUnmarshallingJSON(&result), 112 autorest.ByClosing()) 113 result.Response = autorest.Response{Response: resp} 114 return 115} 116 117// BackendHealthOnDemand gets the backend health for given combination of backend pool and http setting of the 118// specified application gateway in a resource group. 119// Parameters: 120// resourceGroupName - the name of the resource group. 121// applicationGatewayName - the name of the application gateway. 122// probeRequest - request body for on-demand test probe operation. 123// expand - expands BackendAddressPool and BackendHttpSettings referenced in backend health. 124func (client ApplicationGatewaysClient) BackendHealthOnDemand(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest ApplicationGatewayOnDemandProbe, expand string) (result ApplicationGatewaysBackendHealthOnDemandFuture, err error) { 125 if tracing.IsEnabled() { 126 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.BackendHealthOnDemand") 127 defer func() { 128 sc := -1 129 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 130 sc = result.FutureAPI.Response().StatusCode 131 } 132 tracing.EndSpan(ctx, sc, err) 133 }() 134 } 135 req, err := client.BackendHealthOnDemandPreparer(ctx, resourceGroupName, applicationGatewayName, probeRequest, expand) 136 if err != nil { 137 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealthOnDemand", nil, "Failure preparing request") 138 return 139 } 140 141 result, err = client.BackendHealthOnDemandSender(req) 142 if err != nil { 143 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealthOnDemand", nil, "Failure sending request") 144 return 145 } 146 147 return 148} 149 150// BackendHealthOnDemandPreparer prepares the BackendHealthOnDemand request. 151func (client ApplicationGatewaysClient) BackendHealthOnDemandPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest ApplicationGatewayOnDemandProbe, expand string) (*http.Request, error) { 152 pathParameters := map[string]interface{}{ 153 "applicationGatewayName": autorest.Encode("path", applicationGatewayName), 154 "resourceGroupName": autorest.Encode("path", resourceGroupName), 155 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 156 } 157 158 const APIVersion = "2019-09-01" 159 queryParameters := map[string]interface{}{ 160 "api-version": APIVersion, 161 } 162 if len(expand) > 0 { 163 queryParameters["$expand"] = autorest.Encode("query", expand) 164 } 165 166 preparer := autorest.CreatePreparer( 167 autorest.AsContentType("application/json; charset=utf-8"), 168 autorest.AsPost(), 169 autorest.WithBaseURL(client.BaseURI), 170 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/getBackendHealthOnDemand", pathParameters), 171 autorest.WithJSON(probeRequest), 172 autorest.WithQueryParameters(queryParameters)) 173 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 174} 175 176// BackendHealthOnDemandSender sends the BackendHealthOnDemand request. The method will close the 177// http.Response Body if it receives an error. 178func (client ApplicationGatewaysClient) BackendHealthOnDemandSender(req *http.Request) (future ApplicationGatewaysBackendHealthOnDemandFuture, err error) { 179 var resp *http.Response 180 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 181 if err != nil { 182 return 183 } 184 var azf azure.Future 185 azf, err = azure.NewFutureFromResponse(resp) 186 future.FutureAPI = &azf 187 future.Result = future.result 188 return 189} 190 191// BackendHealthOnDemandResponder handles the response to the BackendHealthOnDemand request. The method always 192// closes the http.Response Body. 193func (client ApplicationGatewaysClient) BackendHealthOnDemandResponder(resp *http.Response) (result ApplicationGatewayBackendHealthOnDemand, err error) { 194 err = autorest.Respond( 195 resp, 196 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 197 autorest.ByUnmarshallingJSON(&result), 198 autorest.ByClosing()) 199 result.Response = autorest.Response{Response: resp} 200 return 201} 202 203// CreateOrUpdate creates or updates the specified application gateway. 204// Parameters: 205// resourceGroupName - the name of the resource group. 206// applicationGatewayName - the name of the application gateway. 207// parameters - parameters supplied to the create or update application gateway operation. 208func (client ApplicationGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway) (result ApplicationGatewaysCreateOrUpdateFuture, err error) { 209 if tracing.IsEnabled() { 210 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.CreateOrUpdate") 211 defer func() { 212 sc := -1 213 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 214 sc = result.FutureAPI.Response().StatusCode 215 } 216 tracing.EndSpan(ctx, sc, err) 217 }() 218 } 219 if err := validation.Validate([]validation.Validation{ 220 {TargetValue: parameters, 221 Constraints: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat", Name: validation.Null, Rule: false, 222 Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration", Name: validation.Null, Rule: false, 223 Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.Enabled", Name: validation.Null, Rule: true, Chain: nil}, 224 {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetType", Name: validation.Null, Rule: true, Chain: nil}, 225 {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetVersion", Name: validation.Null, Rule: true, Chain: nil}, 226 {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySize", Name: validation.Null, Rule: false, 227 Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySize", Name: validation.InclusiveMaximum, Rule: int64(128), Chain: nil}, 228 {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySize", Name: validation.InclusiveMinimum, Rule: int64(8), Chain: nil}, 229 }}, 230 {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySizeInKb", Name: validation.Null, Rule: false, 231 Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySizeInKb", Name: validation.InclusiveMaximum, Rule: int64(128), Chain: nil}, 232 {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySizeInKb", Name: validation.InclusiveMinimum, Rule: int64(8), Chain: nil}, 233 }}, 234 {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.FileUploadLimitInMb", Name: validation.Null, Rule: false, 235 Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.FileUploadLimitInMb", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, 236 }}, 237 {Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration", Name: validation.Null, Rule: false, 238 Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration.MinCapacity", Name: validation.Null, Rule: true, 239 Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration.MinCapacity", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, 240 {Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration.MaxCapacity", Name: validation.Null, Rule: false, 241 Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration.MaxCapacity", Name: validation.InclusiveMinimum, Rule: int64(2), Chain: nil}}}, 242 }}, 243 }}}}}); err != nil { 244 return result, validation.NewError("network.ApplicationGatewaysClient", "CreateOrUpdate", err.Error()) 245 } 246 247 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationGatewayName, parameters) 248 if err != nil { 249 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request") 250 return 251 } 252 253 result, err = client.CreateOrUpdateSender(req) 254 if err != nil { 255 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", nil, "Failure sending request") 256 return 257 } 258 259 return 260} 261 262// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 263func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway) (*http.Request, error) { 264 pathParameters := map[string]interface{}{ 265 "applicationGatewayName": autorest.Encode("path", applicationGatewayName), 266 "resourceGroupName": autorest.Encode("path", resourceGroupName), 267 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 268 } 269 270 const APIVersion = "2019-09-01" 271 queryParameters := map[string]interface{}{ 272 "api-version": APIVersion, 273 } 274 275 parameters.Etag = nil 276 preparer := autorest.CreatePreparer( 277 autorest.AsContentType("application/json; charset=utf-8"), 278 autorest.AsPut(), 279 autorest.WithBaseURL(client.BaseURI), 280 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters), 281 autorest.WithJSON(parameters), 282 autorest.WithQueryParameters(queryParameters)) 283 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 284} 285 286// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 287// http.Response Body if it receives an error. 288func (client ApplicationGatewaysClient) CreateOrUpdateSender(req *http.Request) (future ApplicationGatewaysCreateOrUpdateFuture, err error) { 289 var resp *http.Response 290 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 291 if err != nil { 292 return 293 } 294 var azf azure.Future 295 azf, err = azure.NewFutureFromResponse(resp) 296 future.FutureAPI = &azf 297 future.Result = future.result 298 return 299} 300 301// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 302// closes the http.Response Body. 303func (client ApplicationGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationGateway, err error) { 304 err = autorest.Respond( 305 resp, 306 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 307 autorest.ByUnmarshallingJSON(&result), 308 autorest.ByClosing()) 309 result.Response = autorest.Response{Response: resp} 310 return 311} 312 313// Delete deletes the specified application gateway. 314// Parameters: 315// resourceGroupName - the name of the resource group. 316// applicationGatewayName - the name of the application gateway. 317func (client ApplicationGatewaysClient) Delete(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysDeleteFuture, err error) { 318 if tracing.IsEnabled() { 319 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.Delete") 320 defer func() { 321 sc := -1 322 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 323 sc = result.FutureAPI.Response().StatusCode 324 } 325 tracing.EndSpan(ctx, sc, err) 326 }() 327 } 328 req, err := client.DeletePreparer(ctx, resourceGroupName, applicationGatewayName) 329 if err != nil { 330 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", nil, "Failure preparing request") 331 return 332 } 333 334 result, err = client.DeleteSender(req) 335 if err != nil { 336 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", nil, "Failure sending request") 337 return 338 } 339 340 return 341} 342 343// DeletePreparer prepares the Delete request. 344func (client ApplicationGatewaysClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) { 345 pathParameters := map[string]interface{}{ 346 "applicationGatewayName": autorest.Encode("path", applicationGatewayName), 347 "resourceGroupName": autorest.Encode("path", resourceGroupName), 348 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 349 } 350 351 const APIVersion = "2019-09-01" 352 queryParameters := map[string]interface{}{ 353 "api-version": APIVersion, 354 } 355 356 preparer := autorest.CreatePreparer( 357 autorest.AsDelete(), 358 autorest.WithBaseURL(client.BaseURI), 359 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters), 360 autorest.WithQueryParameters(queryParameters)) 361 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 362} 363 364// DeleteSender sends the Delete request. The method will close the 365// http.Response Body if it receives an error. 366func (client ApplicationGatewaysClient) DeleteSender(req *http.Request) (future ApplicationGatewaysDeleteFuture, err error) { 367 var resp *http.Response 368 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 369 if err != nil { 370 return 371 } 372 var azf azure.Future 373 azf, err = azure.NewFutureFromResponse(resp) 374 future.FutureAPI = &azf 375 future.Result = future.result 376 return 377} 378 379// DeleteResponder handles the response to the Delete request. The method always 380// closes the http.Response Body. 381func (client ApplicationGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 382 err = autorest.Respond( 383 resp, 384 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), 385 autorest.ByClosing()) 386 result.Response = resp 387 return 388} 389 390// Get gets the specified application gateway. 391// Parameters: 392// resourceGroupName - the name of the resource group. 393// applicationGatewayName - the name of the application gateway. 394func (client ApplicationGatewaysClient) Get(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGateway, err error) { 395 if tracing.IsEnabled() { 396 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.Get") 397 defer func() { 398 sc := -1 399 if result.Response.Response != nil { 400 sc = result.Response.Response.StatusCode 401 } 402 tracing.EndSpan(ctx, sc, err) 403 }() 404 } 405 req, err := client.GetPreparer(ctx, resourceGroupName, applicationGatewayName) 406 if err != nil { 407 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", nil, "Failure preparing request") 408 return 409 } 410 411 resp, err := client.GetSender(req) 412 if err != nil { 413 result.Response = autorest.Response{Response: resp} 414 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", resp, "Failure sending request") 415 return 416 } 417 418 result, err = client.GetResponder(resp) 419 if err != nil { 420 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", resp, "Failure responding to request") 421 return 422 } 423 424 return 425} 426 427// GetPreparer prepares the Get request. 428func (client ApplicationGatewaysClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) { 429 pathParameters := map[string]interface{}{ 430 "applicationGatewayName": autorest.Encode("path", applicationGatewayName), 431 "resourceGroupName": autorest.Encode("path", resourceGroupName), 432 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 433 } 434 435 const APIVersion = "2019-09-01" 436 queryParameters := map[string]interface{}{ 437 "api-version": APIVersion, 438 } 439 440 preparer := autorest.CreatePreparer( 441 autorest.AsGet(), 442 autorest.WithBaseURL(client.BaseURI), 443 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters), 444 autorest.WithQueryParameters(queryParameters)) 445 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 446} 447 448// GetSender sends the Get request. The method will close the 449// http.Response Body if it receives an error. 450func (client ApplicationGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { 451 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 452} 453 454// GetResponder handles the response to the Get request. The method always 455// closes the http.Response Body. 456func (client ApplicationGatewaysClient) GetResponder(resp *http.Response) (result ApplicationGateway, err error) { 457 err = autorest.Respond( 458 resp, 459 azure.WithErrorUnlessStatusCode(http.StatusOK), 460 autorest.ByUnmarshallingJSON(&result), 461 autorest.ByClosing()) 462 result.Response = autorest.Response{Response: resp} 463 return 464} 465 466// GetSslPredefinedPolicy gets Ssl predefined policy with the specified policy name. 467// Parameters: 468// predefinedPolicyName - name of Ssl predefined policy. 469func (client ApplicationGatewaysClient) GetSslPredefinedPolicy(ctx context.Context, predefinedPolicyName string) (result ApplicationGatewaySslPredefinedPolicy, err error) { 470 if tracing.IsEnabled() { 471 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.GetSslPredefinedPolicy") 472 defer func() { 473 sc := -1 474 if result.Response.Response != nil { 475 sc = result.Response.Response.StatusCode 476 } 477 tracing.EndSpan(ctx, sc, err) 478 }() 479 } 480 req, err := client.GetSslPredefinedPolicyPreparer(ctx, predefinedPolicyName) 481 if err != nil { 482 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "GetSslPredefinedPolicy", nil, "Failure preparing request") 483 return 484 } 485 486 resp, err := client.GetSslPredefinedPolicySender(req) 487 if err != nil { 488 result.Response = autorest.Response{Response: resp} 489 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "GetSslPredefinedPolicy", resp, "Failure sending request") 490 return 491 } 492 493 result, err = client.GetSslPredefinedPolicyResponder(resp) 494 if err != nil { 495 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "GetSslPredefinedPolicy", resp, "Failure responding to request") 496 return 497 } 498 499 return 500} 501 502// GetSslPredefinedPolicyPreparer prepares the GetSslPredefinedPolicy request. 503func (client ApplicationGatewaysClient) GetSslPredefinedPolicyPreparer(ctx context.Context, predefinedPolicyName string) (*http.Request, error) { 504 pathParameters := map[string]interface{}{ 505 "predefinedPolicyName": autorest.Encode("path", predefinedPolicyName), 506 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 507 } 508 509 const APIVersion = "2019-09-01" 510 queryParameters := map[string]interface{}{ 511 "api-version": APIVersion, 512 } 513 514 preparer := autorest.CreatePreparer( 515 autorest.AsGet(), 516 autorest.WithBaseURL(client.BaseURI), 517 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName}", pathParameters), 518 autorest.WithQueryParameters(queryParameters)) 519 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 520} 521 522// GetSslPredefinedPolicySender sends the GetSslPredefinedPolicy request. The method will close the 523// http.Response Body if it receives an error. 524func (client ApplicationGatewaysClient) GetSslPredefinedPolicySender(req *http.Request) (*http.Response, error) { 525 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 526} 527 528// GetSslPredefinedPolicyResponder handles the response to the GetSslPredefinedPolicy request. The method always 529// closes the http.Response Body. 530func (client ApplicationGatewaysClient) GetSslPredefinedPolicyResponder(resp *http.Response) (result ApplicationGatewaySslPredefinedPolicy, err error) { 531 err = autorest.Respond( 532 resp, 533 azure.WithErrorUnlessStatusCode(http.StatusOK), 534 autorest.ByUnmarshallingJSON(&result), 535 autorest.ByClosing()) 536 result.Response = autorest.Response{Response: resp} 537 return 538} 539 540// List lists all application gateways in a resource group. 541// Parameters: 542// resourceGroupName - the name of the resource group. 543func (client ApplicationGatewaysClient) List(ctx context.Context, resourceGroupName string) (result ApplicationGatewayListResultPage, err error) { 544 if tracing.IsEnabled() { 545 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.List") 546 defer func() { 547 sc := -1 548 if result.aglr.Response.Response != nil { 549 sc = result.aglr.Response.Response.StatusCode 550 } 551 tracing.EndSpan(ctx, sc, err) 552 }() 553 } 554 result.fn = client.listNextResults 555 req, err := client.ListPreparer(ctx, resourceGroupName) 556 if err != nil { 557 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", nil, "Failure preparing request") 558 return 559 } 560 561 resp, err := client.ListSender(req) 562 if err != nil { 563 result.aglr.Response = autorest.Response{Response: resp} 564 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure sending request") 565 return 566 } 567 568 result.aglr, err = client.ListResponder(resp) 569 if err != nil { 570 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure responding to request") 571 return 572 } 573 if result.aglr.hasNextLink() && result.aglr.IsEmpty() { 574 err = result.NextWithContext(ctx) 575 return 576 } 577 578 return 579} 580 581// ListPreparer prepares the List request. 582func (client ApplicationGatewaysClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { 583 pathParameters := map[string]interface{}{ 584 "resourceGroupName": autorest.Encode("path", resourceGroupName), 585 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 586 } 587 588 const APIVersion = "2019-09-01" 589 queryParameters := map[string]interface{}{ 590 "api-version": APIVersion, 591 } 592 593 preparer := autorest.CreatePreparer( 594 autorest.AsGet(), 595 autorest.WithBaseURL(client.BaseURI), 596 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways", pathParameters), 597 autorest.WithQueryParameters(queryParameters)) 598 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 599} 600 601// ListSender sends the List request. The method will close the 602// http.Response Body if it receives an error. 603func (client ApplicationGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { 604 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 605} 606 607// ListResponder handles the response to the List request. The method always 608// closes the http.Response Body. 609func (client ApplicationGatewaysClient) ListResponder(resp *http.Response) (result ApplicationGatewayListResult, err error) { 610 err = autorest.Respond( 611 resp, 612 azure.WithErrorUnlessStatusCode(http.StatusOK), 613 autorest.ByUnmarshallingJSON(&result), 614 autorest.ByClosing()) 615 result.Response = autorest.Response{Response: resp} 616 return 617} 618 619// listNextResults retrieves the next set of results, if any. 620func (client ApplicationGatewaysClient) listNextResults(ctx context.Context, lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) { 621 req, err := lastResults.applicationGatewayListResultPreparer(ctx) 622 if err != nil { 623 return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listNextResults", nil, "Failure preparing next results request") 624 } 625 if req == nil { 626 return 627 } 628 resp, err := client.ListSender(req) 629 if err != nil { 630 result.Response = autorest.Response{Response: resp} 631 return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listNextResults", resp, "Failure sending next results request") 632 } 633 result, err = client.ListResponder(resp) 634 if err != nil { 635 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listNextResults", resp, "Failure responding to next results request") 636 } 637 return 638} 639 640// ListComplete enumerates all values, automatically crossing page boundaries as required. 641func (client ApplicationGatewaysClient) ListComplete(ctx context.Context, resourceGroupName string) (result ApplicationGatewayListResultIterator, err error) { 642 if tracing.IsEnabled() { 643 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.List") 644 defer func() { 645 sc := -1 646 if result.Response().Response.Response != nil { 647 sc = result.page.Response().Response.Response.StatusCode 648 } 649 tracing.EndSpan(ctx, sc, err) 650 }() 651 } 652 result.page, err = client.List(ctx, resourceGroupName) 653 return 654} 655 656// ListAll gets all the application gateways in a subscription. 657func (client ApplicationGatewaysClient) ListAll(ctx context.Context) (result ApplicationGatewayListResultPage, err error) { 658 if tracing.IsEnabled() { 659 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAll") 660 defer func() { 661 sc := -1 662 if result.aglr.Response.Response != nil { 663 sc = result.aglr.Response.Response.StatusCode 664 } 665 tracing.EndSpan(ctx, sc, err) 666 }() 667 } 668 result.fn = client.listAllNextResults 669 req, err := client.ListAllPreparer(ctx) 670 if err != nil { 671 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", nil, "Failure preparing request") 672 return 673 } 674 675 resp, err := client.ListAllSender(req) 676 if err != nil { 677 result.aglr.Response = autorest.Response{Response: resp} 678 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure sending request") 679 return 680 } 681 682 result.aglr, err = client.ListAllResponder(resp) 683 if err != nil { 684 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure responding to request") 685 return 686 } 687 if result.aglr.hasNextLink() && result.aglr.IsEmpty() { 688 err = result.NextWithContext(ctx) 689 return 690 } 691 692 return 693} 694 695// ListAllPreparer prepares the ListAll request. 696func (client ApplicationGatewaysClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { 697 pathParameters := map[string]interface{}{ 698 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 699 } 700 701 const APIVersion = "2019-09-01" 702 queryParameters := map[string]interface{}{ 703 "api-version": APIVersion, 704 } 705 706 preparer := autorest.CreatePreparer( 707 autorest.AsGet(), 708 autorest.WithBaseURL(client.BaseURI), 709 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways", pathParameters), 710 autorest.WithQueryParameters(queryParameters)) 711 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 712} 713 714// ListAllSender sends the ListAll request. The method will close the 715// http.Response Body if it receives an error. 716func (client ApplicationGatewaysClient) ListAllSender(req *http.Request) (*http.Response, error) { 717 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 718} 719 720// ListAllResponder handles the response to the ListAll request. The method always 721// closes the http.Response Body. 722func (client ApplicationGatewaysClient) ListAllResponder(resp *http.Response) (result ApplicationGatewayListResult, err error) { 723 err = autorest.Respond( 724 resp, 725 azure.WithErrorUnlessStatusCode(http.StatusOK), 726 autorest.ByUnmarshallingJSON(&result), 727 autorest.ByClosing()) 728 result.Response = autorest.Response{Response: resp} 729 return 730} 731 732// listAllNextResults retrieves the next set of results, if any. 733func (client ApplicationGatewaysClient) listAllNextResults(ctx context.Context, lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) { 734 req, err := lastResults.applicationGatewayListResultPreparer(ctx) 735 if err != nil { 736 return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAllNextResults", nil, "Failure preparing next results request") 737 } 738 if req == nil { 739 return 740 } 741 resp, err := client.ListAllSender(req) 742 if err != nil { 743 result.Response = autorest.Response{Response: resp} 744 return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAllNextResults", resp, "Failure sending next results request") 745 } 746 result, err = client.ListAllResponder(resp) 747 if err != nil { 748 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAllNextResults", resp, "Failure responding to next results request") 749 } 750 return 751} 752 753// ListAllComplete enumerates all values, automatically crossing page boundaries as required. 754func (client ApplicationGatewaysClient) ListAllComplete(ctx context.Context) (result ApplicationGatewayListResultIterator, err error) { 755 if tracing.IsEnabled() { 756 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAll") 757 defer func() { 758 sc := -1 759 if result.Response().Response.Response != nil { 760 sc = result.page.Response().Response.Response.StatusCode 761 } 762 tracing.EndSpan(ctx, sc, err) 763 }() 764 } 765 result.page, err = client.ListAll(ctx) 766 return 767} 768 769// ListAvailableRequestHeaders lists all available request headers. 770func (client ApplicationGatewaysClient) ListAvailableRequestHeaders(ctx context.Context) (result ListString, err error) { 771 if tracing.IsEnabled() { 772 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableRequestHeaders") 773 defer func() { 774 sc := -1 775 if result.Response.Response != nil { 776 sc = result.Response.Response.StatusCode 777 } 778 tracing.EndSpan(ctx, sc, err) 779 }() 780 } 781 req, err := client.ListAvailableRequestHeadersPreparer(ctx) 782 if err != nil { 783 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableRequestHeaders", nil, "Failure preparing request") 784 return 785 } 786 787 resp, err := client.ListAvailableRequestHeadersSender(req) 788 if err != nil { 789 result.Response = autorest.Response{Response: resp} 790 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableRequestHeaders", resp, "Failure sending request") 791 return 792 } 793 794 result, err = client.ListAvailableRequestHeadersResponder(resp) 795 if err != nil { 796 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableRequestHeaders", resp, "Failure responding to request") 797 return 798 } 799 800 return 801} 802 803// ListAvailableRequestHeadersPreparer prepares the ListAvailableRequestHeaders request. 804func (client ApplicationGatewaysClient) ListAvailableRequestHeadersPreparer(ctx context.Context) (*http.Request, error) { 805 pathParameters := map[string]interface{}{ 806 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 807 } 808 809 const APIVersion = "2019-09-01" 810 queryParameters := map[string]interface{}{ 811 "api-version": APIVersion, 812 } 813 814 preparer := autorest.CreatePreparer( 815 autorest.AsGet(), 816 autorest.WithBaseURL(client.BaseURI), 817 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableRequestHeaders", pathParameters), 818 autorest.WithQueryParameters(queryParameters)) 819 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 820} 821 822// ListAvailableRequestHeadersSender sends the ListAvailableRequestHeaders request. The method will close the 823// http.Response Body if it receives an error. 824func (client ApplicationGatewaysClient) ListAvailableRequestHeadersSender(req *http.Request) (*http.Response, error) { 825 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 826} 827 828// ListAvailableRequestHeadersResponder handles the response to the ListAvailableRequestHeaders request. The method always 829// closes the http.Response Body. 830func (client ApplicationGatewaysClient) ListAvailableRequestHeadersResponder(resp *http.Response) (result ListString, err error) { 831 err = autorest.Respond( 832 resp, 833 azure.WithErrorUnlessStatusCode(http.StatusOK), 834 autorest.ByUnmarshallingJSON(&result.Value), 835 autorest.ByClosing()) 836 result.Response = autorest.Response{Response: resp} 837 return 838} 839 840// ListAvailableResponseHeaders lists all available response headers. 841func (client ApplicationGatewaysClient) ListAvailableResponseHeaders(ctx context.Context) (result ListString, err error) { 842 if tracing.IsEnabled() { 843 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableResponseHeaders") 844 defer func() { 845 sc := -1 846 if result.Response.Response != nil { 847 sc = result.Response.Response.StatusCode 848 } 849 tracing.EndSpan(ctx, sc, err) 850 }() 851 } 852 req, err := client.ListAvailableResponseHeadersPreparer(ctx) 853 if err != nil { 854 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableResponseHeaders", nil, "Failure preparing request") 855 return 856 } 857 858 resp, err := client.ListAvailableResponseHeadersSender(req) 859 if err != nil { 860 result.Response = autorest.Response{Response: resp} 861 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableResponseHeaders", resp, "Failure sending request") 862 return 863 } 864 865 result, err = client.ListAvailableResponseHeadersResponder(resp) 866 if err != nil { 867 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableResponseHeaders", resp, "Failure responding to request") 868 return 869 } 870 871 return 872} 873 874// ListAvailableResponseHeadersPreparer prepares the ListAvailableResponseHeaders request. 875func (client ApplicationGatewaysClient) ListAvailableResponseHeadersPreparer(ctx context.Context) (*http.Request, error) { 876 pathParameters := map[string]interface{}{ 877 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 878 } 879 880 const APIVersion = "2019-09-01" 881 queryParameters := map[string]interface{}{ 882 "api-version": APIVersion, 883 } 884 885 preparer := autorest.CreatePreparer( 886 autorest.AsGet(), 887 autorest.WithBaseURL(client.BaseURI), 888 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableResponseHeaders", pathParameters), 889 autorest.WithQueryParameters(queryParameters)) 890 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 891} 892 893// ListAvailableResponseHeadersSender sends the ListAvailableResponseHeaders request. The method will close the 894// http.Response Body if it receives an error. 895func (client ApplicationGatewaysClient) ListAvailableResponseHeadersSender(req *http.Request) (*http.Response, error) { 896 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 897} 898 899// ListAvailableResponseHeadersResponder handles the response to the ListAvailableResponseHeaders request. The method always 900// closes the http.Response Body. 901func (client ApplicationGatewaysClient) ListAvailableResponseHeadersResponder(resp *http.Response) (result ListString, err error) { 902 err = autorest.Respond( 903 resp, 904 azure.WithErrorUnlessStatusCode(http.StatusOK), 905 autorest.ByUnmarshallingJSON(&result.Value), 906 autorest.ByClosing()) 907 result.Response = autorest.Response{Response: resp} 908 return 909} 910 911// ListAvailableServerVariables lists all available server variables. 912func (client ApplicationGatewaysClient) ListAvailableServerVariables(ctx context.Context) (result ListString, err error) { 913 if tracing.IsEnabled() { 914 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableServerVariables") 915 defer func() { 916 sc := -1 917 if result.Response.Response != nil { 918 sc = result.Response.Response.StatusCode 919 } 920 tracing.EndSpan(ctx, sc, err) 921 }() 922 } 923 req, err := client.ListAvailableServerVariablesPreparer(ctx) 924 if err != nil { 925 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableServerVariables", nil, "Failure preparing request") 926 return 927 } 928 929 resp, err := client.ListAvailableServerVariablesSender(req) 930 if err != nil { 931 result.Response = autorest.Response{Response: resp} 932 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableServerVariables", resp, "Failure sending request") 933 return 934 } 935 936 result, err = client.ListAvailableServerVariablesResponder(resp) 937 if err != nil { 938 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableServerVariables", resp, "Failure responding to request") 939 return 940 } 941 942 return 943} 944 945// ListAvailableServerVariablesPreparer prepares the ListAvailableServerVariables request. 946func (client ApplicationGatewaysClient) ListAvailableServerVariablesPreparer(ctx context.Context) (*http.Request, error) { 947 pathParameters := map[string]interface{}{ 948 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 949 } 950 951 const APIVersion = "2019-09-01" 952 queryParameters := map[string]interface{}{ 953 "api-version": APIVersion, 954 } 955 956 preparer := autorest.CreatePreparer( 957 autorest.AsGet(), 958 autorest.WithBaseURL(client.BaseURI), 959 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableServerVariables", pathParameters), 960 autorest.WithQueryParameters(queryParameters)) 961 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 962} 963 964// ListAvailableServerVariablesSender sends the ListAvailableServerVariables request. The method will close the 965// http.Response Body if it receives an error. 966func (client ApplicationGatewaysClient) ListAvailableServerVariablesSender(req *http.Request) (*http.Response, error) { 967 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 968} 969 970// ListAvailableServerVariablesResponder handles the response to the ListAvailableServerVariables request. The method always 971// closes the http.Response Body. 972func (client ApplicationGatewaysClient) ListAvailableServerVariablesResponder(resp *http.Response) (result ListString, err error) { 973 err = autorest.Respond( 974 resp, 975 azure.WithErrorUnlessStatusCode(http.StatusOK), 976 autorest.ByUnmarshallingJSON(&result.Value), 977 autorest.ByClosing()) 978 result.Response = autorest.Response{Response: resp} 979 return 980} 981 982// ListAvailableSslOptions lists available Ssl options for configuring Ssl policy. 983func (client ApplicationGatewaysClient) ListAvailableSslOptions(ctx context.Context) (result ApplicationGatewayAvailableSslOptions, err error) { 984 if tracing.IsEnabled() { 985 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableSslOptions") 986 defer func() { 987 sc := -1 988 if result.Response.Response != nil { 989 sc = result.Response.Response.StatusCode 990 } 991 tracing.EndSpan(ctx, sc, err) 992 }() 993 } 994 req, err := client.ListAvailableSslOptionsPreparer(ctx) 995 if err != nil { 996 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslOptions", nil, "Failure preparing request") 997 return 998 } 999 1000 resp, err := client.ListAvailableSslOptionsSender(req) 1001 if err != nil { 1002 result.Response = autorest.Response{Response: resp} 1003 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslOptions", resp, "Failure sending request") 1004 return 1005 } 1006 1007 result, err = client.ListAvailableSslOptionsResponder(resp) 1008 if err != nil { 1009 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslOptions", resp, "Failure responding to request") 1010 return 1011 } 1012 1013 return 1014} 1015 1016// ListAvailableSslOptionsPreparer prepares the ListAvailableSslOptions request. 1017func (client ApplicationGatewaysClient) ListAvailableSslOptionsPreparer(ctx context.Context) (*http.Request, error) { 1018 pathParameters := map[string]interface{}{ 1019 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1020 } 1021 1022 const APIVersion = "2019-09-01" 1023 queryParameters := map[string]interface{}{ 1024 "api-version": APIVersion, 1025 } 1026 1027 preparer := autorest.CreatePreparer( 1028 autorest.AsGet(), 1029 autorest.WithBaseURL(client.BaseURI), 1030 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default", pathParameters), 1031 autorest.WithQueryParameters(queryParameters)) 1032 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1033} 1034 1035// ListAvailableSslOptionsSender sends the ListAvailableSslOptions request. The method will close the 1036// http.Response Body if it receives an error. 1037func (client ApplicationGatewaysClient) ListAvailableSslOptionsSender(req *http.Request) (*http.Response, error) { 1038 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1039} 1040 1041// ListAvailableSslOptionsResponder handles the response to the ListAvailableSslOptions request. The method always 1042// closes the http.Response Body. 1043func (client ApplicationGatewaysClient) ListAvailableSslOptionsResponder(resp *http.Response) (result ApplicationGatewayAvailableSslOptions, err error) { 1044 err = autorest.Respond( 1045 resp, 1046 azure.WithErrorUnlessStatusCode(http.StatusOK), 1047 autorest.ByUnmarshallingJSON(&result), 1048 autorest.ByClosing()) 1049 result.Response = autorest.Response{Response: resp} 1050 return 1051} 1052 1053// ListAvailableSslPredefinedPolicies lists all SSL predefined policies for configuring Ssl policy. 1054func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPolicies(ctx context.Context) (result ApplicationGatewayAvailableSslPredefinedPoliciesPage, err error) { 1055 if tracing.IsEnabled() { 1056 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableSslPredefinedPolicies") 1057 defer func() { 1058 sc := -1 1059 if result.agaspp.Response.Response != nil { 1060 sc = result.agaspp.Response.Response.StatusCode 1061 } 1062 tracing.EndSpan(ctx, sc, err) 1063 }() 1064 } 1065 result.fn = client.listAvailableSslPredefinedPoliciesNextResults 1066 req, err := client.ListAvailableSslPredefinedPoliciesPreparer(ctx) 1067 if err != nil { 1068 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslPredefinedPolicies", nil, "Failure preparing request") 1069 return 1070 } 1071 1072 resp, err := client.ListAvailableSslPredefinedPoliciesSender(req) 1073 if err != nil { 1074 result.agaspp.Response = autorest.Response{Response: resp} 1075 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslPredefinedPolicies", resp, "Failure sending request") 1076 return 1077 } 1078 1079 result.agaspp, err = client.ListAvailableSslPredefinedPoliciesResponder(resp) 1080 if err != nil { 1081 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslPredefinedPolicies", resp, "Failure responding to request") 1082 return 1083 } 1084 if result.agaspp.hasNextLink() && result.agaspp.IsEmpty() { 1085 err = result.NextWithContext(ctx) 1086 return 1087 } 1088 1089 return 1090} 1091 1092// ListAvailableSslPredefinedPoliciesPreparer prepares the ListAvailableSslPredefinedPolicies request. 1093func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesPreparer(ctx context.Context) (*http.Request, error) { 1094 pathParameters := map[string]interface{}{ 1095 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1096 } 1097 1098 const APIVersion = "2019-09-01" 1099 queryParameters := map[string]interface{}{ 1100 "api-version": APIVersion, 1101 } 1102 1103 preparer := autorest.CreatePreparer( 1104 autorest.AsGet(), 1105 autorest.WithBaseURL(client.BaseURI), 1106 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies", pathParameters), 1107 autorest.WithQueryParameters(queryParameters)) 1108 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1109} 1110 1111// ListAvailableSslPredefinedPoliciesSender sends the ListAvailableSslPredefinedPolicies request. The method will close the 1112// http.Response Body if it receives an error. 1113func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesSender(req *http.Request) (*http.Response, error) { 1114 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1115} 1116 1117// ListAvailableSslPredefinedPoliciesResponder handles the response to the ListAvailableSslPredefinedPolicies request. The method always 1118// closes the http.Response Body. 1119func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesResponder(resp *http.Response) (result ApplicationGatewayAvailableSslPredefinedPolicies, err error) { 1120 err = autorest.Respond( 1121 resp, 1122 azure.WithErrorUnlessStatusCode(http.StatusOK), 1123 autorest.ByUnmarshallingJSON(&result), 1124 autorest.ByClosing()) 1125 result.Response = autorest.Response{Response: resp} 1126 return 1127} 1128 1129// listAvailableSslPredefinedPoliciesNextResults retrieves the next set of results, if any. 1130func (client ApplicationGatewaysClient) listAvailableSslPredefinedPoliciesNextResults(ctx context.Context, lastResults ApplicationGatewayAvailableSslPredefinedPolicies) (result ApplicationGatewayAvailableSslPredefinedPolicies, err error) { 1131 req, err := lastResults.applicationGatewayAvailableSslPredefinedPoliciesPreparer(ctx) 1132 if err != nil { 1133 return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAvailableSslPredefinedPoliciesNextResults", nil, "Failure preparing next results request") 1134 } 1135 if req == nil { 1136 return 1137 } 1138 resp, err := client.ListAvailableSslPredefinedPoliciesSender(req) 1139 if err != nil { 1140 result.Response = autorest.Response{Response: resp} 1141 return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAvailableSslPredefinedPoliciesNextResults", resp, "Failure sending next results request") 1142 } 1143 result, err = client.ListAvailableSslPredefinedPoliciesResponder(resp) 1144 if err != nil { 1145 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAvailableSslPredefinedPoliciesNextResults", resp, "Failure responding to next results request") 1146 } 1147 return 1148} 1149 1150// ListAvailableSslPredefinedPoliciesComplete enumerates all values, automatically crossing page boundaries as required. 1151func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesComplete(ctx context.Context) (result ApplicationGatewayAvailableSslPredefinedPoliciesIterator, err error) { 1152 if tracing.IsEnabled() { 1153 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableSslPredefinedPolicies") 1154 defer func() { 1155 sc := -1 1156 if result.Response().Response.Response != nil { 1157 sc = result.page.Response().Response.Response.StatusCode 1158 } 1159 tracing.EndSpan(ctx, sc, err) 1160 }() 1161 } 1162 result.page, err = client.ListAvailableSslPredefinedPolicies(ctx) 1163 return 1164} 1165 1166// ListAvailableWafRuleSets lists all available web application firewall rule sets. 1167func (client ApplicationGatewaysClient) ListAvailableWafRuleSets(ctx context.Context) (result ApplicationGatewayAvailableWafRuleSetsResult, err error) { 1168 if tracing.IsEnabled() { 1169 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableWafRuleSets") 1170 defer func() { 1171 sc := -1 1172 if result.Response.Response != nil { 1173 sc = result.Response.Response.StatusCode 1174 } 1175 tracing.EndSpan(ctx, sc, err) 1176 }() 1177 } 1178 req, err := client.ListAvailableWafRuleSetsPreparer(ctx) 1179 if err != nil { 1180 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", nil, "Failure preparing request") 1181 return 1182 } 1183 1184 resp, err := client.ListAvailableWafRuleSetsSender(req) 1185 if err != nil { 1186 result.Response = autorest.Response{Response: resp} 1187 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", resp, "Failure sending request") 1188 return 1189 } 1190 1191 result, err = client.ListAvailableWafRuleSetsResponder(resp) 1192 if err != nil { 1193 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", resp, "Failure responding to request") 1194 return 1195 } 1196 1197 return 1198} 1199 1200// ListAvailableWafRuleSetsPreparer prepares the ListAvailableWafRuleSets request. 1201func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsPreparer(ctx context.Context) (*http.Request, error) { 1202 pathParameters := map[string]interface{}{ 1203 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1204 } 1205 1206 const APIVersion = "2019-09-01" 1207 queryParameters := map[string]interface{}{ 1208 "api-version": APIVersion, 1209 } 1210 1211 preparer := autorest.CreatePreparer( 1212 autorest.AsGet(), 1213 autorest.WithBaseURL(client.BaseURI), 1214 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets", pathParameters), 1215 autorest.WithQueryParameters(queryParameters)) 1216 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1217} 1218 1219// ListAvailableWafRuleSetsSender sends the ListAvailableWafRuleSets request. The method will close the 1220// http.Response Body if it receives an error. 1221func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsSender(req *http.Request) (*http.Response, error) { 1222 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1223} 1224 1225// ListAvailableWafRuleSetsResponder handles the response to the ListAvailableWafRuleSets request. The method always 1226// closes the http.Response Body. 1227func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsResponder(resp *http.Response) (result ApplicationGatewayAvailableWafRuleSetsResult, err error) { 1228 err = autorest.Respond( 1229 resp, 1230 azure.WithErrorUnlessStatusCode(http.StatusOK), 1231 autorest.ByUnmarshallingJSON(&result), 1232 autorest.ByClosing()) 1233 result.Response = autorest.Response{Response: resp} 1234 return 1235} 1236 1237// Start starts the specified application gateway. 1238// Parameters: 1239// resourceGroupName - the name of the resource group. 1240// applicationGatewayName - the name of the application gateway. 1241func (client ApplicationGatewaysClient) Start(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysStartFuture, err error) { 1242 if tracing.IsEnabled() { 1243 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.Start") 1244 defer func() { 1245 sc := -1 1246 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 1247 sc = result.FutureAPI.Response().StatusCode 1248 } 1249 tracing.EndSpan(ctx, sc, err) 1250 }() 1251 } 1252 req, err := client.StartPreparer(ctx, resourceGroupName, applicationGatewayName) 1253 if err != nil { 1254 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", nil, "Failure preparing request") 1255 return 1256 } 1257 1258 result, err = client.StartSender(req) 1259 if err != nil { 1260 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", nil, "Failure sending request") 1261 return 1262 } 1263 1264 return 1265} 1266 1267// StartPreparer prepares the Start request. 1268func (client ApplicationGatewaysClient) StartPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) { 1269 pathParameters := map[string]interface{}{ 1270 "applicationGatewayName": autorest.Encode("path", applicationGatewayName), 1271 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1272 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1273 } 1274 1275 const APIVersion = "2019-09-01" 1276 queryParameters := map[string]interface{}{ 1277 "api-version": APIVersion, 1278 } 1279 1280 preparer := autorest.CreatePreparer( 1281 autorest.AsPost(), 1282 autorest.WithBaseURL(client.BaseURI), 1283 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start", pathParameters), 1284 autorest.WithQueryParameters(queryParameters)) 1285 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1286} 1287 1288// StartSender sends the Start request. The method will close the 1289// http.Response Body if it receives an error. 1290func (client ApplicationGatewaysClient) StartSender(req *http.Request) (future ApplicationGatewaysStartFuture, err error) { 1291 var resp *http.Response 1292 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1293 if err != nil { 1294 return 1295 } 1296 var azf azure.Future 1297 azf, err = azure.NewFutureFromResponse(resp) 1298 future.FutureAPI = &azf 1299 future.Result = future.result 1300 return 1301} 1302 1303// StartResponder handles the response to the Start request. The method always 1304// closes the http.Response Body. 1305func (client ApplicationGatewaysClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { 1306 err = autorest.Respond( 1307 resp, 1308 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1309 autorest.ByClosing()) 1310 result.Response = resp 1311 return 1312} 1313 1314// Stop stops the specified application gateway in a resource group. 1315// Parameters: 1316// resourceGroupName - the name of the resource group. 1317// applicationGatewayName - the name of the application gateway. 1318func (client ApplicationGatewaysClient) Stop(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysStopFuture, err error) { 1319 if tracing.IsEnabled() { 1320 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.Stop") 1321 defer func() { 1322 sc := -1 1323 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 1324 sc = result.FutureAPI.Response().StatusCode 1325 } 1326 tracing.EndSpan(ctx, sc, err) 1327 }() 1328 } 1329 req, err := client.StopPreparer(ctx, resourceGroupName, applicationGatewayName) 1330 if err != nil { 1331 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", nil, "Failure preparing request") 1332 return 1333 } 1334 1335 result, err = client.StopSender(req) 1336 if err != nil { 1337 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", nil, "Failure sending request") 1338 return 1339 } 1340 1341 return 1342} 1343 1344// StopPreparer prepares the Stop request. 1345func (client ApplicationGatewaysClient) StopPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) { 1346 pathParameters := map[string]interface{}{ 1347 "applicationGatewayName": autorest.Encode("path", applicationGatewayName), 1348 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1349 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1350 } 1351 1352 const APIVersion = "2019-09-01" 1353 queryParameters := map[string]interface{}{ 1354 "api-version": APIVersion, 1355 } 1356 1357 preparer := autorest.CreatePreparer( 1358 autorest.AsPost(), 1359 autorest.WithBaseURL(client.BaseURI), 1360 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop", pathParameters), 1361 autorest.WithQueryParameters(queryParameters)) 1362 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1363} 1364 1365// StopSender sends the Stop request. The method will close the 1366// http.Response Body if it receives an error. 1367func (client ApplicationGatewaysClient) StopSender(req *http.Request) (future ApplicationGatewaysStopFuture, err error) { 1368 var resp *http.Response 1369 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1370 if err != nil { 1371 return 1372 } 1373 var azf azure.Future 1374 azf, err = azure.NewFutureFromResponse(resp) 1375 future.FutureAPI = &azf 1376 future.Result = future.result 1377 return 1378} 1379 1380// StopResponder handles the response to the Stop request. The method always 1381// closes the http.Response Body. 1382func (client ApplicationGatewaysClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { 1383 err = autorest.Respond( 1384 resp, 1385 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1386 autorest.ByClosing()) 1387 result.Response = resp 1388 return 1389} 1390 1391// UpdateTags updates the specified application gateway tags. 1392// Parameters: 1393// resourceGroupName - the name of the resource group. 1394// applicationGatewayName - the name of the application gateway. 1395// parameters - parameters supplied to update application gateway tags. 1396func (client ApplicationGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters TagsObject) (result ApplicationGateway, err error) { 1397 if tracing.IsEnabled() { 1398 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.UpdateTags") 1399 defer func() { 1400 sc := -1 1401 if result.Response.Response != nil { 1402 sc = result.Response.Response.StatusCode 1403 } 1404 tracing.EndSpan(ctx, sc, err) 1405 }() 1406 } 1407 req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, applicationGatewayName, parameters) 1408 if err != nil { 1409 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "UpdateTags", nil, "Failure preparing request") 1410 return 1411 } 1412 1413 resp, err := client.UpdateTagsSender(req) 1414 if err != nil { 1415 result.Response = autorest.Response{Response: resp} 1416 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "UpdateTags", resp, "Failure sending request") 1417 return 1418 } 1419 1420 result, err = client.UpdateTagsResponder(resp) 1421 if err != nil { 1422 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "UpdateTags", resp, "Failure responding to request") 1423 return 1424 } 1425 1426 return 1427} 1428 1429// UpdateTagsPreparer prepares the UpdateTags request. 1430func (client ApplicationGatewaysClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters TagsObject) (*http.Request, error) { 1431 pathParameters := map[string]interface{}{ 1432 "applicationGatewayName": autorest.Encode("path", applicationGatewayName), 1433 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1434 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1435 } 1436 1437 const APIVersion = "2019-09-01" 1438 queryParameters := map[string]interface{}{ 1439 "api-version": APIVersion, 1440 } 1441 1442 preparer := autorest.CreatePreparer( 1443 autorest.AsContentType("application/json; charset=utf-8"), 1444 autorest.AsPatch(), 1445 autorest.WithBaseURL(client.BaseURI), 1446 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters), 1447 autorest.WithJSON(parameters), 1448 autorest.WithQueryParameters(queryParameters)) 1449 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1450} 1451 1452// UpdateTagsSender sends the UpdateTags request. The method will close the 1453// http.Response Body if it receives an error. 1454func (client ApplicationGatewaysClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { 1455 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1456} 1457 1458// UpdateTagsResponder handles the response to the UpdateTags request. The method always 1459// closes the http.Response Body. 1460func (client ApplicationGatewaysClient) UpdateTagsResponder(resp *http.Response) (result ApplicationGateway, err error) { 1461 err = autorest.Respond( 1462 resp, 1463 azure.WithErrorUnlessStatusCode(http.StatusOK), 1464 autorest.ByUnmarshallingJSON(&result), 1465 autorest.ByClosing()) 1466 result.Response = autorest.Response{Response: resp} 1467 return 1468} 1469