你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

BatchClient.GetApplication Method

Definition

Overloads

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

[Protocol Method] Gets information about the specified Application.

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

Gets information about the specified Application.

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

Source:
BatchClient.cs

[Protocol Method] Gets information about the specified Application.

public virtual Azure.Response GetApplication (string applicationId, int? timeOutInSeconds, DateTimeOffset? ocpdate, Azure.RequestContext context);
abstract member GetApplication : string * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestContext -> Azure.Response
override this.GetApplication : string * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestContext -> Azure.Response
Public Overridable Function GetApplication (applicationId As String, timeOutInSeconds As Nullable(Of Integer), ocpdate As Nullable(Of DateTimeOffset), context As RequestContext) As 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 GetApplication 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 = client.GetApplication("<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 GetApplication 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 = client.GetApplication("<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

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

Source:
BatchClient.cs

Gets information about the specified Application.

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

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

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

This sample shows how to call GetApplication 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 = client.GetApplication("<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