Skip to content

get_resource_policy async

get_resource_policy(
    resource_arn: String,
    policy_name: String,
    policy_type: PolicyType,
    *,
    config_overrides: Optional[AsyncMPAClientConfig] = None,
) -> GetResourcePolicyResponse

Returns details about a policy for a resource.

Parameters:

  • resource_arn (String) –

    Amazon Resource Name (ARN) for the resource.

  • policy_name (String) –

    Name of the policy.

  • policy_type (PolicyType) –

    The type of policy.

Raises:

Source code in docs_src/capo_mpa/_services/async_mpa.py
async def get_resource_policy(
    self,
    resource_arn: "capo_mpa.types.string.String",
    policy_name: "capo_mpa.types.string.String",
    policy_type: "capo_mpa.types.policy_type.PolicyType",
    *,
    config_overrides: Optional[AsyncMPAClientConfig] = None,
) -> "capo_mpa.types.get_resource_policy_response.GetResourcePolicyResponse":
    """<p>Returns details about a policy for a resource.</p>

    Args:
        resource_arn: <p>Amazon Resource Name (ARN) for the resource.</p>
        policy_name: <p>Name of the policy.</p>
        policy_type: <p>The type of policy.</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.invalid_parameter_exception.InvalidParameterException: <p>The request contains an invalid parameter value.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_mpa.types.get_resource_policy_request.GetResourcePolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_mpa.types.get_resource_policy_response.GetResourcePolicyResponse"
    ]:
        import capo_mpa._operations.aws_fluffy_core_service.get_resource_policy

        (
            output,
            http_response,
        ) = await capo_mpa._operations.aws_fluffy_core_service.get_resource_policy.async_get_resource_policy(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_mpa.types.get_resource_policy_response.GetResourcePolicyResponse",
    ) -> dict[str, Any]:
        import capo_mpa.types.get_resource_policy_response

        return capo_mpa.types.get_resource_policy_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("GetResourcePolicy", redact_output=_redact_output),
    )
    input_: capo_mpa.types.get_resource_policy_request.GetResourcePolicyRequest = {
        "resource_arn": resource_arn,
        "policy_name": policy_name,
        "policy_type": policy_type,
    }

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