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.
Parameters:
-
database_name
(ResourceName)
–
The name of the database.
-
kms_key_id
(StringValue2048)
–
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
Raises:
Source code in docs_src/capo_timestream_write/_services/async_timestream_write.py
| async def update_database(
self,
database_name: "capo_timestream_write.types.resource_name.ResourceName",
kms_key_id: "capo_timestream_write.types.string_value2048.StringValue2048",
*,
config_overrides: Optional[AsyncTimestreamWriteClientConfig] = None,
) -> "capo_timestream_write.types.update_database_response.UpdateDatabaseResponse":
"""<p> 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 (<code>KmsKeyId</code>). If there are any concurrent <code>UpdateDatabase</code> requests, first writer wins. </p> <p>See <a href="https://docs.aws.amazon.com/timestream/latest/developerguide/code-samples.update-db.html">code sample</a> for details.</p>
Args:
database_name: <p> The name of the database. </p>
kms_key_id: <p> The identifier of the new KMS key (<code>KmsKeyId</code>) to be used to encrypt the data stored in the database. If the <code>KmsKeyId</code> currently registered with the database is the same as the <code>KmsKeyId</code> in the request, there will not be any update. </p> <p>You can specify the <code>KmsKeyId</code> using any of the following:</p> <ul> <li> <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code> </p> </li> <li> <p>Key ARN: <code>arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code> </p> </li> <li> <p>Alias name: <code>alias/ExampleAlias</code> </p> </li> <li> <p>Alias ARN: <code>arn:aws:kms:us-east-1:111122223333:alias/ExampleAlias</code> </p> </li> </ul>
Raises:
capo_timestream_write.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to perform this action.</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.resource_not_found_exception.ResourceNotFoundException: <p>The operation tried to access a nonexistent resource. The resource might not be specified correctly, or its status might not be ACTIVE.</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.update_database_request.UpdateDatabaseRequest]",
) -> AsyncOperationResponse[
"capo_timestream_write.types.update_database_response.UpdateDatabaseResponse"
]:
import capo_timestream_write._operations.timestream_20181101.update_database
(
output,
http_response,
) = await capo_timestream_write._operations.timestream_20181101.update_database.async_update_database(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("UpdateDatabase")
)
input_: capo_timestream_write.types.update_database_request.UpdateDatabaseRequest = {
"database_name": database_name,
"kms_key_id": kms_key_id,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|