你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
DeviceManagementClient.GetDeviceStatesForDeviceClassSubgroupDeployments 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取部署中的设备及其状态的列表。 可用于获取故障设备列表。
public virtual Azure.Pageable<BinaryData> GetDeviceStatesForDeviceClassSubgroupDeployments (string groupId, string deviceClassId, string deploymentId, string filter = default, Azure.RequestContext context = default);
abstract member GetDeviceStatesForDeviceClassSubgroupDeployments : string * string * string * string * Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetDeviceStatesForDeviceClassSubgroupDeployments : string * string * string * string * Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetDeviceStatesForDeviceClassSubgroupDeployments (groupId As String, deviceClassId As String, deploymentId As String, Optional filter As String = Nothing, Optional context As RequestContext = Nothing) As Pageable(Of BinaryData)
参数
- groupId
- String
组标识符。
- deviceClassId
- String
设备类标识符。
- deploymentId
- String
部署标识符。
- filter
- String
限制返回的部署设备状态集。 可以筛选 deviceId 和 moduleId 和/或 deviceState。
- context
- RequestContext
请求上下文,可以基于每个调用替代客户端管道的默认行为。
返回
Pageable<T>包含对象列表的服务中的 BinaryData 。 集合中每个项的正文架构的详细信息,请参阅下面的“备注”部分。
例外
groupId
、deviceClassId
或 deploymentId
为 null。
groupId
或 deviceClassId
deploymentId
是空字符串,预期为非空。
服务返回了非成功状态代码。
示例
此示例演示如何使用所需参数调用 GetDeviceStatesForDeviceClassSubgroupDeployments 并分析结果。
var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new DeviceManagementClient(endpoint, "<instanceId>", credential);
foreach (var data in client.GetDeviceStatesForDeviceClassSubgroupDeployments("<groupId>", "<deviceClassId>", "<deploymentId>"))
{
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("deviceId").ToString());
Console.WriteLine(result.GetProperty("retryCount").ToString());
Console.WriteLine(result.GetProperty("movedOnToNewDeployment").ToString());
Console.WriteLine(result.GetProperty("deviceState").ToString());
}
此示例演示如何使用所有参数调用 GetDeviceStatesForDeviceClassSubgroupDeployments,以及如何分析结果。
var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new DeviceManagementClient(endpoint, "<instanceId>", credential);
foreach (var data in client.GetDeviceStatesForDeviceClassSubgroupDeployments("<groupId>", "<deviceClassId>", "<deploymentId>", "<filter>"))
{
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("deviceId").ToString());
Console.WriteLine(result.GetProperty("moduleId").ToString());
Console.WriteLine(result.GetProperty("retryCount").ToString());
Console.WriteLine(result.GetProperty("movedOnToNewDeployment").ToString());
Console.WriteLine(result.GetProperty("deviceState").ToString());
}
注解
下面是可分页响应中一项的 JSON 架构。
响应正文:
的 DeploymentDeviceStatesListValue
架构:
{
deviceId: string, # Required. Device identity.
moduleId: string, # Optional. Device module identity.
retryCount: number, # Required. The number of times this deployment has been retried on this device.
movedOnToNewDeployment: boolean, # Required. Boolean flag indicating whether this device is in a newer deployment and can no longer retry this deployment.
deviceState: "Succeeded" | "InProgress" | "Canceled" | "Failed", # Required. Deployment device state.
}