你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

DeviceManagementClient.GetUpdateComplianceAsync(RequestContext) 方法

定义

获取有多少设备在其最新更新、有可用的新更新或正在接收新更新的明细。

public virtual System.Threading.Tasks.Task<Azure.Response> GetUpdateComplianceAsync (Azure.RequestContext context = default);
abstract member GetUpdateComplianceAsync : Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetUpdateComplianceAsync : Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetUpdateComplianceAsync (Optional context As RequestContext = Nothing) As Task(Of Response)

参数

context
RequestContext

请求上下文,可以基于每个调用替代客户端管道的默认行为。

返回

从服务返回的响应。 响应正文架构的详细信息,请参阅下面的“备注”部分。

例外

服务返回了非成功状态代码。

示例

此示例演示如何调用 GetUpdateComplianceAsync 并分析结果。

var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new DeviceManagementClient(endpoint, "<instanceId>", credential);

Response response = await client.GetUpdateComplianceAsync();

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("totalDeviceCount").ToString());
Console.WriteLine(result.GetProperty("onLatestUpdateDeviceCount").ToString());
Console.WriteLine(result.GetProperty("newUpdatesAvailableDeviceCount").ToString());
Console.WriteLine(result.GetProperty("updatesInProgressDeviceCount").ToString());

注解

下面是响应有效负载的 JSON 架构。

响应正文:

UpdateCompliance架构:

{
              totalDeviceCount: number, # Required. Total number of devices.
              onLatestUpdateDeviceCount: number, # Required. Number of devices on the latest update.
              newUpdatesAvailableDeviceCount: number, # Required. Number of devices with a newer update available.
              updatesInProgressDeviceCount: number, # Required. Number of devices with update in-progress.
            }

适用于