This topic describes the parameters in the metadata of an event target.

Request parameters

ParameterTypeRequiredExampleDescription
EventBusNameStringYesdefaultThe name of the event bus. For more information, see Limits.
RuleNameStringYesMNSRuleThe name of the event rule. For more information, see Limits.
DescriptionStringNoMessage Service filter rule The description of the event rule.
StatusStringNoENABLEThe status of the event rule. Valid values:
  • ENABLE
  • DISABLE

Default value: ENABLE.

FilterPatternStringNo{\"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.
TargetsList<Target>YesThe event target to which events that match the event rule are delivered.
IdStringYes1The ID of the custom event target. The ID must be unique in the event rule.
TypeStringYesacs.mns.queueThe type of the event target. For more information, see the description of each event target in the following sections.
EndpointStringYesacs:mns:cn-hangzhou:123456789098****:queues/myqueueThe endpoint of the event target. For more information, see the description of the endpoint format of each event target in the following sections.
PushRetryStrategyStringYesBACKOFF_RETRYThe retry policy that is used to push events. Valid values:
  • BACKOFF_RETRY: backoff retry. A failed event can be retried up to three times. The interval between two consecutive retries is a random value from 10 to 20. Unit: seconds.
  • EXPONENTIAL_DECAY_RETRY: exponential decay retry. A failed event can be retried up to 176 times. The interval between two consecutive retries exponentially increases to a maximum of 512 seconds. The total amount of time that can be used for retries is one day. Example: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 512... The number 512 is used for 167 retries.
DeadLetterQueueStringNoThe 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.
ArnStringNoacs:mns:cn-hangzhou:123456789098****:/queues/rule-deadletterqueue or acs:mq:cn-hangzhou:123456789098****:/instances/myinstance/topic/mytopicThe 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.
ParamListList<Param>YesThe parameters to be passed by events.
resourceKeyStringYesbodyThe parameter of the destination service.
formStringYesTEMPLATEThe transformation method. The following transformation methods are supported:
  • ORIGINAL: complete event. You do not need to specify the value or template field. EventBridge routes the complete data structure of an event in the CloudEvents format to an event target without transformation. For more information, see the "Complete event" section in Event transformation.
  • JSONPATH: partial event. You need to specify only the value field. EventBridge extracts fields from an event in the CloudEvents format by using JSONPath and routes the specified part of the event to an event target. For more information, see the "Partial event" section in Event transformation.
    Sample value of the value field:
    $.data.name
  • CONSTANT: constant. You need to specify only the value field. EventBridge routes only constants specified by the value field to an event target regardless of the event context. For more information, see the "Constant" section in Event transformation.
    Sample value of the value field:
    "test1"
  • TEMPLATE: template. You must specify the value and template fields. EventBridge extracts fields from an event in the CloudEvents format by using JSONPath, stores the field values in the value field, and then routes the event in the format that is specified by the template field to an event target. For more information, see the "Template" section in Event transformation.
    Sample value of the value field:
    {
        "name":"$.data.name",
        "constant":"Please deal with it timely."
    }
    Sample value of the template field:
    The instance is broken, which name is ${name}, ${constant}
valueStringYes{\"key\"=\"value\"}The value of the transformed event.
templateStringNo
The value of ${key} is ${value}!
The template that is used for event transformation.

Response parameters

ParameterTypeExampleDescription
RuleARNStringacs:eventbridge:cn-hangzhou:123456789098****:eventbus/default/rule/MNSRuleThe 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.

resourceKeyRequiredformvaluetemplate
URLYesCONSTANTThe DingTalk URL. None
SecretKeyYesCONSTANTThe secret key. None
BodyYesTEMPLATEDefine 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.

resourceKeyRequiredformvaluetemplate
SubjectYesCONSTANTThe subject of the email. None
AccountNameYesCONSTANTThe email address of the sender. None
AddressTypeYesCONSTANTThe type of the email address. None
ReplyToAddressYesCONSTANTThe reply-to address. None
ToAddressYes
  • CONSTANT
  • JSONPATH
The email address of the recipient. None
IsHtmlBodyYesCONSTANTSpecify whether the email body is of the HTML type. Valid values:
  • true
  • false
None
BodyYesTEMPLATEDefine 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.

resourceKeyRequiredformvaluetemplate
PhoneNumbersYes
  • CONSTANT
  • JSONPATH
The phone number. None
SignNameYesCONSTANTThe name of the signature. None
TemplateCodeYesCONSTANTThe template code for Short Message Service. None
TemplateParamYesTEMPLATEDefine 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.

resourceKeyRequiredformvaluetemplate
serviceNameYesCONSTANTThe name of the service. None
functionNameYesCONSTANTThe name of the function. None
BodyYes
  • ORIGINAL
  • CONSTANT
  • JSONPATH
  • TEMPLATE
The message body of the function. You must define the key and value. Define the template of the message body.
InvocationTypeYesCONSTANTThe type of the function call. Valid values:
  • Sync: synchronous.
  • Async: asynchronous.
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.

resourceKeyRequiredformvaluetemplate
queueYesCONSTANTThe ID of the queue. None
BodyYes
  • ORIGINAL
  • CONSTANT
  • JSONPATH
  • TEMPLATE
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.

resourceKeyRequiredformvaluetemplate
InstanceIdYesCONSTANTThe ID of the instance. None
TopicYesCONSTANTThe topic. None
BodyYes
  • ORIGINAL
  • JSONPATH
  • CONSTANT
  • TEMPLATE
The message body. If you set the form parameter to TEMPLATE, specify the value for the corresponding parameter in the template.
PropertiesNo
  • JSONPATH
  • TEMPLATE
The properties. None
KeysNo
  • JSONPATH
  • CONSTANT
  • TEMPLATE
The keys. If you set the form parameter to TEMPLATE, specify the value for the corresponding parameter in the template.
TagsNo
  • JSONPATH
  • CONSTANT
  • TEMPLATE
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.

resourceKeyRequiredformvaluetemplate
InstanceIdYesCONSTANTThe ID of the instance. None
VhostYesCONSTANTThe vhost. None
TargetTypeYesCONSTANTThe type of the resource to which events are delivered.
Note You can configure only one of the Exchange and Queue parameters.
None
ExchangeNo. This parameter is required only if the TargetType parameter is set to Exchange. CONSTANTThe exchange mode. None
QueueNo. 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
BodyYes
  • ORIGINAL
  • JSONPATH
  • CONSTANT
  • TEMPLATE
The message body. If you set the form parameter to TEMPLATE, specify the value for the corresponding parameter in the template.
MessageIdNo. By default, the value of this parameter is automatically generated.
  • JSONPATH
  • CONSTANT
  • TEMPLATE
The ID of the message. If you set the form parameter to TEMPLATE, specify the value for the corresponding parameter in the template.
PropertiesNo
  • JSONPATH
  • TEMPLATE
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.

resourceKeyRequiredformvaluetemplate
urlYesCONSTANTThe URL. None
BodyYes
  • ORIGINAL
  • CONSTANT
  • JSONPATH
  • TEMPLATE
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.
NetworkYesCONSTANTThe type of the network. Valid values:
  • PublicNetwork: the Internet.
  • PrivateNetwork: virtual private clouds (VPCs). If you set the Network parameter to PrivateNetwork, you must specify the VPC, vSwitch, and security group.
None
VPCNameAndIdNo. This parameter is required when the Network parameter is set to PrivateNetwork. CONSTANTThe information about the VPC in which the event target resides. Format: VPCName+"/" + VPCId. None
VSwitchesNameAndIdNo. This parameter is required when the Network parameter is set to PrivateNetwork. CONSTANTThe 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
SecurityGroupNameAndIdNo. This parameter is required when the Network parameter is set to PrivateNetwork. CONSTANTThe information about the security group of the VPC in which the event target resides. Format: SecurityGroupName+"/" + SecurityGroupId. None
TokenNo. This parameter is empty by default. CONSTANTThe 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 is acs:rds:${region}:${uid}:dbinstance/${dbinstanceid}. The following table describes the details of the resourceKey field in the ParamList parameter.
    resourceKeyRequiredformvaluetemplate
    InstanceIdYesCONSTANTThe ID of the Container Registry Enterprise Edition instance. None
    DBNameYesCONSTANTThe name of the database. None
    AccountNameYesCONSTANTThe account that is used to log on to the database. None
    AccountPasswordYesCONSTANTThe password of the account that is used to log on to the database. None
    ExecuteSQLYes
    • 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.
    VpcIdYesCONSTANTThe ID of the VPC. None
    VSwitchIdsYesCONSTANTThe ID of the vSwitch. None
    SecurityGroupIdYesCONSTANTThe 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 of Database address${ConnectionStringAndPort}. The following table describes the details of the resourceKey field in the ParamList parameter.
    resourceKeyRequiredformvaluetemplate
    ConnectionStringAndPortYesCONSTANTThe address of your MySQL database. None
    DBNameYesCONSTANTThe name of the database. None
    AccountNameYesCONSTANTThe account that is used to log on to the database. None
    AccountPasswordYesCONSTANTThe password of the account that is used to log on to the database. None
    ExecuteSQLYes
    • ORIGINAL
    • CONSTANT
    • JSONPATH
    • TEMPLATE
    The custom SQL. None
    NetworkYesCONSTANTThe 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
    VpcIdNo. This parameter is required when the Network parameter is set to PrivateNetwork. CONSTANTThe ID of the VPC. None
    VSwitchIdsNo. This parameter is required when the Network parameter is set to PrivateNetwork. CONSTANTThe ID of the vSwitch. None
    SecurityGroupIdNo. This parameter is required when the Network parameter is set to PrivateNetwork. CONSTANTThe 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.

resourceKeyRequiredformvaluetemplate
RegionIdYesCONSTANTThe ID of the destination region. None
AccountTypeYesCONSTANTThe type of the account. Valid values:
  • AnotherAccount: other Alibaba Cloud accounts.
  • SameAccount: the current Alibaba Cloud account.
None
AccountIdNo. By default, the current Alibaba Cloud account is used. CONSTANTThe ID of the Alibaba Cloud account. This parameter is not required if you set the AccountType to SameAccount. None
EventBusNameYesCONSTANTThe name of the destination event bus. None
RAMRoleNameNo. This parameter is required if events are delivered across Alibaba Cloud accounts. CONSTANTThe 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
BodyYesORIGINAL, 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"
        }
    ]
}