createDatabase method
Creates a new Timestream database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. For more information, see Amazon Web Services managed keys. Service quotas apply. For details, see code sample.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw InvalidEndpointException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter databaseName :
The name of the Timestream database.
Parameter kmsKeyId :
The KMS key for the database. If the KMS key is not specified, the
database will be encrypted with a Timestream managed KMS key located in
your account. For more information, see Amazon
Web Services managed keys.
Parameter tags :
A list of key-value pairs to label the table.
Implementation
Future<CreateDatabaseResponse> createDatabase({
required String databaseName,
String? kmsKeyId,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'Timestream_20181101.CreateDatabase'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'DatabaseName': databaseName,
if (kmsKeyId != null) 'KmsKeyId': kmsKeyId,
if (tags != null) 'Tags': tags,
},
);
return CreateDatabaseResponse.fromJson(jsonResponse.body);
}