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

DeviceManagementClient.GetDeviceClassSubgroupsForGroups 方法

定义

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

public virtual Azure.Pageable<BinaryData> GetDeviceClassSubgroupsForGroups (string groupId, string filter = default, Azure.RequestContext context = default);
abstract member GetDeviceClassSubgroupsForGroups : string * string * Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetDeviceClassSubgroupsForGroups : string * string * Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetDeviceClassSubgroupsForGroups (groupId As String, Optional filter As String = Nothing, Optional context As RequestContext = Nothing) As Pageable(Of BinaryData)

参数

groupId
String

组标识符。

filter
String

限制返回的设备类子组集。 可以按名称和值筛选兼容性属性。 (即 filter=compatProperties/propertyName1 eq 'value1' and compatProperties/propertyName2 eq 'value2') 。

context
RequestContext

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

返回

Pageable<T>包含对象列表的服务中的 BinaryData 。 集合中每个项的正文架构的详细信息,请参阅下面的“备注”部分。

例外

groupId 为 null。

groupId 是一个空字符串,预期为非空。

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

示例

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

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.GetDeviceClassSubgroupsForGroups("<groupId>"))
{
    JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("deviceClassId").ToString());
    Console.WriteLine(result.GetProperty("groupId").ToString());
    Console.WriteLine(result.GetProperty("createdDateTime").ToString());
}

此示例演示如何使用所有参数调用 GetDeviceClassSubgroupsForGroups,以及如何分析结果。

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.GetDeviceClassSubgroupsForGroups("<groupId>", "<filter>"))
{
    JsonElement result = JsonDocument.Parse(data.ToStream()).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 架构。

响应正文:

DeviceClassSubgroupsListValue架构:

{
              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.
            }

适用于