完了するまでの時間が通常でも長くなる API メソッドについては、クライアントに Operation を返すように設計できます。クライアントはこのインターフェースを使用することで、オペレーション リソースをポーリングして実際のレスポンスを非同期的に受信できます。また、オペレーション リソースを別の API(Pub/Sub API など)に渡してレスポンスを受信することもできます。長時間実行オペレーションを返す API サービスでは、デベロッパーがクライアントの動作の一貫性を期待できるように、Operations インターフェースを実装する必要があります。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-03-04 UTC。"],[[["\u003cp\u003eThe \u003ccode\u003eOperations\u003c/code\u003e interface manages long-running operations in API services, allowing clients to asynchronously receive responses to methods that take a long time.\u003c/p\u003e\n"],["\u003cp\u003eClients can use methods like \u003ccode\u003eCancelOperation\u003c/code\u003e to attempt to cancel an operation, \u003ccode\u003eDeleteOperation\u003c/code\u003e to indicate they are no longer interested in the result, and \u003ccode\u003eGetOperation\u003c/code\u003e to poll for the current state.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eListOperations\u003c/code\u003e enables clients to retrieve a list of operations that match specific criteria, using filtering and pagination.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eWaitOperation\u003c/code\u003e allows clients to wait for a specified operation to complete or until a timeout is reached, retrieving the latest state.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eOperation\u003c/code\u003e resource represents the long-running operation itself and contains details like the name, metadata, whether it's done, and either an error or a successful response.\u003c/p\u003e\n"]]],[],null,["# Package google.longrunning\n\nIndex\n-----\n\n- [Operations](/dataproc-serverless/docs/reference/rpc/google.longrunning#google.longrunning.Operations) (interface)\n- [CancelOperationRequest](/dataproc-serverless/docs/reference/rpc/google.longrunning#google.longrunning.CancelOperationRequest) (message)\n- [DeleteOperationRequest](/dataproc-serverless/docs/reference/rpc/google.longrunning#google.longrunning.DeleteOperationRequest) (message)\n- [GetOperationRequest](/dataproc-serverless/docs/reference/rpc/google.longrunning#google.longrunning.GetOperationRequest) (message)\n- [ListOperationsRequest](/dataproc-serverless/docs/reference/rpc/google.longrunning#google.longrunning.ListOperationsRequest) (message)\n- [ListOperationsResponse](/dataproc-serverless/docs/reference/rpc/google.longrunning#google.longrunning.ListOperationsResponse) (message)\n- [Operation](/dataproc-serverless/docs/reference/rpc/google.longrunning#google.longrunning.Operation) (message)\n- [WaitOperationRequest](/dataproc-serverless/docs/reference/rpc/google.longrunning#google.longrunning.WaitOperationRequest) (message)\n\nOperations\n----------\n\nManages long-running operations with an API service.\n\nWhen an API method normally takes long time to complete, it can be designed to return [Operation](/dataproc-serverless/docs/reference/rpc/google.longrunning#google.longrunning.Operation) to the client, and the client can use this interface to receive the real response asynchronously by polling the operation resource, or pass the operation resource to another API (such as Pub/Sub API) to receive the response. Any API service that returns long-running operations should implement the `Operations` interface so developers can have a consistent client experience.\n\nCancelOperationRequest\n----------------------\n\nThe request message for [Operations.CancelOperation](/dataproc-serverless/docs/reference/rpc/google.longrunning#google.longrunning.Operations.CancelOperation).\n\nDeleteOperationRequest\n----------------------\n\nThe request message for [Operations.DeleteOperation](/dataproc-serverless/docs/reference/rpc/google.longrunning#google.longrunning.Operations.DeleteOperation).\n\nGetOperationRequest\n-------------------\n\nThe request message for [Operations.GetOperation](/dataproc-serverless/docs/reference/rpc/google.longrunning#google.longrunning.Operations.GetOperation).\n\nListOperationsRequest\n---------------------\n\nThe request message for [Operations.ListOperations](/dataproc-serverless/docs/reference/rpc/google.longrunning#google.longrunning.Operations.ListOperations).\n\nListOperationsResponse\n----------------------\n\nThe response message for [Operations.ListOperations](/dataproc-serverless/docs/reference/rpc/google.longrunning#google.longrunning.Operations.ListOperations).\n\nOperation\n---------\n\nThis resource represents a long-running operation that is the result of a network API call.\n\nWaitOperationRequest\n--------------------\n\nThe request message for [Operations.WaitOperation](/dataproc-serverless/docs/reference/rpc/google.longrunning#google.longrunning.Operations.WaitOperation)."]]