updateDatabase method
Modifies the KMS key for an existing database. While updating the
database, you must specify the database name and the identifier of the new
KMS key to be used (KmsKeyId). If there are any concurrent
UpdateDatabase requests, first writer wins.
See code sample for details.
May throw AccessDeniedException.
May throw InternalServerException.
May throw InvalidEndpointException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter databaseName :
The name of the database.
Parameter kmsKeyId :
The identifier of the new KMS key (KmsKeyId) to be used to
encrypt the data stored in the database. If the KmsKeyId
currently registered with the database is the same as the
KmsKeyId in the request, there will not be any update.
You can specify the KmsKeyId using any of the following:
-
Key ID:
1234abcd-12ab-34cd-56ef-1234567890ab -
Key ARN:
arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab -
Alias name:
alias/ExampleAlias -
Alias ARN:
arn:aws:kms:us-east-1:111122223333:alias/ExampleAlias
Implementation
Future<UpdateDatabaseResponse> updateDatabase({
required String databaseName,
required String kmsKeyId,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'Timestream_20181101.UpdateDatabase'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'DatabaseName': databaseName,
'KmsKeyId': kmsKeyId,
},
);
return UpdateDatabaseResponse.fromJson(jsonResponse.body);
}