createLegalHold method
Creates a legal hold on a recovery point (backup). A legal hold is a restraint on altering or deleting a backup until an authorized user cancels the legal hold. Any actions to delete or disassociate a recovery point will fail with an error if one or more active legal holds are on the recovery point.
May throw InvalidParameterValueException.
May throw LimitExceededException.
May throw MissingParameterValueException.
May throw ServiceUnavailableException.
Parameter description :
The description of the legal hold.
Parameter title :
The title of the legal hold.
Parameter idempotencyToken :
This is a user-chosen string used to distinguish between otherwise
identical calls. Retrying a successful request with the same idempotency
token results in a success message with no action taken.
Parameter recoveryPointSelection :
The criteria to assign a set of resources, such as resource types or
backup vaults.
Parameter tags :
Optional tags to include. A tag is a key-value pair you can use to manage,
filter, and search for your resources. Allowed characters include UTF-8
letters, numbers, spaces, and the following characters: + - = . _ : /.
Implementation
Future<CreateLegalHoldOutput> createLegalHold({
required String description,
required String title,
String? idempotencyToken,
RecoveryPointSelection? recoveryPointSelection,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'Description': description,
'Title': title,
'IdempotencyToken': idempotencyToken ?? _s.generateIdempotencyToken(),
if (recoveryPointSelection != null)
'RecoveryPointSelection': recoveryPointSelection,
if (tags != null) 'Tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/legal-holds',
exceptionFnMap: _exceptionFns,
);
return CreateLegalHoldOutput.fromJson(response);
}