Share via


BatchClient.GetApplicationAsync Method

Definition

Overloads

GetApplicationAsync(String, Nullable<Int32>, Nullable<DateTimeOffset>, RequestContext)

[Protocol Method] Gets information about the specified Application.

GetApplicationAsync(String, Nullable<Int32>, Nullable<DateTimeOffset>, CancellationToken)

Gets information about the specified Application.

GetApplicationAsync(String, Nullable<Int32>, Nullable<DateTimeOffset>, RequestContext)

[Protocol Method] Gets information about the specified Application.

public virtual System.Threading.Tasks.Task<Azure.Response> GetApplicationAsync (string applicationId, int? timeOutInSeconds, DateTimeOffset? ocpdate, Azure.RequestContext context);
abstract member GetApplicationAsync : string * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetApplicationAsync : string * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetApplicationAsync (applicationId As String, timeOutInSeconds As Nullable(Of Integer), ocpdate As Nullable(Of DateTimeOffset), context As RequestContext) As Task(Of Response)

Parameters

applicationId
String

The ID of the Application.

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.

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

applicationId is null.

applicationId 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 GetApplicationAsync and parse the result.

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

Response response = await client.GetApplicationAsync("<applicationId>", null, null, null);

JsonElement result = JsonDocument.Parse(response.ContentStream).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 GetApplicationAsync 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);

Response response = await client.GetApplicationAsync("<applicationId>", 1234, DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), null);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("displayName").ToString());
Console.WriteLine(result.GetProperty("versions")[0].ToString());

Applies to

GetApplicationAsync(String, Nullable<Int32>, Nullable<DateTimeOffset>, CancellationToken)

Gets information about the specified Application.

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

Parameters

applicationId
String

The ID of the Application.

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.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

applicationId is null.

applicationId is an empty string, and was expected to be non-empty.

Examples

This sample shows how to call GetApplicationAsync.

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

Response<BatchApplication> response = await client.GetApplicationAsync("<applicationId>");

This sample shows how to call GetApplicationAsync with all parameters.

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

Response<BatchApplication> response = await client.GetApplicationAsync("<applicationId>", timeOutInSeconds: 1234, ocpdate: DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"));

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