listKeyRotations method
Returns information about the key materials associated with the specified
KMS key. You can use the optional IncludeKeyMaterial
parameter to control which key materials are included in the response.
You must specify the KMS key in all requests. You can refine the key rotations list by limiting the number of rotations returned.
For detailed information about automatic and on-demand key rotations, see Rotate KMS keys in the Key Management Service Developer Guide.
Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.
Required permissions: kms:ListKeyRotations (key policy)
Related operations:
- EnableKeyRotation
- DeleteImportedKeyMaterial
- DisableKeyRotation
- GetKeyRotationStatus
- ImportKeyMaterial
- RotateKeyOnDemand
May throw InvalidArnException.
May throw InvalidMarkerException.
May throw KMSInternalException.
May throw KMSInvalidStateException.
May throw NotFoundException.
May throw UnsupportedOperationException.
Parameter keyId :
Gets the key rotations for the specified KMS key.
Specify the key ID or key ARN of the KMS key.
For example:
-
Key ID:
1234abcd-12ab-34cd-56ef-1234567890ab -
Key ARN:
arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
Parameter includeKeyMaterial :
Use this optional parameter to control which key materials associated with
this key are listed in the response. The default value of this parameter
is ROTATIONS_ONLY. If you omit this parameter, KMS returns
information on the key materials created by automatic or on-demand key
rotation. When you specify a value of ALL_KEY_MATERIAL, KMS
adds the first key material and any imported key material pending rotation
to the response. This parameter can only be used with KMS keys that
support automatic or on-demand key rotation.
Parameter limit :
Use this parameter to specify the maximum number of items to return. When
this value is present, KMS does not return more than the specified number
of items, but it might return fewer.
This value is optional. If you include a value, it must be between 1 and 1000, inclusive. If you do not include a value, it defaults to 100.
Parameter marker :
Use this parameter in a subsequent request after you receive a response
with truncated results. Set it to the value of NextMarker
from the truncated response you just received.
Implementation
Future<ListKeyRotationsResponse> listKeyRotations({
required String keyId,
IncludeKeyMaterial? includeKeyMaterial,
int? limit,
String? marker,
}) async {
_s.validateNumRange(
'limit',
limit,
1,
1000,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'TrentService.ListKeyRotations'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'KeyId': keyId,
if (includeKeyMaterial != null)
'IncludeKeyMaterial': includeKeyMaterial.value,
if (limit != null) 'Limit': limit,
if (marker != null) 'Marker': marker,
},
);
return ListKeyRotationsResponse.fromJson(jsonResponse.body);
}