BatchClient.GetPoolUsageMetricsAsync 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
GetPoolUsageMetricsAsync(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, String, CancellationToken) |
Lists the usage metrics, aggregated by Pool across individual time intervals, for the specified Account. |
GetPoolUsageMetricsAsync(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, String, RequestContext) |
[Protocol Method] Lists the usage metrics, aggregated by Pool across individual time intervals, for the specified Account.
|
GetPoolUsageMetricsAsync(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, String, CancellationToken)
- Source:
- BatchClient.cs
Lists the usage metrics, aggregated by Pool across individual time intervals, for the specified Account.
public virtual Azure.AsyncPageable<Azure.Compute.Batch.BatchPoolUsageMetrics> GetPoolUsageMetricsAsync (int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, int? maxresults = default, DateTimeOffset? starttime = default, DateTimeOffset? endtime = default, string filter = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetPoolUsageMetricsAsync : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * Nullable<DateTimeOffset> * Nullable<DateTimeOffset> * string * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Compute.Batch.BatchPoolUsageMetrics>
override this.GetPoolUsageMetricsAsync : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * Nullable<DateTimeOffset> * Nullable<DateTimeOffset> * string * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Compute.Batch.BatchPoolUsageMetrics>
Public Overridable Function GetPoolUsageMetricsAsync (Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional maxresults As Nullable(Of Integer) = Nothing, Optional starttime As Nullable(Of DateTimeOffset) = Nothing, Optional endtime As Nullable(Of DateTimeOffset) = Nothing, Optional filter As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of BatchPoolUsageMetrics)
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.
- starttime
- Nullable<DateTimeOffset>
The earliest time from which to include metrics. This must be at least two and a half hours before the current time. If not specified this defaults to the start time of the last aggregation interval currently available.
- endtime
- Nullable<DateTimeOffset>
The latest time from which to include metrics. This must be at least two hours before the current time. If not specified this defaults to the end time of the last aggregation interval currently available.
- 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-account-usage-metrics.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Examples
This sample shows how to call GetPoolUsageMetricsAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
await foreach (BatchPoolUsageMetrics item in client.GetPoolUsageMetricsAsync())
{
}
This sample shows how to call GetPoolUsageMetricsAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
await foreach (BatchPoolUsageMetrics item in client.GetPoolUsageMetricsAsync(timeOutInSeconds: 1234, ocpdate: DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), maxresults: 1234, starttime: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), endtime: DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), filter: "<filter>"))
{
}
Remarks
If you do not specify a $filter clause including a poolId, the response includes all Pools that existed in the Account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned.
Applies to
GetPoolUsageMetricsAsync(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, String, RequestContext)
- Source:
- BatchClient.cs
[Protocol Method] Lists the usage metrics, aggregated by Pool across individual time intervals, for the specified Account.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler GetPoolUsageMetricsAsync(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, String, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.AsyncPageable<BinaryData> GetPoolUsageMetricsAsync (int? timeOutInSeconds, DateTimeOffset? ocpdate, int? maxresults, DateTimeOffset? starttime, DateTimeOffset? endtime, string filter, Azure.RequestContext context);
abstract member GetPoolUsageMetricsAsync : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * Nullable<DateTimeOffset> * Nullable<DateTimeOffset> * string * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetPoolUsageMetricsAsync : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * Nullable<DateTimeOffset> * Nullable<DateTimeOffset> * string * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetPoolUsageMetricsAsync (timeOutInSeconds As Nullable(Of Integer), ocpdate As Nullable(Of DateTimeOffset), maxresults As Nullable(Of Integer), starttime As Nullable(Of DateTimeOffset), endtime As Nullable(Of DateTimeOffset), 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.
- starttime
- Nullable<DateTimeOffset>
The earliest time from which to include metrics. This must be at least two and a half hours before the current time. If not specified this defaults to the start time of the last aggregation interval currently available.
- endtime
- Nullable<DateTimeOffset>
The latest time from which to include metrics. This must be at least two hours before the current time. If not specified this defaults to the end time of the last aggregation interval currently available.
- 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-account-usage-metrics.
- 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 GetPoolUsageMetricsAsync 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.GetPoolUsageMetricsAsync(null, null, null, null, null, null, null))
{
JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("poolId").ToString());
Console.WriteLine(result.GetProperty("startTime").ToString());
Console.WriteLine(result.GetProperty("endTime").ToString());
Console.WriteLine(result.GetProperty("vmSize").ToString());
Console.WriteLine(result.GetProperty("totalCoreHours").ToString());
}
This sample shows how to call GetPoolUsageMetricsAsync 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.GetPoolUsageMetricsAsync(1234, DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), 1234, DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), "<filter>", null))
{
JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("poolId").ToString());
Console.WriteLine(result.GetProperty("startTime").ToString());
Console.WriteLine(result.GetProperty("endTime").ToString());
Console.WriteLine(result.GetProperty("vmSize").ToString());
Console.WriteLine(result.GetProperty("totalCoreHours").ToString());
}
Applies to
Azure SDK for .NET