Skip to content

get_resource_policy

get_resource_policy(
    resource_arn: PolicyResourceArn,
    *,
    config_overrides: Optional[LambdaClientConfig] = None,
) -> GetResourcePolicyResponse

Retrieves the resource-based policy attached to a Lambda resource.

Parameters:

  • resource_arn (PolicyResourceArn) –

    The Amazon Resource Name (ARN) of the Lambda resource you want to retrieve the policy for. You can use a qualified or an unqualified ARN. The value must be a complete ARN, and the operation does not accept wildcard characters.

Raises:

Source code in docs_src/capo_lambda/_services/_lambda.py
def get_resource_policy(
    self,
    resource_arn: "capo_lambda.types.policy_resource_arn.PolicyResourceArn",
    *,
    config_overrides: Optional[LambdaClientConfig] = None,
) -> "capo_lambda.types.get_resource_policy_response.GetResourcePolicyResponse":
    """<p>Retrieves the <a href="https://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html">resource-based policy</a> attached to a Lambda resource.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the Lambda resource you want to retrieve the policy for. You can use a qualified or an unqualified ARN. The value must be a complete ARN, and the operation does not accept wildcard characters.</p>

    Raises:
        capo_lambda.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One of the parameters in the request is not valid.</p>
        capo_lambda.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request does not exist.</p>
        capo_lambda.errors.service_exception.ServiceException: <p>The Lambda service encountered an internal error.</p>
        capo_lambda.errors.too_many_requests_exception.TooManyRequestsException: <p>The request throughput limit was exceeded. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html#api-requests">Lambda quotas</a>.</p>
        capo_lambda.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_lambda.types.get_resource_policy_request.GetResourcePolicyRequest]",
    ) -> OperationResponse[
        "capo_lambda.types.get_resource_policy_response.GetResourcePolicyResponse"
    ]:
        import capo_lambda._operations.aws_gir_api_service.get_resource_policy

        output, http_response = (
            capo_lambda._operations.aws_gir_api_service.get_resource_policy.get_resource_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetResourcePolicy")
    )
    input_: capo_lambda.types.get_resource_policy_request.GetResourcePolicyRequest = {
        "resource_arn": resource_arn
    }

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