Event Notifications CLI
IBM Cloud 命令行界面(CLI)为服务产品提供了额外功能。IBM Cloud CLI支持插件框架以扩展其功能。 您可以从 IBM Cloud 插件库安装 Event Notifications CLI 插件。 借助 Event Notifications 服务命令行接口插件,您可以通过现有的命令行指令轻松管理 Event Notifications 服务实例。
先决条件
- IBM Cloud 账户。 如果您还没有账号,请点击 此处 创建。
- IBM Cloud Event Notifications 服务的一个实例。
- 本地系统上的 IBM Cloud CLI 软件包。
当您登录 IBM Cloud CLI 时,系统会在有更新可用时向您发送通知。 请确保 CLI 是最新的,以便使用适用于 Event Notifications CLI 插件的命令和标志。
注意:1.15.2 之前的 CLI 插件版本已弃用
安装 Event Notifications CLI
使用 plugin install 命令安装 Event Notifications CLI插件。
ibmcloud plugin install en
Event Notifications CLI 命令
注 CLI 插件初始化命令今后将不再使用
ibmcloud en en-list
列出目标区域中的实例。 您可以从列出的实例中检索您的实例 GUID。
ibmcloud en en-list
ibmcloud事件通知环境变量设置
通过设置 ibmcloud 目标区域(ibmcloud target -r
-
export 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` (字符串)
: 源的唯一标识。 必需。
最大长度为 `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(字符串)-
源的唯一标识。 必需。
最大长度为
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(字符串)-
源的唯一标识。 必需。
最大长度为
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
5000characters. The minimum length is1character. --icon16x162x-content-type(字符串)-
Icon16x162x 的内容类型。
--icon32x32(io.ReadCloser)-
Safari图标 32x32。
The maximum length is
5000characters. The minimum length is1character. --icon32x32-content-type(字符串)-
Icon32x32 的内容类型。
--icon32x322x(io.ReadCloser)-
Safari图标 32x32@2x。
The maximum length is
5000characters. The minimum length is1character. --icon32x322x-content-type(字符串)-
Icon32x322x 的内容类型。
--icon128x128(io.ReadCloser)-
Safari图标 128x128。
The maximum length is
5000characters. The minimum length is1character. --icon128x128-content-type(字符串)-
Icon128x128 的内容类型。
--icon128x1282x(io.ReadCloser)-
Safari图标 128x128@2x。
The maximum length is
5000characters. The minimum length is1character. --icon128x1282x-content-type(字符串)-
Icon128x1282x 的内容类型。
{
"params" : {
"url" : "exampleString",
"verb" : "get",
"custom_headers" : { },
"sensitive_headers" : [ "exampleString" ]
}
}
注意:Cloud Functions Event Notifications已弃用,不再支持目的地类别。
示例
- 以下示例显示了带有 P8 证书的 iOS 目标(push_ios)的
DestinationConfig对象的格式。 将布尔参数pre_prod设置为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)
}
}
```
- 以下示例显示了带有 P12 证书的 iOS 目标(push_ios)的 `DestinationConfig` 对象的格式。 将布尔参数 `pre_prod` 设置为 *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` 设置为 *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` 设置为 *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目标(push_safari)的 `DestinationConfig` 对象的格式。 将布尔参数 `pre_prod` 设置为 *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)
}
}
```
- 以下示例显示了 `DestinationConfig` 对象在MS Teams(msteams)目标中的格式。
```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"
}
}
```
- 以下示例显示了华为(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)
}
}
```
- 以下示例显示了自定义电子邮件(smtp_custom)目标的 `DestinationConfig` 对象的格式。 如果是自定义电子邮件沙盒(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` 即可创建自定义短信接收端,但在明确申请并配置所需的个性化号码之前,该接收端将无法正常工作。 如需申请个性化号码,请参阅 [“自定义短信个性化号码”](/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 事件通知实例的唯一标识。 必需。
最大长度为 `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(字符串)-
目标的唯一标识。 必需。
最大长度为
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字符串选项,或通过提供一个以
@开头的文件路径选项来指定要读取的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
获取短信目的地所在国家/地区的详细信息。
ibmcloud event-notifications enabled-countries --instance-id INSTANCE-ID --id ID
命令选项
--instance-id(字符串)-
IBM Cloud 事件通知实例的唯一标识。 必需。
最大长度为 `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(字符串)-
目标的唯一标识。 必需。
最大长度为
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 事件通知实例的唯一标识。 必需。
最大长度为 `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(字符串)-
目标的唯一标识。 必需。
最大长度为
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 事件通知实例的唯一标识。 必需。
最大长度为 `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(字符串)-
目标的唯一标识。 必需。
最大长度为
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 事件通知实例的唯一标识。 必需。
最大长度为 `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(字符串)-
目标的唯一标识。 必需。
最大长度为
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(字符串)-
主题的唯一标识。 必需。
最大长度为
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(字符串)-
主题的唯一标识。 必需。
最大长度为
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(字符串)-
主题的唯一标识。 必需。
最大长度为
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)-
订阅时需要设置的属性。
示例
- 以下示例显示了用于网络挂钩的
SubscriptionCreateAttributes对象的格式。
{
"signing_enabled" : true,
"template_id_notification": "a59f6e38-7a48-xxxx-b665-3724axx58b13"
}
```
- 以下示例显示了SMS中 `SubscriptionCreateAttributes` 对象的格式。
```json
{
"invited" :["+1xxxxxxxxxx", "+1xxxxxxxxxx"]
}
```
- 以下示例显示了 IBM `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中 `SubscriptionCreateAttributes` 对象的格式,目标类型为direct_message。
```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(字符串)-
预订的唯一标识。 必需。
最大长度为
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(字符串)-
预订的唯一标识。 必需。
最大长度为
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(字符串)-
预订的唯一标识。 必需。
最大长度为
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 `SubscriptionUpdateAttributes` 对象的格式。
```json
{
"invited": {
"add": ["+8xxxxxxxxxx"],
"remove": ["+1xxxxxxxxxx", "+91xxxxxxxxxx"]
},
"subscribed": {
"remove": ["+1xxxxxxxxxx", "+91xxxxxxxxxx"]
},
"unsubscribed": {
"remove": ["+1xxxxxxxxxx", "+91xxxxxxxxxx"]
}
}
```
- 以下示例显示了 IBM `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",
}
```
- 以下示例显示了Service Now中 `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-:_]*/匹配。
示例
- 下面的示例显示了
IntegrationReplaceAttributeskms 对象的格式。
{
"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 事件通知实例的唯一标识。 必需。
最大长度为 `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字符串选项,或通过提供一个以
@开头的文件路径选项来指定要读取的JSON文件,例如--params=@path/to/file.json。 --description(字符串)-
模板描述。
最大长度为
255个字符。 最小长度为1个字符。 该值必须与正则表达式/[a-zA-Z 0-9-_\/.?:'";,+=!#@$%^&*() ]*/匹配。 --params-body(字符串)-
模板正文。 此选项为JSON选项“参数”的子字段提供值。 它与该选项互斥。
最大长度为
20000个字符。 最小长度为1个字符。 该值必须与正则表达式/.*/匹配。 --params-subject(字符串)-
模板主题。 此选项为JSON选项“参数”的子字段提供值。 它与该选项互斥。
最大长度为
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 事件通知实例的唯一标识。 必需。
最大长度为 `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 事件通知实例的唯一标识。 必需。
最大长度为 `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 事件通知实例的唯一标识。 必需。
最大长度为 `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字符串选项,或通过提供一个以
@开头的文件路径选项来指定要读取的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 事件通知实例的唯一标识。 必需。
最大长度为 `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 事件通知实例的唯一标识。 必需。
最大长度为 `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 配置。
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 事件通知实例的唯一标识。 必需。
最大长度为 `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 事件通知实例的唯一标识。 必需。
最大长度为 `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 事件通知实例的唯一标识。 必需。
最大长度为 `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 事件通知实例的唯一标识。 必需。
最大长度为 `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 事件通知实例的唯一标识。 必需。
最大长度为 `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 事件通知实例的唯一标识。 必需。
最大长度为 `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 事件通知实例的唯一标识。 必需。
最大长度为 `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 事件通知实例的唯一标识。 必需。
最大长度为 `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 事件通知实例的唯一标识。 必需。
最大长度为 `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 事件通知实例的唯一标识。 必需。
最大长度为 `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 事件通知实例的唯一标识。 必需。
最大长度为 `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
注意:已弃用对旧版白名单的支持。 支持通过基于上下文的限制启用。 如需了解详细信息,请参阅此处: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 事件通知实例的唯一标识。 必需。
最大长度为 `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 事件通知实例的唯一标识。 必需。
最大长度为 `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(字符串)-
目标的唯一标识。
最大长度为
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(字符串)-
预订的唯一标识。
最大长度为
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(字符串)-
源的唯一标识。
最大长度为
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 事件通知实例的唯一标识。 必需。
最大长度为 `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(字符串)-
目标的唯一标识。
最大长度为
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(字符串)-
预订的唯一标识。
最大长度为
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(字符串)-
源的唯一标识。
最大长度为
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 目的地测试通知状态的有效载荷详情。
ibmcloud event-notifications notifications-status
获取发送到 webhook 目标的测试通知的状态。 该命令专门用于查询 webhook 测试通知的投递状态。
ibmcloud event-notifications notifications-status --instance-id INSTANCE-ID --id ID
命令选项
--instance-id(字符串)-
IBM Cloud 事件通知实例的唯一标识。 必需。
最大长度为 `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的。 这些模式包括二进制模式和结构化模式。 更多详情请点击这里 - https://github.com/cloudevents/spec. 在二进制内容模式中,事件数据的值按原样放入 HTTP 请求或响应主体中,其中 datacontenttype 属性值在 HTTP Content-Type 标头中声明其媒体类型;所有其他事件属性都映射到 HTTP 标头。 所有属性名称均以ce-开头,并添加到标题中(数据和datacontenttype除外)。 当 CloudEvents强制属性(specversion、id、type和source)作为请求头的一部分传递时,请求将被视为二进制模式。 结构化模式。 在结构化内容模式下,事件元数据属性和事件数据被放入 HTTP正文中。 对于结构化模式,请将Content-Type标头设置为application/cloudevents+json。 CloudEvents强制属性(规格版本、ID、类型和来源)必须作为请求正文的一部分。 此外,id数据以datacontenttype的形式提供,这是必填项。 我们只支持将数据内容类型设置为“application/json”。
ibmcloud event-notifications send-notifications
从实例发送通知正文。 有关Event Notifications有效负载的更多信息,请参见 此处。
ibmcloud event-notifications send-notifications --instance-id INSTANCE-ID [--body BODY]
命令选项
--instance-id(字符串)-
IBM Cloud 事件通知实例的唯一标识。 必需。
最大长度为 `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字符串选项,或通过提供一个以
@开头的文件路径选项来指定要读取的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可配置的其他属性
| 属性 | 属性类型 | 描述 |
|---|---|---|
badge |
整数 | 要显示为应用程序图标的角标的数字。 |
interactive_category |
string | 要用于交互式推送通知的类别标识。 |
ios_action_key |
string | 操作键的标题。 |
payload |
JSON 对象 | 将作为通知消息的一部分发送的定制 JSON 有效内容。 |
sound |
string | 应用程序捆绑软件中声音文件的名称。 此文件的声音播放为警报。 |
title_loc_key |
string | 针对当前本地化的 Localizable.strings 文件中标题字符串的键。 键字符串可以使用 %@ 和 %n$@ 指定符进行格式化,以采用 titleLocArgs 数组中指定的变量。 |
loc_key |
string | 当前本地化(由用户的语言偏好设置决定)中,Localizabl.strings 文件内某条提示消息字符串的键。 该键字符串可以使用 %@ 和 %n$@ 说明符设置格式,以采用 locArgs 数组中指定的变量。 |
launch_image |
string | 应用包中图像文件的文件名,无论是否包含文件扩展名。 图像用作用户点击操作按钮或移动操作滑块时的启动图像。 |
title_loc_args |
string | 要在 title-loc-key 中显示以替换格式说明符的变量字符串值。 |
loc_args |
string | 将出现在 locKey 中格式指定符位置的可变字符串值。 |
title |
string | 富文本推送通知的标题(仅 iOS 10 及更高版本上支持)。 |
subtitle |
string | “富通知”的副标题(仅支持 iOS 10及以上版本)。 |
body |
string | iOS通知的正文。 |
attachment_url |
string | iOS 通知媒体的链接(视频、音频、GIF、图像 - 仅 iOS 10 及更高版本上支持)。 |
type |
string | 允许值:默认、混合、静音。 |
apns_collapse_id |
string | 多个具有相同折叠标识的通知将作为单个通知显示给用户。 |
apns_thread_id |
string | 用于将相关通知分组的特定于应用程序的标识符。 该值对应于 UNNotificationContent中的 threadIdentifier。 |
apns_group_summary_arg |
string | 通知添加到类别摘要格式字符串中的字符串。 |
apns_group_summary_arg_count |
整数 | 通知添加到类别摘要格式字符串中的项目数量。 |
可配置的FCM通知附加属性
| 属性 | 属性类型 | 描述 |
|---|---|---|
icon |
string | 指定要为通知显示的图标的名称。 确保图标已经与客户机应用程序打包在一起。 |
delay_while_idle |
布尔值 | 当设置为true时,该参数表示在设备激活前不应发送消息。 |
sync |
布尔值 | 设备组消息传递使得组中每一个应用程序实例都可反映出最新的消息传递状态。 |
visibility |
string | 私有或公开——此通知的可见性,这会影响通知在安全锁屏界面上的显示方式和显示时间。 |
redact |
string | 当可见性设置为“私人”时,指定的内容会显示在设备上安全锁定的屏幕上。 |
payload |
JSON 对象 | 将作为通知消息的一部分发送的定制 JSON 有效内容。 |
priority |
string | 一个字符串值,指示此通知的优先级。 允许的值有“最大值”、“高值”、“默认值”、“低值”和“最小值”。 高/最大优先级通知以及“声音”字段可能用于 Android 5.0 或higher.sampleval中的抬头通知。sampleval ='low'。 |
sound |
string | 当通知到达设备时,系统将尝试播放的(设备上的)音频文件。 |
time_to_live |
整数 | 指定当设备处于离线状态时,消息应在 GCM 存储中保留多长时间(以秒为单位)。 |
lights |
设置接收推送通知时通知LED的颜色。 | |
ledArgb |
string | LED 指示灯的颜色。 硬件将尽力接近设定值。 |
ledOnMs |
整数 | LED 闪烁期间保持点亮的时间(单位:毫秒)。 硬件将尽力接近设定值。 |
ledOffMs |
string | LED 闪烁期间保持熄灭状态的时间(单位:毫秒)。 硬件将尽力接近设定值。 |
android_title |
string | 富媒体推送通知的标题。 |
group_id |
string | 将此通知设置为共享同一密钥的通知组的一部分。 分组通知可能会在支持这种呈现方式的设备上以群集或堆叠的形式显示。 |
style |
可指定Android可扩展通知的选项。 可扩展通知的类型包括图片通知、大文本通知和收件箱通知。 | |
type |
string | 指定可展开通知的类型。 可能的取值为 bigtext_notification、picture_notification、inbox_notification。 |
title |
string | 指定通知的标题。 标题在展开通知时显示。 必须为所有三个可展开通知指定标题。 |
type |
string | 允许值:默认、静音。 |
alert |
string | 通知的提醒值。 |
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 已被弃用。
| 版本 | 发布日期 | 更改 |
|---|---|---|
| 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 日 | 通知的标记符内容。 |
| 1.16.0 | 2025 年 8 月 1 日 | Code Engine 和预设模板支持。 |
| 1.17.0 | 2025 年 9 月 4 日 | 支持 webhook 目的地测试 get notifications-status 命令 |
| 1.18.0 | 2025 年 9 月 25 日 | 支持应用程序配置目的地、订阅和模板 |
| 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 实例列表命令。 提供了根据设定的目标区域自动设置 EN 端点的修正。 |
| 1.21.2 | 2026年6月29日 | 针对 SMTP 指标的错误修复,以支持 SMTP 配置 ID 标志,并将目标类型标记为可选。 |
| 1.21.3 | 2026年8月6日 | 修复了 CLI 插件的漏洞,并进行了易用性和外观方面的改进 |