Menyimpan versi baru nilai rahasia untuk rahasia generik.
Deskripsi operasi
-
For information about the access policy required for a RAM user or RAM role to call this OpenAPI operation, see Resource Access Management.
-
This operation supports only generic secrets. Each generic secret can have a maximum of 10 versions. If the number of versions exceeds the limit, KMS deletes the earliest version.
-
By default, the new secret value is marked with ACSCurrent, and the previous version that was marked with ACSCurrent is marked with ACSPrevious. You can specify the VersionStage parameter to overwrite this default behavior.
-
This operation stores a new version of a secret value. You cannot use it to modify an existing version of a secret value. You must specify a version number when you store a new version. KMS processes requests based on the following rules:
-
If the version number does not exist in the secret, KMS creates a new version and stores the secret value.
-
If the version number already exists in the secret, KMS compares the secret value in the request with the stored value. If the values are the same, the request is ignored and a success message is returned. This makes the operation idempotent. If the values are different, the request is rejected.
-
This topic provides an example of how to store a new version of a secret value for the secret named secret001. The new version number (VersionId) is v3 and the secret value (SecretData) is importantdata.
Coba sekarang
Test
RAM authorization
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| VersionId |
string |
Yes |
Nomor versi rahasia. Nilai harus unik dalam rahasia. |
v3 |
| SecretName |
string |
Yes |
Nama atau Nama Sumber Daya Alibaba Cloud (ARN) rahasia. Catatan
Saat Anda mengakses rahasia di akun Alibaba Cloud lain, Anda harus menentukan ARN rahasia. ARN rahasia dalam format |
secret001 |
| SecretData |
string |
Yes |
Nilai rahasia. Nilai dienkripsi dan disimpan dalam versi baru yang ditentukan. |
importantdata |
| SecretDataType |
string |
No |
Tipe nilai rahasia. Nilai valid:
|
text |
| VersionStages |
string |
No |
Label tahap yang digunakan untuk menandai versi baru. Jika Anda tidak menentukan parameter ini, KMS menandai versi baru dengan ACSCurrent. |
["ACSCurrent","ACSNext"] |
Untuk informasi selengkapnya tentang parameter permintaan umum, lihat Parameter umum.
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
|||
| SecretName |
string |
The name of the secret. |
secret001 |
| VersionId |
string |
The version number of the secret. |
v3 |
| RequestId |
string |
The ID of the request, which is a unique identifier generated by Alibaba Cloud. You can use this ID to troubleshoot issues. |
f94ec9d3-2d10-4922-9a5c-5dcd5ebcb5e8 |
| VersionStages |
object |
||
| VersionStage |
array |
The stage labels of the secret version. |
|
|
string |
The stage label of the secret version. |
{ "VersionStage": [ "ACSCurrent", "ACSNext" ] } |
Contoh
Respons sukses
JSONformat
{
"SecretName": "secret001",
"VersionId": "v3",
"RequestId": "f94ec9d3-2d10-4922-9a5c-5dcd5ebcb5e8",
"VersionStages": {
"VersionStage": [
"{ \"VersionStage\": [ \"ACSCurrent\", \"ACSNext\" ] }"
]
}
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParameter | some of the specified parameters "\" is not valid | |
| 400 | Rejected.LimitExceeded | exceed secret limits error | |
| 500 | InternalFailure | Internal Failure | |
| 403 | Forbidden.NoPermission | This operation is forbidden by permission system | |
| 404 | Forbidden.ResourceNotFound | Resource not found | |
| 409 | Rejected.ResourceExist | The request was rejected becasue key already exsit |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.