Event Notifications CLI

IBM Cloud 命令列介面(CLI)為服務方案提供額外功能。IBM Cloud CLI支援擴充功能的插件架構。 您可從 IBM Cloud 插件庫安裝 Event Notifications 命令列介面 (CLI) 插件。 透過 Event Notifications 服務命令列介面(CLI)外掛程式,您可輕鬆運用現有的命令列指令來管理 Event Notifications 服務執行個體。

必要條件

當您登入 IBM Cloud CLI 時,系統會在有更新可用時通知您。 請務必將 CLI 保持最新,以便您可以使用適用於 Event Notifications CLI 外掛程式的指令及旗標。

IBM Cloud 快速參考卡

注意:1.15.2 之前的 CLI 外掛程式版本已不再支援

安裝 Event Notifications CLI

請使用 plugin install 指令安裝 Event Notifications CLI 外掛程式。

ibmcloud plugin install en

Event Notifications CLI 指令

注意 CLI 外掛程式 init 指令將於未來停用

ibmcloud en en-list

列出設定的目標區域中的實體。 您可以從列出的實體中擷取您的實體 GUID。

ibmcloud en en-list

設定 ibmcloud 事件通知 環境變數

請透過設定 IBM Cloud 目標區域(ibmcloud target -r )來指定您將進行作業的區域,或透過變數 IBMCLOUD_EN_ENDPOINT 匯出區域性端點;例如,若要使用雪梨區域,請參照以下設定:

  • 匯出 IBMCLOUD_EN_ENDPOINT= https://au-syd.event-notifications.cloud.ibm.com/event-notifications

  • 匯出 IBMCLOUD_EN_ENDPOINT 變數,以設定 Event Notifications 區域的公用端點。

    • 達拉斯 https://us-south.event-notifications.cloud.ibm.com/event-notifications
    • 倫敦: https://eu-gb.event-notifications.cloud.ibm.com/event-notifications
    • 雪梨: https://au-syd.event-notifications.cloud.ibm.com/event-notifications
    • 法蘭克福: https://eu-de.event-notifications.cloud.ibm.com/event-notifications
    • 馬德里: https://eu-es.event-notifications.cloud.ibm.com/event-notifications
    • 大阪: https://jp-osa.event-notifications.cloud.ibm.com/event-notifications
    • 東京: https://jp-tok.event-notifications.cloud.ibm.com/event-notifications
    • 多倫多 https://ca-tor.event-notifications.cloud.ibm.com/event-notifications
    • 聖保羅: https://br-sao.event-notifications.cloud.ibm.com/event-notifications
    • 蒙特婁: https://ca-mon.event-notifications.cloud.ibm.com/event-notifications
    • 華盛頓特區: https://us-east.event-notifications.cloud.ibm.com/event-notifications
    • 欽奈 https://in-che.event-notifications.cloud.ibm.com/event-notifications
    • 孟買: https://in-mum.event-notifications.cloud.ibm.com/event-notifications
  • 匯出 IBMCLOUD_EN_ENDPOINT 變數,設定 Event Notifications 區域私有端點。

    • 達拉斯 https://private.us-south.event-notifications.cloud.ibm.com/event-notifications
    • 倫敦: https://private.eu-gb.event-notifications.cloud.ibm.com/event-notifications
    • 雪梨: https://private.au-syd.event-notifications.cloud.ibm.com/event-notifications
    • 法蘭克福: https://private.eu-de.event-notifications.cloud.ibm.com/event-notifications
    • 馬德里: https://private.eu-es.event-notifications.cloud.ibm.com/event-notifications
    • 大阪: https://private.jp-osa.event-notifications.cloud.ibm.com/event-notifications
    • 東京: https://private.jp-tok.event-notifications.cloud.ibm.com/event-notifications
    • 多倫多 https://private.ca-tor.event-notifications.cloud.ibm.com/event-notifications
    • 聖保羅: https://private.br-sao.event-notifications.cloud.ibm.com/event-notifications
    • 蒙特婁: https://private.ca-mon.event-notifications.cloud.ibm.com/event-notifications
    • 華盛頓特區: https://private.us-east.event-notifications.cloud.ibm.com/event-notifications
    • 欽奈 https://private.in-che.event-notifications.cloud.ibm.com/event-notifications
    • 孟買: https://private.in-mum.event-notifications.cloud.ibm.com/event-notifications
  • 匯出 EVENT_NOTIFICATIONS_API_KEY 變數,以設定 Event Notifications 的實例 apikey

EVENT_NOTIFICATIONS_API_KEY 可為您的 IBM Cloud API 金鑰,或來自您的 Event Notifications 實例的服務憑證 API 金鑰。

來源

在 IBM Cloud 上執行。Event Notifications 來源。

ibmcloud 事件通知來源建立

  • 行動: 建立 Source

目前 CLI 僅支援建立 API 來源。

ibmcloud event-notifications sources-create --instance-id INSTANCE-ID --name NAME [--description DESCRIPTION] [--enabled ENABLED] [--store-notifications STORE-NOTIFICATIONS]
  • 要提供的參數:
--instance-id INSTANCE-ID (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

--name NAME (int64)

提供給 API 來源的名稱。

預設值為 。 最大長度為 255 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*()]*/

--description DESCRIPTION (字串)

來源的描述。 選用。

預設值為 ``。最大長度為 255 字元。 最小長度為 0 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*()]*/

--enabled ENABLED (布林)

啟用或停用來源的布林旗標。 選用。

該值設定為 true 表示啟用來源,設定為 false 表示停用來源。

--store-notifications (布林值)

啟用此功能,以便檢視傳入事件的載荷,以利疑難排解。

預設值為 false

ibmcloud 事件通知來源更新

  • 行動: 更新 Source
ibmcloud event-notifications source-update --instance-id INSTANCE-ID --id ID [--name NAME] [--description DESCRIPTION] [--enabled ENABLED] [--store-notifications STORE-NOTIFICATIONS]
  • 要提供的參數:
--instance-id (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

--name (int64)

API 來源名稱。

預設值為 ``。最大長度為 255 字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*()]*/

--description (int64)

API 來源說明

預設值為 ``。最大長度為 255 字元。 最小長度為 0 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*()]*/

--enabled (布林)

過濾結果的搜尋字串。

該值設定為 true 表示啟用來源,設定為 false 表示停用來源。

--store-notifications (布林值)

啟用來檢視傳入事件的有效負載,以便排除故障。

預設值為 `false`。

`--id` (字串)
:  來源的唯一 ID。 必要。

   最大長度為 `100` 個字元。 最小長度為 `1` 個字元。 值必須符合正規表達式 `/[a-zA-Z0-9-:_]*/`。

ibmcloud 事件通知來源清單

  • 操作: 列出所有 Source
ibmcloud event-notifications sources [--limit LIMIT] [--offset OFFSET] [--search SEARCH] --instance-id INSTANCE-ID
  • 要提供的參數:
--limit LIMIT (int64)

分頁結果的每頁最大筆數。

最大值為 100。 最小值為 1

--offset OFFSET (int64)

分頁結果的偏移量。

最小值為 0

--search SEARCH (字串)

用於篩選結果的搜尋字串。

最大長度為 100 個字元。 最小長度為 0 個字元。 值必須符合正規表達式 /[a-zA-Z0-9]/

--instance-id INSTANCE-ID (字串)

IBM Cloud 的唯一識別碼。Event Notifications 實例的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

[--force]

啟動以強制刪除資源(繞過確認提示)。

ibmcloud 事件通知來源取得

  • 行動: 具體說明 Source
ibmcloud event-notifications source --id ID --instance-id INSTANCE-ID
  • 要提供的參數:
--id ID (字串)

來源的唯一 ID。 必要。

最大長度為 100 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z0-9-:_]*/

--offset OFFSET

分頁結果的偏移量。

--search SEARCH

用於篩選結果的搜尋字串。

--instance-id INSTANCE-ID (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

[--force]

啟動以強制刪除資源(繞過確認提示)。

ibmcloud 事件通知來源刪除

  • 行動: 刪除特定 Source
ibmcloud event-notifications source-delete  --instance-id INSTANCE-ID --id ID
  • 要提供的參數:
--id ID (字串)

來源的唯一 ID。 必要。

最大長度為 100 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z0-9-:_]*/

