ניהול אירועים בפרויקט

במאמר הזה מוסבר איך להשתמש ב-Service Health API כדי לנהל אירועים שמשפיעים על פרויקט אחד.

לפני שמתחילים

מוודאים שהחיוב מופעל בפרויקט ב- Google Cloud .

  1. מפעילים את Service Health API בפרויקט שבו רוצים לנהל את האירועים.
  2. מגדירים הרשאות גישה ל-Service Health API.

קובצי עזר

במאמרי העזרה של Events API (v1, v1beta) מפורטות השיטות שבהן אפשר להשתמש ומוסבר מה המשמעות של השדות בתגובות. בתגובה מה-API, כל רשומה ברשימה impact כוללת את state (AFFECTED או RESOLVED), startTime ו-endTime (כשהבעיה נפתרה) לכל מוצר ומיקום שהושפעו.

כשמגדירים את המוצר או המיקום, משתמשים בערכים שמופיעים ב-Google Cloud products וב-locations.

הצגת רשימה של כל האירועים הפעילים בפרויקט

למדריך למתחילים

קבלת פרטי האירוע

אתם יכולים להשתמש ב-Get API כדי לראות מידע מפורט על אירוע.

לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:

  • ‫API_VERSION: גרסת ה-API שבה ייעשה שימוש. אפשר להשתמש ב-v1 או ב-v1beta.
  • PROJECT_ID: מזהה הפרויקט בענן של Google.
  • ‫EVENT_ID: מזהה האירוע.

ה-method של ה-HTTP וכתובת ה-URL:

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"
        }
      }
    ]
  }
}

כדי לפתור את השגיאה, צריך להגדיר את ההרשאות הנדרשות.