次の方法で共有


DeviceManagementClient.GetDeploymentStatus メソッド

定義

展開中、完了、または失敗したデバイスの数の内訳を含む、展開の状態を取得します。

public virtual Azure.Response GetDeploymentStatus (string groupId, string deploymentId, Azure.RequestContext context = default);
abstract member GetDeploymentStatus : string * string * Azure.RequestContext -> Azure.Response
override this.GetDeploymentStatus : string * string * Azure.RequestContext -> Azure.Response
Public Overridable Function GetDeploymentStatus (groupId As String, deploymentId As String, Optional context As RequestContext = Nothing) As Response

パラメーター

groupId
String

グループ識別子。

deploymentId
String

デプロイ識別子。

context
RequestContext

要求コンテキスト。これは、呼び出しごとにクライアント パイプラインの既定の動作をオーバーライドできます。

戻り値

サービスから返された応答。 応答本文スキーマの詳細については、以下の「解説」セクションを参照してください。

例外

groupId または deploymentId が null です。

groupId または deploymentId が空の文字列であり、空でないと想定されていました。

サービスから成功以外の状態コードが返されました。

このサンプルでは、必要なパラメーターを使用して GetDeploymentStatus を呼び出し、結果を解析する方法を示します。

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

Response response = client.GetDeploymentStatus("<groupId>", "<deploymentId>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("groupId").ToString());
Console.WriteLine(result.GetProperty("deploymentState").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("errorDetail").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("occurredDateTime").ToString());
Console.WriteLine(result.GetProperty("subgroupStatus")[0].GetProperty("groupId").ToString());
Console.WriteLine(result.GetProperty("subgroupStatus")[0].GetProperty("deviceClassId").ToString());
Console.WriteLine(result.GetProperty("subgroupStatus")[0].GetProperty("deploymentState").ToString());
Console.WriteLine(result.GetProperty("subgroupStatus")[0].GetProperty("error").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("subgroupStatus")[0].GetProperty("error").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("subgroupStatus")[0].GetProperty("error").GetProperty("target").ToString());
Console.WriteLine(result.GetProperty("subgroupStatus")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("subgroupStatus")[0].GetProperty("error").GetProperty("innererror").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("subgroupStatus")[0].GetProperty("error").GetProperty("innererror").GetProperty("errorDetail").ToString());
Console.WriteLine(result.GetProperty("subgroupStatus")[0].GetProperty("error").GetProperty("occurredDateTime").ToString());
Console.WriteLine(result.GetProperty("subgroupStatus")[0].GetProperty("totalDevices").ToString());
Console.WriteLine(result.GetProperty("subgroupStatus")[0].GetProperty("devicesInProgressCount").ToString());
Console.WriteLine(result.GetProperty("subgroupStatus")[0].GetProperty("devicesCompletedFailedCount").ToString());
Console.WriteLine(result.GetProperty("subgroupStatus")[0].GetProperty("devicesCompletedSucceededCount").ToString());
Console.WriteLine(result.GetProperty("subgroupStatus")[0].GetProperty("devicesCanceledCount").ToString());

注釈

応答ペイロードの JSON スキーマを次に示します。

応答本文:

DeploymentStatusスキーマ:

{
              groupId: string, # Required. The group identity
              deploymentState: "Active" | "ActiveWithSubgroupFailures" | "Failed" | "Inactive" | "Canceled", # Required. The state of the deployment.
              error: {
                code: string, # Required. Server defined error code.
                message: string, # Required. A human-readable representation of the error.
                target: string, # Optional. The target of the error.
                details: [Error], # Optional. An array of errors that led to the reported error.
                innererror: {
                  code: string, # Required. A more specific error code than what was provided by the containing error.
                  message: string, # Optional. A human-readable representation of the error.
                  errorDetail: string, # Optional. The internal error or exception message.
                  innerError: InnerError, # Optional. An object containing more specific information than the current object about the error.
                }, # Optional. An object containing more specific information than the current object about the error.
                occurredDateTime: string (ISO 8601 Format), # Optional. Date and time in UTC when the error occurred.
              }, # Optional. The error details of the Failed state.  This is not present if the deployment state is not Failed.
              subgroupStatus: [
                {
                  groupId: string, # Required. The group identity
                  deviceClassId: string, # Required. The device class subgroup identity
                  deploymentState: "Active" | "Failed" | "Inactive" | "Canceled", # Required. The state of the subgroup deployment.
                  error: Error, # Optional. The error details of the Failed state.  This is not present if the deployment state is not Failed.
                  totalDevices: number, # Optional. The total number of devices in the deployment.
                  devicesInProgressCount: number, # Optional. The number of devices that are currently in deployment.
                  devicesCompletedFailedCount: number, # Optional. The number of devices that have completed deployment with a failure.
                  devicesCompletedSucceededCount: number, # Optional. The number of devices which have successfully completed deployment.
                  devicesCanceledCount: number, # Optional. The number of devices which have had their deployment canceled.
                }
              ], # Required. The collection of device class subgroup status objects
            }

適用対象