次の方法で共有


DeviceManagementClient.GetDeviceClassSubgroupsForGroupsAsync メソッド

定義

グループのデバイス クラス サブグループを取得します。 デバイス クラス サブグループは、同じデバイス クラスを共有するグループ内のデバイスのセットです。 同じデバイス クラス内のすべてのデバイスは、同じ更新プログラムと互換性があります。

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)

パラメーター

groupId
String

グループ識別子。

filter
String

返されるデバイス クラス サブグループのセットを制限します。 compat プロパティは、名前と値でフィルター処理できます。 (つまり、filter=compatProperties/propertyName1 eq 'value1' と compatProperties/propertyName2 eq 'value2')。

context
RequestContext

要求コンテキスト。これは、呼び出しごとにクライアント パイプラインの既定の動作をオーバーライドできます。

戻り値

AsyncPageable<T>オブジェクトの一覧を含むサービスの BinaryData 。 コレクション内の各項目の本文スキーマの詳細については、以下の「解説」セクションを参照してください。

例外

groupId が null です。

groupId は空の文字列であり、空でないと想定されていました。

サービスから成功以外の状態コードが返されました。

このサンプルでは、必要なパラメーターを使用して GetDeviceClassSubgroupsForGroupsAsync を呼び出し、結果を解析する方法を示します。

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

このサンプルでは、すべてのパラメーターを使用して GetDeviceClassSubgroupsForGroupsAsync を呼び出す方法と、結果を解析する方法を示します。

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

注釈

ページング可能な応答の 1 つの項目の 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.
            }

適用対象