cancelRotateSecret method
Disables automatic scheduled rotation and cancels the rotation of a secret if currently in progress.
To re-enable scheduled rotation, call RotateSecret with
AutomaticallyRotateAfterDays
set to a value greater than 0.
This immediately rotates your secret and then enables the automatic
schedule.
To successfully start a rotation, the staging label
AWSPENDING
must be in one of the following states:
- Not attached to any version at all
-
Attached to the same version as the staging label
AWSCURRENT
AWSPENDING
attached to a different
version than the version with AWSCURRENT
then the attempt to
rotate fails.
Minimum permissions
To run this command, you must have the following permissions:
- secretsmanager:CancelRotateSecret
- To configure rotation for a secret or to manually trigger a rotation, use RotateSecret.
- To get the rotation configuration details for a secret, use DescribeSecret.
- To list all of the currently available secrets, use ListSecrets.
- To list all of the versions currently associated with a secret, use ListSecretVersionIds.
May throw ResourceNotFoundException. May throw InvalidParameterException. May throw InternalServiceError. May throw InvalidRequestException.
Parameter secretId
:
Specifies the secret to cancel a rotation request. 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<CancelRotateSecretResponse> cancelRotateSecret({
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.CancelRotateSecret'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'SecretId': secretId,
},
);
return CancelRotateSecretResponse.fromJson(jsonResponse.body);
}