你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
DeviceManagementClient.GetDeploymentsForDeviceClassSubgroups 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取设备类子组的部署列表。
public virtual Azure.Pageable<BinaryData> GetDeploymentsForDeviceClassSubgroups (string groupId, string deviceClassId, string orderBy = default, Azure.RequestContext context = default);
abstract member GetDeploymentsForDeviceClassSubgroups : string * string * string * Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetDeploymentsForDeviceClassSubgroups : string * string * string * Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetDeploymentsForDeviceClassSubgroups (groupId As String, deviceClassId As String, Optional orderBy As String = Nothing, Optional context As RequestContext = Nothing) As Pageable(Of BinaryData)
参数
- groupId
- String
组标识符。
- deviceClassId
- String
设备类标识符。
- orderBy
- String
对返回的部署集进行排序。 可以按开始日期订购。
- context
- RequestContext
请求上下文,可以基于每个调用替代客户端管道的默认行为。
返回
Pageable<T>包含对象列表的服务中的 BinaryData 。 集合中每个项的正文架构的详细信息,请参阅下面的“备注”部分。
例外
groupId
或 deviceClassId
为 null。
groupId
或 deviceClassId
是空字符串,预期为非空。
服务返回了非成功状态代码。
示例
此示例演示如何使用所需参数调用 GetDeploymentsForDeviceClassSubgroups 并分析结果。
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.GetDeploymentsForDeviceClassSubgroups("<groupId>", "<deviceClassId>"))
{
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("deploymentId").ToString());
Console.WriteLine(result.GetProperty("startDateTime").ToString());
Console.WriteLine(result.GetProperty("update").GetProperty("updateId").GetProperty("provider").ToString());
Console.WriteLine(result.GetProperty("update").GetProperty("updateId").GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("update").GetProperty("updateId").GetProperty("version").ToString());
Console.WriteLine(result.GetProperty("groupId").ToString());
}
此示例演示如何使用所有参数调用 GetDeploymentsForDeviceClassSubgroups,以及如何分析结果。
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.GetDeploymentsForDeviceClassSubgroups("<groupId>", "<deviceClassId>", "<orderBy>"))
{
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("deploymentId").ToString());
Console.WriteLine(result.GetProperty("startDateTime").ToString());
Console.WriteLine(result.GetProperty("update").GetProperty("updateId").GetProperty("provider").ToString());
Console.WriteLine(result.GetProperty("update").GetProperty("updateId").GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("update").GetProperty("updateId").GetProperty("version").ToString());
Console.WriteLine(result.GetProperty("update").GetProperty("description").ToString());
Console.WriteLine(result.GetProperty("update").GetProperty("friendlyName").ToString());
Console.WriteLine(result.GetProperty("groupId").ToString());
Console.WriteLine(result.GetProperty("deviceClassSubgroups")[0].ToString());
Console.WriteLine(result.GetProperty("isCanceled").ToString());
Console.WriteLine(result.GetProperty("isRetried").ToString());
Console.WriteLine(result.GetProperty("rollbackPolicy").GetProperty("update").GetProperty("updateId").GetProperty("provider").ToString());
Console.WriteLine(result.GetProperty("rollbackPolicy").GetProperty("update").GetProperty("updateId").GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("rollbackPolicy").GetProperty("update").GetProperty("updateId").GetProperty("version").ToString());
Console.WriteLine(result.GetProperty("rollbackPolicy").GetProperty("update").GetProperty("description").ToString());
Console.WriteLine(result.GetProperty("rollbackPolicy").GetProperty("update").GetProperty("friendlyName").ToString());
Console.WriteLine(result.GetProperty("rollbackPolicy").GetProperty("failure").GetProperty("devicesFailedPercentage").ToString());
Console.WriteLine(result.GetProperty("rollbackPolicy").GetProperty("failure").GetProperty("devicesFailedCount").ToString());
Console.WriteLine(result.GetProperty("isCloudInitiatedRollback").ToString());
}
注解
下面是可分页响应中一项的 JSON 架构。
响应正文:
的 DeploymentsListValue
架构:
{
deploymentId: string, # Required. The caller-provided deployment identifier. This cannot be longer than 73 characters, must be all lower-case, and cannot contain '&', '^', '[', ']', '{', '}', '|', '<', '>', forward slash, backslash, or double quote. The Updates view in the Azure Portal IoT Hub resource generates a GUID for deploymentId when you create a deployment.
startDateTime: string (ISO 8601 Format), # Required. The deployment start datetime.
update: {
updateId: {
provider: string, # Required. Update provider.
name: string, # Required. Update name.
version: string, # Required. Update version.
}, # Required. Update identifier.
description: string, # Optional. Update description.
friendlyName: string, # Optional. Friendly update name.
}, # Required. Update information for the update in the deployment.
groupId: string, # Required. The group identity for the devices the deployment is intended to update.
deviceClassSubgroups: [string], # Optional. The device class subgroups the deployment is compatible with and subgroup deployments have been created for. This is not provided by the caller during CreateOrUpdateDeployment but is automatically determined by Device Update
isCanceled: boolean, # Optional. Boolean flag indicating whether the deployment was canceled.
isRetried: boolean, # Optional. Boolean flag indicating whether the deployment has been retried.
rollbackPolicy: {
update: UpdateInfo, # Required. Update to rollback to.
failure: {
devicesFailedPercentage: number, # Required. Percentage of devices that failed.
devicesFailedCount: number, # Required. Number of devices that failed.
}, # Required. Failure conditions to initiate rollback policy.
}, # Optional. The rollback policy for the deployment.
isCloudInitiatedRollback: boolean, # Optional. Boolean flag indicating whether the deployment is a rollback deployment.
}