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.
Parameters:
Raises:
Source code in docs_src/capo_timestream_write/_services/async_timestream_write.py
| async def create_database(
self,
database_name: "capo_timestream_write.types.resource_create_api_name.ResourceCreateAPIName",
*,
config_overrides: Optional[AsyncTimestreamWriteClientConfig] = None,
kms_key_id: Optional[
"capo_timestream_write.types.string_value2048.StringValue2048"
] = None,
tags: Optional["capo_timestream_write.types.tag_list.TagList"] = None,
) -> "capo_timestream_write.types.create_database_response.CreateDatabaseResponse":
"""<p>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 <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk">Amazon Web Services managed keys</a>. <a href="https://docs.aws.amazon.com/timestream/latest/developerguide/ts-limits.html">Service quotas apply</a>. For details, see <a href="https://docs.aws.amazon.com/timestream/latest/developerguide/code-samples.create-db.html">code sample</a>. </p>
Args:
database_name: <p>The name of the Timestream database.</p>
kms_key_id: <p>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 <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk">Amazon Web Services managed keys</a>.</p>
tags: <p> A list of key-value pairs to label the table. </p>
Raises:
capo_timestream_write.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to perform this action.</p>
capo_timestream_write.errors.conflict_exception.ConflictException: <p>Timestream was unable to process this request because it contains resource that already exists.</p>
capo_timestream_write.errors.internal_server_exception.InternalServerException: <p> Timestream was unable to fully process this request because of an internal server error.</p>
capo_timestream_write.errors.invalid_endpoint_exception.InvalidEndpointException: <p>The requested endpoint was not valid.</p>
capo_timestream_write.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p> The instance quota of resource exceeded for this account.</p>
capo_timestream_write.errors.throttling_exception.ThrottlingException: <p> Too many requests were made by a user and they exceeded the service quotas. The request was throttled.</p>
capo_timestream_write.errors.validation_exception.ValidationException: <p> An invalid or malformed request.</p>
capo_timestream_write.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_timestream_write.types.create_database_request.CreateDatabaseRequest]",
) -> AsyncOperationResponse[
"capo_timestream_write.types.create_database_response.CreateDatabaseResponse"
]:
import capo_timestream_write._operations.timestream_20181101.create_database
(
output,
http_response,
) = await capo_timestream_write._operations.timestream_20181101.create_database.async_create_database(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateDatabase")
)
input_: capo_timestream_write.types.create_database_request.CreateDatabaseRequest = {
"database_name": database_name
}
if kms_key_id is not None:
input_["kms_key_id"] = kms_key_id
if tags is not None:
input_["tags"] = tags
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|