All Products
Search
Document Center

EventBridge:PutTargets

Last Updated:Dec 04, 2024

Creates or updates event targets under a rule.

Operation description

You can call this API operation to create or update event targets under a rule.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
eventbridge:PutTargetsupdate
*Rule
acs:eventbridge:{#regionId}:{#accountId}:eventbus/{#EventBusName}/rule/{#RuleName}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
EventBusNamestringYes

The name of the event bus.

eventTest
RuleNamestringYes

The name of the event rule.

ssr-send-to-vendor-test01
Targetsarray<object>Yes

The event targets to be created or updated. For more information, see Limits.

objectYes
IdstringYes

The ID of the custom event target.

Mlm123456JHd2RsRoKw
TypestringYes

The type of the event target. For more information, see Event target parameters.

acs.fc.function
EndpointstringNo

The endpoint of the event target.

acs:fc:cn-hangzhou:123456789098****:services/guide.LATEST/functions/HelloFC
PushRetryStrategystringNo

The retry policy for pushing the event. 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. The request can be retried up to 176 times. The interval between two consecutive retries exponentially increases to 512 seconds, and the total retry time is one day. The specific retry intervals are 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 512, ..., and 512 seconds. The interval of 512 seconds can be used up to one hundred and sixty-seven times in total.

BACKOFFRETRY
DeadLetterQueueobjectNo

The dead-letter queue. Events that are not processed or whose maximum retries have been exceeded are written to the dead-letter queue. The dead-letter queue feature supports the following queue types: Message Queue for Apache RocketMQ, Message Service, Message Queue for Apache Kafka, and event bus.

ArnstringNo

The Alibaba Cloud Resource Name (ARN) of the dead-letter queue. Events that are not processed or whose maximum retries have been exceeded are written to the dead-letter queue.

acs:mns:cn-hangzhou:123456789098****:/queues/deadletterqueue or acs:mq:cn-hangzhou:123456789098****:/instances/MQ_INST_123456789098****_BX8QbBPL/topic/deadlettertopic or acs:alikafka:cn-hangzhou:123456789098****:instance/alikafka_post-cn-123456/topic/deadlettertopic or acs:eventbridge:cn-hangzhou:123456789098****:eventbus/deadletterbus
ErrorsTolerancestringNo

The fault tolerance policy. Valid values:

  • ALL: ignores the error. Fault tolerance is allowed. If an error occurs, event processing is not blocked. If the message exceeds the number of retries specified by the retry policy, the message is delivered to a dead-letter queue or discarded based on your configurations.

  • NONE: does not ignore the error. Fault tolerance is prohibited. If an error occurs and the message exceeds the number of retries specified by the retry policy, event processing is blocked.

ALL
ParamListarray<object>No

The parameters that are configured for the event target.

objectNo
ResourceKeystringNo

The resource parameter of the event target. For more information,see Event target parameters.

body
FormstringNo

The method that is used to deliver events to the event target. For more information,see Event target parameters.

TEMPLATE
ValuestringNo

The value of the event target parameter.

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

The template based on which events are delivered to the event target.

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

Response parameters

ParameterTypeDescriptionExample
object
Messagestring

The error message that is returned if the request failed.

The event rule not existed!
RequestIdstring

The request ID.

6FB52207-7621-5292-BDF2-A17E2E984160
Dataobject

The returned result.

ErrorEntriesCountinteger

The number of failed event targets. Valid values:

  • 0: All event targets succeeded.
  • An integer other than 0: indicates the number of failed event targets.
0
ErrorEntriesarray<object>

The ID of the failed event target.

ErrorEntriesobject
ErrorMessagestring

The error message returned.

The id of event target is duplicate!
ErrorCodestring

The error code returned.

EventRuleTargetIdDuplicate
EntryIdstring

The ID of the failed event target.

Mlm123456JHd2RsRoKw
Codestring

The response code. Valid values:

  • Success: The call succeeded.
  • Other codes: The call failed. For more information about error codes, see Error codes.
Success
Successboolean

Indicates whether the request was successful. Valid values:

  • true: The request is successful.
  • false: The request failed.
true

Examples

Sample success responses

JSONformat

{
  "Message": "The event rule not existed!",
  "RequestId": "6FB52207-7621-5292-BDF2-A17E2E984160\n",
  "Data": {
    "ErrorEntriesCount": 0,
    "ErrorEntries": [
      {
        "ErrorMessage": "The id of event target is duplicate!",
        "ErrorCode": "EventRuleTargetIdDuplicate",
        "EntryId": "Mlm123456JHd2RsRoKw"
      }
    ]
  },
  "Code": "Success",
  "Success": true
}

Error codes

HTTP status codeError codeError message
403ServiceNotEnableService not enable

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-09-25The Error code has changedView Change Details