putLogGroupDeletionProtection method

Future<void> putLogGroupDeletionProtection({
  1. required bool deletionProtectionEnabled,
  2. required String logGroupIdentifier,
})

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.

May throw AccessDeniedException. May throw InvalidOperationException. May throw InvalidParameterException. May throw OperationAbortedException. May throw ResourceNotFoundException. May throw ServiceUnavailableException.

Parameter deletionProtectionEnabled : Whether to enable deletion protection.

Type: Boolean

Required: Yes

Parameter 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

Implementation

Future<void> putLogGroupDeletionProtection({
  required bool deletionProtectionEnabled,
  required String logGroupIdentifier,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Logs_20140328.PutLogGroupDeletionProtection'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'deletionProtectionEnabled': deletionProtectionEnabled,
      'logGroupIdentifier': logGroupIdentifier,
    },
  );
}