PutTargets

Updated at:

Creates or updates an event target under a specified rule.

Operation description

Creates or updates an event target under 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

The list of event targets to be added or updated. For more information, see Limits.

array<object>

No

The event target to be added or updated.

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 delivery endpoint URL.

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

PushRetryStrategy

string

No

The push retry policy. Valid values:

  • BACKOFF_RETRY: Backoff retry policy. The system retries three times, and the interval between each retry is a random value between 10 and 20 seconds.

  • EXPONENTIAL_DECAY_RETRY: Exponential decay retry. The system retries 176 times, and the interval between retries increments exponentially up to 512 seconds. The total retry time is one day. The specific intervals are 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 512...512 seconds (167 intervals of 512 seconds in total).

BACKOFFRETRY

DeadLetterQueue

object

No

The dead-letter queue. Unprocessed events or events that exceed the retry limit are written to the dead-letter queue. The supported queue types for the dead-letter queue include ApsaraMQ for RocketMQ, Simple Message Queue (formerly MNS), Message Queue for Apache Kafka, and EventBridge event bus.

Arn

string

No

The ARN of the dead-letter queue. Unprocessed events or events that exceed the maximum number of retries 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

Network

string

No

The network type of the dead-letter queue.

PrivateNetwork

VpcId

string

No

The ID of the VPC where the dead-letter queue resides.

vpc-2z****

VSwitchIds

string

No

The vSwitch ID.

vsw-m5****

SecurityGroupId

string

No

The security group ID.

sg-2vp****

ErrorsTolerance

string

No

The fault tolerance strategy. Valid values:

  • ALL: Allows fault tolerance. Exceptions are tolerated and do not block execution. If the retry strategy is exhausted, messages are delivered to the dead-letter queue or discarded based on the configuration.

  • NONE: Disables fault tolerance. Exceptions are not tolerated. If an exception occurs and the retry strategy is exhausted, execution is blocked.

ALL

ParamList

array<object>

No

The parameters of the event target.

object

No

The parameters of the event target.

ResourceKey

string

No

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

body

Form

string

No

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

TEMPLATE

Value

string

No

The value of the event target parameter.

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

Template

string

No

The parameter template style of the event target.

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

ConcurrentConfig

object

No

The concurrency control configuration.

Concurrency

integer

No

The concurrency.

34

Response elements

Element

Type

Description

Example

object

Message

string

The error message.

The event rule not existed!

RequestId

string

The unique identifier generated by Alibaba Cloud for the request.

6FB52207-7621-5292-BDF2-A17E2E984160

Data

object

The returned result.

ErrorEntriesCount

integer

The number of event targets that failed to be processed. Valid values:

  • 0: All event targets are processed normally.

  • Other integers: The number of event targets that failed to be processed.

0

ErrorEntries

array<object>

The information about the event targets that failed to be processed.

object

The information about the event targets that failed to be processed.

ErrorMessage

string

The detailed error message.

The id of event target is duplicate!

ErrorCode

string

The error code.

EventRuleTargetIdDuplicate

EntryId

string

The ID of the event target that failed to be processed.

Mlm123456JHd2RsRoKw

Code

string

The API return code. Valid values:

  • Success: The operation is successful.

  • Other values: The error code. For more information, see Error codes.

Success

Success

boolean

Indicates whether the operation is successful. A value of true indicates that 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.