DeviceUpdateClient.GetOperationStatuses メソッド

定義

すべてのインポート更新操作の一覧を取得します。 完了した操作は、自動削除の前に 7 日間保持されます。 削除操作は、この API バージョンでは返されません。

public virtual Azure.Pageable<BinaryData> GetOperationStatuses (string filter = default, int? top = default, Azure.RequestContext context = default);
abstract member GetOperationStatuses : string * Nullable<int> * Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetOperationStatuses : string * Nullable<int> * Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetOperationStatuses (Optional filter As String = Nothing, Optional top As Nullable(Of Integer) = Nothing, Optional context As RequestContext = Nothing) As Pageable(Of BinaryData)

パラメーター

filter
String

状態プロパティで操作をフィルター処理する場合は省略可能です。 "status eq 'NotStarted' または status eq 'Running' の 1 つの特定のフィルターのみがサポートされています。

top
Nullable<Int32>

コレクションから返される項目の数を制限する負以外の整数 n を指定します。 サービスは、指定された値 n より大きくない、使用可能な項目の数を返します。

context
RequestContext

要求コンテキスト。これは、クライアント パイプラインの既定の動作を呼び出しごとにオーバーライドできます。

戻り値

Pageable<T>オブジェクトの一覧を含むサービスの BinaryData 。 コレクション内の各項目の本文スキーマの詳細については、以下の「解説」セクションを参照してください。

例外

サービスから成功以外の状態コードが返されました。

このサンプルでは、GetOperationStatuses を呼び出して結果を解析する方法を示します。

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

foreach (var data in client.GetOperationStatuses())
{
    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());
}

このサンプルでは、すべてのパラメーターで GetOperationStatuses を呼び出す方法と、結果を解析する方法を示します。

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

foreach (var data in client.GetOperationStatuses("<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());
}

注釈

ページング可能な応答の 1 つの項目の JSON スキーマを次に示します。

応答本文:

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.
            }

適用対象