All Products
Search
Document Center

EventBridge:Event target parameters

Last Updated:Nov 19, 2024

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

The filtering rule for Simple Message Queue (formerly MNS) (SMQ).

The description of the event rule.

Status

String

No

ENABLE

The status of the event rule. Valid values:

  • ENABLE

  • DISABLE

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 of this parameter is in the JSON format. For more information, 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

No

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 if events fail to be pushed. 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.

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. Queues in SMQ and ApsaraMQ for RocketMQ can be used as dead-letter queues.

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. Queues in SMQ and ApsaraMQ for RocketMQ can be used as dead-letter queues.

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 method that you want to use to transform events. Valid values:

  • 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 of the Event transformation topic.

  • 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 event content to the event target. For more information, see the "Partial Event" section of the Event transformation topic.

    Sample value of the value field:

    $.data.name
  • CONSTANT: constant. You need to specify only the value field. EventBridge routes only constants that are specified by the value field to the event target, regardless of the event content. For more information, see the "Constant" section of the Event transformation topic.

    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 the event target. For more information, see the "Template" section of the Event transformation topic.

    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}

value

String

Yes

{\"key\"=\"value\"}

The value in the transformed event.

template

String

No

The value of ${key} is ${value}!

The template that you want to use for event transformation.

Response parameters

Parameter

Required

Example

Description

RuleARN

String

acs:eventbridge:cn-hangzhou:123456789098****:eventbus/default/rule/MNSRule

The ARN of the event rule. The 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

  • CONSTANT

  • JSONPATH

The email address of the recipient.

None.

IsHtmlBody

Yes

CONSTANT

Specify whether the email body is of the HTML type. Valid values:

  • true

  • false

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",
            "EsourceKey":"ToAddress",
            "Form":"JSONPATH"
        },
        {
            "Value":"true",
            "ResourceKey":"IsHtmlBody",
            "Form":"CONSTANT"
        },
        {
            "Value":{
                "Mobile":"$.data.mobile",
                "Subject":"$.subject"
            },
            "ResourceKey":"Body",
            "Form":"TEMPLATE",
            "Template":{
                "Code":"${subject}"
            }
        }
    ]
}

SMS

If you set the Service Type parameter to Short Message Service (SMS) 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 SMS 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

  • CONSTANT

  • JSONPATH

The mobile phone number.

None.

SignName

Yes

CONSTANT

The signature name.

None.

TemplateCode

Yes

CONSTANT

The template code for SMS.

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 Communication 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 service name.

None.

functionName

Yes

CONSTANT

The function name.

None.

Body

Yes

  • ORIGINAL

  • CONSTANT

  • JSONPATH

  • TEMPLATE

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 invocation. 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"
        }
    ]
}

SMQ

If you set the Service Type parameter to SMQ 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 queue ID.

None.

Body

Yes

  • ORIGINAL

  • CONSTANT

  • JSONPATH

  • TEMPLATE

Specify the message content based on the form parameter.

If you set the form parameter to TEMPLATE, configure 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."
        }
    ]
}

ApsaraMQ for RocketMQ

If you set the Service Type parameter to ApsaraMQ for 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 instance ID.

None.

Topic

Yes

CONSTANT

The topic name.

None.

Body

Yes

  • ORIGINAL

  • JSONPATH

  • CONSTANT

  • TEMPLATE

The message body.

If you set the form parameter to TEMPLATE, configure the template.

Properties

No

  • JSONPATH

  • TEMPLATE

The attributes.

None.

Keys

No

  • JSONPATH

  • CONSTANT

  • TEMPLATE

The keys.

If you set the form parameter to TEMPLATE, configure the template.

Tags

No

  • JSONPATH

  • CONSTANT

  • TEMPLATE

The tags.

If you set the form parameter to TEMPLATE, configure 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"
        }
    ]
}

ApsaraMQ for RabbitMQ

If you set the Service Type parameter to ApsaraMQ 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 instance ID.

None.

