DeviceManagementClient.GetLogCollectionsAsync(RequestContext) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Get all device diagnostics log collections.
public virtual Azure.AsyncPageable<BinaryData> GetLogCollectionsAsync (Azure.RequestContext context = default);
abstract member GetLogCollectionsAsync : Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetLogCollectionsAsync : Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetLogCollectionsAsync (Optional context As RequestContext = Nothing) As AsyncPageable(Of BinaryData)
Parameters
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The AsyncPageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.
Exceptions
Service returned a non-success status code.
Examples
This sample shows how to call GetLogCollectionsAsync and parse the result.
var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new DeviceManagementClient(endpoint, "<instanceId>", credential);
await foreach (var data in client.GetLogCollectionsAsync())
{
JsonElement result = JsonDocument.Parse(data.ToStream()).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 one item in the pageable response.
Response Body:
Schema for LogCollectionListValue
:
{
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
Azure SDK for .NET