Querying the Secret Version List
Function
This API is used to query the version list of a specified secret.
Constraints
The information returned by this API is the metadata of secret versions, which does not contain secret values.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
URI
GET /v1/{project_id}/secrets/{secret_name}/versions
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. For details, see Obtaining a Project ID. Constraints N/A Range The value returned by the IAM API is used, which contains 32 characters. Default Value N/A |
| secret_name | Yes | String | Definition Secret name. Constraints N/A Range The value must match the regular expression ^[a-zA-Z0-9_-]{1,64}$. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| marker | No | String | Definition Name of the last secret on each page is used as a pagination tag. If this parameter is left blank, the first page is queried. A maximum of 20 secret versions can be stored. You are not advised to set this parameter. Constraints Parameters marker and limit must be used together. If the number of records returned on the last page is less than the value of limit, the query ends. Range N/A Default Value N/A |
| limit | No | Integer | Definition Number of secret versions returned on each page. A maximum of 20 secret versions can be stored. You are not advised to set this parameter. Constraints By default, 20 secret versions are returned on each page. A maximum of 20 secret versions can be returned. Range N/A Default Value 50 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. It can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token. This parameter is optional if AK/SK authentication is used. Constraints N/A Range Obtain the value by calling the IAM API for obtaining the user token. Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| version_metadatas | Array of VersionMetadata objects | Definition Secret version metadata object Range N/A |
| page_info | PageInfo object | Definition Pagination information. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Secret version ID, which is unique under a secret object. Range N/A |
| create_time | Long | Definition Timestamp when a secret version was created, that is, total number of seconds since January 1, 1970. Range N/A |
| expire_time | Long | Definition Timestamp when a secret version expired, that is, the total seconds since January 1, 1970. This parameter is left blank by default. When version expiration events are subscribed to, the validity period is determined based on this parameter. Range N/A |
| kms_key_id | String | Definition ID of the KMS CMK used to encrypt secret values Range N/A |
| secret_name | String | Definition Secret name Range N/A |
| version_stages | Array of strings | Definition Secret version status list. Each status tag is unique for a secret version. If a status tag in use is added to a new version, the tag will be automatically removed from the original version. If version_stage is not specified, the temporary tag SYSCURRENT will be added to this version. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| next_marker | String | Definition Query address of the next page (secret name at the end of the current page and the start of the next page) Range N/A |
| previous_marker | String | Definition Secret name at the start of the current page and the end of the last page Range N/A |
| current_count | Integer | Definition Number of records returned on this page Range N/A |
Example Requests
None
Example Responses
Status code: 200
Request succeeded.
{
"version_metadatas" : [ {
"id" : "v1",
"kms_key_id" : "b168fe00ff56492495a7d22974df2d0b",
"create_time" : 1581507580000,
"secret_name" : "secret-name-demo",
"version_stages" : [ "SYSCURRENT" ]
} ],
"page_info" : {
"next_marker" : "v10",
"previous_marker" : "v1",
"current_count" : 10
}
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Request succeeded. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot