Mengambil nilai rahasia dari versi tertentu suatu rahasia.
Deskripsi operasi
-
For information about the required access policy for a RAM user or RAM role to call this API operation, see Resource Access Management.
-
If you do not specify a version number or stage, KMS returns the secret value of the version that is marked as ACSCurrent.
-
If a user-specified key is used to protect the secret value, the caller must have the
kms:Decryptpermission on the corresponding master key.
This topic provides an example of how to obtain the value of a secret named secret001. The response shows that the secret value of SecretData is testdata1.
Coba sekarang
Test
RAM authorization
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| 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 |
| VersionStage |
string |
No |
Label tahap yang menandai versi rahasia. Nilai default adalah ACSCurrent. Jika Anda menentukan parameter ini, nilai rahasia dari versi dengan label tahap yang ditentukan akan dikembalikan. Jika Anda tidak menentukan parameter ini, nilai rahasia dari versi yang ditandai dengan ACSCurrent akan dikembalikan. Catatan
Untuk rahasia RDS, rahasia PolarDB Basis Data Relasional Cloud-Native, rahasia Redis/Tair, rahasia RAM, dan rahasia ECS, Anda hanya dapat memperoleh nilai rahasia dari versi yang ditandai dengan ACSPrevious dan ACSCurrent. |
ACSCurrent |
| VersionId |
string |
No |
Nomor versi. Catatan
Anda tidak dapat menentukan parameter VersionId untuk rahasia RDS, rahasia PolarDB Basis Data Relasional Cloud-Native, rahasia Redis/Tair, rahasia RAM, atau rahasia ECS. Jika Anda menetapkan parameter ini, pengaturan tersebut akan diabaikan. |
v1 |
| FetchExtendedConfig |
boolean |
No |
Apakah akan mengambil konfigurasi tambahan rahasia. Nilai valid:
Catatan
Rahasia generik tidak mendukung konfigurasi tambahan. Jika Anda menetapkan parameter ini untuk rahasia generik, pengaturan tersebut akan diabaikan. |
true |
| DryRun |
string |
No |
Apakah akan mengaktifkan fitur dry run.
Fitur dry run digunakan untuk menguji panggilan API. Fitur ini memverifikasi apakah Anda memiliki izin yang diperlukan pada Sumber daya dan apakah parameter permintaan valid. Jika Anda mengaktifkan fitur dry run, KMS selalu mengembalikan tanggapan kegagalan yang menunjukkan penyebab kegagalan. Penyebab kegagalan yang mungkin adalah sebagai berikut:
|
false |
Untuk informasi selengkapnya tentang parameter permintaan umum, lihat Parameter umum.
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
|||
| SecretDataType |
string |
The type of the secret value. Valid values:
|
binary |
| CreateTime |
string |
The time when the secret was created. |
2024-02-21T15:39:26Z |
| VersionId |
string |
The version number of the secret. |
v1 |
| NextRotationDate |
string |
The time when the secret is next rotated. Catatan
This parameter is returned only if automatic rotation is enabled. |
2024-07-06T18:22:03Z |
| SecretData |
string |
The value of the secret. The value is decrypted from the ciphertext by KMS and returned.
|
testdata1 |
| RotationInterval |
string |
The interval for automatic rotation. Catatan
This parameter is returned only if automatic rotation is enabled. |
604800s |
| ExtendedConfig |
string |
The extended configuration of the secret. Catatan
This parameter is returned for an RDS secret, PolarDB secret, Redis/Tair secret, RAM secret, or ECS secret only when FetchExtendedConfig is set to true. |
{\"SecretSubType\":\"SingleUser\", \"DBInstanceId\":\"rm-uf667446pc955****\", \"CustomData\":{} } |
| LastRotationDate |
string |
The time when the secret was last rotated. Catatan
This parameter is returned only if the secret was rotated. |
2023-07-05T08:22:03Z |
| RequestId |
string |
The ID of the request, which is a unique identifier generated by Alibaba Cloud. You can use this ID to troubleshoot issues. |
6a3e9c36-1150-4881-84d3-eb8672fcafad |
| SecretName |
string |
The name of the secret. |
secret001 |
| AutomaticRotation |
string |
Indicates whether automatic rotation is enabled. Valid values:
Catatan
This parameter is returned only for an RDS secret, PolarDB secret, Redis/Tair secret, RAM secret, or ECS secret. |
Enabled |
| SecretType |
string |
The type of the secret. Valid values:
|
Generic |
| VersionStages |
array |
The stage labels that mark the secret version. |
|
|
string |
The stage label that marks the secret version. |
{ "VersionStage": [ "ACSCurrent" ] } |
Contoh
Respons sukses
JSONformat
{
"SecretDataType": "binary",
"CreateTime": "2024-02-21T15:39:26Z",
"VersionId": "v1",
"NextRotationDate": "2024-07-06T18:22:03Z",
"SecretData": "testdata1",
"RotationInterval": "604800s",
"ExtendedConfig": "{\\\"SecretSubType\\\":\\\"SingleUser\\\", \\\"DBInstanceId\\\":\\\"rm-uf667446pc955****\\\", \\\"CustomData\\\":{} }",
"LastRotationDate": "2023-07-05T08:22:03Z",
"RequestId": "6a3e9c36-1150-4881-84d3-eb8672fcafad",
"SecretName": "secret001",
"AutomaticRotation": "Enabled",
"SecretType": "Generic",
"VersionStages": [
"{ \"VersionStage\": [ \t\"ACSCurrent\" \t] }"
]
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 403 | Forbidden.DKMSInstanceStateInvalid | The DKMS instance state is invalid. | Your dedicated KMS instance is invalid. |
| 403 | Forbidden.DKMSInstanceNotFound | The specified DKMS Instance is not found. | Your dedicated KMS instance is not found. |
| 404 | Forbidden.KeyNotFound | The specified Key is not found. | The error message returned because the specified CMK does not exist. |
| 404 | Forbidden.ResourceNotFound | Resource not found. | The resource is not found. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.