Skip to content

list_resource_policies

list_resource_policies(
    resource_arn: String,
    *,
    config_overrides: Optional[MPAClientConfig] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[Token] = None,
) -> ListResourcePoliciesResponse

Returns a list of policies for a resource.

Parameters:

  • resource_arn (String) –

    Amazon Resource Name (ARN) for the resource.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of items to return in the response. If more results exist than the specified MaxResults value, a token is included in the response so that you can retrieve the remaining results.

  • next_token (Optional[Token], default: None ) –

    If present, indicates that more output is available than is included in the current response. Use this value in the NextToken request parameter in a next call to the operation to get more output. You can repeat this until the NextToken response element returns null.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action. Check your permissions, and try again.

  • InternalServerException –

    The service encountered an internal error. Try your request again. If the problem persists, contact Amazon Web Services Support.

  • ResourceNotFoundException –

    The specified resource doesn't exist. Check the resource ID, and try again.

  • ThrottlingException –

    The request was denied due to request throttling.

  • ValidationException –

    The input fails to satisfy the constraints specified by an Amazon Web Services service.

  • UnknownServiceError –

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

Source code in docs_src/capo_mpa/_services/mpa.py
def list_resource_policies(
    self,
    resource_arn: "capo_mpa.types.string.String",
    *,
    config_overrides: Optional[MPAClientConfig] = None,
    max_results: Optional["capo_mpa.types.max_results.MaxResults"] = None,
    next_token: Optional["capo_mpa.types.token.Token"] = None,
) -> "capo_mpa.types.list_resource_policies_response.ListResourcePoliciesResponse":
    """<p>Returns a list of policies for a resource.</p>

    Args:
        resource_arn: <p>Amazon Resource Name (ARN) for the resource.</p>
        max_results: <p>The maximum number of items to return in the response. If more results exist than the specified <code>MaxResults</code> value, a token is included in the response so that you can retrieve the remaining results.</p>
        next_token: <p>If present, indicates that more output is available than is included in the current response. Use this value in the <code>NextToken</code> request parameter in a next call to the operation to get more output. You can repeat this until the <code>NextToken</code> response element returns <code>null</code>.</p>

    Raises:
        capo_mpa.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action. Check your permissions, and try again.</p>
        capo_mpa.errors.internal_server_exception.InternalServerException: <p>The service encountered an internal error. Try your request again. If the problem persists, contact Amazon Web Services Support.</p>
        capo_mpa.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource doesn't exist. Check the resource ID, and try again.</p>
        capo_mpa.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_mpa.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_mpa.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_mpa._operations.aws_fluffy_core_service.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_mpa.types.list_resource_policies_request.ListResourcePoliciesRequest = {
        "resource_arn": resource_arn
    }
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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