Creates one or more event targets for an event rule.
URI
/openapi/createTargets
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 | myRule2 | The name of the event rule.For more information, see Limits. |
Targets | List<Target> | Yes | The event targets that you want to create. For more information, see Limits. | |
Id | String | Yes | target5 | The custom ID of the event target. |
Type | String | Yes | acs.fc.function | The type of the event target. |
Endpoint | String | Yes | acs:fc:cn-hangzhou:123456789098****:services/guide.LATEST/functions/HelloFC | The endpoint of the event target. |
PushRetryStrategy | String | Yes | BACKOFF_RETRY | The retry policy that is used to push the event. Valid values:
|
ParamList | List<Param> | Yes | The parameters that the event passes. | |
resourceKey | String | Yes | body | The resource key of the transformed event.For more information, see Event target parameters. |
form | String | Yes | TEMPLATE | The transformation method.For more information, see Event target parameters. |
value | String | Yes |
|
The event value to be transformed. |
template | String | No | The value of ${key} is ${value}! | The format of the template. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
ErrorEntriesCount | Int |
|
The number of event bodies that failed to be processed. Valid values:
|
ErrorEntries | List |
|
The information about the event body that failed to be processed. |
ErrorCode | String | EventRuleTargetIdDuplicate | The error code returned. |
ErrorMessage | String | The id of event target is duplicate! | The error message returned. |
EntryId | String | target5 | The ID of the event body that failed to be processed. |
Examples
Sample requests
POST /openapi/createTargets HTTP/1.1
Host: 123456789098****.eventbridge.cn-hangzhou.aliyuncs.com
Date: Sat, 18 Apr 2020 05:30:41 GMT
x-eventbridge-version: 2020-04-01
Authorization: acs vZ3VL0SuJdHi****:Jo2PbTj******zYAYoYslKLvWzg=
Content-Type: application/json;charset=UTF-8
Content-Length: 26
{
"EventBusName":"default",
"RuleName":"myRule2",
"Targets":[
{
"Id":"target5",
"Type":"acs.fc.function",
"Endpoint":"acs:fc:cn-hangzhou:123456789098****:services/guide.LATEST/functions/HelloFC",
"PushRetryStrategy":"BACKOFF_RETRY",
"ParamList":[
{
"resourceKey":"serviceName",
"form":"CONSTANT",
"value":"guide"
},
{
"resourceKey":"functionName",
"form":"CONSTANT",
"value":"HelloFC"
},
{
"resourceKey":"body",
"form":"TEMPLATE",
"value":"{\"key\"=\"value\"}",
"template":"The value of ${key} is ${value}!"
}
]
}
]
}
Sample success response
HTTP/1.1 200 OK
Server: AliyunEventBridge
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Content-Length: 79
x-eventbridge-request-id: 5E9A908133324571D800****
Date: Sat, 18 Apr 2020 05:30:41 GMT
{
"errorEntriesCount":0,
"errorEntries":[
]
}
Sample error response
HTTP/1.1 200 OK
Server: AliyunEventBridge
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Content-Length: 79
x-eventbridge-request-id: 5E9A908133324571D800****
Date: Sat, 18 Apr 2020 05:30:41 GMT
{
"errorEntriesCount":1,
"errorEntries":[
{
"ErrorCode":"EventRuleTargetIdDuplicate",
"ErrorMessage":"The id of event target is duplicate! ",
"EntryId":"target5"
}
]
}