DeviceUpdateClient.GetOperationStatus Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Recuperar status de operação.
public virtual Azure.Response GetOperationStatus (string operationId, Azure.ETag? ifNoneMatch = default, Azure.RequestContext context = default);
abstract member GetOperationStatus : string * Nullable<Azure.ETag> * Azure.RequestContext -> Azure.Response
override this.GetOperationStatus : string * Nullable<Azure.ETag> * Azure.RequestContext -> Azure.Response
Public Overridable Function GetOperationStatus (operationId As String, Optional ifNoneMatch As Nullable(Of ETag) = Nothing, Optional context As RequestContext = Nothing) As Response
Parâmetros
- operationId
- String
Identificador de operação.
Define a condição If-None-Match. A operação será executada somente se a ETag no servidor não corresponder a esse valor.
- context
- RequestContext
O contexto de solicitação, que pode substituir os comportamentos padrão do pipeline do cliente por chamada.
Retornos
A resposta retornada do serviço. Os detalhes do esquema do corpo da resposta estão na seção Comentários abaixo.
Exceções
operationId
é nulo.
operationId
é uma cadeia de caracteres vazia e esperava-se que não estivesse vazia.
O serviço retornou um código de status sem êxito.
Exemplos
Este exemplo mostra como chamar GetOperationStatus com os parâmetros necessários e analisar o resultado.
var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new DeviceUpdateClient(endpoint, "<instanceId>", credential);
Response response = client.GetOperationStatus("<operationId>");
JsonElement result = JsonDocument.Parse(response.ContentStream).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());
Este exemplo mostra como chamar GetOperationStatus com todos os parâmetros e como analisar o resultado.
var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new DeviceUpdateClient(endpoint, "<instanceId>", credential);
Response response = client.GetOperationStatus("<operationId>", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).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());
Comentários
Abaixo está o esquema JSON para o conteúdo da resposta.
Corpo da resposta:
Esquema para UpdateOperation
:
{
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.
}
Aplica-se a
Azure SDK for .NET