Operation

此資源表示作為網絡 API 調用結果的長時間運行的操作。

JSON 表示
{
  "name": string,
  "metadata": {
    "@type": string,
    field1: ...,
    ...
  },
  "done": boolean,

  // Union field result can be only one of the following:
  "error": {
    object(Status)
  },
  "response": {
    "@type": string,
    field1: ...,
    ...
  }
  // End of list of possible types for union field result.
}
字段
name

string

服務器分配的名稱,僅在最初返回它的服務中是唯一的。如果使用默認的HTTP映射, name應具有格式operations/some/unique/name

metadata

object

與操作關聯的特定於服務的元數據。它通常包含進度信息和通用元數據,例如創建時間。某些服務可能不提供此類元數據。任何返回長時間運行操作的方法都應記錄元數據類型(如果有)。

包含任意類型字段的對象。一個附加的字段"@type"包含URI識別的類型。例如: { "id": 1234, "@type": "types.example.com/standard/id" }

done

boolean

如果該值是false ,這意味著操作仍在進行中。如果true ,則操作完成,並且或者errorresponse是可用的。

聯盟場result 。的操作結果,其可以是一個error或有效的response 。如果done == false ,既不error也不response設置。如果done == true ,正好一個errorresponse設置。 result只能是以下情況之一:
error

object( Status )

操作失敗或取消時的錯誤結果。

response

object

操作成功時的正常反應。如果原始方法返回成功沒有數據,諸如Delete ,響應是google.protobuf.Empty 。如果原來的方法是標準Get / Create / Update ,響應應該是資源。對於其他方法,響應應具有類型XxxResponse ,其中Xxx是原來的方法的名稱。例如,如果原來的方法名是TakeSnapshot()所推斷的響應類型是TakeSnapshotResponse

包含任意類型字段的對象。一個附加的字段"@type"包含URI識別的類型。例如: { "id": 1234, "@type": "types.example.com/standard/id" }