批量獲取憑證。
介面說明
-
RAM 使用者或 RAM 角色呼叫該 OpenAPI 需要被授予的權限策略詳情,請參見存取控制。
-
如果不指定版本號或版本狀態,則 KMS 預設返回被標記為 ACSCurrent 的版本憑證值。
-
呼叫者同時應具備所有批次憑證的
kms:GetSecretValue權限。 -
如果憑證使用了使用者指定的金鑰來保護憑證值,則需要呼叫者同時具備相應主金鑰的
kms:Decrypt權限。
本文將提供一個範例,取得一個名為secret001憑證的憑證值,返回結果顯示憑證值SecretData為testdata1。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
請求文法
GET HTTP/1.1
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| SecretsList |
array<object> |
否 |
憑證資訊列表(最多同時查詢 20 組不同的憑證資訊) |
|
|
object |
否 |
|||
| SecretName |
string |
是 |
憑證名稱或憑證資源名稱(ARN)。 說明
存取其他阿里雲帳號下的憑證時,必須輸入憑證 ARN。憑證 ARN 的格式為 |
secret001 |
| VersionStage |
string |
否 |
版本狀態。預設值:ACSCurrent。 輸入該參數時返回指定版本狀態的憑證值,不輸入該參數時返回 ACSCurrent 版本狀態的憑證值。 說明
RDS 憑證、PolarDB 憑證、Redis/Tair 憑證、RAM 憑證和 ECS 憑證只能取得 ACSPrevious 和 ACSCurrent 對應版本的憑證值。 |
ACSCurrent |
| VersionId |
string |
否 |
版本號。 |
v1 |
| FetchExtendedConfig |
string |
否 |
是否獲取憑證的擴充配置。取值:
說明
通用憑證不支援擴充配置,設定該參數將被忽略。 枚舉值:
|
true |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
Schema of Response |
||
| RequestId |
string |
請求 ID。 |
8252db58-2036-408c-a3d5-56e656dc2551 |
| SecretValues |
array<object> |
獲取成功憑證列表。 |
|
|
array<object> |
|||
| SecretDataType |
string |
憑證值類型。取值:
|
binary |
| CreateTime |
string |
建立憑證的時間(UTC)。 |
2024-02-21T15:39:26Z |
| VersionId |
string |
憑證的版本號。 |
v1 |
| NextRotationDate |
string |
下一次輪轉的時間(UTC)。 說明
當自動輪轉開啟時,返回該參數。 |
2024-07-06T18:22:03Z |
| SecretData |
string |
憑證值。KMS 將儲存的密文憑證值進行解密後返回該參數。
|
testdata1 |
| RotationInterval |
string |
憑證自動輪轉的週期。 格式為 integer[unit],其中 integer 表示時間長度,unit 表示時間單位。 unit 取值:s(秒)。例如:7 天的輪轉週期為 604800s。 說明
當自動輪轉開啟時,返回該參數。 |
604800s |
| ExtendedConfig |
string |
憑證的擴充配置。 說明
當 FetchExtendedConfig 取值為 true 時,僅 RDS 憑證、PolarDB 憑證、Redis/Tair 憑證、RAM 憑證或 ECS 憑證返回該參數。 |
{\"SecretSubType\":\"SingleUser\", \"DBInstanceId\":\"rm-uf667446pc955****\", \"CustomData\":{} } |
| LastRotationDate |
string |
最近一次輪轉的時間(UTC)。 說明
當憑證發生過輪轉時返回該參數。 |
2023-07-05T08:22:03Z |
| RequestId |
string |
本次呼叫請求的 ID,是由阿里雲為該請求產生的唯一識別碼,可用於排查和定位問題。 |
8252db58-2036-408c-a3d5-56e656dc2551 |
| SecretName |
string |
憑證名稱。 |
secret001 |
| AutomaticRotation |
string |
是否開啟了自動輪轉。取值:
說明
僅 RDS 憑證、PolarDB 憑證、Redis/Tair 憑證、RAM 憑證或 ECS 憑證返回該參數。 |
Enabled |
| SecretType |
string |
憑證類型。取值:
|
Generic |
| VersionStages |
object |
憑證版本的狀態標記。 |
|
| VersionStage |
array |
憑證版本的狀態標記。 |
|
|
string |
憑證版本的狀態標記。 |
{ "VersionStage": [ "ACSCurrent" ] } |
|
| Errors |
array<object> |
獲取失敗憑證錯誤列表。 |
|
|
object |
無。 |
||
| SecretName |
string |
憑證名稱。 |
secret002 |
| HttpStatus |
integer |
返回錯誤頁面時的 HTTP 狀態碼。 |
404 |
| Code |
string |
服務錯誤碼。 |
Forbidden.ResourceNotFound |
| Message |
string |
獲取憑證失敗錯誤資訊。 |
Resource not found. |
樣本
正常返回樣本
JSON格式
{
"RequestId": "8252db58-2036-408c-a3d5-56e656dc2551",
"SecretValues": [
{
"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": "8252db58-2036-408c-a3d5-56e656dc2551",
"SecretName": "secret001",
"AutomaticRotation": "Enabled",
"SecretType": "Generic",
"VersionStages": {
"VersionStage": [
"{ \"VersionStage\": [ \"ACSCurrent\" ] }"
]
}
}
],
"Errors": [
{
"SecretName": "secret002",
"HttpStatus": 404,
"Code": "Forbidden.ResourceNotFound",
"Message": "Resource not found."
}
]
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 403 | Forbidden.DKMSInstanceStateInvalid | The DKMS instance state is invalid. | |
| 403 | Forbidden.DKMSInstanceNotFound | The specified DKMS Instance is not found. | |
| 404 | Forbidden.KeyNotFound | The specified Key is not found. | |
| 404 | Forbidden.ResourceNotFound | Resource not found. |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。