Overview
The feature for scheduled key deletion consists of two APIs, which are distributed as follows:
|
| Add a scheduled deletion task. | The KeyId and PendingWindowInDays parameters are required for this API operation. |
| Cancel a scheduled deletion task. | The KeyId parameter is required for this API operation. |
Note:
When a key is disabled, you can schedule its deletion time using the ScheduleKeyDeletion API. After the specified time is reached, the key is automatically cleaned up.
The examples in this document use the Tencent Cloud command-line tool TCCLI. Subsequently, you can make calls using any supported programming language. Examples
Sample Scheduled Deletion Task
We now perform a deletion operation on the specified CMK that has been disabled, with the deletion scheduled to occur after 7 days.
Inputs
tccli kms ScheduleKeyDeletion --region ap-guangzhou --KeyId 5xxxxx-xxxx-xxxx-xxxx-52xxxxx4 --PendingWindowInDays 7
Output
If the setup is successful, the scheduled deletion ID and timestamp are returned in the response.
{
"KeyId": "6xxxxxxx-xxxx-xxxx-xxxx-5xxxxxxxxc09",
"RequestId": "2bd72d85-f9dd-4465-ae51-beebff54f540",
"DeletionDate": 1572512542
}
Sample Cancel Deletion Scheduled Task
We now cancel the scheduled deletion task for the specified CMK. In the example workflow, the CMK refers to the one created above.
Inputs
tccli kms CancelKeyDeletion --region ap-guangzhou --KeyId 5xxxxx-xxxx-xxxx-xxxx-52xxxxx
Output
If the operation is successful, the response contains the CMK ID for which the scheduled deletion was successfully canceled.
{
"KeyId": "6xxxxxxx-xxxx-xxxx-xxxx-5xxxxxxxxc09",
"RequestId": "c85473c6-e18d-4a09-9eac-03958dd4714d"
}