クイックスタート: Service Health API を使用してプロジェクトまたは組織に影響するイベントを一覧表示する

このドキュメントでは、 Google Cloud プロジェクトまたは組織の Google Cloud プロダクトに影響している、または影響している可能性があるサービス健全性イベントを一覧表示する方法について説明します。Service Health API を使用します。

始める前に

  1. イベントを一覧表示する組織内のプロジェクトで Service Health API を有効にします
  2. Make sure that billing is enabled for your Google Cloud project.

  3. Service Health API にアクセスするための権限を設定します。
  4. OrganizationEvents API リソースと OrganizationImpacts API リソースを使用するように、組織の Identity and Access Management(IAM)権限を構成します。

    後述のコマンドデータを使用する前に、次のように置き換えます。

    • ORGANIZATION ID: Google Cloud 組織 ID。

    次のコマンドを実行します。

    Linux、macOS、Cloud Shell

    gcloud organizations add-iam-policy-binding ORGANIZATION_ID \
    --member {USER|GROUP|SERVICE_ACCOUNT} \
    --role roles/servicehealth.viewer

    Windows(PowerShell)

    gcloud organizations add-iam-policy-binding ORGANIZATION_ID `
    --member {USER|GROUP|SERVICE_ACCOUNT} `
    --role roles/servicehealth.viewer

    Windows(cmd.exe)

    gcloud organizations add-iam-policy-binding ORGANIZATION_ID ^
    --member {USER|GROUP|SERVICE_ACCOUNT} ^
    --role roles/servicehealth.viewer

    ORGANIZATION_ID を取得するには、組織リソース ID の取得をご覧ください。

    組織に付与された IAM ポリシーは、組織内のすべてのプロジェクトに継承されます。これらのポリシーを使用すると、組織全体で組織とプロジェクトのイベント API にアクセスできます。

参照

使用できるメソッドとレスポンス内のフィールドの意味については、Events(v1v1beta)、OrganizationEvents(v1v1beta)、OrganizationImpacts(v1v1beta)API リファレンスをご覧ください。

商品またはロケーションを設定する場合は、Google Cloud productslocations の値を使用します。

プロジェクトのアクティブなインシデントをすべて一覧表示する

特定のプロジェクトのすべてのインシデントを一覧表示できます。 Google Cloud Google Cloud

リクエストのデータを使用する前に、次のように置き換えます。

  • API_VERSION: 使用する API のバージョン。v1 または v1beta を使用してください。
  • PROJECT_ID: プロジェクトの ID。

HTTP メソッドと URL:

GET https://servicehealth.googleapis.com/API_VERSION/projects/PROJECT_ID/locations/global/events?filter=state=ACTIVE%20category=INCIDENT&page_size=2&page_token={page_token}

リクエストを送信するには、次のいずれかのオプションを展開します。

次のような JSON レスポンスが返されます。

{
  "events": [
    {
      "name": "projects/PROJECT_ID/locations/global/events/event-123",
      "title": "We are experiencing a connectivity issue affecting Google Cloud SQL in us-east1, australia-southeast2.",
      "description": "The issue with Google Cloud SQL has been resolved for all affected projects. We thank you for your patience while we worked on resolving the issue.",
      "category": "INCIDENT",
      "detailedCategory": "CONFIRMED_INCIDENT",
      "state": "ACTIVE",
      "detailedState": "CONFIRMED",
      "eventImpacts": [
        {
          "product": {
            "productName": "Google Cloud SQL",
            "id": "hV87iK5DcEXKgWU2kDri",
          },
          "location": {
            "locationName": "asia-east2",
          }
        },
        {
          "product": {
            "productName": "Google Cloud SQL",
            "id": "hV87iK5DcEXKgWU2kDri",
          },
          "location": {
            "locationName": "asia-southeast1",
          }
        }
      ],
      "relevance": "RELATED",
      "updateTime": "2022-10-18T17:44:05.690761Z",
      "startTime": "2022-10-18T17:41:20.112287Z",
    },
    {
      "name": "projects/PROJECT_ID/locations/global/events/event-567",
      "title": "Cloud Firestore may experience errors.",
      "description": "Mitigation work is currently underway by our engineering team. The mitigation is expected to complete by 2022-10-07T16:30:00Z.",
      "category": "INCIDENT",
      "detailedCategory": "CONFIRMED_INCIDENT",
      "state": "ACTIVE",
      "detailedState": "CONFIRMED",
      "eventImpacts": [
        {
          "product": {
            "productName": "Cloud Firestore",
            "id": "CETSkT92V21G6A1x28me",
          },
          "location": {
            "locationName": "us-central1-a",
          }
        }
      ],
      "relevance": "RELATED",
      "updateTime": "2022-10-07T15:19:59.409530Z",
      "startTime": "2022-10-07T15:10:35.887125Z",
      "nextUpdateTime": "2022-10-07T16:30:00Z"
    }
  ],
  "nextPageToken": "CgwIw8bDmgYQz4nUlgMQChomcHJvamVjdHMvcHNoLW1hbnVhbC"
}

