DeviceUpdateClient.GetOperationStatusesAsync Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Obtenga una lista de todas las operaciones de actualización de importación. Las operaciones completadas se conservan durante 7 días antes de eliminarse automáticamente. Esta versión de api no devuelve las operaciones de eliminación.
public virtual Azure.AsyncPageable<BinaryData> GetOperationStatusesAsync(string filter = default, int? top = default, Azure.RequestContext context = default);
abstract member GetOperationStatusesAsync : string * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetOperationStatusesAsync : string * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetOperationStatusesAsync (Optional filter As String = Nothing, Optional top As Nullable(Of Integer) = Nothing, Optional context As RequestContext = Nothing) As AsyncPageable(Of BinaryData)
Parámetros
- filter
- String
Opcional para filtrar las operaciones por propiedad status. Solo se admite un filtro específico: "status eq 'NotStarted' o status eq 'Running'".
Especifica un entero no negativo n que limita el número de elementos devueltos de una colección. El servicio devuelve el número de elementos disponibles hasta pero no mayor que el valor especificado n.
- context
- RequestContext
Contexto de solicitud, que puede invalidar los comportamientos predeterminados de la canalización de cliente por llamada.
Devoluciones
del AsyncPageable<T> servicio que contiene una lista de BinaryData objetos. Los detalles del esquema del cuerpo de cada elemento de la colección se encuentran en la sección Comentarios a continuación.
Excepciones
El servicio devolvió un código de estado no correcto.
Ejemplos
En este ejemplo se muestra cómo llamar a GetOperationStatusesAsync y analizar el resultado.
var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new DeviceUpdateClient(endpoint, "<instanceId>", credential);
await foreach (var data in client.GetOperationStatusesAsync())
{
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("operationId").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("lastActionDateTime").ToString());
Console.WriteLine(result.GetProperty("createdDateTime").ToString());
}
En este ejemplo se muestra cómo llamar a GetOperationStatusesAsync con todos los parámetros y cómo analizar el resultado.
var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new DeviceUpdateClient(endpoint, "<instanceId>", credential);
await foreach (var data in client.GetOperationStatusesAsync("<filter>", 1234))
{
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("operationId").ToString());
Console.WriteLine(result.GetProperty("status").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("resourceLocation").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("errorDetail").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("occurredDateTime").ToString());
Console.WriteLine(result.GetProperty("traceId").ToString());
Console.WriteLine(result.GetProperty("lastActionDateTime").ToString());
Console.WriteLine(result.GetProperty("createdDateTime").ToString());
Console.WriteLine(result.GetProperty("etag").ToString());
}
Comentarios
A continuación se muestra el esquema JSON de un elemento de la respuesta paginable.
Cuerpo de la respuesta:
Esquema para UpdateOperationsListValue
:
{
operationId: string, # Required. Operation Id.
status: "NotStarted" | "Running" | "Succeeded" | "Failed", # Required. Operation status.
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.
}, # Optional. The update being imported or deleted. For import, this property will only be populated after import manifest is processed successfully.
resourceLocation: string, # Optional. Location of the imported update when operation is successful.
error: {
code: string, # Required. Server defined error code.
message: string, # Required. A human-readable representation of the error.
target: string, # Optional. The target of the error.
details: [Error], # Optional. An array of errors that led to the reported error.
innererror: {
code: string, # Required. A more specific error code than what was provided by the containing error.
message: string, # Optional. A human-readable representation of the error.
errorDetail: string, # Optional. The internal error or exception message.
innerError: InnerError, # Optional. An object containing more specific information than the current object about the error.
}, # Optional. An object containing more specific information than the current object about the error.
occurredDateTime: string (ISO 8601 Format), # Optional. Date and time in UTC when the error occurred.
}, # Optional. Operation error encountered, if any.
traceId: string, # Optional. Operation correlation identity that can used by Microsoft Support for troubleshooting.
lastActionDateTime: string (ISO 8601 Format), # Required. Date and time in UTC when the operation status was last updated.
createdDateTime: string (ISO 8601 Format), # Required. Date and time in UTC when the operation was created.
etag: string, # Optional. Operation ETag.
}
Se aplica a
Azure SDK for .NET