Vhost

Yes

CONSTANT

The vhost.

None.

TargetType

Yes

CONSTANT

The type of the resource to which you want to deliver events.

Note

You can configure only one of the Exchange and Queue parameters.

None.

Exchange

No. This parameter is required only if you set the TargetType parameter to Exchange.

CONSTANT

The exchange mode.

None.

Queue

No. This parameter is required only if you set the TargetType parameter to Queue.

CONSTANT

Note

You can set only one of the Exchange and Queue parameters.

The queue mode.

None.

Body

Yes

  • ORIGINAL

  • JSONPATH

  • CONSTANT

  • TEMPLATE

The message body.

If you set the form parameter to TEMPLATE, configure the template.

MessageId

No. By default, the value of this parameter is automatically generated.

  • JSONPATH

  • CONSTANT

  • TEMPLATE

The message ID.

If you set the form parameter to TEMPLATE, configure the template.

Properties

No

  • JSONPATH

  • TEMPLATE

The attributes.

If you set the form parameter to TEMPLATE, configure the template.

The following sample code provides the 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"
        }
    ]
}

ApsaraMQ for Kafka

If you set the Service Type parameter to ApsaraMQ for Kafka when you create an event rule, the value of the Type parameter in the metadata is acs.alikafka, and the value of the Endpoint parameter in the metadata is the URL that you want to configure. The value format of the Endpoint parameter is acs:alikafka:${regionId}:${accountId}:topics/${topic}. The following table describes the details of the resourceKey field in the ParamList parameter.

resourceKey

Required

form

value

template

InstanceId

Yes

CONSTANT

The instance ID.

None.

Topic

Yes

CONSTANT

The topic name.

None.

Value

Yes

  • CONSTANT

  • ORIGINAL

  • JSONPATH

  • TEMPLATE

The message body.

The method that you want to use to transform events. Valid values:

  • 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 of the Event transformation topic.

  • 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 event content to the event target. For more information, see the "Partial Event" section of the Event transformation topic.

    Sample value of the value field:

    $.data.name
  • CONSTANT: constant. You need to specify only the value field. EventBridge routes only constants that are specified by the value field to the event target, regardless of the event content. For more information, see the "Constant" section of the Event transformation topic.

    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 the event target. For more information, see the "Template" section of the Event transformation topic.

    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}

Key

Yes

JSONPATH

The message key.

For more information, see the template column of the Value parameter.

Acks

Yes

CONSTANT

The acknowledgment (ACK) mode.

None.

The following sample code provides an example of JSONPath:

{
    "id":"1rypRt1I9ET6Aks9Y6NNg6U****",
    "type":"acs.alikafka",
    "endpoint":"acs:alikafka:cn-huhehaote:118609547428****:topics/test-topic",
    "pushSelector":"PARAM_TRANSFORMER",
    "errorsTolerance":"ALL",
    "pushRetryStrategy":"BACKOFF_RETRY",
    "paramList":[
        {
            "value":"alikafka_pre-cn-zpr3fwhe****",
            "resourceKey":"InstanceId",
            "form":"CONSTANT"
        },
        {
            "value":"test-topic",
            "resourceKey":"Topic",
            "form":"CONSTANT"
        },
        {
            "value":"$.data",
            "resourceKey":"Value",
            "form":"JSONPATH"
        },
        {
            "value":"$.data.key",
            "resourceKey":"Key",
            "form":"JSONPATH"
        },
        {
            "value":"0",
            "resourceKey":"Acks",
            "form":"CONSTANT"
        }
    ]
}

Simple Log Service

If you set the Event Target parameter to Simple Log Service when you create an event rule, the value of the Type parameter in the metadata is acs.sls, and the value of the Endpoint parameter in the metadata is the URL that you want to configure. The value format of the Endpoint parameter is acs:sls:${regionId}:${accountId}:project/${project}/logstore/${logstore}. The following table describes the details of the resourceKey field in the ParamList parameter.

resourceKey

