你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
BatchClient.GetApplications 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
GetApplications(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, CancellationToken) |
Lists all of the applications available in the specified Account. |
GetApplications(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, RequestContext) |
[Protocol Method] Lists all of the applications available in the specified Account.
|
GetApplications(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, CancellationToken)
- Source:
- BatchClient.cs
Lists all of the applications available in the specified Account.
public virtual Azure.Pageable<Azure.Compute.Batch.BatchApplication> GetApplications (int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, int? maxresults = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetApplications : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * System.Threading.CancellationToken -> Azure.Pageable<Azure.Compute.Batch.BatchApplication>
override this.GetApplications : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * System.Threading.CancellationToken -> Azure.Pageable<Azure.Compute.Batch.BatchApplication>
Public Overridable Function GetApplications (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 Pageable(Of BatchApplication)
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.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Examples
This sample shows how to call GetApplications.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
foreach (BatchApplication item in client.GetApplications())
{
}
This sample shows how to call GetApplications with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
foreach (BatchApplication item in client.GetApplications(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
GetApplications(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, RequestContext)
- Source:
- BatchClient.cs
[Protocol Method] Lists all of the applications available in the specified Account.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler GetApplications(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Pageable<BinaryData> GetApplications (int? timeOutInSeconds, DateTimeOffset? ocpdate, int? maxresults, Azure.RequestContext context);
abstract member GetApplications : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetApplications : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetApplications (timeOutInSeconds As Nullable(Of Integer), ocpdate As Nullable(Of DateTimeOffset), maxresults As Nullable(Of Integer), context As RequestContext) As Pageable(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.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The Pageable<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 GetApplications and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
foreach (BinaryData item in client.GetApplications(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 GetApplications 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);
foreach (BinaryData item in client.GetApplications(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());
}