Skip to content

list_rule_names_by_target

list_rule_names_by_target(
    target_arn: TargetArn,
    *,
    config_overrides: Optional[EventBridgeClientConfig] = None,
    event_bus_name: Optional[EventBusNameOrArn] = None,
    next_token: Optional[NextToken] = None,
    limit: Optional[LimitMax100] = None,
) -> ListRuleNamesByTargetResponse

Lists the rules for the specified target. You can see which of the rules in Amazon EventBridge can invoke a specific target in your account.

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

Parameters:

  • target_arn (TargetArn) –

    The Amazon Resource Name (ARN) of the target resource.

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

    The name or ARN of the event bus to list 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/event_bridge.py
def list_rule_names_by_target(
    self,
    target_arn: "capo_eventbridge.types.target_arn.TargetArn",
    *,
    config_overrides: Optional[EventBridgeClientConfig] = 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_rule_names_by_target_response.ListRuleNamesByTargetResponse":
    """<p>Lists the rules for the specified target. You can see which of the rules in Amazon EventBridge can invoke a specific target in your account.</p> <p>The maximum number of results per page for requests is 100.</p>

    Args:
        target_arn: <p>The Amazon Resource Name (ARN) of the target resource.</p>
        event_bus_name: <p>The name or ARN of the event bus to list 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.
    """

    def _handler(
        req: "OperationRequest[capo_eventbridge.types.list_rule_names_by_target_request.ListRuleNamesByTargetRequest]",
    ) -> OperationResponse[
        "capo_eventbridge.types.list_rule_names_by_target_response.ListRuleNamesByTargetResponse"
    ]:
        import capo_eventbridge._operations.aws_events.list_rule_names_by_target

        output, http_response = (
            capo_eventbridge._operations.aws_events.list_rule_names_by_target.list_rule_names_by_target(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListRuleNamesByTarget")
    )
    input_: capo_eventbridge.types.list_rule_names_by_target_request.ListRuleNamesByTargetRequest = {
        "target_arn": target_arn
    }
    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 = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output