Required

form

value

template

Project

Yes

CONSTANT

The project name.

None.

LogStore

Yes

CONSTANT

The Logstore name.

None.

Topic

No

  • CONSTANT

  • TEMPLATE

  • JSONPATH

The log topic.

The method that you want to use to transform events. Valid values:

  • 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 of the Event transformation topic.

  • 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 event content to the event target. For more information, see the "Partial Event" section of the Event transformation topic.

    Sample value of the value field:

    $.data.name
  • CONSTANT: constant. You need to specify only the value field. EventBridge routes only constants that are specified by the value field to the event target, regardless of the event content. For more information, see the "Constant" section of the Event transformation topic.

    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 the event target. For more information, see the "Template" section of the Event transformation topic.

    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}

Body

No

  • CONSTANT

  • ORIGINAL

  • JSONPATH

  • TEMPLATE

The log content.

For more information, see the template column of the Topic parameter.

ContentType

Yes

CONSTANT

The data type of the content.

Valid values: JSON and KeyValue. Default value: JSON.

  • If you select JSON for this parameter, the key field of a log that is delivered to Simple Log Service is content, and the value field of the log is the event content that is defined in the body of the parameter.

  • If you select KeyValue for this parameter, the key and value fields of a log that is delivered to Simple Log Service are determined by the structure that is defined by the ContentSchema parameter.

RoleName

Yes

CONSTANT

The role name.

None.

ContentSchema

No

CONSTANT

Specify a custom content template for the indexes and values of logs that are written to Simple Log Service.

{
    "Key_1":{
        "form":"CONSTANT",
        "value":"myKey01"
    },
    "Value_1":{
        "form":"JSONPATH",
        "value":"$.data.myValue01"
    }
}

The Key_1 and Value_1 fields in the sample code indicate a key-value pair.

The following sample code provides an example of JSONPath:

{
    "id":"MwOpn5yyemTlQjE5JwYjme****",
    "type":"acs.sls",
    "endpoint":"acs:sls:cn-hangzhou:182572506381****:project/${project}/logstore/${logstore}",
    "pushSelector":"PARAM_TRANSFORMER",
    "errorsTolerance":"ALL",
    "pushRetryStrategy":"BACKOFF_RETRY",
    "paramList":[
        {
            "value":"testproject37****",
            "resourceKey":"Project",
            "form":"CONSTANT"
        },
        {
            "value":"testlogstore37****",
            "resourceKey":"LogStore",
            "form":"CONSTANT"
        },
        {
            "value":"$.data.topic",
            "resourceKey":"Topic",
            "form":"JSONPATH"
        },
        {
            "value":"KeyValue",
            "resourceKey":"ContentType",
            "form":"CONSTANT"
        },
        {
            "value":"AliyunEventBridgeSLS-248QJd****",
            "resourceKey":"RoleName",
            "form":"CONSTANT"
        },
        {
            "value":"{\"Key_1\":{\"form\":\"CONSTANT\",\"value\":\"name\"},\"Value_1\":{\"form\":\"CONSTANT\",\"value\":\"age\"}}",
            "resourceKey":"ContentSchema",
            "form":"CONSTANT"
        }
    ]
}

HTTP/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

  • 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, configure the template. The variables in the template are from the Value parameter.

Network

Yes

CONSTANT

The network type. Valid values:

  • PublicNetwork: the Internet.

  • PrivateNetwork: virtual private cloud (VPC). If you set the Network parameter to PrivateNetwork, you must specify the VPC, vSwitch, and security group.

None.

VPCNameAndId

No. This parameter is required only if you set the Network parameter to PrivateNetwork.

CONSTANT

The information about the VPC in which the event target resides. Format: VPCName+"/" + VPCId.

None.

VSwitchesNameAndId

No. This parameter is required only if you set the Network parameter to PrivateNetwork.

CONSTANT

