diff --git a/profiles/latest/network/mgmt/network/models.go b/profiles/latest/network/mgmt/network/models.go index 22912a9d3ab3..825737f4869e 100644 --- a/profiles/latest/network/mgmt/network/models.go +++ b/profiles/latest/network/mgmt/network/models.go @@ -964,6 +964,7 @@ type ApplicationGatewayBackendHTTPSettings = original.ApplicationGatewayBackendH type ApplicationGatewayBackendHTTPSettingsPropertiesFormat = original.ApplicationGatewayBackendHTTPSettingsPropertiesFormat type ApplicationGatewayBackendHealth = original.ApplicationGatewayBackendHealth type ApplicationGatewayBackendHealthHTTPSettings = original.ApplicationGatewayBackendHealthHTTPSettings +type ApplicationGatewayBackendHealthOnDemand = original.ApplicationGatewayBackendHealthOnDemand type ApplicationGatewayBackendHealthPool = original.ApplicationGatewayBackendHealthPool type ApplicationGatewayBackendHealthServer = original.ApplicationGatewayBackendHealthServer type ApplicationGatewayConnectionDraining = original.ApplicationGatewayConnectionDraining @@ -986,6 +987,7 @@ type ApplicationGatewayIPConfigurationPropertiesFormat = original.ApplicationGat type ApplicationGatewayListResult = original.ApplicationGatewayListResult type ApplicationGatewayListResultIterator = original.ApplicationGatewayListResultIterator type ApplicationGatewayListResultPage = original.ApplicationGatewayListResultPage +type ApplicationGatewayOnDemandProbe = original.ApplicationGatewayOnDemandProbe type ApplicationGatewayPathRule = original.ApplicationGatewayPathRule type ApplicationGatewayPathRulePropertiesFormat = original.ApplicationGatewayPathRulePropertiesFormat type ApplicationGatewayProbe = original.ApplicationGatewayProbe @@ -1013,6 +1015,7 @@ type ApplicationGatewayURLPathMap = original.ApplicationGatewayURLPathMap type ApplicationGatewayURLPathMapPropertiesFormat = original.ApplicationGatewayURLPathMapPropertiesFormat type ApplicationGatewayWebApplicationFirewallConfiguration = original.ApplicationGatewayWebApplicationFirewallConfiguration type ApplicationGatewaysBackendHealthFuture = original.ApplicationGatewaysBackendHealthFuture +type ApplicationGatewaysBackendHealthOnDemandFuture = original.ApplicationGatewaysBackendHealthOnDemandFuture type ApplicationGatewaysClient = original.ApplicationGatewaysClient type ApplicationGatewaysCreateOrUpdateFuture = original.ApplicationGatewaysCreateOrUpdateFuture type ApplicationGatewaysDeleteFuture = original.ApplicationGatewaysDeleteFuture diff --git a/profiles/preview/network/mgmt/network/models.go b/profiles/preview/network/mgmt/network/models.go index f5c3daae5a2d..34cdee075fbd 100644 --- a/profiles/preview/network/mgmt/network/models.go +++ b/profiles/preview/network/mgmt/network/models.go @@ -964,6 +964,7 @@ type ApplicationGatewayBackendHTTPSettings = original.ApplicationGatewayBackendH type ApplicationGatewayBackendHTTPSettingsPropertiesFormat = original.ApplicationGatewayBackendHTTPSettingsPropertiesFormat type ApplicationGatewayBackendHealth = original.ApplicationGatewayBackendHealth type ApplicationGatewayBackendHealthHTTPSettings = original.ApplicationGatewayBackendHealthHTTPSettings +type ApplicationGatewayBackendHealthOnDemand = original.ApplicationGatewayBackendHealthOnDemand type ApplicationGatewayBackendHealthPool = original.ApplicationGatewayBackendHealthPool type ApplicationGatewayBackendHealthServer = original.ApplicationGatewayBackendHealthServer type ApplicationGatewayConnectionDraining = original.ApplicationGatewayConnectionDraining @@ -986,6 +987,7 @@ type ApplicationGatewayIPConfigurationPropertiesFormat = original.ApplicationGat type ApplicationGatewayListResult = original.ApplicationGatewayListResult type ApplicationGatewayListResultIterator = original.ApplicationGatewayListResultIterator type ApplicationGatewayListResultPage = original.ApplicationGatewayListResultPage +type ApplicationGatewayOnDemandProbe = original.ApplicationGatewayOnDemandProbe type ApplicationGatewayPathRule = original.ApplicationGatewayPathRule type ApplicationGatewayPathRulePropertiesFormat = original.ApplicationGatewayPathRulePropertiesFormat type ApplicationGatewayProbe = original.ApplicationGatewayProbe @@ -1013,6 +1015,7 @@ type ApplicationGatewayURLPathMap = original.ApplicationGatewayURLPathMap type ApplicationGatewayURLPathMapPropertiesFormat = original.ApplicationGatewayURLPathMapPropertiesFormat type ApplicationGatewayWebApplicationFirewallConfiguration = original.ApplicationGatewayWebApplicationFirewallConfiguration type ApplicationGatewaysBackendHealthFuture = original.ApplicationGatewaysBackendHealthFuture +type ApplicationGatewaysBackendHealthOnDemandFuture = original.ApplicationGatewaysBackendHealthOnDemandFuture type ApplicationGatewaysClient = original.ApplicationGatewaysClient type ApplicationGatewaysCreateOrUpdateFuture = original.ApplicationGatewaysCreateOrUpdateFuture type ApplicationGatewaysDeleteFuture = original.ApplicationGatewaysDeleteFuture diff --git a/services/network/mgmt/2018-12-01/network/applicationgateways.go b/services/network/mgmt/2018-12-01/network/applicationgateways.go index 53585e18d1aa..1565d950a937 100644 --- a/services/network/mgmt/2018-12-01/network/applicationgateways.go +++ b/services/network/mgmt/2018-12-01/network/applicationgateways.go @@ -122,6 +122,91 @@ func (client ApplicationGatewaysClient) BackendHealthResponder(resp *http.Respon return } +// BackendHealthOnDemand gets the backend health for given combination of backend pool and http setting of the +// specified application gateway in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +// probeRequest - request body for on-demand test probe operation. +// expand - expands BackendAddressPool and BackendHttpSettings referenced in backend health. +func (client ApplicationGatewaysClient) BackendHealthOnDemand(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest ApplicationGatewayOnDemandProbe, expand string) (result ApplicationGatewaysBackendHealthOnDemandFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.BackendHealthOnDemand") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.BackendHealthOnDemandPreparer(ctx, resourceGroupName, applicationGatewayName, probeRequest, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealthOnDemand", nil, "Failure preparing request") + return + } + + result, err = client.BackendHealthOnDemandSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealthOnDemand", result.Response(), "Failure sending request") + return + } + + return +} + +// BackendHealthOnDemandPreparer prepares the BackendHealthOnDemand request. +func (client ApplicationGatewaysClient) BackendHealthOnDemandPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest ApplicationGatewayOnDemandProbe, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendHealthOnDemand", pathParameters), + autorest.WithJSON(probeRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// BackendHealthOnDemandSender sends the BackendHealthOnDemand request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) BackendHealthOnDemandSender(req *http.Request) (future ApplicationGatewaysBackendHealthOnDemandFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// BackendHealthOnDemandResponder handles the response to the BackendHealthOnDemand request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) BackendHealthOnDemandResponder(resp *http.Response) (result ApplicationGatewayBackendHealthOnDemand, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // CreateOrUpdate creates or updates the specified application gateway. // Parameters: // resourceGroupName - the name of the resource group. diff --git a/services/network/mgmt/2018-12-01/network/models.go b/services/network/mgmt/2018-12-01/network/models.go index 57e0bfd75296..6e07d66e845c 100644 --- a/services/network/mgmt/2018-12-01/network/models.go +++ b/services/network/mgmt/2018-12-01/network/models.go @@ -2653,6 +2653,15 @@ type ApplicationGatewayBackendHealthHTTPSettings struct { Servers *[]ApplicationGatewayBackendHealthServer `json:"servers,omitempty"` } +// ApplicationGatewayBackendHealthOnDemand result of on demand test probe +type ApplicationGatewayBackendHealthOnDemand struct { + autorest.Response `json:"-"` + // BackendAddressPool - Reference of an ApplicationGatewayBackendAddressPool resource. + BackendAddressPool *ApplicationGatewayBackendAddressPool `json:"backendAddressPool,omitempty"` + // BackendHealthHTTPSettings - Application gateway BackendHealthHttp settings. + BackendHealthHTTPSettings *ApplicationGatewayBackendHealthHTTPSettings `json:"backendHealthHttpSettings,omitempty"` +} + // ApplicationGatewayBackendHealthPool application gateway BackendHealth pool. type ApplicationGatewayBackendHealthPool struct { // BackendAddressPool - Reference of an ApplicationGatewayBackendAddressPool resource. @@ -3558,6 +3567,26 @@ func NewApplicationGatewayListResultPage(getNextPage func(context.Context, Appli return ApplicationGatewayListResultPage{fn: getNextPage} } +// ApplicationGatewayOnDemandProbe details of on demand test probe request +type ApplicationGatewayOnDemandProbe struct { + // Protocol - The protocol used for the probe. Possible values are 'Http' and 'Https'. Possible values include: 'HTTP', 'HTTPS' + Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` + // Host - Host name to send the probe to. + Host *string `json:"host,omitempty"` + // Path - Relative path of probe. Valid path starts from '/'. Probe is sent to ://: + Path *string `json:"path,omitempty"` + // Timeout - The probe timeout in seconds. Probe marked as failed if valid response is not received with this timeout period. Acceptable values are from 1 second to 86400 seconds. + Timeout *int32 `json:"timeout,omitempty"` + // PickHostNameFromBackendHTTPSettings - Whether the host header should be picked from the backend http settings. Default value is false. + PickHostNameFromBackendHTTPSettings *bool `json:"pickHostNameFromBackendHttpSettings,omitempty"` + // Match - Criterion for classifying a healthy probe response. + Match *ApplicationGatewayProbeHealthResponseMatch `json:"match,omitempty"` + // BackendPoolName - Name of backend pool of application gateway to which probe request will be sent. + BackendPoolName *string `json:"backendPoolName,omitempty"` + // BackendHTTPSettingName - Name of backend http setting of application gateway to be used for test probe + BackendHTTPSettingName *string `json:"backendHttpSettingName,omitempty"` +} + // ApplicationGatewayPathRule path rule of URL path map of an application gateway. type ApplicationGatewayPathRule struct { *ApplicationGatewayPathRulePropertiesFormat `json:"properties,omitempty"` @@ -4228,6 +4257,35 @@ func (future *ApplicationGatewaysBackendHealthFuture) Result(client ApplicationG return } +// ApplicationGatewaysBackendHealthOnDemandFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ApplicationGatewaysBackendHealthOnDemandFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ApplicationGatewaysBackendHealthOnDemandFuture) Result(client ApplicationGatewaysClient) (agbhod ApplicationGatewayBackendHealthOnDemand, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthOnDemandFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysBackendHealthOnDemandFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if agbhod.Response.Response, err = future.GetResult(sender); err == nil && agbhod.Response.Response.StatusCode != http.StatusNoContent { + agbhod, err = client.BackendHealthOnDemandResponder(agbhod.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthOnDemandFuture", "Result", agbhod.Response.Response, "Failure responding to request") + } + } + return +} + // ApplicationGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a // long-running operation. type ApplicationGatewaysCreateOrUpdateFuture struct { @@ -29681,8 +29739,7 @@ func (wafp *WebApplicationFirewallPolicy) UnmarshalJSON(body []byte) error { } // WebApplicationFirewallPolicyListResult result of the request to list WebApplicationFirewallPolicies. It -// contains a list of WebApplicationFirewallPolicy objects and a URL link to get the the next set of -// results. +// contains a list of WebApplicationFirewallPolicy objects and a URL link to get the next set of results. type WebApplicationFirewallPolicyListResult struct { autorest.Response `json:"-"` // Value - List of WebApplicationFirewallPolicies within a resource group. diff --git a/services/network/mgmt/2018-12-01/network/networkapi/interfaces.go b/services/network/mgmt/2018-12-01/network/networkapi/interfaces.go index 9f37df5450d6..4ca346b11325 100644 --- a/services/network/mgmt/2018-12-01/network/networkapi/interfaces.go +++ b/services/network/mgmt/2018-12-01/network/networkapi/interfaces.go @@ -34,6 +34,7 @@ var _ BaseClientAPI = (*network.BaseClient)(nil) // ApplicationGatewaysClientAPI contains the set of methods on the ApplicationGatewaysClient type. type ApplicationGatewaysClientAPI interface { BackendHealth(ctx context.Context, resourceGroupName string, applicationGatewayName string, expand string) (result network.ApplicationGatewaysBackendHealthFuture, err error) + BackendHealthOnDemand(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest network.ApplicationGatewayOnDemandProbe, expand string) (result network.ApplicationGatewaysBackendHealthOnDemandFuture, err error) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters network.ApplicationGateway) (result network.ApplicationGatewaysCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result network.ApplicationGatewaysDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result network.ApplicationGateway, err error)