restoreSecret method
Cancels the scheduled deletion of a secret by removing the
DeletedDate
time stamp. This makes the secret accessible to
query once again.
Minimum permissions
To run this command, you must have the following permissions:
- secretsmanager:RestoreSecret
- To delete a secret, use DeleteSecret.
May throw ResourceNotFoundException. May throw InvalidParameterException. May throw InvalidRequestException. May throw InternalServiceError.
Parameter secretId
:
Specifies the secret that you want to restore from a previously scheduled
deletion. You can specify either the Amazon Resource Name (ARN) or the
friendly name of the secret.
If you specify an incomplete ARN without the random suffix, and instead provide the 'friendly name', you must not include the random suffix. If you do include the random suffix added by Secrets Manager, you receive either a ResourceNotFoundException or an AccessDeniedException error, depending on your permissions.
Implementation
Future<RestoreSecretResponse> restoreSecret({
required String secretId,
}) async {
ArgumentError.checkNotNull(secretId, 'secretId');
_s.validateStringLength(
'secretId',
secretId,
1,
2048,
isRequired: true,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'secretsmanager.RestoreSecret'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'SecretId': secretId,
},
);
return RestoreSecretResponse.fromJson(jsonResponse.body);
}