The information about the vSwitch of the VPC in which the event target is deployed. Multiple vSwitches can be specified. The value of this parameter is a JSON string. Example: [VSwitchName+"/"+VSwitchId , VSwitchName+"/"+VSwitchId ].

None.

SecurityGroupNameAndId

No. This parameter is required only if you set the Network parameter to PrivateNetwork.

CONSTANT

The information about the security group of the VPC in which the event target resides. Format: SecurityGroupName+"/" + SecurityGroupId.

None.

Token

No. By default, this parameter is left empty.

CONSTANT

The token that is used for signature verification. You must set the Header Key parameter to a fixed value "x-eventbridge-signature-token" and manually configure the Value parameter.

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 value 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.

    resourceKey

    Required

    form

    value

    template

    InstanceId

    Yes

    CONSTANT

    The instance ID.

    None.

    DBName

    Yes

    CONSTANT

    The database name.

    None.

    AccountName

    Yes

    CONSTANT

    The username of 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 statement.

    If you set the form parameter to TEMPLATE, configure the template.

    VpcId

    Yes

    CONSTANT

    The VPC ID.

    None.

    VSwitchIds

    Yes

    CONSTANT

    The vSwitch ID.

    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 of Database 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 database endpoint.

    None.

    DBName

    Yes

    CONSTANT

    The database name.

    None.

    AccountName

    Yes

    CONSTANT

    The username of 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 statement.

    None.

    Network

    Yes

    CONSTANT

    The network type. Valid values:

    • PublicNetwork: the Internet.

    • PrivateNetwork: VPC. If you set the Network parameter to PrivateNetwork, you must specify the VPC, vSwitch, and security group.

    None.

    VpcId

    No. This parameter is required only if you set the Network parameter to PrivateNetwork.

    CONSTANT

    The VPC ID.

    None.

    VSwitchIds

    No. This parameter is required only if you set the Network parameter to PrivateNetwork.

    CONSTANT

    The vSwitch ID.

    None.

    SecurityGroupId

    No. This parameter is required only if you set the Network parameter 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 region where the event target resides.

None.

AccountType

Yes

CONSTANT

The account type. Valid values:

  • AnotherAccount: another Alibaba Cloud account.

  • SameAccount: the current Alibaba Cloud account.

None.

AccountId

No. By default, the current Alibaba Cloud account is used.

CONSTANT

The ID of the Alibaba Cloud account to which events are delivered. This parameter is optional 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 Resource Access Management (RAM) role. For more information, see Route events to EventBridge. This parameter is optional 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"
        }
    ]
}

Triggered by API destinations

If you set the Service Type parameter to Triggered by API Destination when you create an event rule, the value of the Type parameter in the metadata data is acs.api.destination and the value of the Endpoint parameter is in the format of acs:api-destination:${region}:${AccountId}:eventbus/${APIName}. The following table describes the details of the resourceKey field in the ParamList parameter.

resourceKey

Required

form

value

template

Name

Yes

CONSTANT

The name of the API destination.

None.

HeaderParameters

No

TEMPLATE

The request header.

Configure the template.

BodyParameters

No

TEMPLATE

The request body parameters.

Configure the template.

QueryStringParameters

No

TEMPLATE

The request path parameters.

Configure the template.

The following sample code provides an example of JSONPath:

