Skip to content

list_rules async

list_rules(
    *,
    config_overrides: Optional[AsyncEventBridgeClientConfig] = None,
    name_prefix: Optional[RuleName] = None,
    event_bus_name: Optional[EventBusNameOrArn] = None,
    next_token: Optional[NextToken] = None,
    limit: Optional[LimitMax100] = None,
) -> 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.

Parameters:

  • name_prefix (Optional[RuleName], default: None ) –

    The prefix matching the rule name.

  • event_bus_name (Optional[EventBusNameOrArn], default: None ) –

    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 (Optional[NextToken], default: None ) –

    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 (Optional[LimitMax100], default: None ) –

    The maximum number of results to return.

Raises:

Source code in docs_src/capo_eventbridge/_services/async_event_bridge.py
async def list_rules(
    self,
    *,
    config_overrides: Optional[AsyncEventBridgeClientConfig] = None,
    name_prefix: Optional["capo_eventbridge.types.rule_name.RuleName"] = None,
    event_bus_name: Optional[
        "capo_eventbridge.types.event_bus_name_or_arn.EventBusNameOrArn"
    ] = None,
    next_token: Optional["capo_eventbridge.types.next_token.NextToken"] = None,
    limit: Optional["capo_eventbridge.types.limit_max100.LimitMax100"] = None,
) -> "capo_eventbridge.types.list_rules_response.ListRulesResponse":
    """<p>Lists your Amazon EventBridge rules. You can either list all the rules or you can provide a prefix to match to the rule names.</p> <p>The maximum number of results per page for requests is 100.</p> <p>ListRules does not list the targets of a rule. To see the targets associated with a rule, use <a href="https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_ListTargetsByRule.html">ListTargetsByRule</a>.</p>

    Args:
        name_prefix: <p>The prefix matching the rule name.</p>
        event_bus_name: <p>The name or ARN of the event bus to list the rules for. If you omit this, the default event bus is used.</p>
        next_token: <p>The token returned by a previous call, which you can use to retrieve the next set of results.</p> <p>The value of <code>nextToken</code> 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.</p> <p> Using an expired pagination token results in an <code>HTTP 400 InvalidToken</code> error.</p>
        limit: <p>The maximum number of results to return.</p>

    Raises:
        capo_eventbridge.errors.internal_exception.InternalException: <p>This exception occurs due to unexpected causes.</p>
        capo_eventbridge.errors.resource_not_found_exception.ResourceNotFoundException: <p>An entity that you specified does not exist.</p>
        capo_eventbridge.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_eventbridge.types.list_rules_request.ListRulesRequest]",
    ) -> AsyncOperationResponse[
        "capo_eventbridge.types.list_rules_response.ListRulesResponse"
    ]:
        import capo_eventbridge._operations.aws_events.list_rules

        (
            output,
            http_response,
        ) = await capo_eventbridge._operations.aws_events.list_rules.async_list_rules(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListRules")
    )
    input_: capo_eventbridge.types.list_rules_request.ListRulesRequest = {}
    if name_prefix is not None:
        input_["name_prefix"] = name_prefix
    if event_bus_name is not None:
        input_["event_bus_name"] = event_bus_name
    if next_token is not None:
        input_["next_token"] = next_token
    if limit is not None:
        input_["limit"] = limit

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output