Compartilhar via


BatchClient.GetApplicationsAsync Method

Definition

Overloads

GetApplicationsAsync(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, RequestContext)

[Protocol Method] Lists all of the applications available in the specified Account.

GetApplicationsAsync(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, CancellationToken)

Lists all of the applications available in the specified Account.

GetApplicationsAsync(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, RequestContext)

Source:
BatchClient.cs

[Protocol Method] Lists all of the applications available in the specified Account.

public virtual Azure.AsyncPageable<BinaryData> GetApplicationsAsync (int? timeOutInSeconds, DateTimeOffset? ocpdate, int? maxresults, Azure.RequestContext context);
abstract member GetApplicationsAsync : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetApplicationsAsync : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetApplicationsAsync (timeOutInSeconds As Nullable(Of Integer), ocpdate As Nullable(Of DateTimeOffset), maxresults As Nullable(Of Integer), context As RequestContext) As AsyncPageable(Of BinaryData)

Parameters

timeOutInSeconds
Nullable<Int32>

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.

maxresults
Nullable<Int32>

The maximum number of items to return in the response. A maximum of 1000 applications can be returned.

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 GetApplicationsAsync 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.GetApplicationsAsync(null, null, null, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("id").ToString());
    Console.WriteLine(result.GetProperty("displayName").ToString());
    Console.WriteLine(result.GetProperty("versions")[0].ToString());
}

This sample shows how to call GetApplicationsAsync 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.GetApplicationsAsync(1234, DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), 1234, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("id").ToString());
    Console.WriteLine(result.GetProperty("displayName").ToString());
    Console.WriteLine(result.GetProperty("versions")[0].ToString());
}

Applies to

GetApplicationsAsync(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, CancellationToken)

Source:
BatchClient.cs

Lists all of the applications available in the specified Account.

public virtual Azure.AsyncPageable<Azure.Compute.Batch.BatchApplication> GetApplicationsAsync (int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, int? maxresults = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetApplicationsAsync : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Compute.Batch.BatchApplication>
override this.GetApplicationsAsync : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Compute.Batch.BatchApplication>
Public Overridable Function GetApplicationsAsync (Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional maxresults As Nullable(Of Integer) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of BatchApplication)

Parameters

timeOutInSeconds
Nullable<Int32>

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.

maxresults
Nullable<Int32>

The maximum number of items to return in the response. A maximum of 1000 applications can be returned.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Examples

This sample shows how to call GetApplicationsAsync.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);

await foreach (BatchApplication item in client.GetApplicationsAsync())
{
}

This sample shows how to call GetApplicationsAsync with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);

await foreach (BatchApplication item in client.GetApplicationsAsync(timeOutInSeconds: 1234, ocpdate: DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), maxresults: 1234))
{
}

Remarks

This operation returns only Applications and versions that are available for use on Compute Nodes; that is, that can be used in an Package reference. For administrator information about applications and versions that are not yet available to Compute Nodes, use the Azure portal or the Azure Resource Manager API.

Applies to