Method: Aws::EventBridge::Client#list_rules

Defined in:
lib/aws-sdk-eventbridge/client.rb

#list_rules(params = {}) ⇒ Types::ListRulesResponse

Lists your Amazon EventBridge rules. You can either list all the rules or you can provide a prefix to match to the rule names.

The maximum number of results per page for requests is 100.

ListRules does not list the targets of a rule. To see the targets associated with a rule, use [ListTargetsByRule].

[1]: docs.aws.amazon.com/eventbridge/latest/APIReference/API_ListTargetsByRule.html

Examples:

Request syntax with placeholder values


resp = client.list_rules({
  name_prefix: "RuleName",
  event_bus_name: "EventBusNameOrArn",
  next_token: "NextToken",
  limit: 1,
})

Response structure


resp.rules #=> Array
resp.rules[0].name #=> String
resp.rules[0].arn #=> String
resp.rules[0].event_pattern #=> String
resp.rules[0].state #=> String, one of "ENABLED", "DISABLED", "ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS"
resp.rules[0].description #=> String
resp.rules[0].schedule_expression #=> String
resp.rules[0].role_arn #=> String
resp.rules[0].managed_by #=> String
resp.rules[0].event_bus_name #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :name_prefix (String)

    The prefix matching the rule name.

  • :event_bus_name (String)

    The name or ARN of the event bus to list the rules for. If you omit this, the default event bus is used.

  • :next_token (String)

    The token returned by a previous call, which you can use to retrieve the next set of results.

    The value of nextToken is a unique pagination token for each page. To retrieve the next page of results, make the call again using the returned token. Keep all other arguments unchanged.

    Using an expired pagination token results in an ‘HTTP 400 InvalidToken` error.

  • :limit (Integer)

    The maximum number of results to return.

Returns:

See Also:



2703
2704
2705
2706
# File 'lib/aws-sdk-eventbridge/client.rb', line 2703

def list_rules(params = {}, options = {})
  req = build_request(:list_rules, params)
  req.send_request(options)
end