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

DeviceManagementClient.GetLogCollectionDetailedStatus 方法

定义

获取具有详细状态的日志收集。

public virtual Azure.Response GetLogCollectionDetailedStatus (string logCollectionId, Azure.RequestContext context = default);
abstract member GetLogCollectionDetailedStatus : string * Azure.RequestContext -> Azure.Response
override this.GetLogCollectionDetailedStatus : string * Azure.RequestContext -> Azure.Response
Public Overridable Function GetLogCollectionDetailedStatus (logCollectionId As String, Optional context As RequestContext = Nothing) As Response

参数

logCollectionId
String

日志收集标识符。

context
RequestContext

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

返回

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

例外

logCollectionId 为 null。

logCollectionId 是一个空字符串,预期为非空。

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

示例

此示例演示如何使用所需的参数调用 GetLogCollectionDetailedStatus 并分析结果。

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

Response response = client.GetLogCollectionDetailedStatus("<logCollectionId>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("operationId").ToString());
Console.WriteLine(result.GetProperty("createdDateTime").ToString());
Console.WriteLine(result.GetProperty("lastActionDateTime").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("deviceStatus")[0].GetProperty("deviceId").ToString());
Console.WriteLine(result.GetProperty("deviceStatus")[0].GetProperty("moduleId").ToString());
Console.WriteLine(result.GetProperty("deviceStatus")[0].GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("deviceStatus")[0].GetProperty("resultCode").ToString());
Console.WriteLine(result.GetProperty("deviceStatus")[0].GetProperty("extendedResultCode").ToString());
Console.WriteLine(result.GetProperty("deviceStatus")[0].GetProperty("logLocation").ToString());
Console.WriteLine(result.GetProperty("description").ToString());

注解

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

响应正文:

LogCollectionOperationDetailedStatus架构:

{
              operationId: string, # Optional. The device diagnostics operation id.
              createdDateTime: string, # Optional. The timestamp when the operation was created.
              lastActionDateTime: string, # Optional. A timestamp for when the current state was entered.
              status: "NotStarted" | "Running" | "Succeeded" | "Failed", # Optional. Operation status.
              deviceStatus: [
                {
                  deviceId: string, # Required. Device id
                  moduleId: string, # Optional. Module id.
                  status: "NotStarted" | "Running" | "Succeeded" | "Failed", # Required. Log upload status
                  resultCode: string, # Optional. Log upload result code
                  extendedResultCode: string, # Optional. Log upload extended result code
                  logLocation: string, # Optional. Log upload location
                }
              ], # Optional. Status of the devices in the operation
              description: string, # Optional. Device diagnostics operation description.
            }

适用于