All Products
Search
Document Center

EventBridge:DeleteTargets

Last Updated:Dec 04, 2024

Deletes one or more event targets of an event rule.

Operation description

You can call this API operation to delete one or more event targets of an event 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:DeleteTargetsdelete
*Rule
acs:eventbridge:{#regionId}:{#accountId}:eventbus/{#EventBusName}/rule/{#RuleName}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
EventBusNamestringYes

The name of the event bus.

MyEventBus
RuleNamestringYes

The name of the event rule.

ramrolechange-mns
TargetIdsarrayNo

The IDs of the event targets that you want to delete.

stringNo

The ID of the event target.

  • Note:

You can call the GetRule operation to query the IDs of event targets.

12

Sample request: `POST /openapi/deleteTargets 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****:Jo2PbT*****4azYAYoYslKLvWzg= Content-type: application/json;charset=UTF-8 Content-Length: 26

{ "EventBusName":"default", "RuleName":"myRule", "TargetIds": [ "targetId1", "targetId2" ] }`

Response parameters

ParameterTypeDescriptionExample
object
Messagestring

The returned error message.

EventBusNotExist
RequestIdstring

The request ID.

78FA9EAC-F0C0-58B0-871E-9F9756CE1D29
Dataobject

The returned data.

ErrorEntriesCountinteger

The number of event bodies that failed to be processed. Valid values: 0: No event bodies failed to be processed. An integer other than 0: the number of event bodies that failed to be processed.

0
ErrorEntriesarray<object>

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

ErrorEntriesobject
ErrorMessagestring

The error message.

The id of event target is duplicate!
ErrorCodestring

The error code.

EventRuleTargetIdDuplicate
EntryIdstring

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

target5
Codestring

The response code. The code 200 indicates that the request was successful. Other codes indicate that the request failed. For information about error codes, see Error codes.

200
Successboolean

Indicates whether the operation is successful. Valid values: true and false.

true

Examples

Sample success responses

JSONformat

{
  "Message": "EventBusNotExist",
  "RequestId": "78FA9EAC-F0C0-58B0-871E-9F9756CE1D29",
  "Data": {
    "ErrorEntriesCount": 0,
    "ErrorEntries": [
      {
        "ErrorMessage": "The id of event target is duplicate!",
        "ErrorCode": "EventRuleTargetIdDuplicate",
        "EntryId": "target5"
      }
    ]
  },
  "Code": "200",
  "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-04-09The Error code has changedView Change Details