All Products
Search
Document Center

EventBridge:ListRules

Last Updated:Dec 04, 2024

Queries all rules of an event bus.

Operation description

You can call this API operation to query all rules of an event bus.

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:ListRulesget
*Rule
acs:eventbridge:{#regionId}:{#accountId}:eventbus/{#EventBusName}/rule/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RuleNamePrefixstringNo

The prefix of the rule name.

test
LimitintegerNo

The maximum number of entries to be returned in a single call. You can use this parameter and the NextToken parameter to implement paging. A maximum of 100 entries can be returned in a single call.

50
NextTokenstringNo

If you set the Limit parameter and excess return values exist, this parameter is returned.

1000
EventBusNamestringYes

The name of the event bus.

default

Response parameters

ParameterTypeDescriptionExample
object
Messagestring

The error message that is returned if the request failed.

Specified parameter Limit is not valid.
RequestIdstring

The request ID.

C7043799-F4DA-5290-9249-97C359876D97
Dataobject

The data returned.

NextTokenstring

If excess return values exist, this parameter is returned.

1000
Totalinteger

The total number of entries.

6
Rulesarray<object>

The rules.

Rulesobject
DetailMapobject

The details of the event rule.

Statusstring

The status of the event rule. Valid values: ENABLE: The event rule is enabled. It is the default state of the event rule. DISABLE: The event rule is disabled.

ENABLE
EventBusNamestring

The name of the event bus.

demo
RuleARNstring

The Alibaba Cloud Resource Name (ARN) of the rule.

acs:eventbridge:cn-hangzhou:123456789098****:eventbus/default/rule/myRule3
Descriptionstring

The rule description.

demo
Targetsarray<object>

The event targets.

Targetsobject
Typestring

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

acs.mns.queue
Endpointstring

The endpoint of the event target.

acs:mns:cn-hangzhou:123456789098****:queues/myqueue
Idstring

The ID of the custom event target.

177
PushSelectorstring

The transformer that is used to push events.

MATCHED_EVENT
FilterPatternstring

The event pattern, in JSON format. Valid values: stringEqual pattern stringExpression pattern Each field can have a maximum of five expressions in the map data structure.

Each field can have a maximum of five expressions in the map data structure.

{\"source\":[\"acs.oss\"],\"type\":[\"oss:BucketQueried:GetBucketStat\"]}
CreatedTimestamplong

The creation timestamp.

1607071602000
RuleNamestring

The name of the event rule.

tf-testacc-rule
Codestring

The error code. The value Success indicates that the request is successful.

Success
Successboolean

Indicates whether the request was successful. Valid values: true and false.

true

Examples

Sample success responses

JSONformat

{
  "Message": "Specified parameter Limit is not valid.",
  "RequestId": "C7043799-F4DA-5290-9249-97C359876D97",
  "Data": {
    "NextToken": "1000",
    "Total": 6,
    "Rules": [
      {
        "DetailMap": {
          "test": "test",
          "test2": 1
        },
        "Status": "ENABLE",
        "EventBusName": "demo",
        "RuleARN": "acs:eventbridge:cn-hangzhou:123456789098****:eventbus/default/rule/myRule3",
        "Description": "demo",
        "Targets": [
          {
            "Type": "acs.mns.queue\n",
            "Endpoint": "acs:mns:cn-hangzhou:123456789098****:queues/myqueue",
            "Id": "177",
            "PushSelector": "MATCHED_EVENT",
            "ErrorsTolerance": "ALL"
          }
        ],
        "FilterPattern": "{\\\"source\\\":[\\\"acs.oss\\\"],\\\"type\\\":[\\\"oss:BucketQueried:GetBucketStat\\\"]}\n",
        "CreatedTimestamp": 1607071602000,
        "RuleName": "tf-testacc-rule"
      }
    ]
  },
  "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
2023-07-04The Error code has changed. The response structure of the API has changedView Change Details