{
    "id":"gwrxsJKAnLxSEo4GHhV69q****",
    "type":"acs.api.destination",
    "endpoint":"acs:api-destination:cn-hangzhou:11860954742****:name/api-key-test",
    "pushSelector":"PARAM_TRANSFORMER",
    "errorsTolerance":"ALL",
    "pushRetryStrategy":"BACKOFF_RETRY",
    "paramList":[
        {
            "resourceKey":"Name",
            "form":"CONSTANT",
            "value":"api-key-test"
        },
        {
            "resourceKey":"HeaderParameters",
            "form":"TEMPLATE",
            "value":"{\"headerKey1\":\"Content-Type\",\"headerValue1\":\"multipart/form-data\",\"headerKey2\":\"name\",\"headerValue2\":\"$.data.name\",\"headerKey3\":\"$.data.number\",\"headerValue3\":\"name\"}",
            "template":"{\"${headerKey1}\":\"${headerValue1}\",\"${headerKey2}\":\"${headerValue2}\",\"${headerKey3}\":\"${headerValue3}\"}"
        },
        {
            "resourceKey":"BodyParameters",
            "form":"TEMPLATE",
            "value":"{\"bodyKey1\":\"name\",\"bodyValue1\":\"$.data.name\"}",
            "template":"{\"${bodyKey1}\":\"${bodyValue1}\"}"
        },
        {
            "resourceKey":"QueryStringParameters",
            "form":"TEMPLATE",
            "value":"{\"queryKey1\":\"name\",\"queryValue1\":\"$.data.name\",\"queryKey2\":\"$.data.name\",\"queryValue2\":\"name\"}",
            "template":"{\"${queryKey1}\":\"${queryValue1}\",\"${queryKey2}\":\"${queryValue2}\"}"
        }
    ]
}

CloudFlow

If you set the Service Type parameter to CloudFlow when you create an event rule, the value of the Type parameter in the metadata data is acs.fnf and the value of the Endpoint parameter is in the format of acs:fnf:${region}:${AccountId}:flow/${flow}. The following table describes the details of the resourceKey field in the ParamList parameter.

resourceKey

Required

form

value

template

FlowName

Yes

CONSTANT

The flow name.

None.

ExecutionName

No

  • JSONPATH

  • CONSTANT

  • TEMPLATE

The execution name.

The method that you want to use to transform events. Valid values:

  • 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 of the Event transformation topic.

  • 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 event content to the event target. For more information, see the "Partial Event" section of the Event transformation topic.

    Sample value of the value field:

    $.data.name
  • CONSTANT: constant. You need to specify only the value field. EventBridge routes only constants that are specified by the value field to the event target, regardless of the event content. For more information, see the "Constant" section of the Event transformation topic.

    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 the event target. For more information, see the "Template" section of the Event transformation topic.

    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}

Input

No

JSONPATH

The input information of the execution.

For more information, see the template column of the ExecutionName parameter.

RoleName

Yes

CONSTANT

The role name.

None.

The following sample code provides an example of JSONPath:

{
    "id":"KLUGLVJeuWDw1bIJ6lgURl****",
    "type":"acs.fnf",
    "endpoint":"acs:fnf:cn-hangzhou:118609547428****:flow/${flow}",
    "pushSelector":"PARAM_TRANSFORMER",
    "errorsTolerance":"ALL",
    "pushRetryStrategy":"BACKOFF_RETRY",
    "paramList":[
        {
            "value":"serverless",
            "resourceKey":"FlowName",
            "form":"CONSTANT"
        },
        {
            "value":"$.data",
            "resourceKey":"ExecutionName",
            "form":"JSONPATH"
        },
        {
            "value":"$.data",
            "resourceKey":"Input",
            "form":"JSONPATH"
        },
        {
            "value":"AliyunEventBridgeFNF-FZwEeE****",
            "resourceKey":"RoleName",
            "form":"CONSTANT"
        }
    ]
}

ACK

If you set the Service Type parameter to Container Service for Kubernetes (ACK) when you create an event rule, the value of the Type parameter in the metadata data is acs.k8s and the value of the Endpoint parameter is kubernetes. The following table describes the details of the resourceKey field in the ParamList parameter.

resourceKey

Required

form

value

template

KubeConfig

Yes

CONSTANT

The cluster configuration file.

None.

YamlContent

Yes

CONSTANT

The YAML configuration.

The method that you want to use to transform events. Valid values:

  • 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 of the Event transformation topic.

  • 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 event content to the event target. For more information, see the "Partial Event" section of the Event transformation topic.

    Sample value of the value field:

    $.data.name
  • CONSTANT: constant. You need to specify only the value field. EventBridge routes only constants that are specified by the value field to the event target, regardless of the event content. For more information, see the "Constant" section of the Event transformation topic.

    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 the event target. For more information, see the "Template" section of the Event transformation topic.

    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}

