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

BatchClient.GetNodeExtensionAsync Method

Definition

Overloads

GetNodeExtensionAsync(String, String, String, Nullable<Int32>, Nullable<DateTimeOffset>, IEnumerable<String>, RequestContext)

[Protocol Method] Gets information about the specified Compute Node Extension.

GetNodeExtensionAsync(String, String, String, Nullable<Int32>, Nullable<DateTimeOffset>, IEnumerable<String>, CancellationToken)

Gets information about the specified Compute Node Extension.

GetNodeExtensionAsync(String, String, String, Nullable<Int32>, Nullable<DateTimeOffset>, IEnumerable<String>, RequestContext)

Source:
BatchClientCustom.cs

[Protocol Method] Gets information about the specified Compute Node Extension.

public virtual System.Threading.Tasks.Task<Azure.Response> GetNodeExtensionAsync (string poolId, string nodeId, string extensionName, int? timeOutInSeconds, DateTimeOffset? ocpdate, System.Collections.Generic.IEnumerable<string> select, Azure.RequestContext context);
abstract member GetNodeExtensionAsync : string * string * string * Nullable<int> * Nullable<DateTimeOffset> * seq<string> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetNodeExtensionAsync : string * string * string * Nullable<int> * Nullable<DateTimeOffset> * seq<string> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetNodeExtensionAsync (poolId As String, nodeId As String, extensionName As String, timeOutInSeconds As Nullable(Of Integer), ocpdate As Nullable(Of DateTimeOffset), select As IEnumerable(Of String), context As RequestContext) As Task(Of Response)

Parameters

poolId
String

The ID of the Pool that contains the Compute Node.

nodeId
String

The ID of the Compute Node that contains the extensions.

extensionName
String

The name of the Compute Node Extension that you want to get information about.

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.

select
IEnumerable<String>

An OData $select clause.

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

poolId, nodeId or extensionName is null.

poolId, nodeId or extensionName 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 GetNodeExtensionAsync 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.GetNodeExtensionAsync("<poolId>", "<nodeId>", "<extensionName>", null, null, null, null);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());

This sample shows how to call GetNodeExtensionAsync 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.GetNodeExtensionAsync("<poolId>", "<nodeId>", "<extensionName>", 1234, DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), new string[] { "<select>" }, null);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("provisioningState").ToString());
Console.WriteLine(result.GetProperty("vmExtension").GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("vmExtension").GetProperty("publisher").ToString());
Console.WriteLine(result.GetProperty("vmExtension").GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("vmExtension").GetProperty("typeHandlerVersion").ToString());
Console.WriteLine(result.GetProperty("vmExtension").GetProperty("autoUpgradeMinorVersion").ToString());
Console.WriteLine(result.GetProperty("vmExtension").GetProperty("enableAutomaticUpgrade").ToString());
Console.WriteLine(result.GetProperty("vmExtension").GetProperty("settings").GetProperty("<key>").ToString());
Console.WriteLine(result.GetProperty("vmExtension").GetProperty("protectedSettings").GetProperty("<key>").ToString());
Console.WriteLine(result.GetProperty("vmExtension").GetProperty("provisionAfterExtensions")[0].ToString());
Console.WriteLine(result.GetProperty("instanceView").GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("instanceView").GetProperty("statuses")[0].GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("instanceView").GetProperty("statuses")[0].GetProperty("displayStatus").ToString());
Console.WriteLine(result.GetProperty("instanceView").GetProperty("statuses")[0].GetProperty("level").ToString());
Console.WriteLine(result.GetProperty("instanceView").GetProperty("statuses")[0].GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("instanceView").GetProperty("statuses")[0].GetProperty("time").ToString());
Console.WriteLine(result.GetProperty("instanceView").GetProperty("subStatuses")[0].GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("instanceView").GetProperty("subStatuses")[0].GetProperty("displayStatus").ToString());
Console.WriteLine(result.GetProperty("instanceView").GetProperty("subStatuses")[0].GetProperty("level").ToString());
Console.WriteLine(result.GetProperty("instanceView").GetProperty("subStatuses")[0].GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("instanceView").GetProperty("subStatuses")[0].GetProperty("time").ToString());

Applies to

GetNodeExtensionAsync(String, String, String, Nullable<Int32>, Nullable<DateTimeOffset>, IEnumerable<String>, CancellationToken)

Source:
BatchClientCustom.cs

Gets information about the specified Compute Node Extension.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Compute.Batch.BatchNodeVMExtension>> GetNodeExtensionAsync (string poolId, string nodeId, string extensionName, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, System.Collections.Generic.IEnumerable<string> select = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetNodeExtensionAsync : string * string * string * Nullable<int> * Nullable<DateTimeOffset> * seq<string> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Compute.Batch.BatchNodeVMExtension>>
override this.GetNodeExtensionAsync : string * string * string * Nullable<int> * Nullable<DateTimeOffset> * seq<string> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Compute.Batch.BatchNodeVMExtension>>
Public Overridable Function GetNodeExtensionAsync (poolId As String, nodeId As String, extensionName As String, Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional select As IEnumerable(Of String) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of BatchNodeVMExtension))

Parameters

poolId
String

The ID of the Pool that contains the Compute Node.

nodeId
String

The ID of the Compute Node that contains the extensions.

extensionName
String

The name of the Compute Node Extension that you want to get information about.

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.

select
IEnumerable<String>

An OData $select clause.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

poolId, nodeId or extensionName is null.

poolId, nodeId or extensionName is an empty string, and was expected to be non-empty.

Examples

This sample shows how to call GetNodeExtensionAsync.

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

Response<BatchNodeVMExtension> response = await client.GetNodeExtensionAsync("<poolId>", "<nodeId>", "<extensionName>");

This sample shows how to call GetNodeExtensionAsync with all parameters.

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

Response<BatchNodeVMExtension> response = await client.GetNodeExtensionAsync("<poolId>", "<nodeId>", "<extensionName>", timeOutInSeconds: 1234, ocpdate: DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), select: new string[] { "<select>" });

Applies to