列出事件供應器

Eventarc 提供者是一種服務或實體,可將事件直接傳送至 Google Cloud ,再轉送至您的專案。

第一方供應商是 Google Cloud 來源,例如 Cloud Storage。第三方提供者是指提供 Eventarc 來源的非Google Cloud 實體。

您可以執行 gcloud 指令和必要和選用旗標,列出所有供應商並擷取詳細資料,包括支援的事件類型。

必要條件

執行 gcloud 指令前,請務必完成下列事項:

  1. 設定 Google Cloud 專案 ID:

    gcloud config set project PROJECT_ID
    

    PROJECT_ID 替換為您的 Google Cloud 專案 ID。

    您可以在 Google Cloud 控制台的「歡迎」頁面找到專案 ID。

  2. 啟用 Eventarc API:

    gcloud services enable eventarc.googleapis.com
    

列出特定地區的所有供應商

如要列出特定位置的所有供應商,請按照下列步驟操作:

gcloud eventarc providers list \
    --location=LOCATION

LOCATION 替換為支援的 Eventarc 區域

例如:gcloud eventarc providers list --location=us-central1

輸出結果會與下列內容相似:

NAME                       LOCATION
bigquery.googleapis.com    us-central1
cloudbuild.googleapis.com  us-central1
storage.googleapis.com     us-central1
workflows.googleapis.com   us-central1
[...]

列出任何地點的所有供應商

如要列出任何位置的所有供應商:

gcloud eventarc providers list

輸出結果會與下列內容相似:

NAME                       LOCATION
workflows.googleapis.com   asia-northeast3
pubsub.googleapis.com      europe-west3
storage.googleapis.com     nam4
bigquery.googleapis.com    us-central1
cloudbuild.googleapis.com  us-central1
storage.googleapis.com     us-central1
workflows.googleapis.com   us-central1
storage.googleapis.com     us-east1
[...]

在任何地點列出特定供應商

如要在任何地點列出特定供應商:

gcloud eventarc providers list \
    --name=PROVIDER

PROVIDER 改為供應商名稱。

例如:gcloud eventarc providers list --name=storage.googleapis.com

輸出結果會與下列內容相似:

NAME                    LOCATION
storage.googleapis.com  nam4
storage.googleapis.com  us-central1
storage.googleapis.com  us-east1

列出任何地點的所有第三方供應商

如要列出任何地點的所有第三方供應商:

gcloud eventarc providers list --filter='eventTypes.type!~^google*'

輸出結果會列出所有第三方供應商。

說明特定供應商及其支援的事件類型

如要說明特定供應商及其支援的事件類型,請按照下列步驟操作:

  gcloud eventarc providers describe PROVIDER \
      --location=LOCATION

更改下列內容:

  • PROVIDER:特定供應商的名稱。
  • LOCATION:支援的 Eventarc 區域

例如:gcloud eventarc providers describe storage.googleapis.com --location=us-central1

輸出結果會與下列內容相似:

displayName: Cloud Storage
eventTypes:
- description: 'The live version of an object has become a noncurrent version, either
    because it was explicitly made noncurrent or because it was replaced by the upload
    of an object of the same name. Only sent when a bucket has enabled object versioning. '
  filteringAttributes:
  - attribute: bucket
    description: The bucket name being watched.
    required: true
  - attribute: type
    required: true
  type: google.cloud.storage.object.v1.archived
[...]

請記下事件類型,以便建立 Eventarc 觸發條件時使用。