イベントを一覧表示するための必要な権限がない場合は、PERMISSION_DENIED エラーが発生します。

{
  "error": {
    "code": 403,
    "message": "Permission 'servicehealth.events.list' denied on resource '//servicehealth.googleapis.com/projects/PROJECT_ID/locations/global' (or it may not exist).",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "IAM_PERMISSION_DENIED",
        "domain": "servicehealth.googleapis.com",
        "metadata": {
          "resource": "projects/PROJECT_ID/locations/global",
          "permission": "servicehealth.events.list"
        }
      }
    ]
  }
}

組織のアクティブなインシデントをすべて一覧表示する

特定の組織で Personalized Service Health が有効になっているプロジェクトに影響するすべてのインシデントを一覧表示できます。 Google Cloud Google Cloud

リクエストのデータを使用する前に、次のように置き換えます。

  • API_VERSION: 使用する API のバージョン。v1 または v1beta を使用してください。
  • ORGANIZATION_ID: Google Cloud 組織 ID。

HTTP メソッドと URL:

GET https://servicehealth.googleapis.com/API_VERSION/organizations/ORGANIZATION_ID/locations/global/organizationEvents?filter=state=ACTIVE%20category=INCIDENT&page_size=2&page_token={page_token}

リクエストを送信するには、次のいずれかのオプションを展開します。

次のような JSON レスポンスが返されます。

{
  "organization_events": [
    {
      "name": "organizations/ORGANIZATION_ID/locations/global/organizationEvents/event-123",
      "title": "We are experiencing a connectivity issue affecting Google Cloud SQL in us-east1, australia-southeast2.",
      "description": "The issue with Google Cloud SQL has been resolved for all affected projects. We thank you for your patience while we worked on resolving the issue.",
      "category": "INCIDENT",
      "detailedCategory": "CONFIRMED_INCIDENT",
      "state": "ACTIVE",
      "detailedState": "CONFIRMED",
      "eventImpacts": [
        {
          "product": {
            "productName": "Google Cloud SQL",
            "id": "hV87iK5DcEXKgWU2kDri",
          },
          "location": {
            "locationName": "asia-east2",
          }
        },
        {
          "product": {
            "productName": "Google Cloud SQL",
            "id": "hV87iK5DcEXKgWU2kDri",
          },
          "location": {
            "locationName": "asia-southeast1",
          }
        }
      ],
      "updateTime": "2022-10-18T17:44:05.690761Z",
      "startTime": "2022-10-18T17:41:20.112287Z",
    },
    {
      "name": "organizations/ORGANIZATION_ID/locations/global/organizationEvents/event-567",
      "title": "Cloud Firestore may experience errors.",
      "description": "Mitigation work is currently underway by our engineering team. The mitigation is expected to complete by 2022-10-07T16:30:00Z.",
      "category": "INCIDENT",
      "detailedCategory": "CONFIRMED_INCIDENT",
      "state": "ACTIVE",
      "detailedState": "CONFIRMED",
      "eventImpacts": [
        {
          "product": {
            "productName": "Cloud Firestore",
            "id": "CETSkT92V21G6A1x28me",
          },
          "location": {
            "locationName": "us-central1-a",
          }
        }
      ],
      "updateTime": "2022-10-07T15:19:59.409530Z",
      "startTime": "2022-10-07T15:10:35.887125Z",
      "nextUpdateTime": "2022-10-07T16:30:00Z"
    }
  ],
  "nextPageToken": "CgwIw8bDmgYQz4nUlgMQChomcHJvamVjdHMvcHNoLW1hbnVhbC"
}

