This topic describes the parameters in the metadata of an event target.
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
EventBusName | String | Yes | default | The name of the event bus. For more information, see Limits. |
RuleName | String | Yes | MNSRule | The name of the event rule. For more information, see Limits. |
Description | String | No | Message Service filter rule | The description of the event rule. |
Status | String | No | ENABLE | The status of the event rule. Valid values:
Default value: ENABLE. |
FilterPattern | String | No | {\"source\": [{\"prefix\": \"acs.\"}],\"type\": [{\"prefix\":\"oss:ObjectReplication\"}],\"subject\":[{\"prefix\":\"acs:oss:cn-hangzhou:123456789098****:my-movie-bucket/\", \"suffix\":\".txt\"}]} | The event pattern. The value is a JSON string. For more information about the value of this parameter, see Event patterns. |
Targets | List<Target> | Yes | The event target to which events that match the event rule are delivered. | |
Id | String | Yes | 1 | The ID of the custom event target. The ID must be unique in the event rule. |
Type | String | Yes | acs.mns.queue | The type of the event target. For more information, see the description of each event target in the following sections. |
Endpoint | String | Yes | acs:mns:cn-hangzhou:123456789098****:queues/myqueue | The endpoint of the event target. For more information, see the description of the endpoint format of each event target in the following sections. |
PushRetryStrategy | String | Yes | BACKOFF_RETRY | The retry policy that is used to push events. Valid values:
|
DeadLetterQueue | String | No | The dead-letter queue. Events that are not processed or whose maximum retries are exceeded are sent to the dead-letter queue. The MNS and Message Queue for Apache RocketMQ dead-letter queues are supported. | |
Arn | String | No | acs:mns:cn-hangzhou:123456789098****:/queues/rule-deadletterqueue or acs:mq:cn-hangzhou:123456789098****:/instances/myinstance/topic/mytopic | The Alibaba Cloud Resource Name (ARN) of the dead-letter queue. Events that are not processed or whose maximum retries are exceeded are sent to the dead-letter queue. The MNS and Message Queue for Apache RocketMQ dead-letter queues are supported. |
ParamList | List<Param> | Yes | The parameters to be passed by events. | |
resourceKey | String | Yes | body | The parameter of the destination service. |
form | String | Yes | TEMPLATE | The transformation method. The following transformation methods are supported:
|
value | String | Yes | {\"key\"=\"value\"} | The value of the transformed event. |
template | String | No |
| The template that is used for event transformation. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RuleARN | String | acs:eventbridge:cn-hangzhou:123456789098****:eventbus/default/rule/MNSRule | The ARN of the event rule. An ARN is used for authorization. |
DingTalk
If you set the Service Type parameter to DingTalk when you create an event rule, the value of the Type parameter in the metadata is acs.dingtalk
, and the value of the Endpoint parameter in the metadata is the DingTalk URL that you want to configure. The following table describes the details of the resourceKey field in the ParamList parameter.
resourceKey | Required | form | value | template |
---|---|---|---|---|
URL | Yes | CONSTANT | The DingTalk URL. | None |
SecretKey | Yes | CONSTANT | The secret key. | None |
Body | Yes | TEMPLATE | Define the key and value. | Define the template of the message body. |
The following sample code provides an example of JSONPath:
{
"id":"KD20k9rpqDRXPq0SXXlqeT****",
"type":"acs.dingtalk",
"endpoint":"https://oapi.dingtalk.com/robot/send?access_token=1560abe367f48877c69bb6a9916244979927abbbbf82f4fe8801692cd6ea****",
"paramList":[
{
"value":"https://oapi.dingtalk.com/robot/send?access_token=1560abe367f48877c69bb6a9916244979927abbbbf82f4fe8801692cd6ea****",
"resourceKey":"URL",
"form":"CONSTANT"
},
{
"value":"SEC1eca5209e0c6c23165b9504967522d47b0d0004e1caf3a75f6ddfda7359d****",
"resourceKey":"SecretKey",
"form":"CONSTANT"
},
{
"value":{
"content":"$.data.content"
},
"resourceKey":"Body",
"form":"TEMPLATE",
"template":{
"msgtype":"text",
"text":{
"content":"@1851111***** ${content}"
},
"at":{
}
}
}
]
}
Direct Mail
If you set the Service Type parameter to Email when you create an event rule, the value of the Type parameter in the metadata is acs.mail
, and the value of the Endpoint parameter in the metadata is the email URL that you want to configure. The format of the Endpoint parameter is acs:mail:${region}:${uid}
. The following table describes the details of the resourceKey field in the ParamList parameter.
resourceKey | Required | form | value | template |
---|---|---|---|---|
Subject | Yes | CONSTANT | The subject of the email. | None |
AccountName | Yes | CONSTANT | The email address of the sender. | None |
AddressType | Yes | CONSTANT | The type of the email address. | None |
ReplyToAddress | Yes | CONSTANT | The reply-to address. | None |
ToAddress | Yes |
| The email address of the recipient. | None |
IsHtmlBody | Yes | CONSTANT | Specify whether the email body is of the HTML type. Valid values:
| None |
Body | Yes | TEMPLATE | Define the key and value. | Define the template of the message body. |
The following sample code provides an example of JSONPath:
{
"id":"KD20k9rpqDRXPq0SXXlqeT****",
"type":"acs.mail",
"endpoint":"acs:mail:cn-hangzhou:164901546557****",
"paramList":[
{
"value":"test",
"resourceKey":"Subject",
"form":"CONSTANT"
},
{
"value":"example.com",
"resourceKey":"AccountName",
"form":"CONSTANT"
},
{
"value":"1",
"resourceKey":"AddressType",
"form":"CONSTANT"
},
{
"value":"true",
"resourceKey":"ReplyToAddress",
"form":"CONSTANT"
},
{
"value":"$.data.name",
"resourceKey":"ToAddress",
"form":"JSONPATH"
},
{
"value":"true",
"resourceKey":"IsHtmlBody",
"form":"CONSTANT"
},
{
"value":{
"mobile":"$.data.mobile",
"subject":"$.subject"
},
"resourceKey":"Body",
"form":"TEMPLATE",
"template":{
"code":"${subject}"
}
}
]
}
Short Message Service
If you set the Service Type parameter to Short Message Service when you create an event rule, the value of the Type parameter in the metadata is acs.sms
, and the value of the Endpoint parameter in the metadata is the Short Message Service URL that you want to configure. The format of the Endpoint parameter is acs:sms:${region}:${uid}
. The following table describes the details of the resourceKey field in the ParamList parameter.
resourceKey | Required | form | value | template |
---|---|---|---|---|
PhoneNumbers | Yes |
| The phone number. | None |
SignName | Yes | CONSTANT | The name of the signature. | None |
TemplateCode | Yes | CONSTANT | The template code for Short Message Service. | None |
TemplateParam | Yes | TEMPLATE | Define the key and value. | Define the template of the message body. |
The following sample code provides an example of JSONPath:
{
"id":"KD20k9rpqDRXPq0SXXlqeT****",
"type":"acs.sms",
"endpoint":"acs:sms:cn-hangzhou:164901546557****",
"paramList":[
{
"value":"$.data",
"resourceKey":"PhoneNumbers",
"form":"JSONPATH"
},
{
"value":"[Test] Alibaba Cloud Communications",
"resourceKey":"SignName",
"form":"CONSTANT"
},
{
"value":"[Test] Alibaba Cloud Communications Test Template",
"resourceKey":"TemplateCode",
"form":"CONSTANT"
},
{
"value":{
"mobile":"$.data.mobile",
"subject":"$.subject"
},
"resourceKey":"TemplateParam",
"form":"TEMPLATE",
"template":{
"code":"${subject}"
}
}
]
}
Function Compute
If you set the Service Type parameter to Function Compute when you create an event rule, the value of the Type parameter in the metadata is acs.fc.function
, and the value of the Endpoint parameter in the metadata is the URL that you want to configure. The format of the Endpoint parameter is acs:fc:${region}:${uid}:services/${serviceName}.${Qualifier}/functions/${functionName}
. The following table describes the resourceKey field in the ParamList parameter.
resourceKey | Required | form | value | template |
---|---|---|---|---|
serviceName | Yes | CONSTANT | The name of the service. | None |
functionName | Yes | CONSTANT | The name of the function. | None |
Body | Yes |
| The message body of the function. You must define the key and value. | Define the template of the message body. |
InvocationType | Yes | CONSTANT | The type of the function call. Valid values:
| None |
The following sample code provides an example of JSONPath:
{
"id":"KD20k9rpqDRXPq0SXXlqeT****",
"type":"acs.fc.function",
"endpoint":"acs:fc:cn-hangzhou:164901546557****:services/guide-hello_world.LATEST/functions/hello_world",
"paramList":[
{
"value":"guide-hello_world",
"resourceKey":"serviceName",
"form":"CONSTANT"
},
{
"value":"hello_world",
"resourceKey":"functionName",
"form":"CONSTANT"
},
{
"value":"$.data.name",
"resourceKey":"Body",
"form":"JSONPATH"
},
{
"value":"LATEST",
"resourceKey":"Qualifier",
"form":"CONSTANT"
}
]
}
Message Service
If you set the Service Type parameter to Message Service when you create an event rule, the value of the Type parameter in the metadata is acs.mns.queue
, and the value of the Endpoint parameter in the metadata is the URL that you want to configure. The format of the Endpoint parameter is acs:mns:${region}:${uid}:queues/${queue}
. The following table describes the details of the resourceKey field in the ParamList parameter.
resourceKey | Required | form | value | template |
---|---|---|---|---|
queue | Yes | CONSTANT | The ID of the queue. | None |
Body | Yes |
| Specify the message content based on the form. | If you set the form parameter to TEMPLATE, specify the value for the corresponding parameter in the template. |
The following sample code provides an example of JSONPath:
{
"id":"KD20k9rpqDRXPq0SXXlqeT****",
"type":"acs.mns.queue",
"endpoint":"acs:mns:cn-hangzhou:164901546557****:queues/MyQueue",
"paramList":[
{
"value":"MyQueue",
"resourceKey":"queue",
"form":"CONSTANT"
},
{
"value":{
"source":"$.source"
},
"resourceKey":"Body",
"form":"TEMPLATE",
"template":"The event comes from ${source} is abnormal."
}
]
}
Message Queue for Apache RocketMQ
If you set the Service Type parameter to Message Queue for Apache RocketMQ when you create an event rule, the value of the Type parameter in the metadata is acs.rocketmq
, and the value of the Endpoint parameter in the metadata is the URL that you want to configure. The format of the Endpoint parameter is acs:mq:${region}:${uid}:/instances/${instanceId}/topic/${topic}
. The following table describes the details of the resourceKey field in the ParamList parameter.
resourceKey | Required | form | value | template |
---|---|---|---|---|
InstanceId | Yes | CONSTANT | The ID of the instance. | None |
Topic | Yes | CONSTANT | The topic. | None |
Body | Yes |
| The message body. | If you set the form parameter to TEMPLATE, specify the value for the corresponding parameter in the template. |
Properties | No |
| The properties. | None |
Keys | No |
| The keys. | If you set the form parameter to TEMPLATE, specify the value for the corresponding parameter in the template. |
Tags | No |
| The tags. | If you set the form parameter to TEMPLATE, specify the value for the corresponding parameter in the template. |
The following sample code provides an example of JSONPath:
{
"id":"KD20k9rpqDRXPq0SXXlqeT****",
"type":"acs.rocketmq",
"endpoint":"acs:mq:cn-hangzhou:164901546557****:/instances/${instanceId}/topic/${topic}",
"paramList":[
{
"value":"MQ_INST_164901546557****_BAAQ4gWo",
"resourceKey":"InstanceId",
"form":"CONSTANT"
},
{
"value":"test-topic1",
"resourceKey":"Topic",
"form":"CONSTANT"
},
{
"value":"$.data.name",
"resourceKey":"Body",
"form":"JSONPATH"
},
{
"value":"$.data.userProperties",
"resourceKey":"Properties",
"form":"JSONPATH"
},
{
"value":"$.data.systemProperties.KEYS",
"resourceKey":"Keys",
"form":"JSONPATH"
},
{
"value":"$.data.systemProperties.TAGS",
"resourceKey":"Tags",
"form":"JSONPATH"
}
]
}
Message Queue for RabbitMQ
If you set the Service Type parameter to Message Queue for RabbitMQ when you create an event rule, the value of the Type parameter in the metadata is acs.rabbitmq
, and the value of the Endpoint parameter in the metadata is the URL that you want to configure. The format of the Endpoint parameter is acs:amqp:${region}:${uid}:/instances/${instanceId}/vhosts/${vhostName}/exchanges/${exchangeName}
. The following table describes the details of the resourceKey field in the ParamList parameter.
resourceKey | Required | form | value | template |
---|---|---|---|---|
InstanceId | Yes | CONSTANT | The ID of the instance. | None |
Vhost | Yes | CONSTANT | The vhost. | None |
TargetType | Yes | CONSTANT | The type of the resource to which events are delivered. Note You can configure only one of the Exchange and Queue parameters. | None |
Exchange | No. This parameter is required only if the TargetType parameter is set to Exchange. | CONSTANT | The exchange mode. | None |
Queue | No. This parameter is required only if the TargetType parameter is set to Queue. | CONSTANT Note You can configure only one of the Exchange and Queue parameters. | The queue mode. | None |
Body | Yes |
| The message body. | If you set the form parameter to TEMPLATE, specify the value for the corresponding parameter in the template. |
MessageId | No. By default, the value of this parameter is automatically generated. |
| The ID of the message. | If you set the form parameter to TEMPLATE, specify the value for the corresponding parameter in the template. |
Properties | No |
| The properties. | If you set the form parameter to TEMPLATE, specify the value for the corresponding parameter in the template. |
The following sample code provides examples of JSONPath:
Example 1: The TargetType parameter is set to Exchange.
{
"id":"KD20k9rpqDRXPq0SXXlqeT****",
"type":"acs.rabbitmq",
"endpoint":"acs:amqp:cn-hangzhou:164901546557****:/instances/${instanceId}/vhosts/${vhostName}/exchanges/${exchangeName}",
"paramList":[
{
"value":"amqp-cn-i7m29o3s****",
"resourceKey":"InstanceId",
"form":"CONSTANT"
},
{
"value":"test.host",
"resourceKey":"Vhost",
"form":"CONSTANT"
},
{
"value":"Exchange",
"resourceKey":"TargetType",
"form":"CONSTANT"
},
{
"value":"amq.direct",
"resourceKey":"Exchange",
"form":"CONSTANT"
},
{
"value":"$.data.name",
"resourceKey":"RoutingKey",
"form":"JSONPATH"
},
{
"value":"$.data.name",
"resourceKey":"Body",
"form":"JSONPATH"
},
{
"value":"$.data.message",
"resourceKey":"MessageId",
"form":"JSONPATH"
},
{
"value":"$.data.userProperties",
"resourceKey":"Properties",
"form":"JSONPATH"
}
]
}
Example 2: The TargetType parameter is set to Queue.
{
"id":"EldwXoVAws5Ix8VpVmrDmr****",
"type":"acs.rabbitmq",
"endpoint":"acs:amqp:cn-hangzhou:164901546557****:/instances/${instanceId}/vhosts/${vhostName}/exchanges/${exchangeName}",
"paramList":[
{
"value":"amqp-cn-i7m29o3s****",
"resourceKey":"InstanceId",
"form":"CONSTANT"
},
{
"value":"test.host",
"resourceKey":"Vhost",
"form":"CONSTANT"
},
{
"value":"Queue",
"resourceKey":"TargetType",
"form":"CONSTANT"
},
{
"value":"test.event",
"resourceKey":"Queue",
"form":"CONSTANT"
},
{
"value":"$.data.body",
"resourceKey":"Body",
"form":"JSONPATH"
},
{
"value":"$.data.message",
"resourceKey":"MessageId",
"form":"JSONPATH"
},
{
"value":"$.data.userproperties",
"resourceKey":"Properties",
"form":"JSONPATH"
}
]
}
HTTP or HTTPS
If you set the Service Type parameter to HTTP or HTTPS when you create an event rule, the value of the Type parameter in the metadata is http
or https
, and the value of the Endpoint parameter in the metadata is the URL that you want to configure. The following table describes the details of the resourceKey field in the ParamList parameter.
resourceKey | Required | form | value | template |
---|---|---|---|---|
url | Yes | CONSTANT | The URL. | None |
Body | Yes |
| Only HTTP bodies are supported. For information about how to use headers and queries, see Manage API destinations. | If the form parameter is set to TEMPALTE, specify the value for the corresponding parameter in the template. The variables in the template are from the Value parameter. |
Network | Yes | CONSTANT | The type of the network. Valid values:
| None |
VPCNameAndId | No. This parameter is required when the Network parameter is set to PrivateNetwork. | CONSTANT | The information about the VPC in which the event target resides. Format: VPCName+"/" + VPCId . | None |
VSwitchesNameAndId | No. This parameter is required when the Network parameter is set to PrivateNetwork. | CONSTANT | The information about the vSwitch of the VPC in which the event target resides. Multiple vSwitches can be configured. The value of this parameter is a JSON string. Example: [VSwitchName+"/"+VSwitchId , VSwitchName+"/"+VSwitchId ] . | None |
SecurityGroupNameAndId | No. This parameter is required when the Network parameter is set to PrivateNetwork. | CONSTANT | The information about the security group of the VPC in which the event target resides. Format: SecurityGroupName+"/" + SecurityGroupId . | None |
Token | No. This parameter is empty by default. | CONSTANT | The token that is used for signature verification. The Header Key parameter is set to a fixed value "x-eventbridge-signature-token" and the Value parameter must be manually configured. | None |
The following sample code provides examples of JSONPath:
Example 1: The Network parameter is set to PublicNetwork.
{
"id":"KD20k9rpqDRXPq0SXXlqeT****",
"type":"https",
"endpoint":"http(s)://www.****.com/product/aliware/eventbridge",
"paramList":[
{
"value":"http(s)://www.****.com/product/aliware/eventbridge",
"resourceKey":"url",
"form":"CONSTANT"
},
{
"value":"",
"resourceKey":"Body",
"form":"ORIGINAL"
},
{
"value":"PublicNetwork",
"resourceKey":"Network",
"form":"CONSTANT"
}
]
}
Example 2: The Network parameter is set to PrivateNetwork.
{
"id":"ZOiNcqqzTGSrDJanZQ72vj****",
"type":"http",
"endpoint":"http(s)://192.168.XX.XX:8080",
"paramList":[
{
"value":"http(s)://192.168.XX.XX:8080",
"resourceKey":"url",
"form":"CONSTANT"
},
{
"value":"",
"resourceKey":"Body",
"form":"ORIGINAL"
},
{
"value":"PrivateNetwork",
"resourceKey":"Network",
"form":"CONSTANT"
},
{
"value":"catalog-system/vpc-bp1ohdo84u2lt9wzq****",
"resourceKey":"VPCNameAndId",
"form":"CONSTANT"
},
{
"value":"[\"eb/vsw-bp10rbrt6rb6vrd89****\"]",
"resourceKey":"VSwitchesNameAndId",
"form":"CONSTANT"
},
{
"value":"sg-catalog-eventlistener/sg-bp14zrnfyik5av27****",
"resourceKey":"SecurityGroupNameAndId",
"form":"CONSTANT"
},
{
"value":"",
"resourceKey":"Token",
"form":"CONSTANT"
}
]
}
Databases
- If you set the Service Type parameter to Database and the Database Configuration parameter to RDS For MySql when you create an event rule, the value of the Type parameter in the metadata is
acs.rds.mysql
, and the value of the Endpoint parameter in the metadata is the URL that you want to configure. The format of the Endpoint parameter isacs:rds:${region}:${uid}:dbinstance/${dbinstanceid}
. The following table describes the details of the resourceKey field in the ParamList parameter.resourceKey Required form value template InstanceId Yes CONSTANT The ID of the Container Registry Enterprise Edition instance. None DBName Yes CONSTANT The name of the database. None AccountName Yes CONSTANT The account that is used to log on to the database. None AccountPassword Yes CONSTANT The password of the account that is used to log on to the database. None ExecuteSQL Yes - ORIGINAL
- CONSTANT
- JSONPATH
- TEMPLATE
The custom SQL. If you set the form parameter to TEMPLATE, specify the value for the corresponding parameter in the template. VpcId Yes CONSTANT The ID of the VPC. None VSwitchIds Yes CONSTANT The ID of the vSwitch. None SecurityGroupId Yes CONSTANT The ID of the security group. None The following sample code provides an example of JSONPath:
{ "id":"BRTt1sNe3IvdvejN07k5Sb****", "type":"acs.rds.mysql", "endpoint":"acs:rds:cn-zhangjiakou:164901546557****:dbinstance/${dbinstanceid}", "concurrentConfig":{ "concurrency":10 }, "paramList":[ { "value":"rm-8vban2a66q93o****", "resourceKey":"InstanceId", "form":"CONSTANT" }, { "value":"db-test", "resourceKey":"DBName", "form":"CONSTANT" }, { "value":"db_name", "resourceKey":"AccountName", "form":"CONSTANT" }, { "value":"Aliyun****", "resourceKey":"AccountPassword", "form":"CONSTANT" }, { "value":"{\n \"tableName\": \"customer\",\n \"column1\": \"$.data.tableName\",\n \"column1_value\": \"$.data.id\"\n}", "template":"INSERT INTO ${tableName} \n (${column1}) VALUES('${column1_value}')", "resourceKey":"ExecuteSQL", "form":"TEMPLATE" }, { "value":"vpc-8vbeokru8z8erie8e****", "resourceKey":"VpcId", "form":"CONSTANT" }, { "value":"vsw-8vb9alm00nf29ijxt****", "resourceKey":"VSwitchIds", "form":"CONSTANT" } { "value":"sg-8vbb59f5vq1ydiwr****", "resourceKey":"SecurityGroupId", "form":"CONSTANT" } ] }
- If you set the Service Type parameter to Database and the Database Configuration parameter to Self-managed MySQL Database when you create an event rule, the value of the Type parameter in the metadata is
mysql
, and the value of the Endpoint parameter is in the format ofDatabase address${ConnectionStringAndPort}
. The following table describes the details of the resourceKey field in the ParamList parameter.resourceKey Required form value template ConnectionStringAndPort Yes CONSTANT The address of your MySQL database. None DBName Yes CONSTANT The name of the database. None AccountName Yes CONSTANT The account that is used to log on to the database. None AccountPassword Yes CONSTANT The password of the account that is used to log on to the database. None ExecuteSQL Yes - ORIGINAL
- CONSTANT
- JSONPATH
- TEMPLATE
The custom SQL. None Network Yes CONSTANT The type of the network. Valid values: - PublicNetwork: the Internet.
- PrivateNetwork: VPCs. If you set the Network parameter to PrivateNetwork, you must specify the VPC, vSwitch, and security group.
None VpcId No. This parameter is required when the Network parameter is set to PrivateNetwork. CONSTANT The ID of the VPC. None VSwitchIds No. This parameter is required when the Network parameter is set to PrivateNetwork. CONSTANT The ID of the vSwitch. None SecurityGroupId No. This parameter is required when the Network parameter is set to PrivateNetwork. CONSTANT The ID of the security group. None The following sample code provides an example in which the Network parameter is set to PublicNetwork:
{ "id":"HmfVOvdG4k1NK9qJiqrxtv****", "type":"mysql", "endpoint":"192.168.XX.XX:3306", "concurrentConfig":{ "concurrency":10 }, "paramList":[ { "value":"192.168.XX.XX:3306", "resourceKey":"ConnectionStringAndPort", "form":"CONSTANT" }, { "value":"db-test", "resourceKey":"DBName", "form":"CONSTANT" }, { "value":"dbTest", "resourceKey":"AccountName", "form":"CONSTANT" }, { "value":"Mydb****", "resourceKey":"AccountPassword", "form":"CONSTANT" }, { "value":"{\n \"tableName\": \"user\",\n \"column1\": \"$.data.tableName\",\n \"column1_value\": \"$.data.id\"\n}", "template":"INSERT INTO ${tableName} \n (${column1}) VALUES('${column1_value}')", "resourceKey":"ExecuteSQL", "form":"TEMPLATE" }, ] }
The following sample code provides an example in which the Network parameter is set to PrivateNetwork:
{ "id":"HmfVOvdG4k1NK9qJiqrxtv****", "type":"mysql", "endpoint":"192.168.XX.XX:3306", "concurrentConfig":{ "concurrency":10 }, "paramList":[ { "value":"vpc-8vbeokru8z8erie8e****", "resourceKey":"VpcId", "form":"CONSTANT" }, { "value":"vsw-8vbo9jk84z0obm24f****", "resourceKey":"VSwitchIds", "form":"CONSTANT" }, { "value":"192.168.XX.XX:3306", "resourceKey":"ConnectionStringAndPorte", "form":"CONSTANT" }, { "value":"my-db", "resourceKey":"DBName", "form":"CONSTANT" }, { "value":"dmsTest", "resourceKey":"AccountName", "form":"TEMPLATE" }, { "value":"Mydb****", "resourceKey":"AccountPassword", "form":"CONSTANT" }, { "value":"{\n \"tableName\": \"user\",\n \"column1\": \"$.data.tableName\",\n \"column1_value\": \"$.data.id\"\n}", "template": "INSERT INTO ${tableName} \n (${column1}) VALUES('${column1_value}')", "resourceKey":"ExecuteSQL", "form":"TEMPLATE" } ] }
EventBridge
If you set the Service Type parameter to EventBridge when you create an event rule, the value of the Type parameter in the metadata is acs.eventbridge
, and the value of the Endpoint parameter in the metadata is in the format of acs:eventbridge:${region}:${AccountId}:eventbus/${EventBusName}
. The following table describes the details of the resourceKey field in the ParamList parameter.
resourceKey | Required | form | value | template |
---|---|---|---|---|
RegionId | Yes | CONSTANT | The ID of the destination region. | None |
AccountType | Yes | CONSTANT | The type of the account. Valid values:
| None |
AccountId | No. By default, the current Alibaba Cloud account is used. | CONSTANT | The ID of the Alibaba Cloud account. This parameter is not required if you set the AccountType to SameAccount. | None |
EventBusName | Yes | CONSTANT | The name of the destination event bus. | None |
RAMRoleName | No. This parameter is required if events are delivered across Alibaba Cloud accounts. | CONSTANT | The name of the RAM role. For more information, see Route events to EventBridge. This parameter is not required if you set the AccountType parameter to SameAccount. | None |
Body | Yes | ORIGINAL, which indicates that the complete event is delivered. | None | None |
The following sample code provides examples of JSONPath:
Example 1: An event is delivered to the same Alibaba Cloud account.
{
"id":"KD20k9rpqDRXPq0SXXlqeT****",
"type":"acs.eventbridge",
"endpoint":"acs:eventbridge:cn-hangzhou:xxxxx:eventbus/xxxxx",
"paramList":[
{
"value":"cn-hangzhou",
"resourceKey":"RegionId",
"form":"CONSTANT"
},
{
"value":"SameAccount",
"resourceKey":"AccountType",
"form":"CONSTANT"
},
{
"value":"xxxxx",
"resourceKey":"EventBusName",
"form":"CONSTANT"
},
{
"resourceKey":"Body",
"form":"ORIGINAL"
}
]
}
Example 2: An event is delivered to another Alibaba Cloud account.
{
"id":"KD20k9rpqDRXPq0SXXlqeT****",
"type":"acs.eventbridge",
"endpoint":"acs:eventbridge:cn-hangzhou:xxxxx:eventbus/xxxxx",
"paramList":[
{
"value":"cn-hangzhou",
"resourceKey":"RegionId",
"form":"CONSTANT"
},
{
"value":"AnotherAccount",
"resourceKey":"AccountType",
"form":"CONSTANT"
},
{
"value":"xxxxx",
"resourceKey":"AccountId",
"form":"CONSTANT"
},
{
"value":"xxxxx",
"resourceKey":"EventBusName",
"form":"CONSTANT"
},
{
"value":"xxxxx",
"resourceKey":"RAMRoleName",
"form":"CONSTANT"
},
{
"resourceKey":"Body",
"form":"ORIGINAL"
}
]
}