다음을 통해 공유


DeviceManagementClient.GetDeviceClassSubgroupsForGroups Method

Definition

Get the device class subgroups for the group. A device class subgroup is the set of devices within the group that share the same device class. All devices within the same device class are compatible with the same updates.

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)

Parameters

groupId
String

Group identifier.

filter
String

Restricts the set of device class subgroups returned. You can filter on compat properties by name and value. (i.e. filter=compatProperties/propertyName1 eq 'value1' and compatProperties/propertyName2 eq 'value2').

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The Pageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.

Exceptions

groupId is null.

groupId is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call GetDeviceClassSubgroupsForGroups with required parameters and parse the result.

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());
}

This sample shows how to call GetDeviceClassSubgroupsForGroups with all parameters, and how to parse the result.

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());
}

Remarks

Below is the JSON schema for one item in the pageable response.

Response Body:

Schema for 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.
            }

Applies to