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/{unique_id} 的資源名稱。
|
metadata |
object
服務專屬,且與該作業相關聯的中繼資料,通常包含進度資訊和常用中繼資料 (例如建立時間)。部分服務可能不會提供這類中繼資料。凡是會傳回長時間執行作業的方法,都應記錄中繼資料類型 (如果有的話)。 包含任意類型欄位的物件。額外的 "@type" 欄位則包含能辨識類型的 URI。例如:{ "id": 1234, "@type": "types.example.com/standard/id" } .
|
done |
boolean
如果值為 false ,代表作業仍在執行中。如果設為 true ,表示作業已完成,且可用的 error 或 response 。
|
聯集欄位 result 。這是作業的執行結果,可能為 error ,或是有效的 response 。如果 done == false ,系統不會將結果設定為 error ,也不會設定為 response 。如果 done == true ,系統會將結果設定為 error 或 response 。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" } .
|
狀態
Status
類型會定義適用於不同程式設計環境 (包含 REST API 和遠端程序呼叫 (RPC) API) 的邏輯錯誤模型。gRPC 會使用這個模型。每個 Status
訊息包含三部分的資料:錯誤代碼、錯誤訊息和錯誤詳細資料。
如要進一步瞭解這個錯誤模型,以及如何使用這個錯誤模型,請參閱 API 設計指南。
JSON 表示法 |
{
"code": number,
"message": string,
"details": [
{
"@type": string,
field1: ...,
...
}
]
} |
欄位 |
code |
number
狀態碼,應為 google.rpc.Code 的列舉值。
|
message |
string
向開發人員顯示的錯誤訊息,應以英文呈現。所有向使用者顯示的錯誤訊息都應經過本地化,並透過 google.rpc.Status.details 欄位傳送,或是由用戶端加以本地化。
|
details[] |
object
包含錯誤詳細資料的訊息清單。這是供 API 使用的一組常用訊息類型。 包含任意類型欄位的物件。額外的 "@type" 欄位則包含能辨識類型的 URI。例如:{ "id": 1234, "@type": "types.example.com/standard/id" } .
|
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2022-09-26 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2022-09-26 (世界標準時間)。"],[[["This resource describes a long-running operation initiated by a network API call, tracked by a server-assigned name."],["Operations have metadata, a status flag (`done`), and a result which can indicate either an error (`error`) or a response (`response`)."],["The `Status` object provides structured error information with a code, message, and optional details for debugging."]]],["This describes a long-running operation's structure and status, represented in JSON. Key components include: `name` (server-assigned identifier), `metadata` (service-specific information), and `done` (operation status). Upon completion (`done: true`), either an `error` (defined by `Status`) or a `response` (success data) is available. `Status` includes `code` (error type), `message` (developer-facing error explanation), and `details` (error specifics). The `result` field can be either an error or response.\n"]]