Network

Yes

CONSTANT

The network type.

None.

QPSLimit

Yes

CONSTANT

The throttling configuration.

None.

The following sample code provides an example of JSONPath:

{
    "id":"Grdzk1cR4DNjmHa0oPJp8j****",
    "type":"acs.k8s",
    "endpoint":"kubernetes",
    "pushSelector":"PARAM_TRANSFORMER",
    "errorsTolerance":"ALL",
    "pushRetryStrategy":"BACKOFF_RETRY",
    "paramList":[
        {
            "form":"CONSTANT",
            "value":"PublicNetwork",
            "resourceKey":"Network"
        },
        {
            "form":"CONSTANT",
            "value":5,
            "resourceKey":"QPSLimit"
        },
        {
            "form":"CONSTANT",
            "value":"test1",
            "resourceKey":"KubeConfig"
        },
        {
            "form":"CONSTANT",
            "resourceKey":"YamlContent",
            "value":"test2"
        }
    ]
}

SAE

If you set the Service Type parameter to Serverless App Engine (SAE) when you create an event rule, the value of the Type parameter in the metadata data is acs.sae and the value of the Endpoint parameter is in the format of http://sae.cn-huhehaote.aliyuncs.com/pop/v1/sam/job/execJob. The following table describes the details of the resourceKey field in the ParamList parameter.

resourceKey

Required

form

value

template

RegionId

Yes

CONSTANT

The region ID.

The method that you want to use to transform events. Valid values:

  • 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 of the Event transformation topic.

  • 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 event content to the event target. For more information, see the "Partial Event" section of the Event transformation topic.

    Sample value of the value field:

    $.data.name
  • CONSTANT: constant. You need to specify only the value field. EventBridge routes only constants that are specified by the value field to the event target, regardless of the event content. For more information, see the "Constant" section of the Event transformation topic.

    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 the event target. For more information, see the "Template" section of the Event transformation topic.

    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}

AppId

Yes

CONSTANT

The ID of the job template.

For more information, see the template column of the RegionId parameter.

EventId

Yes

JSONPATH

The event ID.

For more information, see the template column of the RegionId parameter.

Parameters

Yes

CONSTANT

The CommandArgs Envs parameter of execjob.

For more information, see the template column of the RegionId parameter.

The following sample code provides an example of JSONPath:

{
    "id":"xp0dEW4mVbS5tDQzIBiZrY****",
    "type":"acs.sae",
    "endpoint":"http://sae.cn-huhehaote.aliyuncs.com/pop/v1/sam/job/execJob",
    "pushSelector":"PARAM_TRANSFORMER",
    "errorsTolerance":"ALL",
    "pushRetryStrategy":"BACKOFF_RETRY",
    "paramList":[
        {
            "value":"cn-huhehaote",
            "resourceKey":"RegionId",
            "form":"CONSTANT"
        },
        {
            "value":"3F2504E0-4F89-11D3-9A0C-0305E82C****",
            "resourceKey":"AppId",
            "form":"CONSTANT"
        },
        {
            "value":"$.id",
            "resourceKey":"EventId",
            "form":"JSONPATH"
        },
        {
            "value":"[\"a\",\"b\"]",
            "resourceKey":"Parameters",
            "form":"CONSTANT"
        }
    ]
}

Event Analysis

If you set the Service Type parameter to Event Analysis when you create an event rule, the value of the Type parameter in the metadata data is acs.eventbridge.olap and the value of the Endpoint parameter is in the format of ${SchemaURI}. The following table describes the details of the resourceKey field in the ParamList parameter.

resourceKey

Required

form

value

template

UseSchema

Yes

CONSTANT

The mapping method. Valid values:

  • FromEvent: Use the schema that is specified in the dataschema field of an event.

  • FromRule: Use the schema that is specified in the rule.

