PutTargets

Updated at:
Copy as MD

Create or update event targets for the specified rule.

Operation description

Creates or updates event targets for a specified rule.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

eventbridge:PutTargets

update

*Rule

acs:eventbridge:{#regionId}:{#accountId}:eventbus/{#EventBusName}/rule/{#RuleName}

None None

Request parameters

Parameter

Type

Required

Description

Example

EventBusName

string

Yes

The name of the event bus.

eventTest

RuleName

string

Yes

The name of the event rule.

ssr-send-to-vendor-test01

Targets

array<object>

Yes

A list of event targets to create or update. For more information, see Limits.

array<object>

No

An event target.

Id

string

Yes

The custom ID of the event target.

Mlm123456JHd2RsRoKw

Type

string

Yes

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

acs.fc.function

Endpoint

string

No

The endpoint of the event target.

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

PushRetryStrategy

string

No

The retry strategy for pushing events. Valid values:

  • BACKOFF_RETRY: The event is retried up to three times at random intervals between 10 and 20 seconds.

  • EXPONENTIAL_DECAY_RETRY: The event is retried up to 176 times over 24 hours. The retry interval starts at 1 second, doubles with each attempt (1, 2, 4, ..., 256 seconds), and is capped at 512 seconds for all subsequent retries.

BACKOFFRETRY

DeadLetterQueue

object

No

The dead-letter queue (DLQ) to which events are sent after all retry attempts fail. Supported DLQ types include Message Queue for Apache RocketMQ, Message Service (MNS), Message Queue for Apache Kafka, and EventBridge.

Arn

string

No

The Alibaba Cloud Resource Name (ARN) of the dead-letter queue.

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

Network

string

No

The network type of the dead-letter queue.

VpcId

string

No

The VPC ID.

VSwitchIds

string

No

The VSwitch IDs.

SecurityGroupId

string

No

The security group ID.

ErrorsTolerance

string

No

The fault tolerance policy. Valid values:

  • ALL: Enables fault tolerance. If an error occurs, execution continues. After the retry attempts defined by the retry strategy are exhausted, the event is sent to the configured dead-letter queue or discarded.

  • NONE: Disables fault tolerance. If an error persists after all retry attempts fail, execution is blocked.

ALL

ParamList

array<object>

No

A list of parameters for the event target.

object

No

An event target parameter.

ResourceKey

string

No

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

body

Form

string

No

The format of the parameter value. For more information, see Event target parameters.

TEMPLATE

Value

string

No

The value of the parameter.

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

Template

string

No

The template for the parameter value. This parameter applies only when Form is set to TEMPLATE.

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

ConcurrentConfig

object

No

The concurrency control settings.

Concurrency

integer

No

The maximum number of concurrent executions for the event target.

34

Response elements

Element

Type

Description

Example

object

Message

string

The error message.

The event rule not existed!

RequestId

string

The unique ID that Alibaba Cloud generates for the request.

6FB52207-7621-5292-BDF2-A17E2E984160

Data

object

The returned data.

ErrorEntriesCount

integer

The number of event targets that failed to be processed. A value of 0 indicates that all event targets were processed successfully.

0

ErrorEntries

array<object>

Details about the event targets that failed to be processed.

object

Details about a failed event target.

ErrorMessage

string

The description of the error.

The id of event target is duplicate!

ErrorCode

string

The error code.

EventRuleTargetIdDuplicate

EntryId

string

The ID of the failed event target.

Mlm123456JHd2RsRoKw

Code

string

The response code.

  • Success: The request was successful.

  • Other values indicate an error. For details, see Error codes.

Success

Success

boolean

Returns true if the operation is successful.

true

Examples

Success response

JSON format

{
  "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 code

Error code

Error message

Description

403 ServiceNotEnable Service not enable

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.