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

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

始める前に

  1. Service Health API を有効にします。

    API を有効にするために必要なロール

    API を有効にするには、 権限を含む Service Usage 管理者 IAM ロール(roles/serviceusage.serviceUsageAdmin)が必要です。serviceusage.services.enable詳しくは、ロールを付与する方法をご覧ください。

    gcloud services enable servicehealth.googleapis.com
  2. プロジェクトに対して課金が有効になっていることを確認します Google Cloud 。

  3. このガイドで既存のプロジェクトを使用する場合は、このガイドを完了するために必要な 権限があることを確認します。新しいプロジェクトを作成した場合は、必要な権限がすでに付与されています。

必要なロール

サービス健全性イベントを一覧表示するために必要な権限を取得するには、イベントを一覧表示するプロジェクトまたは組織に対するPersonalized Service Health 閲覧者 roles/servicehealth.viewer)の IAM ロールを付与するように管理者に依頼します。ロールの付与については、プロジェクト、フォルダ、組織に対するアクセス権の管理をご覧ください。

必要な権限は、カスタム ロールや他の事前定義 ロールから取得することもできます。

参照

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

プロダクトまたはロケーションを設定する場合は、 Google Cloud プロダクトロケーションにある値を使用します。

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

特定の 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"
        }
      }
    ]
  }
}

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

特定の Google Cloud 組織で Personalized Service Health を 有効にしているプロジェクトに影響するすべての 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 を使用して、プロジェクトまたは 組織ごとにイベント情報を取得する方法をご覧ください。