你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
DeviceManagementClient.GetGroup(String, RequestContext) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取设备组属性。
public virtual Azure.Response GetGroup (string groupId, Azure.RequestContext context = default);
abstract member GetGroup : string * Azure.RequestContext -> Azure.Response
override this.GetGroup : string * Azure.RequestContext -> Azure.Response
Public Overridable Function GetGroup (groupId As String, Optional context As RequestContext = Nothing) As Response
参数
- groupId
- String
组标识符。
- context
- RequestContext
请求上下文,它可以基于每个调用替代客户端管道的默认行为。
返回
从服务返回的响应。 响应正文架构的详细信息位于下面的“备注”部分。
例外
groupId
为 null。
groupId
是一个空字符串,预期为非空。
服务返回了不成功状态代码。
示例
此示例演示如何使用所需参数调用 GetGroup 并分析结果。
var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new DeviceManagementClient(endpoint, "<instanceId>", credential);
Response response = client.GetGroup("<groupId>");
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("groupId").ToString());
Console.WriteLine(result.GetProperty("groupType").ToString());
Console.WriteLine(result.GetProperty("createdDateTime").ToString());
Console.WriteLine(result.GetProperty("deviceCount").ToString());
Console.WriteLine(result.GetProperty("subgroupsWithNewUpdatesAvailableCount").ToString());
Console.WriteLine(result.GetProperty("subgroupsWithUpdatesInProgressCount").ToString());
Console.WriteLine(result.GetProperty("subgroupsWithOnLatestUpdateCount").ToString());
Console.WriteLine(result.GetProperty("deployments")[0].ToString());
注解
下面是响应有效负载的 JSON 架构。
响应正文:
的 Group
架构:
{
groupId: string, # Required. Group identity. This is created from the value of the ADUGroup tag in the Iot Hub's device/module twin or $default for devices with no tag.
groupType: "IoTHubTag" | "DefaultNoTag", # Required. Group type.
createdDateTime: string, # Required. Date and time when the update was created.
deviceCount: number, # Optional. The number of devices in the group.
subgroupsWithNewUpdatesAvailableCount: number, # Optional. The count of subgroups with new updates available.
subgroupsWithUpdatesInProgressCount: number, # Optional. The count of subgroups with updates in progress.
subgroupsWithOnLatestUpdateCount: number, # Optional. The count of subgroups with devices on the latest update.
deployments: [string], # Optional. The active deployment Ids for the group
}