你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
DeviceManagementClient.GetDeploymentStatus 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取部署的状态,包括部署中有多少设备正在进行、已完成或失败的明细。
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
}