Share via


DeviceManagementClient.GetDeviceClassSubgroupsForGroupsAsync 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.AsyncPageable<BinaryData> GetDeviceClassSubgroupsForGroupsAsync (string groupId, string filter = default, Azure.RequestContext context = default);
abstract member GetDeviceClassSubgroupsForGroupsAsync : string * string * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetDeviceClassSubgroupsForGroupsAsync : string * string * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetDeviceClassSubgroupsForGroupsAsync (groupId As String, Optional filter As String = Nothing, Optional context As RequestContext = Nothing) As AsyncPageable(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 AsyncPageable<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 GetDeviceClassSubgroupsForGroupsAsync 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);

await foreach (var data in client.GetDeviceClassSubgroupsForGroupsAsync("<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 GetDeviceClassSubgroupsForGroupsAsync 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);

await foreach (var data in client.GetDeviceClassSubgroupsForGroupsAsync("<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