本文档介绍了如何使用 Service Health API 管理影响单个项目的事件。
准备工作
Make sure 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
如需发送您的请求,请展开以下选项之一:
curl(Linux、macOS 或 Cloud Shell)
执行以下命令:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://servicehealth.googleapis.com/API VERSION /projects/PROJECT_ID /locations/global/events/EVENT_ID "
PowerShell (Windows)
执行以下命令:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://servicehealth.googleapis.com/API VERSION /projects/PROJECT_ID /locations/global/events/EVENT_ID " | Select-Object -Expand Content
您应该收到类似以下内容的 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"
}
}
]
}
}
如需修正此错误,请设置所需的权限。