BatchClient.EvaluatePoolAutoScaleAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
EvaluatePoolAutoScaleAsync(String, BatchPoolEvaluateAutoScaleContent, Nullable<Int32>, Nullable<DateTimeOffset>, CancellationToken) |
Gets the result of evaluating an automatic scaling formula on the Pool. |
EvaluatePoolAutoScaleAsync(String, RequestContent, Nullable<Int32>, Nullable<DateTimeOffset>, RequestContext) |
[Protocol Method] Gets the result of evaluating an automatic scaling formula on the Pool.
|
EvaluatePoolAutoScaleAsync(String, BatchPoolEvaluateAutoScaleContent, Nullable<Int32>, Nullable<DateTimeOffset>, CancellationToken)
- Source:
- BatchClientCustom.cs
Gets the result of evaluating an automatic scaling formula on the Pool.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Compute.Batch.AutoScaleRun>> EvaluatePoolAutoScaleAsync (string poolId, Azure.Compute.Batch.BatchPoolEvaluateAutoScaleContent content, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, System.Threading.CancellationToken cancellationToken = default);
abstract member EvaluatePoolAutoScaleAsync : string * Azure.Compute.Batch.BatchPoolEvaluateAutoScaleContent * Nullable<int> * Nullable<DateTimeOffset> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Compute.Batch.AutoScaleRun>>
override this.EvaluatePoolAutoScaleAsync : string * Azure.Compute.Batch.BatchPoolEvaluateAutoScaleContent * Nullable<int> * Nullable<DateTimeOffset> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Compute.Batch.AutoScaleRun>>
Public Overridable Function EvaluatePoolAutoScaleAsync (poolId As String, content As BatchPoolEvaluateAutoScaleContent, Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of AutoScaleRun))
Parameters
- poolId
- String
The ID of the Pool on which to evaluate the automatic scaling formula.
The options to use for evaluating the automatic scaling formula.
The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
- ocpdate
- Nullable<DateTimeOffset>
The time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
poolId
or content
is null.
poolId
is an empty string, and was expected to be non-empty.
Examples
This sample shows how to call EvaluatePoolAutoScaleAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent("<autoScaleFormula>");
Response<AutoScaleRun> response = await client.EvaluatePoolAutoScaleAsync("<poolId>", content);
This sample shows how to call EvaluatePoolAutoScaleAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent("<autoScaleFormula>");
Response<AutoScaleRun> response = await client.EvaluatePoolAutoScaleAsync("<poolId>", content, timeOutInSeconds: 1234, ocpdate: DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"));
Remarks
This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the Pool. The Pool must have auto scaling enabled in order to evaluate a formula.
Applies to
EvaluatePoolAutoScaleAsync(String, RequestContent, Nullable<Int32>, Nullable<DateTimeOffset>, RequestContext)
- Source:
- BatchClientCustom.cs
[Protocol Method] Gets the result of evaluating an automatic scaling formula on the Pool.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler EvaluatePoolAutoScaleAsync(String, BatchPoolEvaluateAutoScaleContent, Nullable<Int32>, Nullable<DateTimeOffset>, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> EvaluatePoolAutoScaleAsync (string poolId, Azure.Core.RequestContent content, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, Azure.RequestContext context = default);
abstract member EvaluatePoolAutoScaleAsync : string * Azure.Core.RequestContent * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.EvaluatePoolAutoScaleAsync : string * Azure.Core.RequestContent * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function EvaluatePoolAutoScaleAsync (poolId As String, content As RequestContent, Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional context As RequestContext = Nothing) As Task(Of Response)
Parameters
- poolId
- String
The ID of the Pool on which to evaluate the automatic scaling formula.
- content
- RequestContent
The content to send as the body of the request.
The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
- ocpdate
- Nullable<DateTimeOffset>
The time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
poolId
or content
is null.
poolId
is an empty string, and was expected to be non-empty.
Service returned a non-success status code.
Examples
This sample shows how to call EvaluatePoolAutoScaleAsync and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new
{
autoScaleFormula = "<autoScaleFormula>",
});
Response response = await client.EvaluatePoolAutoScaleAsync("<poolId>", content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("timestamp").ToString());
This sample shows how to call EvaluatePoolAutoScaleAsync with all parameters and request content and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new
{
autoScaleFormula = "<autoScaleFormula>",
});
Response response = await client.EvaluatePoolAutoScaleAsync("<poolId>", content, timeOutInSeconds: 1234, ocpdate: DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"));
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("timestamp").ToString());
Console.WriteLine(result.GetProperty("results").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("values")[0].GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("values")[0].GetProperty("value").ToString());
Applies to
Azure SDK for .NET