None.

SchemaGroup

Yes

CONSTANT

The name of the schema group.

None.

SchemaID

Yes

CONSTANT

The schema ID.

None.

SchemaVersion

Yes

CONSTANT

The schema version.

None.

The following sample code provides an example of JSONPath:

{
    "id":"DLuVyP3JcAAb3q2CibqZI6****",
    "type":"acs.eventbridge.olap",
    "endpoint":"${SchemaURI}",
    "pushSelector":"PARAM_TRANSFORMER",
    "errorsTolerance":"ALL",
    "pushRetryStrategy":"BACKOFF_RETRY",
    "paramList":[
        {
            "value":"FromRule",
            "resourceKey":"UseSchema",
            "form":"CONSTANT"
        },
        {
            "value":"DEFAULT_SCHEMA_GROUP",
            "resourceKey":"SchemaGroup",
            "form":"CONSTANT"
        },
        {
            "value":"test",
            "resourceKey":"SchemaID",
            "form":"CONSTANT"
        },
        {
            "value":"1",
            "resourceKey":"SchemaVersion",
            "form":"CONSTANT"
        }
    ]
}

DataHub

If you set the Service Type parameter to DataHub when you create an event rule, the value of the Type parameter in the metadata data is acs.datahub and the value of the Endpoint parameter is in the format of acs:datahub:${region}:${AccountId}:project/${project}/topic/${topic}. The following table describes the details of the resourceKey field in the ParamList parameter.

resourceKey

Required

form

value

template

Project

Yes

CONSTANT

The project name.

None.

Topic

Yes

CONSTANT

The topic name.

None.

TopicType

Yes

CONSTANT

The topic type. Valid values:

  • TUPLE: Topics of this type contain records that are similar to data records in databases. Each record contains multiple columns.

  • BLOB: You can write a block of binary data as a record to topics of this type.

None.

TopicSchema

This parameter is required only if you specify the TopicType parameter to TUPLE.

TEMPLATE

The topic schema.

TEMPLATE. Sample value:

{
    "resourceKey":"TopicSchema",
    "value":"{\"k1-0\":\"a\",\"k2-1\":\"$.data.name\",\"k3-2\":\"v\"}",
    "form":"TEMPLATE",
    "template":"{\"k1\":\"${k1-0}\",\"k2\":\"${k2-1}\",\"k3\":\"${k3-2}\"}"
}

In the template, ki indicates the ith field of the topic. The value of i is a positive integer such as 1, 2, and 3. The corresponding value is defined in the value parameter. You can enter partial event or constant.

RoleName

Yes

CONSTANT

The role name.

None.

The following sample code provides an example of JSONPath:

{
    "id":"ZXoGuhjAT5UfqngBPapXro****",
    "type":"acs.datahub",
    "endpoint":"acs:datahub:cn-hangzhou:175299981560****:project/demo_project/topic/demo_topic",
    "errorsTolerance":"ALL",
    "pushRetryStrategy":"BACKOFF_RETRY",
    "paramList":[
        {
            "Form":"CONSTANT",
            "Value":"demo_project",
            "ResourceKey":"Project"
        },
        {
            "Form":"CONSTANT",
            "Value":"demo_topic",
            "ResourceKey":"Topic"
        },
        {
            "Form":"CONSTANT",
            "Value":"TUPLE",
            "ResourceKey":"TopicType"
        },
        {
            "Form":"TEMPLATE",
            "Value":"{\"k1-0\":\"1\",\"k2-1\":\"2\",\"k3-2\":\"3\"}",
            "Template":"{\"k1\":\"${k1-0}\",\"k2\":\"${k2-1}\",\"k3\":\"${k3-2}\"}",
            "ResourceKey":"TopicSchema"
        },
        {
            "Form":"CONSTANT",
            "Value":"AliyunEventBridgeDataHubRole-2HwuVf****",
            "ResourceKey":"RoleName"
        }
    ]
}