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

DeviceManagementClient.GetDeviceClassSubgroupAsync 方法

定义

获取设备类子组详细信息。 设备类子组是组中共享同一设备类的设备集。 同一设备类中的所有设备都与相同的更新兼容。

public virtual System.Threading.Tasks.Task<Azure.Response> GetDeviceClassSubgroupAsync (string groupId, string deviceClassId, Azure.RequestContext context = default);
abstract member GetDeviceClassSubgroupAsync : string * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetDeviceClassSubgroupAsync : string * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetDeviceClassSubgroupAsync (groupId As String, deviceClassId As String, Optional context As RequestContext = Nothing) As Task(Of Response)

参数

groupId
String

组标识符。

deviceClassId
String

设备类标识符。

context
RequestContext

请求上下文,它可以基于每个调用替代客户端管道的默认行为。

返回

从服务返回的响应。 响应正文架构的详细信息位于下面的“备注”部分。

例外

groupIddeviceClassId 为 null。

groupIddeviceClassId 是空字符串,预期为非空。

服务返回了不成功状态代码。

示例

此示例演示如何使用所需的参数调用 GetDeviceClassSubgroupAsync 并分析结果。

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

Response response = await client.GetDeviceClassSubgroupAsync("<groupId>", "<deviceClassId>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("deviceClassId").ToString());
Console.WriteLine(result.GetProperty("groupId").ToString());
Console.WriteLine(result.GetProperty("createdDateTime").ToString());
Console.WriteLine(result.GetProperty("deviceCount").ToString());
Console.WriteLine(result.GetProperty("deploymentId").ToString());

注解

下面是响应有效负载的 JSON 架构。

响应正文:

DeviceClassSubgroup架构:

{
              deviceClassId: string, # Required. Device class subgroup identity. This is generated from the model Id and the compat properties reported by the device update agent in the Device Update PnP interface in IoT Hub. It is a hex-encoded SHA1 hash.
              groupId: string, # Required. Group identity.
              createdDateTime: string, # Required. Date and time when the device class subgroup was created.
              deviceCount: number, # Optional. The number of devices in the device class subgroup.
              deploymentId: string, # Optional. The active deployment Id for the device class subgroup.
            }

适用于