Share via


DeviceManagementClient.GetLogCollectionAsync(String, RequestContext) Method

Definition

Get the device diagnostics log collection.

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

Parameters

logCollectionId
String

Log collection identifier.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service. Details of the response body schema are in the Remarks section below.

Exceptions

logCollectionId is null.

logCollectionId is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call GetLogCollectionAsync with required parameters and parse the result.

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

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

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

Remarks

Below is the JSON schema for the response payload.

Response Body:

Schema for LogCollection:

{
              operationId: string, # Optional. The log collection id.
              deviceList: [
                {
                  deviceId: string, # Required. Device Id
                  moduleId: string, # Optional. Module Id
                }
              ], # Required. Array of Device Update agent ids
              description: string, # Optional. Description of the diagnostics operation.
              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.
            }

Applies to