BatchClient.GetPoolNodeCountsAsync 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
GetPoolNodeCountsAsync(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, RequestContext) |
[Protocol Method] Gets the number of Compute Nodes in each state, grouped by Pool. Note that the numbers returned may not always be up to date. If you need exact node counts, use a list query.
|
GetPoolNodeCountsAsync(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, CancellationToken) |
Gets the number of Compute Nodes in each state, grouped by Pool. Note that the numbers returned may not always be up to date. If you need exact node counts, use a list query. |
GetPoolNodeCountsAsync(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, RequestContext)
- Source:
- BatchClient.cs
[Protocol Method] Gets the number of Compute Nodes in each state, grouped by Pool. Note that the numbers returned may not always be up to date. If you need exact node counts, use a list query.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler GetPoolNodeCountsAsync(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.AsyncPageable<BinaryData> GetPoolNodeCountsAsync (int? timeOutInSeconds, DateTimeOffset? ocpdate, int? maxresults, string filter, Azure.RequestContext context);
abstract member GetPoolNodeCountsAsync : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetPoolNodeCountsAsync : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetPoolNodeCountsAsync (timeOutInSeconds As Nullable(Of Integer), ocpdate As Nullable(Of DateTimeOffset), maxresults As Nullable(Of Integer), filter As String, context As RequestContext) As AsyncPageable(Of BinaryData)
Parameters
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.
The maximum number of items to return in the response. A maximum of 1000 applications can be returned.
- filter
- String
An OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-support-images.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The AsyncPageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.
Exceptions
Service returned a non-success status code.
Examples
This sample shows how to call GetPoolNodeCountsAsync and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
await foreach (BinaryData item in client.GetPoolNodeCountsAsync(null, null, null, null, null))
{
JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("poolId").ToString());
}
This sample shows how to call GetPoolNodeCountsAsync with all parameters and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
await foreach (BinaryData item in client.GetPoolNodeCountsAsync(1234, DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), 1234, "<filter>", null))
{
JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("poolId").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("creating").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("idle").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("offline").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("preempted").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("rebooting").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("reimaging").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("running").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("starting").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("startTaskFailed").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("leavingPool").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("unknown").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("unusable").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("waitingForStartTask").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("total").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("upgradingOS").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("creating").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("idle").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("offline").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("preempted").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("rebooting").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("reimaging").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("running").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("starting").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("startTaskFailed").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("leavingPool").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("unknown").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("unusable").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("waitingForStartTask").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("total").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("upgradingOS").ToString());
}
Applies to
GetPoolNodeCountsAsync(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, CancellationToken)
- Source:
- BatchClient.cs
Gets the number of Compute Nodes in each state, grouped by Pool. Note that the numbers returned may not always be up to date. If you need exact node counts, use a list query.
public virtual Azure.AsyncPageable<Azure.Compute.Batch.BatchPoolNodeCounts> GetPoolNodeCountsAsync (int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, int? maxresults = default, string filter = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetPoolNodeCountsAsync : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Compute.Batch.BatchPoolNodeCounts>
override this.GetPoolNodeCountsAsync : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Compute.Batch.BatchPoolNodeCounts>
Public Overridable Function GetPoolNodeCountsAsync (Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional maxresults As Nullable(Of Integer) = Nothing, Optional filter As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of BatchPoolNodeCounts)
Parameters
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.
The maximum number of items to return in the response. A maximum of 1000 applications can be returned.
- filter
- String
An OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-support-images.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Examples
This sample shows how to call GetPoolNodeCountsAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
await foreach (BatchPoolNodeCounts item in client.GetPoolNodeCountsAsync())
{
}
This sample shows how to call GetPoolNodeCountsAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
await foreach (BatchPoolNodeCounts item in client.GetPoolNodeCountsAsync(timeOutInSeconds: 1234, ocpdate: DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), maxresults: 1234, filter: "<filter>"))
{
}
Applies to
Azure SDK for .NET