Skip to content

list_rule_names_by_target async

list_rule_names_by_target(
    target_arn: TargetArn,
    *,
    config_overrides: Optional[AsyncCloudWatchEventsClientConfig] = 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.

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 to retrieve the next set of results.

  • limit (Optional[LimitMax100], default: None ) –

    The maximum number of results to return.

Raises:

Source code in docs_src/capo_cloudwatch_events/_services/async_cloud_watch_events.py
async def list_rule_names_by_target(
    self,
    target_arn: "capo_cloudwatch_events.types.target_arn.TargetArn",
    *,
    config_overrides: Optional[AsyncCloudWatchEventsClientConfig] = None,
    event_bus_name: Optional[
        "capo_cloudwatch_events.types.event_bus_name_or_arn.EventBusNameOrArn"
    ] = None,
    next_token: Optional[
        "capo_cloudwatch_events.types.next_token.NextToken"
    ] = None,
    limit: Optional["capo_cloudwatch_events.types.limit_max100.LimitMax100"] = None,
) -> "capo_cloudwatch_events.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>

    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 to retrieve the next set of results.</p>
        limit: <p>The maximum number of results to return.</p>

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

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudwatch_events.types.list_rule_names_by_target_request.ListRuleNamesByTargetRequest]",
    ) -> AsyncOperationResponse[
        "capo_cloudwatch_events.types.list_rule_names_by_target_response.ListRuleNamesByTargetResponse"
    ]:
        import capo_cloudwatch_events._operations.aws_events.list_rule_names_by_target

        (
            output,
            http_response,
        ) = await capo_cloudwatch_events._operations.aws_events.list_rule_names_by_target.async_list_rule_names_by_target(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListRuleNamesByTarget")
    )
    input_: capo_cloudwatch_events.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 = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output