本文說明如何使用 Service Health API 管理影響單一專案的事件。
事前準備
Verify that billing is enabled for your Google Cloud project.
參考資料
如要瞭解可用的方法,以及回應中各個欄位的意義,請參閱 Events API 參考資料 (v1、v1beta)。
設定產品或位置時,請使用 Google Cloud products 和 locations 中的值。
列出專案的所有待處理事件
請參閱快速入門導覽課程。
取得事件詳細資料
您可以使用 Get API 查看活動的詳細資訊。
使用任何要求資料之前,請先替換以下項目:
- API_VERSION:要使用的 API 版本。使用
v1或v1beta。 - PROJECT_ID:您的 Google Cloud 專案 ID。
- EVENT_ID:事件的 ID。
HTTP 方法和網址:
GET https://servicehealth.googleapis.com/API VERSION/projects/PROJECT_ID/locations/global/events/EVENT_ID
如要傳送要求,請展開以下其中一個選項:
您應該會收到如下的 JSON 回應:
{
"name": "projects/PROJECT_ID/locations/global/events/EVENT_ID",
"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 as of Tuesday, 2022-10-18 11:00 US/Pacific. We thank you for your patience while we worked on resolving the issue.",
"category": "INCIDENT",
"detailedCategory": "CONFIRMED_INCIDENT",
"state": "CLOSED",
"detailedState": "RESOLVED",
"artifacts": [
{
"artifact": "projects/PROJECT_ID/locations/global/artifacts/artifact_id",
"artifactCategory": "ARTIFACT_CATEGORY_INCIDENT_REPORT",
}
],
"eventImpacts": [
{
"product": {
"productName": "Google Cloud SQL",
"id": "hV87iK5DcEXKgWU2kDri",
},
"location": {
"locationName": "us-central1",
}
}
],
"relevance": "RELATED",
"updates": [
{
"updateTime": "2022-10-18T17:41:20.112287Z",
"title": "We are experiencing a connectivity issue affecting Google Cloud SQL in us-east1, australia-southeast2.",
"description": "We are experiencing an intermittent issue with Google Cloud SQL. Our engineering team continues to investigate the issue.",
"symptom": "None at this time.",
"workaround": "None at this time."
},
{
"updateTime": "2022-10-18T18:00:05.690761Z",
"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 as of Tuesday, 2022-10-18 11:00 US/Pacific.\n\nWe thank you for your patience while we worked on resolving the issue.",
"symptom": "None at this time.",
"workaround": "None at this time."
}
],
"updateTime": "2022-10-18T18:00:05.690761Z",
"startTime": "2022-10-18T17:41:20.112287Z",
"endTime": "2022-10-18T18:00:05.690761Z",
}
如果沒有取得事件的權限,您會收到下列 PERMISSION_DENIED 錯誤。
{
"error": {
"code": 403,
"message": "Permission 'servicehealth.events.get' denied on resource '//servicehealth.googleapis.com/projects/PROJECT_ID/locations/global/events/EVENT_ID' (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/events/EVENT_ID",
"permission": "servicehealth.events.get"
}
}
]
}
}
如要修正錯誤,請設定必要權限。