--instance-id INSTANCE-ID (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

[--force]

啟動以強制刪除資源(繞過確認提示)。

目的地

在 IBM Cloud 上執行。Event Notifications 目的地。

建立 ibmcloud 事件通知目的地

  • 操作: 建立目的地。
ibmcloud event-notifications destination-create --instance-id INSTANCE-ID --name NAME --type TYPE [--description DESCRIPTION] [--collect-failed-events COLLECT-FAILED-EVENTS] [--config CONFIG] [--certificate CERTIFICATE] [--certificate-content-type CERTIFICATE-CONTENT-TYPE] [--icon16x16 ICON16X16] [--icon16x16-content-type ICON16X16-CONTENT-TYPE] [--icon16x162x ICON16X162X] [--icon16x162x-content-type ICON16X162X-CONTENT-TYPE] [--icon32x32 ICON32X32] [--icon32x32-content-type ICON32X32-CONTENT-TYPE] [--icon32x322x ICON32X322X] [--icon32x322x-content-type ICON32X322X-CONTENT-TYPE] [--icon128x128 ICON128X128] [--icon128x128-content-type ICON128X128-CONTENT-TYPE] [--icon128x1282x ICON128X1282X] [--icon128x1282x-content-type ICON128X1282X-CONTENT-TYPE]
  • 要提供的參數:
--instance-id (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

--name NAME (字串)

目的地名稱。 必要。

最大長度為 255 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/

--type TYPE (字串)

目標的類型。 可用的選項有 webhook、push_android、push_ios、push_chrome、push_firefox、push_huawei、push_safari、ibmce、ibmcos、msteams、pagerduty、servicenow、slack、smtp_custom、sms_custom、event_streams。 必要。

允許值為 webhook, push_android, push_ios,push_chrome,push_firefox,push_huawei,push_safari,ibmce, ibmcos,msteams,pagerduty,servicenow,slack,smtp_custom,sms_custom,event_streams. 最小長度為 1 個字元。

--collect-failed-events (布林值)

是否在 Cloud Object Storage桶中收集失敗事件。

預設值為 `false`。

`--description DESCRIPTION` (字串)
:  目的地簡介。

   預設值為 ` `。 最大長度為 `255` 個字元。 最小長度為 `0` 個字元。 值必須符合正規表達式 `/[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/`。
--certificate CERTIFICATE (字串)

要提供的憑證檔案路徑。 允許的檔案類型為 p8 及 p12 憑證。 提供傳送憑證的檔案位置。

--certificate-content-type CERTIFICATE-CONTENT-TYPE (字串)

在 iOS 目的地的情況下,要設定的憑證內容類型。 預設值為 ``。可用的選項為:p8 或 p12。

--config CONFIG ( DestinationConfig 例子 )

設定目的地特定參數所需的設定。

若您在未設定「--config」的情況下建立目的地,該目的地雖已建立,但在您完成設定前將無法運作。

--icon16x16 (io.ReadCloser)
Safari 圖示 16x16。

最大長度為 5000 個字元。 最小長度為 1 個字元。

--icon16x16-content-type (字串)

Icon16x16 的內容類型。

--icon16x162x (io.ReadCloser)

Safari 圖示 16x16@2x。

The maximum length is 5000 characters. The minimum length is 1 character.

--icon16x162x-content-type (字串)

Icon16x162x 的內容類型。

--icon32x32 (io.ReadCloser)

Safari 圖示 32x32。

The maximum length is 5000 characters. The minimum length is 1 character.

--icon32x32-content-type (字串)

Icon32x32 的內容類型。

--icon32x322x (io.ReadCloser)

Safari 圖示 32x32@2x。

The maximum length is 5000 characters. The minimum length is 1 character.

--icon32x322x-content-type (字串)

Icon32x322x 的內容類型。

--icon128x128 (io.ReadCloser)

Safari 圖示 128x128。

The maximum length is 5000 characters. The minimum length is 1 character.

--icon128x128-content-type (字串)

Icon128x128 的內容類型。

--icon128x1282x (io.ReadCloser)

Safari 圖示 128x128@2x。

The maximum length is 5000 characters. The minimum length is 1 character.

--icon128x1282x-content-type (字串)

Icon128x1282x 的內容類型。

{
   "params" : {
      "url" : "exampleString",
      "verb" : "get",
      "custom_headers" : { },
      "sensitive_headers" : [ "exampleString" ]
   }
}

注意:Event Notifications Destination Cloud Functions 已經廢棄,不再支援目的地類別。

範例

  • 以下範例顯示 iOS 目的地(push_ios) 使用 P8 憑證的 DestinationConfig 物件格式。 將 pre_prod Boolean 參數設定為 true,以將目的地設定為預先生產的目的地,否則設定值為 false
   {
      "params" : {
         "cert_type" : "p8",
         "is_sandbox" : true,
         "key_id": "production",
         "team_id": "1234",
         "bundle_id": "test1",
         "pre_prod" : "true" // Set to true in case of configuring Destination as pre-prod Destination (pre_prod destination can only be configured for Standard plan)
      }
   }
   ```


- 以下範例顯示 iOS 目的地(push_ios) 使用 P12 憑證的 `DestinationConfig` 物件格式。 將 `pre_prod` Boolean 參數設定為 *true*,以將目的地設定為預先生產的目的地,否則設定值為 *false*。

```json
   {
      "params" : {
         "cert_type" : "p12",
         "is_sandbox" : true,
         "password": "apnspasswordvalue",
         "pre_prod" : "true" true // Set to true in case of configuring Destination as pre-prod Destination (pre_prod destination can only be configured for Standard plan)
      }
   }
   ```

- 以下範例顯示 Chrome 目的地(push_chrome)的 `DestinationConfig` 物件格式。 將 `pre_prod` Boolean 參數設定為 *true*,以將目的地設定為預先生產的目的地,否則設定值為 *false*。

```json
   {
      "params" : {
         "api_key": "chromeapikey",
         "website_url" : "https://testwebsite.com",
         "pre_prod" : "true" true // Set to true in case of configuring Destination as pre-prod Destination (pre_prod destination can only be configured for Standard plan)
      }
   }
   ```

- 以下範例顯示 Firefox 目的地(push_firefox)的 `DestinationConfig` 物件格式。 將 `pre_prod` Boolean 參數設定為 *true*,以將目的地設定為預先生產的目的地,否則設定值為 *false*。

```json
   {
      "params" : {
         "website_url" : "https://testwebsite.com",
         "pre_prod" : "true" // Set to true in case of configuring Destination as pre-prod Destination (pre_prod destination can only be configured for Standard plan)
      }
   }
   ```

- 以下範例顯示 Slack 目的地(slack) 的 `DestinationConfig` 物件格式,類型為 incoming_webhook。

```json
   {
      "params" : {
         "type" : "incoming_webhook",
         "url" : "https://hooks.slack.com/services/G0gyhsush/TYodsjhs/GHTbfidsimkk"
      }
   }
   ```

- 以下範例顯示 Slack 目的地(slack)的 `DestinationConfig` 物件格式,類型為 direct_message。

```json
   {
      "params" : {
         "type" : "direct_message",
         "token" : "vhdwvecwefwefewivcweivcwiwiciwcvwicwec"
      }
   }
   ```

- 以下範例顯示 Safari 目的地 `DestinationConfig` 物件的格式(push_safari)。 將 `pre_prod` Boolean 參數設定為 *true*,以將目的地設定為預先生產的目的地,否則設定值為 *false*。

```json
   {
      "params": {
         "cert_type":"p12",
         "certificate_name":"Users/Testuser/Documents/safari.p12",
         "password":"safarinew",
         "url_format_string":"https://test.com",
         "website_name":"testwebsite",
         "website_push_id":"test",
         "website_url":"https://test.com",
         "pre_prod" : "true" // Set to true in case of configuring Destination as pre-prod Destination (pre_prod destination can only be configured for Standard plan)
      }
   }
   ```

- 以下範例顯示 MS Teams(msteams) 目的地 `DestinationConfig` 物件的格式。

```json
   {
      "params" : {
         "url" : "https://xyz.webhook.office.com"
      }
   }
   ```

- 以下範例顯示 PagerDuty(pagerduty ) 目的地的 `DestinationConfig` 物件格式。

   建議在建立目的地時只使用路由鍵。 API 金鑰已經過時,未來將無法使用。
   {: attention}

   ```json
   {
      "params" : {
         "routing_key" : "routingkeytoconnecttoPD",
         "api_key" : "cffunctionnamespaceserviceidapikey"
      }
   }
   ```


- 以下範例顯示 Webhook(webhook) 的 `DestinationConfig` 物件格式。

```json
   {
      "params" : {
         "url" : "exampleString",
         "verb" : "get",
         "custom_headers" : { },
         "sensitive_headers" : [ "exampleString" ]
      }
   }
   ```

- 以下範例顯示 Android(push_android) 目的地 `DestinationConfig` 物件的格式。

```json
   {
      "params" : {
         "project_id" : "6232305230320",
         "private_key" : "36e21epfweort823or8rt832pr8p2r832pr82pr382r8f",
         "client_email" : "testuser.123@gmail.com",
         "pre_prod" : true // Set to true in case of configuring Destination as pre-prod Destination (pre_prod destination can only be configured for Standard plan)
      }
   }
   ```


- 以下範例顯示 ServiceNow(servicenow ) 目的地 `DestinationConfig` 物件的格式。

```json
   {
      "params" : {
         "client_id" : "359705ceddd100eyfewyyw1f0f9e1c96",
         "client_secret": "testsecrets",
         "username": "testuser",
         "password": "user_password",
         "instance_name": "testinstancenje"
      }
   }
   ```

- 下面的示例顯示 Code Engine (ibmce) 目的地的 `DestinationConfig` 物件格式。

   代碼引擎 目的地類型:應用程式

   ```json
   {
      "params" : {
         "type" : "application",
         "url" : "https://codeengine.test.com",
         "verb" : "get",
         "custom_headers" : { },
         "sensitive_headers" : [ "exampleString" ]
      }
   }
   ```

   代碼引擎 目的地類型:工作

   ```json
   {
      "params" : {
         "type" : "job",
         "job_name" : "custom-job",
         "project_crn" : "crn:v1:bluemix:public:codeengine:us-south:a/e7e5820aeccb40efb78fd69a7858ef23:xxxxxxxxxxxxxx::"
      }
   }
   ```


- 下面的示例顯示 IBM Cloud Object Storage (ibmcos) 目的地的 `DestinationConfig` 物件格式。

```json
   {
      "params" : {
         "bucket_name" : "cos-destination-en-bucket",
         "instance_id" : "42e13636e-0548-41a0-a178-e95be28464773",
         "endpoint" : "https://s3.us-west.cloud-object-storage.appdomain.cloud"
      }
   }
   ```


- 以下範例顯示 Huawei(push_huawei) 目的地的 `DestinationConfig` 物件格式。

```json
   {
      "params" : {
         "client_id" : "359705ceddd100eyfew",
         "client_secret": "testsecrets",
         "pre_prod" : true // Set to true in case of configuring Destination as pre-prod Destination (pre_prod destination can only be configured for Standard plan)
      }
   }
   ```

- 以下範例顯示 `DestinationConfig` 自訂電子郵件(smtp_custom) 目的地物件的格式。 如果是自訂電子郵件沙盒(smtp_custom_sandbox)目的地,則不需要目的地設定參數。

   流程 進行自訂網域設定和驗證:<https://cloud.ibm.com/docs/event-notifications?topic=event-notifications-en-destinations-custom-email#en-destinations-custom-email-verify>

   ```json
   {
      "params" : {
         "domain": "mailx.com"
      }
   }
   ```

- 以下範例顯示 Event Streams (event_streams) 目的地的 `DestinationConfig` 物件格式。

```json
   {
      "params" : {
        "crn": "crn:v1:bluemix:public:messagehub:us-south:a/9f007405a9fe4a5d9345fa8c13357373:a292db6e-af78-4c0b-b3db-7d6794b637g::",
        "endpoint": "https://n6627w6t7dgeh2cfgd.svc09.us-south.eventstreams.cloud.ibm.com",
        "topic": "demo_topic"
      }
   }
   ```

- 以下範例顯示 App Configuration (app_configuration) 目的地的 `DestinationConfig` 物件格式。

```json
   {
      "params" : {
        "type": "features",
        "crn": "crn:v1:bluemix:public:apprapp:us-south:a/4a74f2c31f554afc88156b73a1d577c6:dbxxxx93-0xxa-4xx5-axcf-c2faxxxd::",
        "environment_id": "stage",
        "feature_id": "test"
      }
   }
   ```

注意:即使未使用 `DestinationConfig`,仍可建立自訂 SMS 收件端,但除非明確申請並設定所需的個人化號碼,否則該收件端將無法運作。 如需申請個人化號碼,請參閱「[自訂 SMS 個人化號碼](/docs/event-notifications?topic=event-notifications-en-destinations-sms-custom#en-destinations-sms-custom-numbers)」。

### ibmcloud 事件通知目的地清單 {: #en-cli-destination-list-command}

- **操作:** 列出所有 `Destination`。

```sh {: pre}
ibmcloud event-notifications destinations [--limit LIMIT] [--offset OFFSET] [--search SEARCH] --instance-id INSTANCE-ID
  • 要提供的參數:
--limit LIMIT (int64)

分頁結果的每頁最大筆數。

最大值為 100。 最小值為 1

--offset OFFSET (int64)

分頁結果的偏移量。

最小值為 0

--search SEARCH (字串)

用於篩選結果的搜尋字串。

最大長度為 100 個字元。 最小長度為 0 個字元。 值必須符合正規表達式 /[a-zA-Z0-9]/

--instance-id (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

ibmcloud 事件通知目的地獲取

  • 行動: 具體說明 Destination
ibmcloud event-notifications destination --id ID --instance-id INSTANCE-ID
  • 要提供的參數:
--id ID (字串)

目的地的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

--instance-id INSTANCE-ID (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

ibmcloud 事件通知目的地更新

  • 行動: 更新現有的 Destination
ibmcloud event-notifications destination-update --instance-id INSTANCE-ID --id ID [--name NAME] [--description DESCRIPTION] [--collect-failed-events COLLECT-FAILED-EVENTS] [--config CONFIG] [--certificate CERTIFICATE] [--certificate-content-type CERTIFICATE-CONTENT-TYPE] [--icon16x16 ICON16X16] [--icon16x16-content-type ICON16X16-CONTENT-TYPE] [--icon16x162x ICON16X162X] [--icon16x162x-content-type ICON16X162X-CONTENT-TYPE] [--icon32x32 ICON32X32] [--icon32x32-content-type ICON32X32-CONTENT-TYPE] [--icon32x322x ICON32X322X] [--icon32x322x-content-type ICON32X322X-CONTENT-TYPE] [--icon128x128 ICON128X128] [--icon128x128-content-type ICON128X128-CONTENT-TYPE] [--icon128x1282x ICON128X1282X] [--icon128x1282x-content-type ICON128X1282X-CONTENT-TYPE]
  • 要提供的參數:
--instance-id (字串)
IBM Cloud 事件通知實例的唯一 ID。 必要。
最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

目的地的唯一 ID。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

--name (字串)

目的地名稱。

最大長度為 255 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/

--description (字串)

目的地說明。

最大長度為 255 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/

--collect-failed-events (布林值)

是否在 Cloud Object Storage桶中收集失敗事件。

預設值為 false

--config (DestinationConfig)

說明目的地配置的內容。

提供一個 JSON 字串選項,或透過提供一個以 @ 開頭的 filepath 選項,指定要從中讀取的 JSON 檔案,例如 --config=@path/to/file.json

--certificate (io.ReadCloser)

APNS 證書。

最大長度為 5000 個字元。 最小長度為 1 個字元。

--certificate-content-type (字串)

證書的內容類型。

--icon16x16 (io.ReadCloser)

Safari 圖示 16x16。

最大長度為 5000 個字元。 最小長度為 1 個字元。

--icon16x16-content-type (字串)

Icon16x16 的內容類型。

--icon16x162x (io.ReadCloser)

Safari 圖示 16x16@2x。

最大長度為 5000 個字元。 最小長度為 1 個字元。

--icon16x162x-content-type (字串)

Icon16x162x 的內容類型。

--icon32x32 (io.ReadCloser)

Safari 圖示 32x32。

最大長度為 5000 個字元。 最小長度為 1 個字元。

--icon32x32-content-type (字串)

Icon32x32 的內容類型。

--icon32x322x (io.ReadCloser)

Safari 圖示 32x32@2x。

最大長度為 5000 個字元。 最小長度為 1 個字元。

--icon32x322x-content-type (字串)

Icon32x322x 的內容類型。

--icon128x128 (io.ReadCloser)

Safari 圖示 128x128。

最大長度為 5000 個字元。 最小長度為 1 個字元。

--icon128x128-content-type (字串)

Icon128x128 的內容類型。

--icon128x1282x (io.ReadCloser)

Safari 圖示 128x128@2x。

最大長度為 5000 個字元。 最小長度為 1 個字元。

--icon128x1282x-content-type (字串)

Icon128x1282x 的內容類型。

ibmcloud 事件通知目的地刪除

  • 操作: 刪除現有的 Destination
ibmcloud event-notifications destination-delete --id ID --instance-id INSTANCE-ID [--force]
  • 要提供的參數:
--id ID (字串)

目的地的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

--instance-id INSTANCE-ID (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

[--force] (布林)

啟動以強制刪除資源(繞過確認提示)。

ibmcloud event-notifications enabled-countries

取得已啟用的 SMS 目的地國家詳細資訊。

ibmcloud event-notifications enabled-countries --instance-id INSTANCE-ID --id ID

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

目的地的唯一 ID。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

範例

ibmcloud event-notifications enabled-countries \
    --instance-id=exampleString \
    --id=exampleString

ibmcloud event-notifications test-destination

測試目的地。

ibmcloud event-notifications test-destination --instance-id INSTANCE-ID --id ID

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

目的地的唯一 ID。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

範例

ibmcloud event-notifications test-destination \
    --instance-id=exampleString \
    --id=exampleString

ibmcloud event-notifications email-sandbox-destination-update

使用自訂網域將沙盒目的地升級為生產目的地。

ibmcloud event-notifications email-sandbox-destination-update --instance-id INSTANCE-ID --id ID --domain DOMAIN

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `32` 個字元。 最小長度為 `32` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/`。
--id (字串)

目的地的唯一 ID。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /^[0-9(a-f|A-F)]{8}-[0-9(a-f|A-F)]{4}-4[0-9(a-f|A-F)]{3}-[89ab][0-9(a-f|A-F)]{3}-[0-9(a-f|A-F)]{12}$/

--domain (字串)

電子郵件網域。 必要。

最大長度為 250 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /.*/

範例

ibmcloud event-notifications email-sandbox-destination-update \
    --instance-id=exampleString \
    --id=exampleString \
    --domain=exampleString

ibmcloud event-notifications verify-destination-update

驗證自訂網域的 SPF 和 DKIM 記錄。

ibmcloud event-notifications verify-destination-update --instance-id INSTANCE-ID --id ID --type TYPE

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

目的地的唯一 ID。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

--type (字串)

驗證類型。 必要。

最大長度為 20 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-z]/

範例

ibmcloud event-notifications verify-destination-update \
    --instance-id exampleString \
    --id exampleString \
    --type exampleString

主題

在 IBM Cloud 上執行。Event Notifications 主題。

ibmcloud 事件通知主題建立

  • 動作: 建立新的 Topic
ibmcloud event-notifications topic-create --name NAME [--description DESCRIPTION] [--sources SOURCES] --instance-id INSTANCE-ID
  • 要提供的參數:
--name NAME (字串)

主題的名稱。 必要。

最大長度為 255 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*()]*/

--description DESCRIPTION (字串)

主題的說明。

預設值為 ``。最大長度為 255 字元。 最小長度為 0 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*()]*/

--instance-id INSTANCE-ID (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

[--sources SOURCES] (TopicCreateSourcesItem[])

附屬於此主題的來源清單及其篩選設定。 這不僅僅是一份來源 ID 清單——每個條目都包含來源 ID 以及用來決定該來源的哪些事件會被路由至此主題的篩選規則。 請參 閱範例 以了解完整的結構。

範例

  • 以下範例顯示週期性定時器來源的 TopicCreateSourcesItem[] 物件格式。
    [
       {
          "id" : "exampleString",
          "rules" : [
             {
                "enabled" : true,
                "event_schedule_filter": {
                   "starts_at": "2024-12-23T12:00:00.000Z",
                   "ends_at": "2024-12-23T20:00:00.000Z",
                   "expression": "* * * * *"
                   }
             }
          ]
       }
    ]
   ```

- 以下範例展示了 ` `TopicCreateSourcesItem[]` ` 物件的格式。

```json
   [
      {
         "id" : "exampleString",
         "rules" : [
            {
               "enabled" : true,
               "event_type_filter" : "$.*",
               "notification_filter" : "exampleString"
            }
         ]
      }
   ]
   ```

- 以下範例展示了 ` `TopicUpdateSourcesItem[]` ` 物件的格式。

```json
   [
      {
         "id" : "exampleString",
         "rules" : [
            {
               "enabled" : true,
               "event_type_filter": "$.notification_event_info.event_type == \'cert_manager\'",
               "notification_filter" : "$.notification.findings[0].severity == \'MODERATE\'",
               "rule_id" : "exampleString"
            }
         ]
      }
   ]
   ```

### ibmcloud 事件通知主題清單 {: #en-cli-topic-list-command}

- **操作:** 列出所有 `Topic`。

```sh {: pre}
ibmcloud event-notifications topics [--limit LIMIT] [--offset OFFSET] [--search SEARCH] --instance-id INSTANCE-ID
  • 要提供的參數:
--limit LIMIT (int64)

分頁結果的每頁最大筆數。

最大值為 100。 最小值為 1

--offset OFFSET (int64)

分頁結果的偏移量。

最小值為 0

--search SEARCH (字串)

用於篩選結果的搜尋字串。

最大長度為 100 個字元。 最小長度為 0 個字元。 值必須符合正規表達式 /[a-zA-Z0-9]/

--instance-id INSTANCE-ID (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

ibmcloud 事件通知主題取得

  • 行動: 具體說明 Topic
ibmcloud event-notifications topic --id ID [--include INCLUDE] --instance-id INSTANCE-ID
  • 要提供的參數:
--id ID (字串)

主題的唯一 ID。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--include INCLUDE (字串)

包括子主題。

預設值為 ``。最大長度為 20 字元。 最小長度為 0 個字元。 值必須符合正規表達式 /[a-z]/

--instance-id INSTANCE-ID (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

ibmcloud 事件通知主題更新

  • 行動: 更新現有的 Topic
ibmcloud event-notifications topic-replace --id ID [--name NAME] [--description DESCRIPTION] [--sources SOURCES] --instance-id INSTANCE-ID
  • 要提供的參數:
--instance-id (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

--id (字串)

主題的唯一 ID。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--name (字串)

主題的名稱。

最大長度為 255 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*()]*/

--description (字串)

主題的說明。

預設值為 ``。最大長度為 255 字元。 最小長度為 0 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*()]*/

--sources (TopicUpdateSourcesItem[])

將新增至此主題的新來源清單及其篩選設定。 這不僅僅是一份來源 ID 清單——每個條目都包含來源 ID 以及用來決定該來源的哪些事件會被路由至此主題的篩選規則。 請參 閱範例 以了解完整的結構。

此標記僅新增來源。 已附加至該主題的來源無法被替換或更新——只能刪除後重新新增。 若要修改來源篩選器,請先將該來源從主題中移除,然後以新的篩選器設定重新新增該來源。

ibmcloud 事件通知主題刪除

  • 操作: 刪除現有的 Topic
ibmcloud event-notifications topic-delete --id ID --instance-id INSTANCE-ID [--force]
  • 要提供的參數:
--id ID (字串)

主題的唯一 ID。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--instance-id INSTANCE-ID (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

[--force] (布林)

啟動以強制刪除資源(繞過確認提示)。

訂閱

以 IBM Cloud 作業。Event Notifications 訂閱。

ibmcloud 事件通知訂閱建立

  • 動作: 建立新的 Subscription
ibmcloud event-notifications subscription-create --instance-id INSTANCE-ID --name NAME --destination-id DESTINATION-ID --topic-id TOPIC-ID [--description DESCRIPTION] [--attributes ATTRIBUTES]
  • 要提供的參數:
--name NAME (字串)

為訂閱設定的名稱。

最大長度為 50 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/

--instance-id INSTANCE-ID (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

--description DESCRIPTION (字串)

為訂閱設定的說明。

預設值為 ``。最大長度為 255 字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/

--destination-id DESTINATION-ID (字串)

要設定用於訂閱的目的地 ID。

最大長度為 150 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--topic-id TOPIC-ID (字串)

要設定訂閱的主題 ID。

最大長度為 150 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--attributes ATTRIBUTES (SubscriptionCreateAttributes)

為訂閱設定的屬性。

範例

  • 以下範例顯示 Webhook SubscriptionCreateAttributes 物件的格式。
   {
      "signing_enabled" : true,
      "template_id_notification": "a59f6e38-7a48-xxxx-b665-3724axx58b13"
   }
   ```

- 以下範例顯示 SMS `SubscriptionCreateAttributes` 物件的格式。

```json
   {
      "invited" :["+1xxxxxxxxxx", "+1xxxxxxxxxx"]
   }
   ```

- 以下範例顯示 IBM Email `SubscriptionCreateAttributes` 物件的格式。

```json
   {
      "invited" :["entest@gmail.com"],
      "add_notification_payload": true,
      "reply_to_mail": "en@ibm.com",
      "reply_to_name": "EYS ORG",
      "from_name":"ABC ORG"
   }
   ```

- 以下範例顯示 Slack Destination 類型為 incoming_webhook 的 `SubscriptionCreateAttributes` 物件格式。

```json
   {
      "attachment_color" : "#FF0000",
      "template_id_notification": "a59f6e38-7a48-xxxx-b665-3724axx58b13",
   }
   ```

- 以下範例顯示 Slack Destination 類型為 direct_message 的 `SubscriptionCreateAttributes` 物件格式。

```json
{
   "channels" : [{ "id": "GHIUIFJHGGH"},{"id": "TSFDIDFOFNF"}],
   "template_id_notification": "a59f6e38-7a48-xxxx-b665-3724axx58b13",
}
  • 以下範例顯示 ServiceNow SubscriptionCreateAttributes 物件的格式。
   {
      "assigned_to" : "serviceuser@gmail.com",
      "assignment_group" : "incidentgroup"
   }
   ```

- 以下範例顯示自訂電子郵件 `SubscriptionCreateAttributes` 物件的格式。

```json
   {
      "invited" :["entest@gmail.com"],
      "add_notification_payload": true,
      "reply_to_mail": "en@ibm.com",
      "reply_to_name": "EYS ORG",
   }
   ```
- 以下範例顯示自訂電子郵件沙箱 `SubscriptionCreateAttributes` 物件的格式。

```json
   {
      "invited" :["entest@gmail.com"],
      "add_notification_payload": true,
      "reply_to_mail": "en@ibm.com",
      "reply_to_name": "EYS ORG",
      "from_name":"ABC ORG",
      "from_email":"Testuser@mailx.com",
      "template_id_notification": "a59f6e38-7a48-xxxx-b665-3724afc58b13",
      "template_id_invitation": "f1ef32fb-b7dd-4405-xxxx-7b6719cee8aa"
   }
   ```
   - 以下範例顯示 Pagerduty/ Event Streams 的 `SubscriptionCreateAttributes` 物件格式。

   ```json
   {
      "template_id_notification": "a59f6e38-7a48-xxxx-b665-3724afc58b13",
   }
   ```
   - 以下範例顯示 App Configuration 的 `SubscriptionCreateAttributes` 物件格式。 當為目的地建立或更新訂閱時 **App Configuration**`attributes` 物件有特定的規則:
      - 您必須**包括 **`feature_flag_enabled`**或者**`template_id_notification`
      - 您**無法**同時包含這兩項屬性

      這可確保訂閱是針對正確的使用情境所建立——無論是**功能標誌評估**,還是**通知範本建立**,但不會同時涵蓋兩者。

   ```json
   {
      "template_id_notification": "e40843c8-xxxx-4717-xxxx-f923f2786a34",
   }
   ```
   ```json
   {
      "feature_flag_enabled": false,
   }
   ```

### ibmcloud 事件通知訂閱清單 {: #en-cli-subscription-list-command}

- **操作:** 列出所有 `Subscription`。

```sh {: pre}
ibmcloud event-notifications subscriptions [--offset OFFSET] [--limit LIMIT] [--search SEARCH] --instance-id INSTANCE-ID
  • 要提供的參數:
--limit LIMIT (int64)

分頁結果的每頁最大筆數。

最大值為 100。 最小值為 1

--offset OFFSET (int64)

分頁結果的偏移量。

最小值為 0

--search SEARCH (字串)

用於篩選結果的搜尋字串。

最大長度為 100 個字元。 最小長度為 0 個字元。 值必須符合正規表達式 /[a-zA-Z0-9]/

--instance-id INSTANCE-ID (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

ibmcloud 事件通知訂閱獲取

  • 行動: 具體說明 Subscription
ibmcloud event-notifications subscription --id ID --instance-id INSTANCE-ID
  • 要提供的參數:
--id ID (字串)

目的地的唯一 ID。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--instance-id INSTANCE-ID (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

ibmcloud 事件通知訂閱刪除

  • 操作: 刪除現有的 Subscription
ibmcloud event-notifications subscription-delete --id ID --instance-id INSTANCE-ID [--force]
  • 要提供的參數:
--id ID (字串)

目的地的唯一 ID。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--instance-id INSTANCE-ID (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

[--force] (布林)

啟動以強制刪除資源(繞過確認提示)。

ibmcloud 事件通知訂閱更新

  • 行動: 更新現有的 Subscription
ibmcloud event-notifications subscription-update --instance-id INSTANCE-ID --id ID [--name NAME] [--description DESCRIPTION] [--attributes ATTRIBUTES]
  • 要提供的參數:
--id ID (字串)

目的地的唯一 ID。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

[--name NAME] (字串)

要為訂閱設定的更新說明。

最大長度為 100 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z0-9-:_]*/

--instance-id INSTANCE-ID (字串)

IBM Cloud 的唯一識別碼。Event Notifications 實例的唯一識別碼。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/

[--description DESCRIPTION] (字串)

要為訂閱設定的更新說明。

預設值為 ``。最大長度為 100 字元。 最小長度為 0 個字元。 值必須符合正規表達式 /[a-zA-Z0-9-:_]*/

[-attributes ATTRIBUTES] (SubscriptionUpdateAttributes)

為訂閱設定的屬性

範例

  • 以下範例顯示 Webhook SubscriptionUpdateAttributes 物件的格式。
   {
      "signing_enabled": true
   }
   ```

- 以下範例顯示 IBM SMS 的 `SubscriptionUpdateAttributes` 物件格式。

```json
   {
      "invited": {
         "add": ["+8xxxxxxxxxx"],
         "remove": ["+1xxxxxxxxxx", "+91xxxxxxxxxx"]
      },
      "subscribed": {
         "remove": ["+1xxxxxxxxxx", "+91xxxxxxxxxx"]
      },
      "unsubscribed": {
         "remove": ["+1xxxxxxxxxx", "+91xxxxxxxxxx"]
      }
   }
   ```

- 以下範例顯示 IBM Email `SubscriptionUpdateAttributes` 物件的格式。

```json
   {
      "invited": {
         "add": ["example1@gmail.com"],
         "remove": []
      },
      "subscribed": {
         "remove": ["example2@gmail.com"]
      },
      "unsubscribed": {
         "remove": ["example3@gmail.com"]
      },
      "reply_to_mail": "example@ibm.com",
      "reply_to_name": "USA news",
      "from_name": "IBM",
      "add_notification_payload": true
   }
   ```

- 以下範例顯示自訂電子郵件 `SubscriptionUpdateAttributes` 物件的格式。

```json
   {
      "invited": {
         "add": ["example1@gmail.com"],
         "remove": []
      },
      "subscribed": {
         "remove": ["example2@gmail.com"]
      },
      "unsubscribed": {
         "remove": ["example3@gmail.com"]
      },
      "reply_to_mail": "example@ibm.com",
      "reply_to_name": "USA news",
      "from_name": "IBM",
      "from_email": "test@email.com",
      "add_notification_payload": true,
      "template_id_notification": "a59f6e38-7a48-xxxx-b665-3724afc58b13",
      "template_id_invitation": "f1ef32fb-b7dd-4405-xxxx-7b6719cee8aa"
   }
   ```

- 以下範例顯示自訂電子郵件沙箱 `SubscriptionUpdateAttributes` 物件的格式。

```json
   {
      "invited": {
         "add": ["example1@gmail.com"],
         "remove": []
      },
      "subscribed": {
         "remove": ["example2@gmail.com"]
      },
      "unsubscribed": {
         "remove": ["example3@gmail.com"]
      },
      "reply_to_mail": "example@ibm.com",
      "reply_to_name": "USA news",
      "add_notification_payload": true,
      "template_id_notification": "a59f6e38-7a48-xxxx-b665-3724afc58b13",
      "template_id_invitation": "f1ef32fb-b7dd-4405-xxxx-7b6719cee8aa"
   }
   ```

- 以下範例顯示 Slack 的 `SubscriptionUpdateAttributes` 物件格式,類型為 `incoming_webhook`。

```json
   {
      "attachment_color" : "#FF0000",
      "template_id_notification": "a59f6e38-7a48-xxxx-b665-3724axx58b13",
   }
   ```

- 以下範例顯示 Slack 的 `SubscriptionUpdateAttributes` 物件格式,類型為 `direct_message`。

```json
   {
      "channels": [{"id": "D01CFDTYBH", "operation": "add"}, {"id": "D01GHUTYBH", "operation": "remove"}],
      "template_id_notification": "a59f6e38-7a48-xxxx-b665-3724axx58b13",
   }
   ```

- 以下範例顯示立即服務 `SubscriptionUpdateAttributes` 物件的格式。

```json
   {
      "assigned_to" : "serviceuser@gmail.com",
      "assignment_group" : "incidentgroup"
   }
   ```

   - 以下範例顯示 Pagerduty/ Event Streams 的 `SubscriptionUpdateAttributes` 物件格式。

   ```json
   {
      "template_id_notification": "a59f6e38-7a48-xxxx-b665-3724axx58b13",
   }
   ```

   - 以下範例顯示 App Configuration 的 `SubscriptionCreateAttributes` 物件格式。 當為目的地建立或更新訂閱時 **App Configuration**`attributes` 物件有特定的規則:
      - 您必須**包括 **`feature_flag_enabled`**或者**`template_id_notification`
      - 您**無法**同時包含這兩項屬性
               這可確保訂閱是針對正確的使用情境所建立——無論是**功能標誌評估**,還是**通知範本建立**,但不會同時包含兩者。

   ```json
   {
      "template_id_notification": "e40843c8-xxxx-4717-xxxx-f923f2786a34",
   }
   ```
   ```json
   {
      "feature_flag_enabled": false,
   }
   ```

## 整合 {: #en-cli-integration}

在 IBM Cloud 上運作 Event Notifications 整合。

### ibmcloud事件通知整合 創建 {: #en-cli-integration-create-command}

```sh
ibmcloud event-notifications integration-create --instance-id INSTANCE-ID --type TYPE --metadata METADATA

指令選項

--instance-id (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。

 最大長度為 `36` 個字元。 最小長度為 `36` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--type (字串)

整合的類型 collect_failed_events。

最大長度為 50 個字元。 最小長度為 1 個字元。 允許值是 collect_failed_events。

--metadata (IntegrationCreateAttributes)

更新整合模式

整合所需的元資料。

範例

  • 以下範例展示了 IntegrationCreateAttributes 物件的格式。
   {
      "endpoint": "https://s3.us-west.cloud-object-storage.appdomain.cloud",
      "crn": "crn:v1:bluemix:public:cloud-object-storage:global:xxxxxxx6db359a81a1dde8f44bxxxxxx:xxxxxxxx-1d48-xxxx-xxxx-xxxxxxxxxxxx::",
      "bucket_name": "cloud-object-storage"
   }
   ```

### ibmcloud事件通知整合取代 {: #en-cli-integration-update-command}

更換 `Integration`.

```sh
ibmcloud event-notifications integration-replace --instance-id INSTANCE-ID --id ID --type Type --metadata METADATA

指令選項

--instance-id (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。

 最大長度為 `36` 個字元。 最小長度為 `36` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--type (字串)

整合類型 KMS/hs-crypto(已廢棄)。

最大長度為 50 個字元。 最小長度為 1 個字元。 允許值是 KMS 和 collect_failed_events。 注意:hs-crypto 類型已被廢棄。 將不支援具有 hs-crypto 類型的新整合資源。

--metadata (IntegrationReplaceAttributes)

更新整合模式

整合所需的元資料。

--id (字串)

整合的唯一識別碼。 必要。

最大長度為 100 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z0-9-:_]*/

範例

  • 以下範例顯示 IntegrationReplaceAttributes 物件的 kms 格式。
   {
      "endpoint" : "https://qa.us-south.kms.cloud.ibm.com",
      "crn" : "crn of key protect",
      "root_key_id" : "root key id"
   }
   ```

### ibmcloud 事件通知整合清單 {: #en-cli-integration-list-command}

列出所有 `Integrations`.

```sh
ibmcloud event-notifications integrations [--limit LIMIT] [--offset OFFSET] [--search SEARCH] --instance-id INSTANCE-ID

指令選項

--instance-id (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。

 最大長度為 `36` 個字元。 最小長度為 `36` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--limit (int64)

分頁結果的頁面限制。

最大值為 100。 最小值為 1

--offset (int64)

已分頁結果的偏移。

最小值為 0

--search (字串)

過濾結果的搜尋字串。

最大長度為 100 個字元。 最小長度為 0 個字元。 值必須符合正規表達式 /[a-zA-Z0-9]/

ibmcloud 事件通知整合獲取

取得特定 Integration.

ibmcloud event-notifications integration --id ID --instance-id INSTANCE-ID

指令選項

--instance-id (字串)

IBM Cloud Event Notifications 實例的唯一識別碼。

 最大長度為 `36` 個字元。 最小長度為 `36` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

整合的唯一識別碼。 必要。

最大長度為 100 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z0-9-:_]*/

範本

IBM Cloud Event Notifications 範本。

ibmcloud event-notifications template-create

建立新的範本。

ibmcloud event-notifications template-create --instance-id INSTANCE-ID --name NAME --type TYPE --params PARAMS [--description DESCRIPTION]

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--name (字串)

訊息範本。 必要。

最大長度為 255 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/

--type (字串)

範本類型。 必要。

最大長度為 24 個字元。 最小長度為 22 個字元。 值必須符合正規表達式 /^(smtp_custom.notification|smtp_custom.invitation)$/

--params (TemplateConfig)

描述範本配置的載荷。 必要。

此 JSON 選項可透過設定個別欄位與其他選項來提供。 它與這些選項相互排斥。

提供一個 JSON 字串選項,或透過提供一個以 @ 開頭的 filepath 選項,指定要從中讀取的 JSON 檔案,例如 --params=@path/to/file.json

--description (字串)

範本說明。

最大長度為 255 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/

--params-body (字串)

模板正文。 此選項為 JSON 選項 'params' 的子欄位提供一個值。 它與該選項相互排斥。

最大長度為 20000 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /.*/

--params-subject (字串)

範本主題。 此選項為 JSON 選項 'params' 的子欄位提供一個值。 它與該選項相互排斥。

最大長度為 1000 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /.*/

範例

  • 以下範例顯示 TemplateConfig 電子郵件物件的格式。 支援的類型為 smtp_custom.notification|smtp_custom.invitation
ibmcloud event-notifications template-create \
    --instance-id exampleString \
    --name exampleString \
    --type smtp_custom.notification \
    --params '{"body": "exampleString", "subject": "exampleString"}' \
    --description exampleString
  • 以下範例顯示 Slack 的 TemplateConfig 物件格式。 支援的類型是 slack.notification
ibmcloud event-notifications template-create \
    --instance-id exampleString \
    --name exampleString \
    --type slack.notification \
    --params '{"body": "ewoJImJsb2NrcyI6IFsKCQl7CgkJCSJ0eXBlIjogInNlY3Rpb24iLAoJCQkidGV4dCI6IHsKCQkJCSJ0eXBlIjogIm1ya2R3biIsCgkJCQkidGV4dCI6ICJOZXcgUGFpZCBUaW1lIE9mZiByZXF1ZXN0IGZyb20gPGV4YW1wbGUuY29tfEZyZWQgRW5yaXF1ZXo+XG5cbjxodHRwczovL2V4YW1wbGUuY29tfFZpZXcgcmVxdWVzdD4iCgkJCX0KCQl9CgldCn0="}' \
    --description exampleString
  • 以下範例顯示 Webhook TemplateConfig 物件的格式。 支援的類型為 webhook.notification
ibmcloud event-notifications template-create \
    --instance-id exampleString \
    --name exampleString \
    --type webhook.notification \
    --params '{"body": "ewoJImJsb2NrcyI6IFsKCQl7CgkJCSJ0eXBlIjogInNlY3Rpb24iLAoJCQkidGV4dCI6IHsKCQkJCSJ0eXBlIjogIm1ya2R3biIsCgkJCQkidGV4dCI6ICJOZXcgUGFpZCBUaW1lIE9mZiByZXF1ZXN0IGZyb20gPGV4YW1wbGUuY29tfEZyZWQgRW5yaXF1ZXo+XG5cbjxodHRwczovL2V4YW1wbGUuY29tfFZpZXcgcmVxdWVzdD4iCgkJCX0KCQl9CgldCn0="}' \
    --description exampleString
  • 以下範例顯示 Pagerduty TemplateConfig 物件的格式。 支援的類型為 pagerduty.notification
ibmcloud event-notifications template-create \
    --instance-id exampleString \
    --name exampleString \
    --type pagerduty.notification \
    --params '{"body": "ewogICJwYXlsb2FkIjogewogICAgInN1bW1hcnkiOiAie3sgZGF0YS5hbGVydF9kZWZpbml0aW9uLm5hbWV9fSIsCiAgICAidGltZXN0YW1wIjogInt7dGltZX19IiwKICAgICJzZXZlcml0eSI6ICJpbmZvIiwKICAgICJzb3VyY2UiOiAie3sgc291cmNlIH19IgogIH0sCiAgImRlZHVwX2tleSI6ICJ7eyBpZCB9fSIsCiAge3sjZXF1YWwgZGF0YS5zdGF0dXMgInRyaWdnZXJlZCJ9fQogICJldmVudF9hY3Rpb24iOiAidHJpZ2dlciIKICAge3svZXF1YWx9fQoKICB7eyNlcXVhbCBkYXRhLnN0YXR1cyAicmVzb2x2ZWQifX0KICAiZXZlbnRfYWN0aW9uIjogInJlc29sdmUiCiAge3svZXF1YWx9fQoKICAge3sjZXF1YWwgZGF0YS5zdGF0dXMgImFja25vd2xlZGdlZCJ9fQogICAiZXZlbnRfYWN0aW9uIjogImFja25vd2xlZGdlIgogICB7ey9lcXVhbH19Cn0="}' \
    --description exampleString
  • 以下範例顯示 Event Streams 的 TemplateConfig 物件格式。 支援的類型為 event_streams.notification
ibmcloud event-notifications template-create \
    --instance-id exampleString \
    --name exampleString \
    --type event_streams.notification \
    --params '{"body": "eyJuYW1lIjoie3tkYXRhLm5hbWV9fSIifQ=="}' \
    --description exampleString
  • 以下範例顯示 TemplateConfig Code Engine Job 物件的格式。 支援的類型為 ibmcejob.notification
ibmcloud event-notifications template-create \
    --instance-id exampleString \
    --name exampleString \
    --type ibmcejob.notification\
    --params '{"body": "ewogInJ1bl9lbnZfdmFyaWFibGVzIjogWwogICB7ICJuYW1lIjogInJlZ2lvbiIsICJ2YWx1ZSI6ICJ7e2RhdGEucmVnaW9ufX0iLCJ0eXBlIjogImxpdGVyYWwifSwKeyJuYW1lIjoiVkFSMSIsInR5cGUiOiJsaXRlcmFsIiwidmFsdWUiOiJ7e2RhdGEudmFyMX19In0sCnsibmFtZSI6IlZBUjIiLCJ0eXBlIjoibGl0ZXJhbCIsInZhbHVlIjoie3tkYXRhLnZhcjJ9fSJ9Cl0KfQ=="}' \
    --description exampleString
  • 以下範例顯示 Code Engine Application/Function 的 TemplateConfig 物件格式。 支援的類型為 ibmceapp.notification
ibmcloud event-notifications template-create \
    --instance-id exampleString \
    --name exampleString \
    --type ibmceapp.notification\
    --params '{"body": "ewogICJ2YXIxIjogInt7ZGF0YS52YXIxfX0iLAogICJ2YXIyIjogInt7ZGF0YS52YXIyfX0iCn0="}' \
    --description exampleString
  • 以下範例顯示 App Configuration 的 TemplateConfig 物件格式。 支援的類型為 app_configuration.notification
ibmcloud event-notifications template-create \
    --instance-id exampleString \
    --name exampleString \
    --type app_configuration.notification\
    --params '{"body": "eyJlbmFibGVkIjogZmFsc2V9Cg=="}' \
    --description exampleString

ibmcloud event-notifications templates

列出所有範本。 注意:如果沒有設定 --all-pages 選項,指令只會擷取集合的單一頁面。

ibmcloud event-notifications templates --instance-id INSTANCE-ID [--limit LIMIT] [--offset OFFSET] [--search SEARCH]

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--limit (int64)

分頁結果的頁面限制。

預設值為 10。 最大值為 100。 最小值為 1

--offset (int64)

已分頁結果的偏移。

預設值為 0。 最小值為 0

--search (字串)

過濾結果的搜尋字串。

最大長度為 100 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z0-9]/

--all-pages (布林值)

呼叫多個請求,以顯示模板集合中的所有頁面。

範例

ibmcloud event-notifications templates \
    --instance-id exampleString \
    --limit 10 \
    --offset 0 \
    --search exampleString

ibmcloud event-notifications template

取得範本的詳細資訊。

ibmcloud event-notifications template --instance-id INSTANCE-ID --id ID

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `32` 個字元。 最小長度為 `32` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/`。
--id (字串)

模板的唯一識別碼。 必要。

最大長度為 32 個字元。 最小長度為 32 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

範例

ibmcloud event-notifications template \
    --instance-id=exampleString \
    --id=exampleString

ibmcloud event-notifications template-replace

更新範本的詳細資訊。

ibmcloud event-notifications template-replace --instance-id INSTANCE-ID --id ID [--name NAME] [--description DESCRIPTION] [--type TYPE] [--params PARAMS]

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

模板的唯一識別碼。 必要。

最大長度為 32 個字元。 最小長度為 32 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--name (字串)

範本名稱。

最大長度為 255 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/

--description (字串)

範本說明。

最大長度為 255 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/

--type (字串)

範本類型。

最大長度為 24 個字元。 最小長度為 22 個字元。 值必須符合正規表達式 /^(smtp_custom.notification|smtp_custom.invitation)$/

--params (TemplateConfig)

描述範本配置的載荷。 此 JSON 選項可透過設定個別欄位與其他選項來提供。 它與這些選項相互排斥。

提供一個 JSON 字串選項,或透過提供一個以 @ 開頭的 filepath 選項,指定要從中讀取的 JSON 檔案,例如 --params=@path/to/file.json

範例

ibmcloud event-notifications template-update \
    --instance-id exampleString \
    --id exampleString \
    --name exampleString \
    --description exampleString \
    --type exampleString \
    --params '{"body": "exampleString", "subject": "exampleString"}'

ibmcloud event-notifications template-delete

刪除範本。

ibmcloud event-notifications template-delete --instance-id INSTANCE-ID --id ID

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

模板的唯一識別碼。 必要。

最大長度為 32 個字元。 最小長度為 32 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

範例

ibmcloud event-notifications template-delete \
    --instance-id exampleString \
    --id exampleString

ibmcloud event-notifications pre-defined-templates

列出所有預先定義的範本。

如果沒有設定 --all-pages 選項,指令只會擷取集合的單一頁面。

ibmcloud event-notifications pre-defined-templates --instance-id INSTANCE-ID --source SOURCE --type TYPE [--limit LIMIT] [--offset OFFSET] [--search SEARCH]

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `32` 個字元。 最小長度為 `32` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/`。
--source (字串)

來源類型。 必要。

最大長度為 50 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /.*/

--type (字串)

目的地類型。 必要。

最大長度為 50 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /.*/

--limit (int64)

分頁結果的頁面限制。

預設值為 10。 最大值為 100。 最小值為 1

--offset (int64)

已分頁結果的偏移。

預設值為 0。 最小值為 0

--search (字串)

過濾結果的搜尋字串。

最大長度為 100 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z0-9]/

--all-pages (布林值)

呼叫多個請求,以顯示「預定義範本」集合中的所有頁面。

範例

ibmcloud event-notifications pre-defined-templates \
    --instance-id=exampleString \
    --source=exampleString \
    --type=exampleString \
    --limit=10 \
    --offset=0 \
    --search=exampleString

SMTP 配置

IBM Cloud Event Notifications SMTP Configurations。

ibmcloud event-notifications smtp-configuration-create

建立新的 SMTP 設定。

ibmcloud event-notifications smtp-configuration-create --instance-id INSTANCE-ID --name NAME --domain DOMAIN [--description DESCRIPTION]

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--name (字串)

SMTP 設定的名稱。 必要。

最大長度為 250 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/

--domain (字串)

網域名稱。 必要。

最大長度為 512 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /.*/

--description (字串)

SMTP 設定說明。

最大長度為 250 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/

範例

ibmcloud event-notifications smtp-configuration-create \
    --instance-id=exampleString \
    --name=exampleString \
    --domain=exampleString \
    --description=exampleString

ibmcloud event-notifications smtp-configurations

列出所有 SMTP 設定。 注意:如果沒有設定 --all-pages 選項,指令只會擷取集合的單一頁面。

ibmcloud event-notifications smtp-configurations --instance-id INSTANCE-ID [--limit LIMIT] [--offset OFFSET] [--search SEARCH]

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--limit (int64)

分頁結果的頁面限制。

預設值為 10。 最大值為 100。 最小值為 1

--offset (int64)

已分頁結果的偏移。

預設值為 0。 最小值為 0

--search (字串)

過濾結果的搜尋字串。

最大長度為 100 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z0-9]/

--all-pages (布林值)

發出多個請求,以顯示 smtp-configurations 集合的所有頁面。

範例

ibmcloud event-notifications smtp-configurations \
    --instance-id=exampleString \
    --limit=10 \
    --offset=0 \
    --search=exampleString

ibmcloud event-notifications smtp-user-create

建立一個新的 SMTP 使用者。

ibmcloud event-notifications smtp-user-create --instance-id INSTANCE-ID --id ID [--description DESCRIPTION] [--username-to-clone USERNAME-TO-CLONE]

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

SMTP 的唯一識別碼。 必要。

最大長度為 32 個字元。 最小長度為 32 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--description (字串)

SMTP 設定說明。

最大長度為 250 個字元。 最小長度為 0 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/

--username-to-clone (字串)

提供要複製的使用者名稱。

最大長度為 20 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /^[a-z0-9]{18}\\d{2}$/

範例

ibmcloud event-notifications smtp-user-create \
    --instance-id=exampleString \
    --id=exampleString \
    --description=exampleString \
    --username-to-clone=exampleString

ibmcloud event-notifications smtp-users

列出所有 SMTP 使用者。 注意:如果沒有設定 --all-pages 選項,指令只會擷取集合的單一頁面。

ibmcloud event-notifications smtp-users --instance-id INSTANCE-ID --id ID [--limit LIMIT] [--offset OFFSET] [--search SEARCH]

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

SMTP 的唯一識別碼。 必要。

最大長度為 32 個字元。 最小長度為 32 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--limit (int64)

分頁結果的頁面限制。

預設值為 10。 最大值為 100。 最小值為 1

--offset (int64)

已分頁結果的偏移。

預設值為 0。 最小值為 0

--search (字串)

過濾結果的搜尋字串。

最大長度為 100 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z0-9]/

--all-pages (布林值)

發起多個請求,以顯示 smtp-users 集合的所有頁面。

範例

ibmcloud event-notifications smtp-users \
    --instance-id=exampleString \
    --id=exampleString \
    --limit=10 \
    --offset=0 \
    --search=exampleString

ibmcloud event-notifications smtp-configuration

取得 SMTP 設定的詳細資訊。

ibmcloud event-notifications smtp-configuration --instance-id INSTANCE-ID --id ID

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

SMTP 的唯一識別碼。 必要。

最大長度為 32 個字元。 最小長度為 32 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

範例

ibmcloud event-notifications smtp-configuration \
    --instance-id=exampleString \
    --id=exampleString

ibmcloud event-notifications smtp-configuration-update

更新 SMTP 的詳細資訊。

ibmcloud event-notifications smtp-configuration-update --instance-id INSTANCE-ID --id ID [--name NAME] [--description DESCRIPTION]

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

SMTP 的唯一識別碼。 必要。

最大長度為 32 個字元。 最小長度為 32 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--name (字串)

SMTP 名稱。

最大長度為 250 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/

--description (字串)

SMTP 描述。

最大長度為 250 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/

範例

ibmcloud event-notifications smtp-configuration-update \
    --instance-id=exampleString \
    --id=exampleString \
    --name=exampleString \
    --description=exampleString

ibmcloud event-notifications smtp-configuration-delete

刪除 SMTP 設定。

ibmcloud event-notifications smtp-configuration-delete --instance-id INSTANCE-ID --id ID

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

SMTP 的唯一識別碼。 必要。

最大長度為 32 個字元。 最小長度為 32 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

範例

ibmcloud event-notifications smtp-configuration-delete \
    --instance-id=exampleString \
    --id=exampleString

ibmcloud event-notifications smtp-user

取得 SMTP 使用者的詳細資訊。

ibmcloud event-notifications smtp-user --instance-id INSTANCE-ID --id ID --user-id USER-ID

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

SMTP 的唯一識別碼。 必要。

最大長度為 32 個字元。 最小長度為 32 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--user-id (字串)

UserID. 必要。

最大長度為 256 個字元。 最小長度為 5 個字元。 值必須符合正規表達式 /.*/

範例

ibmcloud event-notifications smtp-user \
    --instance-id=exampleString \
    --id=exampleString \
    --user-id=exampleString

ibmcloud event-notifications smtp-user-update

更新 SMTP 使用者的詳細資訊。

ibmcloud event-notifications smtp-user-update --instance-id INSTANCE-ID --id ID --user-id USER-ID [--description DESCRIPTION]

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

SMTP 的唯一識別碼。 必要。

最大長度為 32 個字元。 最小長度為 32 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--user-id (字串)

UserID. 必要。

最大長度為 256 個字元。 最小長度為 5 個字元。 值必須符合正規表達式 /.*/

--description (字串)

SMTP 使用者說明。

最大長度為 250 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/

範例

ibmcloud event-notifications smtp-user-update \
    --instance-id=exampleString \
    --id=exampleString \
    --user-id=exampleString \
    --description=exampleString

ibmcloud event-notifications smtp-user-delete

刪除 SMTP 使用者。

ibmcloud event-notifications smtp-user-delete --instance-id INSTANCE-ID --id ID --user-id USER-ID

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

SMTP 的唯一識別碼。 必要。

最大長度為 32 個字元。 最小長度為 32 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--user-id (字串)

UserID. 必要。

最大長度為 256 個字元。 最小長度為 5 個字元。 值必須符合正規表達式 /.*/

範例

ibmcloud event-notifications smtp-user-delete \
    --instance-id=exampleString \
    --id=exampleString \
    --user-id=exampleString

ibmcloud event-notifications smtp-allowed-ips

取得 SMTP 允許 IP 的詳細資訊。

ibmcloud event-notifications smtp-allowed-ips --instance-id INSTANCE-ID --id ID

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

SMTP 的唯一識別碼。 必要。

最大長度為 32 個字元。 最小長度為 32 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

範例

ibmcloud event-notifications smtp-allowed-ips \
    --instance-id=exampleString \
    --id=exampleString

ibmcloud event-notifications smtp-allowed-ips-update

注意:對傳統 allowlisting 的支援已被廢棄。 該支援已透過 Context-based-restrictions 啟用。 如需詳細資訊,請參閱此處:https://cloud.ibm.com/docs/event-notifications?topic=event-notifications-en-smtp-configurations#en-smtp-configurations-cbr

ibmcloud event-notifications verify-smtp-update

驗證 SMTP 的 SPF 和 DKIM 記錄。

ibmcloud event-notifications verify-smtp-update --instance-id INSTANCE-ID --id ID --type TYPE

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--id (字串)

SMTP 的唯一識別碼。 必要。

最大長度為 32 個字元。 最小長度為 32 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--type (字串)

SMTP 驗證類型。 必要。

最大長度為 20 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /.*/

範例

ibmcloud event-notifications verify-smtp-update \
    --instance-id=exampleString \
    --id=exampleString \
    --type=exampleString

度量值

ibmcloud event-notifications metrics

取得指標。

ibmcloud event-notifications metrics ---instance-id INSTANCE-ID --gte GTE --lte LTE [--smtp-config-id SMTP-CONFIG-ID] [--destination-type DESTINATION-TYPE][--destination-id DESTINATION-ID] [--subscription-id SUBSCRIPTION-ID] [--source-id SOURCE-ID] [--email-to EMAIL-TO] [--notification-id NOTIFICATION-ID] [--subject SUBJECT]

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--gte (字串)

GTE (大於等值),以 UTC 為起始時間戳記。 必要。

最大長度為 28 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[0-9]{1,4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}Z/

--lte (字串)

LTE (小於相等),以 UTC 為單位的結束時間戳記。 必要。

最大長度為 28 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[0-9]{1,4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}Z/

--smtp-config-id (字串)

SMTP 設定 ID。 在查詢 SMTP 介面目的地的指標時,此參數為必填項目。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--destination-type (字串)

要求提供指標的目的地類型。 支援的值:smtp_custom。 查詢自訂電子郵件收件端的指標時,此欄位為必填。

允許的值為:smtp_custom

--destination-id (字串)

目的地的唯一 ID。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--subscription-id (字串)

目的地的唯一 ID。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--source-id (字串)

來源的唯一 ID。

最大長度為 100 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z0-9-:_]*/

--email-to (字串)

收件人電子郵件 ID。

最大長度為 256 個字元。 最小長度為 0 個字元。 值必須符合正規表達式 /[A-Za-z0-9\\._%+\\-]+@[A-Za-z0-9\\.\\-]+\\.[A-Za-z]{2,}/

--notification-id (字串)

通知同上。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--subject (字串)

電子郵件主題。

最大長度為 256 個字元。 最小長度為 0 個字元。 值必須符合正規表達式 /[a-zA-Z0-9]/

範例

ibmcloud event-notifications metrics \
    --instance-id=exampleString \
    --destination-type=smtp_custom \
    --gte=exampleString \
    --lte=exampleString \
    --destination-id=exampleString \
    --subscription-id=exampleString \
    --source-id=exampleString \
    --email-to=exampleString \
    --notification-id=exampleString \
    --subject=exampleString

ibmcloud event-notifications bounce-metrics

獲取彈跳指標。

ibmcloud event-notifications bounce-metrics --instance-id INSTANCE-ID --gte GTE --lte LTE [--smtp-config-id SMTP-CONFIG-ID] [--destination-type DESTINATION-TYPE] [--destination-id DESTINATION-ID] [--subscription-id SUBSCRIPTION-ID] [--source-id SOURCE-ID] [--email-to EMAIL-TO] [--notification-id NOTIFICATION-ID] [--subject SUBJECT] [--limit LIMIT] [--offset OFFSET]

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `32` 個字元。 最小長度為 `32` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/`。
--gte (字串)

GTE (大於等值),以 UTC 為起始時間戳記。 必要。

最大長度為 28 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[0-9]{1,4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}Z/

--lte (字串)

LTE (小於相等),以 UTC 為單位的結束時間戳記。 必要。

最大長度為 28 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[0-9]{1,4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}Z/

--smtp-config-id (字串)

SMTP 設定 ID。 在查詢 SMTP 介面目的地的指標時,此參數為必填項目。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--destination-type (字串)

要求提供指標的目的地類型。 支援的值:smtp_custom。 查詢自訂電子郵件收件端的指標時,此欄位為必填。

允許的值為:smtp_custom

--destination-id (字串)

目的地的唯一 ID。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--subscription-id (字串)

目的地的唯一 ID。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--source-id (字串)

來源的唯一 ID。

最大長度為 100 個字元。 最小長度為 1 個字元。 值必須符合正規表達式 /[a-zA-Z0-9-:_]*/

--email-to (字串)

收件人電子郵件 ID。

最大長度為 256 個字元。 最小長度為 0 個字元。 值必須符合正規表達式 /[A-Za-z0-9\\._%+\\-]+@[A-Za-z0-9\\.\\-]+\\.[A-Za-z]{2,}/

--notification-id (字串)

通知同上。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

--subject (字串)

電子郵件主題。

最大長度為 256 個字元。 最小長度為 0 個字元。 值必須符合正規表達式 /[a-zA-Z0-9]/

--limit (int64)

分頁結果的頁面限制。

預設值為 10。 最大值為 100。 最小值為 1

--offset (int64)

已分頁結果的偏移。

預設值為 0。 最小值為 0

範例

ibmcloud event-notifications bounce-metrics \
    --instance-id=exampleString \
    --destination-type=smtp_custom \
    --gte=exampleString \
    --lte=exampleString \
    --destination-id=exampleString \
    --subscription-id=exampleString \
    --source-id=exampleString \
    --email-to=exampleString \
    --notification-id=exampleString \
    --subject=exampleString \
    --limit=10 \
    --offset=0

取得通知狀態

本文件說明取得 Webhook Destination Test 通知狀態的有效負載詳細資訊。

ibmcloud event-notifications notifications-status

取得發送至 webhook 接收端的測試通知狀態。 此指令專門用於查詢 webhook 測試通知的傳送狀態。

ibmcloud event-notifications notifications-status --instance-id INSTANCE-ID --id ID

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `32` 個字元。 最小長度為 `32` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/`。
--id (字串)

測試 webhook 接收端時所回傳的通知 ID。 此 ID 專用於測試發送至 webhook 接收端的通知。 必要。

最大長度為 36 個字元。 最小長度為 36 個字元。 值必須符合正規表達式 /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/

範例

ibmcloud event-notifications notifications-status \
    --instance-id=exampleString \
    --id=exampleString

傳送通知

本文件說明使用 Event Notifications 中的 API 來源傳送事件的有效負載細節。 API 來源可用於從您的後端應用程式傳送事件。 Event Notifications支援兩種模式進行 HTTP 通話。 這符合 CloudEvents 規格。 這些模式是二進位模式 (Binary Mode) 和結構化模式 (Structured Mode)。 更多詳情請見此處 - https://github.com/cloudevents/spec。在二進位內容模式中,事件資料的值會原封不動地放入 HTTP 請求或回應的正文中,datacontenttype 屬性值在 HTTP Content-Type 標頭中宣告其媒體類型;所有其他事件屬性都會對應到 HTTP 標頭。 所有屬性名都以 ce- 為前綴,並加入標頭(除了 data 和 datacontenttype)。 當 CloudEvents 的強制屬性(specversion、id、type 和 source)作為標頭的一部分傳送時,請求會被視為二進制模式。 結構化模式。 在結構化內容模式中,事件元資料屬性和事件資料會放入 HTTP 請求正文中。 對於結構化模式,請將 Content-Type 標頭設定為 application/cloudevents+json。 CloudEvents 的強制屬性(specversion、id、type 和 source)必須是請求體的一部分。 此外,id 資料是以必須提供的 datacontenttype 提供。 我們只支援 datacontenttype 為 ("application/json/")。

ibmcloud event-notifications send-notifications

從實例傳送通知正文。 有關 Event Notifications payload 的詳細資訊,請參閱 此處

ibmcloud event-notifications send-notifications --instance-id INSTANCE-ID [--body BODY]

指令選項

--instance-id (字串)

IBM Cloud 事件通知實例的唯一 ID。 必要。

 最大長度為 `256` 個字元。 最小長度為 `10` 個字元。 值必須符合正規表達式 `/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]/`。
--body (NotificationCreate)

描述通知建立請求的有效負載。

提供一個 JSON 字串選項,或透過提供一個以 @ 開頭的 filepath 選項,指定要從中讀取的 JSON 檔案,例如 --body=@path/to/file.json

NotificationCreate

以下範例展示了 NotificationCreate 物件的格式。

{
  "specversion" : "1.0",
  "time" : "2019-01-01T12:00:00.000Z",
  "id" : "exampleString",
  "source" : "exampleString",
  "type" : "exampleString",
  "ibmenseverity" : "exampleString",
  "ibmensourceid" : "exampleString",
  "ibmendefaultshort" : "exampleString",
  "ibmendefaultlong" : "exampleString",
  "ibmensubject" : "exampleString",
  "ibmentemplates" : "[\"886f8f4c-8605-47hb-85a1-8682b9377468483\"]",
  "ibmenmailto" : "exampleString",
  "ibmenslackto": "[\"sgjhgsjaS\",\"agjhgsjaS\"]",
  "ibmensmsto" : "exampleString",
  "ibmenmms": {"content": "VBORw0KGgoAAAANSUhEUgAAAFoAAAA4CAYAAAB9lO","content_type": "image/png"},
  "ibmenmarkdownn": "This is a *italic* message.\n- Item 1\n- Item 2\n**bold text** with more text data\n~~strike through~~\n1. order 1\n2. order 2\n```fenced code block```\n> block code\n`code`\n[Click here](https://example.com) for more info."
  "ibmenhtmlbody" : "exampleString",
  "subject" : "exampleString",
   "attachments": [
    {
      "content": "VGhpcyBpcyBhIHRlc3QgZG9jdW1lbnQK",
      "filename": "test.txt",
      "content_type": "text/plain",
      "disposition": "attachment"
    }
  ],
  "data" : {
    "anyKey" : "anyValue"
  },
  "datacontenttype" : "application/json",
  "ibmenpushto" : "{
    \"fcm_devices\" : [ \"exampleString\" ],
    \"apns_devices\" : [ \"exampleString\" ],
    \"huawei_devices\" : [ \"exampleString\" ],
    \"safari_devices\" : [ \"exampleString\" ],
    \"chrome_devices\" : [ \"exampleString\" ],
    \"firefox_devices\" : [ \"exampleString\" ],
    \"user_ids\" : [ \"exampleString\" ],
    \"tags\" : [ \"exampleString\" ],
    \"platforms\" : [ \"push_android\" ]
  }",
  "ibmenfcmbody" : "{ }",
  "ibmenapnsbody" : "{ }",
  "ibmenapnsheaders" : "{ }",
  "ibmenchromebody" : "{ }",
  "ibmenchromeheaders" : "{ }",
  "ibmenfirefoxbody" : "{ }",
  "ibmenfirefoxheaders" : "{ }",
  "ibmenhuaweibody" : "{ }",
  "ibmensafaribody" : "{ }"
}

範例

包含所需參數:

ibmcloud event-notifications send-notifications \
    --instance-id=exampleString \
    --body='{"specversion": "1.0", "time": "2019-01-01T12:00:00.000Z", "type": "*", "id": "exampleString", "source": "exampleString", "ibmensourceid": "exampleString", "ibmendefaultshort": "short message", "ibmendefaultlong": "long message", "data": {"name": "exampleString"}, "datacontenttype": "application/json"}'

包含所有參數:

ibmcloud event-notifications send-notifications \
    --instance-id=exampleString \
    --body='{"specversion": "1.0", "time": "2019-01-01T12:00:00.000Z", "id": "exampleString", "source": "exampleString", "type": "exampleString", "ibmenseverity": "exampleString", "ibmensourceid": "exampleString", "ibmendefaultshort": "exampleString", "ibmendefaultlong": "exampleString", "ibmensubject": "exampleString", "ibmentemplates": [\"template-id\"], "ibmenmailto": "exampleString","ibmenslackto": "[\"sgjhgsjaS\",\"agjhgsjaS\"]", "ibmensmsto": "exampleString","ibmenmms": "{\"content\": \"VBORw0KGgoAAAANSUhEUgAAAFoAAAA4CAYAAAB9lO\",\"content_type\": \"image/png\"}", "ibmenhtmlbody": "exampleString", "subject": "exampleString", "data": {"anyKey": "anyValue"}, "datacontenttype": "application/json", "ibmenpushto": "{\"fcm_devices\": [\"exampleString\"], \"apns_devices\": [\"exampleString\"], \"huawei_devices\": [\"exampleString\"], \"safari_devices\": [\"exampleString\"], \"chrome_devices\": [\"exampleString\"], \"firefox_devices\": [\"exampleString\"], \"user_ids\": [\"exampleString\"], \"tags\": [\"exampleString\"], \"platforms\": [\"push_android\"]}", "ibmenfcmbody": "{}", "ibmenapnsbody": "{}", "ibmenapnsheaders": "{}", "ibmenchromebody": "{}", "ibmenchromeheaders": "{}", "ibmenfirefoxbody": "{}", "ibmenfirefoxheaders": "{}", "ibmenhuaweibody": "{}", "ibmensafaribody": "{}"}'

可為 iOS 通知設定的其他屬性

iOS 平台設定
內容 內容類型 說明
badge integer 要顯示成應用程式圖示徽章的數字。
interactive_category 字串 要用於互動式推送通知的種類 ID。
ios_action_key 字串 動作鍵的標題。
payload JSON 物件 放在通知訊息中一起傳送的自訂 JSON 有效負載。
sound 字串 應用程式組合中的音效檔名稱。 將會播放此檔案的音效作為警示。
title_loc_key 字串 現行本地化的 Localizable.strings 檔中的 title 字串索引鍵。 鍵字串可使用 %@ 和 %n$@ 指定符進行格式化,以套用 titleLocArgs 陣列中指定的變數。
loc_key 字串 當前本地化設定(由使用者的語言偏好設定所決定)中,Localizabl.strings 檔案內某則警示訊息字串的對應鍵。 可使用 %@ 及 %n$@ 指定元來格式化機碼字串,以接受 locArgs 陣列中所指定的變數。
launch_image 字串 應用程式套件中影像檔案的檔案名稱,不論是否包含檔案副檔名。 使用者點選動作按鈕或者移動動作調節器時,使用此影像作為啟動影像。
title_loc_args 字串 在 title-loc-key 中格式指定元位置出現的變數字串值。
loc_args 字串 將出現在 locKey 中格式指定符位置的變數字串值。
title 字串 Rich Push 通知的標題(僅 iOS 10 及更高版本才支援)。
subtitle 字串 「豐富通知」的副標題(僅支援 iOS 10 及以上版本)。
body 字串 IOS 通知的正文。
attachment_url 字串 iOS 通知媒體的鏈結(視訊、音訊、GIF、影像 - 僅 iOS 10 及更高版本才支援)。
type 字串 允許值:預設、混合、無聲。
apns_collapse_id 字串 具有相同崩塌識別碼的多個通知會作為單一通知顯示給使用者。
apns_thread_id 字串 應用程式特有的識別碼,用於將相關通知分組。 此值對應 UNNotificationContent 物件中的 threadIdentifier 屬性。
apns_group_summary_arg 字串 通知加入類別摘要格式字串的字串。
apns_group_summary_arg_count integer 通知加入類別摘要格式字串的項目數量。

可為 FCM 通知設定的其他屬性

Android 平台設定
內容 內容類型 說明
icon 字串 指定要針對通知顯示的圖示名稱。 請確定圖示已與用戶端應用程式包裝在一起。
delay_while_idle 布林 當設定為 true 時,此參數表示在裝置變為作用中之前不應傳送訊息。
sync 布林 裝置群組傳訊使得群組中每一個應用程式實例都可反映出最新的傳訊狀態。
visibility 字串 「私密」或「公開」——此通知的可見性設定,這會影響通知在安全鎖定畫面上的顯示方式與顯示時機。
redact 字串 當可見性設為隱私時,指定的內容會顯示在裝置的安全鎖定螢幕上。
payload JSON 物件 放在通知訊息中一起傳送的自訂 JSON 有效負載。
priority 字串 表示此通知優先順序的字串值。 允許值包括 'max'、'high'、'default'、'low「及」min'。 在 Android 5.0 或higher.sampleval版本中,高/最高優先順序通知以及「聲音」欄位可能會用於抬頭通知。
sound 字串 當通知傳送到裝置時,系統將嘗試播放的音訊檔案(位於裝置上)。
time_to_live integer 指定當裝置離線時,訊息應在 GCM 儲存空間中保留多久(以秒為單位)。
lights 設定接收推送通知時的 LED 顏色。
ledArgb 字串 LED 的顏色。 硬體會達成其最佳近似值。
ledOnMs integer LED 閃爍時保持亮起的時間(單位:毫秒)。 硬體會達成其最佳近似值。
ledOffMs 字串 LED 在閃爍期間保持熄滅的時間(以毫秒為單位)。 硬體會達成其最佳近似值。
android_title 字串 「Rich Push 通知」的標題。
group_id 字串 將此通知設定為共用相同金鑰的通知群組的一部分。 在支援此類呈現的裝置上,群組通知可能會以群集或堆疊的方式顯示。
style 指定 Android 可擴充通知的選項。 可擴充通知的類型有 picture_notification、bigtext_notification、inbox_notification。
type 字串 指定可擴充通知的類型。 可能的值包括 bigtext_notification、picture_notification 以及 inbox_notification。
title 字串 指定通知的標題。 擴充通知時,會顯示標題。 所有這三個可擴充的通知都必須指定標題。
type 字串 允許值:預設、無聲。
alert 字串 通知的警戒值。

Event Notifications 使用 CLI 進行佈建的範例指令碼

provision_event_notification.sh 腳本自動配置 Event Notifications 實例。

使用 CLI 整合平台通知的範例指令碼

en-platform-notification-src-and-email-dest.sh 腳本將平台通知與 Event Notifications 整合,並將通知路由至 IBM 內建電子郵件或自訂網域沙箱。

使用 CLI 整合 IBM Cloud Logs 的範例指令碼

en-icl-src-and-email-dest.sh 腳本將 IBM Cloud Logs 與 Event Notifications 整合,並將通知傳送到 IBM 內建電子郵件或自訂網域沙箱。

本指令碼假設 IBM Cloud Logs 與 Event Notifications 屬於同一帳戶。

CLI 版本歷程

查閱 Event Notifications 外掛程式各版本的變更摘要。 保持最新的 CLI,以便您可以使用所有可用的指令及其選項。

CLI 外掛程式版本從 0.0.5 至 1.9.0 已被廢棄。

IBM Cloud Event Notifications CLI 中的更改
版本 發表日期 變更
1.5.0 2024 年 5 月 10 日 支援 SMTP 設定和 Slack 範本。
1.6.0 2024 年 8 月 1 日 已棄用 CF 目的地,並支援 MMS。
1.7.0 2024 年 8 月 9 日 支援度量,並從 SMTP 設定中移除對 SMTP 允許 IP 的支援。
1.8.0 2024 年 9 月 9 日 支援 Slack DM 目的地。
1.9.0 2024 年 10 月 11 日 支援 Webhook 模板。
1.10.0 2024 年 11 月 4 日 移除Cloud Functions的支援
1.11.0 2025 年 1 月 7 日 支援週期性計時器
1.12.0 2025 年 2 月 27 日 支援 Pagerduty 模版
1.13.0 2025 年 3 月 6 日 支援 Event Streams 目的地、訂閱和範本。
1.14.0 2025 年 4 月 28 日 PagerDuty 目的地 已經廢棄的參數 標示為可選。api_key
1.15.0 2025 年 6 月 27 日 通知的 markdown 內容。
1.16.0 2025 年 8 月 1 日 Code Engine 和預先定義的範本支援。
1.17.0 2025 年 9 月 4 日 支援 webhook 目的地測試 get notifications-status 指令
1.18.0 2025 年 9 月 25 日 Appconfiguration 目的地、訂閱與範本支援
1.19.0 2025 年 10 月 30 日 支援克隆 smtp 使用者憑證
1.20.0 2025年12月15日 彈跳指標支援
1.20.1 2026 年 1 月 19 日 修復私有端點支援元資料和 EN 外掛程式安裝問題,在 private.cloud.ibm.com
1.20.2 2026 年 2 月 18 日 CLI 外掛程式漏洞修補程式更新
1.21.0 2026 年 4 月 7 日 CLI 外掛程式更新為檢視沙箱、電子郵件附件和來源選項支援,以進行有效載荷除錯
1.21.1 2026 年 5 月 25 日 已廢棄 init 和 show 指令,並新增 en instances listing 指令。 提供修正,可根據設定的目標區域自動設定 EN 終點。
1.21.2 2026年6月29日 針對 SMTP 指標的錯誤修正,以支援 SMTP 配置 ID 標誌,並將目的地類型標記為可選項。
1.21.3 2026年8月6日 修復 CLI 外掛程式漏洞,並進行易用性與外觀上的改善