Enables or disables deletion protection for the specified log group. When enabled on a log group, deletion protection blocks all deletion operations until it is explicitly disabled.
For information about the parameters that are common to all actions, see Common Parameters.
Parameters:
-
log_group_identifier
(LogGroupIdentifier)
–
The name or ARN of the log group.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 512.
Pattern: [\.\-_/#A-Za-z0-9]+
Required: Yes
-
deletion_protection_enabled
(DeletionProtectionEnabled)
–
Whether to enable deletion protection.
Type: Boolean
Required: Yes
Raises:
Source code in docs_src/capo_cloudwatch_logs/_services/async_cloud_watch_logs.py
| async def put_log_group_deletion_protection(
self,
log_group_identifier: "capo_cloudwatch_logs.types.log_group_identifier.LogGroupIdentifier",
deletion_protection_enabled: "capo_cloudwatch_logs.types.deletion_protection_enabled.DeletionProtectionEnabled",
*,
config_overrides: Optional[AsyncCloudWatchLogsClientConfig] = None,
) -> None:
r"""<p>Enables or disables deletion protection for the specified log group. When enabled on a log group, deletion protection blocks all deletion operations until it is explicitly disabled.</p> <p>For information about the parameters that are common to all actions, see <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/CommonParameters.html">Common Parameters</a>.</p>
Args:
log_group_identifier: <p>The name or ARN of the log group.</p> <p>Type: String</p> <p>Length Constraints: Minimum length of 1. Maximum length of 512.</p> <p>Pattern: <code>[\.\-_/#A-Za-z0-9]+</code> </p> <p>Required: Yes</p>
deletion_protection_enabled: <p>Whether to enable deletion protection.</p> <p>Type: Boolean</p> <p>Required: Yes</p>
Raises:
capo_cloudwatch_logs.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient permissions to perform this action.</p>
capo_cloudwatch_logs.errors.invalid_operation_exception.InvalidOperationException: <p>The operation is not valid on the specified resource.</p>
capo_cloudwatch_logs.errors.invalid_parameter_exception.InvalidParameterException: <p>A parameter is specified incorrectly.</p>
capo_cloudwatch_logs.errors.operation_aborted_exception.OperationAbortedException: <p>Multiple concurrent requests to update the same resource were in conflict.</p>
capo_cloudwatch_logs.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
capo_cloudwatch_logs.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service cannot complete the request.</p>
capo_cloudwatch_logs.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_cloudwatch_logs.types.put_log_group_deletion_protection_request.PutLogGroupDeletionProtectionRequest]",
) -> AsyncOperationResponse[None]:
import capo_cloudwatch_logs._operations.logs_20140328.put_log_group_deletion_protection
(
output,
http_response,
) = await capo_cloudwatch_logs._operations.logs_20140328.put_log_group_deletion_protection.async_put_log_group_deletion_protection(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PutLogGroupDeletionProtection")
)
input_: capo_cloudwatch_logs.types.put_log_group_deletion_protection_request.PutLogGroupDeletionProtectionRequest = {
"log_group_identifier": log_group_identifier,
"deletion_protection_enabled": deletion_protection_enabled,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|