Skip to content

delete_resource_policy async

delete_resource_policy(
    resource_arn: PolicyResourceArn,
    *,
    config_overrides: Optional[AsyncLambdaClientConfig] = None,
    revision_id: Optional[RevisionId] = None,
) -> None

Deletes a resource-based policy from a Lambda resource.

Parameters:

  • resource_arn (PolicyResourceArn) –

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

  • revision_id (Optional[RevisionId], default: None ) –

    The revision ID that the existing policy must match for the deletion to proceed. If the revision ID doesn't match, the operation fails with a PreconditionFailedException error. To retrieve the current revision ID, use the GetResourcePolicy operation.

Raises:

  • InvalidParameterValueException –

    One of the parameters in the request is not valid.

  • PreconditionFailedException –

    The RevisionId provided does not match the latest RevisionId for the Lambda function or alias.

    • For AddPermission and RemovePermission API operations: Call GetPolicy to retrieve the latest RevisionId for your resource.

    • For all other API operations: Call GetFunction or GetAlias to retrieve the latest RevisionId for your resource.

  • ResourceConflictException –

    The resource already exists, or another operation is in progress.

  • ResourceNotFoundException –

    The resource specified in the request does not exist.

  • ServiceException –

    The Lambda service encountered an internal error.

  • TooManyRequestsException –

    The request throughput limit was exceeded. For more information, see Lambda quotas.

  • UnknownServiceError –

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

Source code in docs_src/capo_lambda/_services/async__lambda.py
async def delete_resource_policy(
    self,
    resource_arn: "capo_lambda.types.policy_resource_arn.PolicyResourceArn",
    *,
    config_overrides: Optional[AsyncLambdaClientConfig] = None,
    revision_id: Optional["capo_lambda.types.revision_id.RevisionId"] = None,
) -> None:
    """<p>Deletes a <a href="https://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html">resource-based policy</a> from a Lambda resource.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the Lambda resource you want to delete the policy from. 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>
        revision_id: <p>The revision ID that the existing policy must match for the deletion to proceed. If the revision ID doesn't match, the operation fails with a <code>PreconditionFailedException</code> error. To retrieve the current revision ID, use the <a>GetResourcePolicy</a> operation.</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.precondition_failed_exception.PreconditionFailedException: <p>The RevisionId provided does not match the latest RevisionId for the Lambda function or alias.</p> <ul> <li> <p> <b>For AddPermission and RemovePermission API operations:</b> Call <code>GetPolicy</code> to retrieve the latest RevisionId for your resource.</p> </li> <li> <p> <b>For all other API operations:</b> Call <code>GetFunction</code> or <code>GetAlias</code> to retrieve the latest RevisionId for your resource.</p> </li> </ul>
        capo_lambda.errors.resource_conflict_exception.ResourceConflictException: <p>The resource already exists, or another operation is in progress.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lambda.types.delete_resource_policy_request.DeleteResourcePolicyRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_lambda._operations.aws_gir_api_service.delete_resource_policy

        (
            output,
            http_response,
        ) = await capo_lambda._operations.aws_gir_api_service.delete_resource_policy.async_delete_resource_policy(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteResourcePolicy")
    )
    input_: capo_lambda.types.delete_resource_policy_request.DeleteResourcePolicyRequest = {
        "resource_arn": resource_arn
    }
    if revision_id is not None:
        input_["revision_id"] = revision_id

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