BatchClient.EvaluatePoolAutoScale 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
EvaluatePoolAutoScale(String, BatchPoolEvaluateAutoScaleContent, Nullable<Int32>, Nullable<DateTimeOffset>, CancellationToken) |
Gets the result of evaluating an automatic scaling formula on the Pool. |
EvaluatePoolAutoScale(String, RequestContent, Nullable<Int32>, Nullable<DateTimeOffset>, RequestContext) |
[Protocol Method] Gets the result of evaluating an automatic scaling formula on the Pool.
|
EvaluatePoolAutoScale(String, BatchPoolEvaluateAutoScaleContent, Nullable<Int32>, Nullable<DateTimeOffset>, CancellationToken)
- Source:
- BatchClient.cs
Gets the result of evaluating an automatic scaling formula on the Pool.
public virtual Azure.Response<Azure.Compute.Batch.AutoScaleRun> EvaluatePoolAutoScale (string poolId, Azure.Compute.Batch.BatchPoolEvaluateAutoScaleContent content, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, System.Threading.CancellationToken cancellationToken = default);
abstract member EvaluatePoolAutoScale : string * Azure.Compute.Batch.BatchPoolEvaluateAutoScaleContent * Nullable<int> * Nullable<DateTimeOffset> * System.Threading.CancellationToken -> Azure.Response<Azure.Compute.Batch.AutoScaleRun>
override this.EvaluatePoolAutoScale : string * Azure.Compute.Batch.BatchPoolEvaluateAutoScaleContent * Nullable<int> * Nullable<DateTimeOffset> * System.Threading.CancellationToken -> Azure.Response<Azure.Compute.Batch.AutoScaleRun>
Public Overridable Function EvaluatePoolAutoScale (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 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 EvaluatePoolAutoScale.
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 = client.EvaluatePoolAutoScale("<poolId>", content);
This sample shows how to call EvaluatePoolAutoScale 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 = client.EvaluatePoolAutoScale("<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
EvaluatePoolAutoScale(String, RequestContent, Nullable<Int32>, Nullable<DateTimeOffset>, RequestContext)
- Source:
- BatchClient.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 EvaluatePoolAutoScale(String, BatchPoolEvaluateAutoScaleContent, Nullable<Int32>, Nullable<DateTimeOffset>, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response EvaluatePoolAutoScale (string poolId, Azure.Core.RequestContent content, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, Azure.RequestContext context = default);
abstract member EvaluatePoolAutoScale : string * Azure.Core.RequestContent * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestContext -> Azure.Response
override this.EvaluatePoolAutoScale : string * Azure.Core.RequestContent * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestContext -> Azure.Response
Public Overridable Function EvaluatePoolAutoScale (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 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 EvaluatePoolAutoScale 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 = client.EvaluatePoolAutoScale("<poolId>", content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("timestamp").ToString());
This sample shows how to call EvaluatePoolAutoScale 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 = client.EvaluatePoolAutoScale("<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