ORGANIZATION_ID を取得するには、組織リソース ID の取得をご覧ください。

イベントを一覧表示する権限がない場合は、PERMISSION_DENIED エラーが発生します。

{
  "error": {
    "code": 403,
    "message": "Permission 'servicehealth.organizationEvents.list' denied on resource '//servicehealth.googleapis.com/organizations/ORGANIZATION_ID/locations/global' (or it may not exist).",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "IAM_PERMISSION_DENIED",
        "domain": "servicehealth.googleapis.com",
        "metadata": {
          "resource": "organizations/<var class="readonly">ORGANIZATION_ID</var>/locations/global",
          "permission": "servicehealth.organizationEvents.list"
        }
      }
    ]
  }
}

イベントの影響を受ける可能性がある組織内のプロジェクトを一覧表示する

特定の組織の次の条件を満たすすべてのプロジェクトを一覧表示できます。 Google Cloud

  • イベント(OrganizationImpact)の影響を受ける可能性があります。
  • Personalized Service Health が有効になっている。

リクエストのデータを使用する前に、次のように置き換えます。

  • API_VERSION: 使用する API のバージョン。v1 または v1beta を使用してください。
  • EVENT_ID: 組織に影響している可能性のあるイベントの ID。
  • ORGANIZATION_ID: Google Cloud 組織 ID。

HTTP メソッドと URL:

GET https://servicehealth.googleapis.com/API_VERSION/organizations/ORGANIZATION_ID/locations/global/organizationImpacts?filter=events:organizations%2FORGANIZATION_ID%2Flocations%2Fglobal%2FEVENT_ID&page_size=2&page_token={page_token}

リクエストを送信するには、次のいずれかのオプションを展開します。

次のような JSON レスポンスが返されます。

{
  "organization_impacts": [
    {
      "name": "organizations/ORGANIZATION_ID/locations/global/organizationImpacts/impact-123",
      "events": [
        "organizations/ORGANIZATION_ID/locations/global/organizationEvents/EVENT_ID",
      ],
      "asset": {
        "assetName": "//cloudresourcemanager.googleapis.com/projects/{PROJECT_NUMBER_1}",
        "assetType": "cloudresourcemanager.googleapis.com/Project",
      },
      "updateTime": "2022-10-18T17:44:05.690761Z",
    },
    {
      "name": "organizations/ORGANIZATION_ID/locations/global/organizationImpacts/impact-234",
      "events": [
        "organizations/ORGANIZATION_ID/locations/global/organizationEvents/EVENT_ID",
      ],
      "asset": {
        "assetName": "//cloudresourcemanager.googleapis.com/projects/{PROJECT_NUMBER_2}",
        "assetType": "cloudresourcemanager.googleapis.com/Project",
      },
      "updateTime": "2022-10-18T17:44:05.690761Z",
    }
  ],
  "nextPageToken": "CgwIw8bDmgYQz4nUlgMQChomcHJvamVjdHMvcHNoLW1hbnVhbC"
}

イベントを一覧表示する権限がない場合は、次の PERMISSION_DENIED エラーが発生します。

{
  "error": {
    "code": 403,
    "message": "Permission 'servicehealth.organizationImpacts.list' denied on resource '//servicehealth.googleapis.com/organizations/ORGANIZATION_ID/locations/global' (or it may not exist).",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "IAM_PERMISSION_DENIED",
        "domain": "servicehealth.googleapis.com",
        "metadata": {
          "resource": "organizations/ORGANIZATION_ID/locations/global",
          "permission": "servicehealth.organizationImpacts.list"
        }
      }
    ]
  }
}

次のステップ

Service Health API を使用してプロジェクトまたは組織のイベント情報を取得する方法については、方法をご覧ください。