Skip to content

list_resource_policies

list_resource_policies(
    resource_arn: EventBusArn,
    *,
    config_overrides: Optional[EventBridgeV2ClientConfig] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
) -> ListResourcePoliciesResponse

Lists the resource policies attached to an event bus as summaries (policy name and revision ID). Use GetResourcePolicy to retrieve a policy document.

Raises:

  • AccessDeniedException –

    The caller does not have the permissions required to perform the operation. This error is also returned when the operation cannot use the AWS KMS key for the event bus.

  • InternalException –

    The request failed because of an internal service error. Retry the request.

  • InvalidInputException –

    A request parameter is missing or not valid.

  • ThrottlingException –

    The request was throttled because it exceeds a request rate limit. Retry the request with backoff.

  • ResourceNotFoundException –

    The resource does not exist.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_eventbridgev2/_services/event_bridge_v2.py
def list_resource_policies(
    self,
    resource_arn: "capo_eventbridgev2.types.event_bus_arn.EventBusArn",
    *,
    config_overrides: Optional[EventBridgeV2ClientConfig] = None,
    next_token: Optional["capo_eventbridgev2.types.next_token.NextToken"] = None,
    max_results: Optional["capo_eventbridgev2.types.max_results.MaxResults"] = None,
) -> "capo_eventbridgev2.types.list_resource_policies_response.ListResourcePoliciesResponse":
    """Lists the resource policies attached to an event bus as summaries (policy name and revision ID). Use GetResourcePolicy to retrieve a policy document.

    Raises:
        capo_eventbridgev2.errors.access_denied_exception.AccessDeniedException: The caller does not have the permissions required to perform the operation. This error is also returned when the operation cannot use the AWS KMS key for the event bus.
        capo_eventbridgev2.errors.internal_exception.InternalException: The request failed because of an internal service error. Retry the request.
        capo_eventbridgev2.errors.invalid_input_exception.InvalidInputException: A request parameter is missing or not valid.
        capo_eventbridgev2.errors.throttling_exception.ThrottlingException: The request was throttled because it exceeds a request rate limit. Retry the request with backoff.
        capo_eventbridgev2.errors.resource_not_found_exception.ResourceNotFoundException: The resource does not exist.
        capo_eventbridgev2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_eventbridgev2.types.list_resource_policies_request.ListResourcePoliciesRequest]",
    ) -> OperationResponse[
        "capo_eventbridgev2.types.list_resource_policies_response.ListResourcePoliciesResponse"
    ]:
        import capo_eventbridgev2._operations.aws_events_v2.list_resource_policies

        output, http_response = (
            capo_eventbridgev2._operations.aws_events_v2.list_resource_policies.list_resource_policies(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListResourcePolicies")
    )
    input_: capo_eventbridgev2.types.list_resource_policies_request.ListResourcePoliciesRequest = {
        "resource_arn": resource_arn
    }
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output