リソースを変更する Compute Engine API を呼び出すと、Compute Engine によってオペレーションのリストにエントリが追加されます。たとえば、VM の更新でデータが変更された場合や、ホストイベントが発生して VM の状態が変更された場合、オペレーションが作成されます。このページでは、Trusted Cloud コンソール、Google Cloud CLI、または REST を使用して、Compute Engine オペレーションのリストを表示する方法について説明します。
オペレーションの完了には時間がかかる場合があるため、表示中に不完全なオペレーションが見つかることがあります。未完了のオペレーションの最終ステータスを確認する場合、オペレーションを繰り返し表示することはおすすめしません。オペレーションが完了するまで待つようにしてください。
始める前に
-
まだ設定していない場合は、認証を設定します。認証とは、 Trusted Cloud by S3NS サービスと API にアクセスするために ID を確認するプロセスです。ローカル開発環境からコードまたはサンプルを実行するには、次のいずれかのオプションを選択して Compute Engine に対する認証を行います。
Select the tab for how you plan to use the samples on this page:
Console
When you use the Trusted Cloud console to access Trusted Cloud by S3NS services and APIs, you don't need to set up authentication.
gcloud
-
After installing the Google Cloud CLI, sign in to the gcloud CLI with your federated identity and then initialize it by running the following command:
gcloud init
- Set a default region and zone.
Trusted Cloud コンソールで、[オペレーション] ページに移動します。
オペレーションの詳細については、[オペレーションの概要] をクリックしてください。たとえば、
my-instance
VM の移行の詳細を表示するには、[インスタンスの自動移行] オペレーションをクリックします。PROJECT_ID
: このリクエストのプロジェクト IDZONE
: このリクエストのゾーン
REST
このページの REST API サンプルをローカル開発環境で使用するには、gcloud CLI に指定した認証情報を使用します。
After installing the Google Cloud CLI, sign in to the gcloud CLI with your federated identity and then initialize it by running the following command:
gcloud init
詳細については、 Trusted Cloud 認証ドキュメントの REST を使用して認証するをご覧ください。
オペレーションの保持期間
オペレーションのクエリを実行する場合、完了したオペレーションは一定期間後、自動的にデータベースから削除されます。
Compute Engine での完了したオペレーションの保持期間は最小 1 時間、最大 14 日間です。プロジェクトで完了したオペレーションの保持期間が最小の 1 時間を超えることはよくありますが、1 時間以上保持されることを前提とするのは推奨されません。
保持期間は、ユーザーが
Operations.delete
メソッドを使用して削除したオペレーションには適用されません。オペレーションの表示
プロジェクトのオペレーションの一覧を表示するには、次の手順に沿って操作します。
コンソール
gcloud
gcloud compute
を使用してプロジェクトのオペレーションの一覧を表示するには、operations list
サブコマンドを使用します。指定したゾーン内のオペレーションの一覧を表示するには、
--filter
フラグを追加します。gcloud compute operations list --filter="zone:(ZONE)"
ZONE
は、オペレーションの一覧を表示するゾーンに置き換えます。たとえば、us-cental1-c
でのオペレーションの一覧を表示するには、次のコマンドを実行します。gcloud compute operations list --filter="zone:(us-central1-c)"
出力は次のようになります。
NAME TYPE TARGET HTTP_STATUS STATUS TIMESTAMP systemevent-1543845145000... compute.instances.migrateOnHostMaintenance us-central1-c/instances/my-instance 200 DONE 2018-12-03T05:52:25.000-08:00
REST
オペレーションに対する API リクエストは、グローバル、リージョン、ゾーンのいずれかのレベルで指定する必要があります。ライブ マイグレーション、VM の停止、自動再起動はすべてゾーンレベルのオペレーションです。
ゾーン オペレーションの場合は、
zoneOperations.list
メソッドにGET
リクエストを発行します。GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/operations
以下のように置き換えます。
リクエスト本文は空のままにします。
以下はゾーン オペレーション リクエストの出力例です。この出力では、ホストの移行に関する詳細が表示されています。
{ "kind": "compute#operation", "id": "3216798767364213712", "name": "systemevent-1543845145000-57c1e7574b840-a195b637-5ff74d9b", "zone": "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c", "operationType": "compute.instances.migrateOnHostMaintenance", "targetLink": "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/instances/my-instance", "targetId": "3070988523247098025", "status": "DONE", "statusMessage": "Instance migrated during Compute Engine maintenance.", "user": "system", "progress": 100, "insertTime": "2018-12-03T05:52:25.000-08:00", "startTime": "2018-12-03T05:52:25.000-08:00", "endTime": "2018-12-03T05:52:25.000-08:00", "selfLink": "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/operations/systemevent-1543845145000-57c1e7574b840-a195b637-5ff74d9b" }
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-21 UTC。
[[["わかりやすい","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"]],["最終更新日 2025-07-21 UTC。"],[[["Compute Engine operations are logged when a resource is mutated, such as during VM updates or host events, which alter the state of a VM."],["Operations can be viewed using the Google Cloud console, the Google Cloud CLI (gcloud), or REST, and they may be incomplete upon initial viewing."],["Authentication is only needed for gcloud or REST usage, and the provided steps outline the necessary commands for both."],["Completed operations are retained for a period ranging from a minimum of 1 hour to a maximum of 14 days, during which time they are available for viewing."],["To view operations, you must specify the scope of the request as either global, region, or zone level using gcloud or REST."]]],[]] -