Removes a statement from the permissions policy for a version of an Lambda layer. For more information, see AddLayerVersionPermission.
Parameters:
-
layer_name
(LayerName)
–
The name or Amazon Resource Name (ARN) of the layer.
-
version_number
(LayerVersionNumber)
–
-
statement_id
(StatementId)
–
The identifier that was specified when the statement was added.
-
revision_id
(Optional[String], default:
None
)
–
Only update the policy if the revision ID matches the ID specified. Use this option to avoid modifying a policy that has changed since you last read it.
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.
-
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.
Examples:
To delete layer-version permissions
The following example deletes permission for an account to configure a layer version.
>>> client.remove_layer_version_permission(layer_name='my-layer', statement_id='xaccount', version_number=1)
Source code in docs_src/capo_lambda/_services/_lambda.py
| def remove_layer_version_permission(
self,
layer_name: "capo_lambda.types.layer_name.LayerName",
version_number: "capo_lambda.types.layer_version_number.LayerVersionNumber",
statement_id: "capo_lambda.types.statement_id.StatementId",
*,
config_overrides: Optional[LambdaClientConfig] = None,
revision_id: Optional["capo_lambda.types.string.String"] = None,
) -> None:
"""<p>Removes a statement from the permissions policy for a version of an <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">Lambda layer</a>. For more information, see <a>AddLayerVersionPermission</a>.</p>
Args:
layer_name: <p>The name or Amazon Resource Name (ARN) of the layer.</p>
version_number: <p>The version number.</p>
statement_id: <p>The identifier that was specified when the statement was added.</p>
revision_id: <p>Only update the policy if the revision ID matches the ID specified. Use this option to avoid modifying a policy that has changed since you last read it.</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_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.
Examples:
To delete layer-version permissions
The following example deletes permission for an account to configure a layer version.
>>> client.remove_layer_version_permission(layer_name='my-layer', statement_id='xaccount', version_number=1)
"""
def _handler(
req: "OperationRequest[capo_lambda.types.remove_layer_version_permission_request.RemoveLayerVersionPermissionRequest]",
) -> OperationResponse[None]:
import capo_lambda._operations.aws_gir_api_service.remove_layer_version_permission
output, http_response = (
capo_lambda._operations.aws_gir_api_service.remove_layer_version_permission.remove_layer_version_permission(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("RemoveLayerVersionPermission")
)
input_: capo_lambda.types.remove_layer_version_permission_request.RemoveLayerVersionPermissionRequest = {
"layer_name": layer_name,
"version_number": version_number,
"statement_id": statement_id,
}
if revision_id is not None:
input_["revision_id"] = revision_id
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|