Querying the Secret List
Function
This API is used to query all secrets created by the current user in the current project.
Constraints
The information returned by this API is secret metadata, which does not contain secret values.
Calling Method
For details, see Calling APIs.
URI
GET /v1/{project_id}/secrets
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
limit |
No |
String |
Specifies the number of records on each page. Default value: 50 |
marker |
No |
String |
Start secret name of pagination query. If this parameter is left blank, only the first page is queried. |
event_name |
No |
String |
When an event name is specified, only the secrets associated with the event are returned. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is a token. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
secrets |
Array of Secret objects |
Secret details list |
page_info |
PageInfo object |
Pagination information. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Resource identifier of a secret |
name |
String |
Secret name |
state |
String |
Secret status. Its value can be: ENABLED DISABLED PENDING_DELETE FROZEN |
kms_key_id |
String |
ID of the KMS CMK used to encrypt a secret value. |
description |
String |
Description of a secret |
create_time |
Long |
Secret creation time. The value is a timestamp, that is, the total number of seconds on January 1, 1970 to the current time. |
update_time |
Long |
Time when a secret was last updated. The value is a timestamp, that is, the total number of seconds on January 1, 1970 to the current time. |
scheduled_delete_time |
Long |
Time when a secret is scheduled to be deleted. The value is a timestamp, that is, the total number of seconds on January 1, 1970 to the current time. If the secret is not in the deletion plan, the value of this parameter is null. |
secret_type |
String |
Secret type
|
auto_rotation |
Boolean |
Automatic rotation The value can be true (enabled) or false (disabled). The default value is false. |
rotation_period |
String |
Rotation period Constraints: 6 hours - 8,760 hours (365 days) Type: Integer[unit]. Integer indicates the time length. unit indicates the time unit, which can be d (day), h (hour), m (minute), or s (second). For example, 1d indicates one day, and 24h also indicates one day. Note: This parameter is mandatory when automatic rotation is enabled. |
rotation_config |
String |
Rotation configuration Constraints: The value can contain a maximum of 1,024 characters. If secret_type is set to RDS-FG or GaussDB-FG, set this parameter to {"InstanceId":"","SecretSubType":""}. Note: This parameter is mandatory when secret_type is set to RDS-FG or GaussDB-FG. InstanceId indicates the instance ID, and SecretSubType indicates the rotation subtype. The value can be SingleUser or MultiUser. SingleUser: Single-user rotation is used. A new password is created for the account for each rotation. MultiUser: Dual-user rotation is used. The users are labeled as SYSCURRENT and SYSPREVIOUS, respectively. During secret rotation, the password of the account who is labeled as SYSPREVIOUS is reset, and a random password is generated. Then, the labels are switched for the users. |
rotation_time |
Long |
Rotation timestamp |
next_rotation_time |
Long |
Next rotation timestamp |
event_subscriptions |
Array of strings |
List of events subscribed to by secrets. Currently, only one event can be subscribed to. When a basic event contained in an event is triggered, a notification message is sent to the notification topic corresponding to the event. |
enterprise_project_id |
String |
Enterprise project ID |
rotation_func_urn |
String |
URN of the FunctionGraph function |
Parameter |
Type |
Description |
---|---|---|
next_marker |
String |
Query address of the next page (name of the secret at the end of the current page, name of the secret at the start of the next page). |
previous_marker |
String |
Name of the start secret on the current page and name of the end secret on the previous page. |
current_count |
Integer |
Number of records returned on this page. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error codes |
error_msg |
String |
Error description |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error codes |
error_msg |
String |
Error description |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error codes |
error_msg |
String |
Error description |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error codes |
error_msg |
String |
Error description |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error codes |
error_msg |
String |
Error description |
Status code: 502
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error codes |
error_msg |
String |
Error description |
Status code: 504
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error codes |
error_msg |
String |
Error description |
Example Requests
None
Example Responses
Status code: 200
Request succeeded.
{ "secrets" : [ { "id" : "bb6a3d22-dc93-47ac-b5bd-88df7ad35f1e", "name" : "secret-name-test", "state" : "ENABLED", "kms_key_id" : "b168fe00ff56492495a7d22974df2d0b", "description" : "description", "create_time" : 1581507580000, "update_time" : 1581507580000, "scheduled_delete_time" : 1581507580000, "secret_type" : "RDS-FG", "auto_rotation" : true, "rotation_config" : "{'InstanceId':'indstance id','SecretSubType':'MultiUser'}", "rotation_period" : "1d", "rotation_time" : 1668567940000, "next_rotation_time" : 1668629140000, "event_subscriptions" : [ "pocEvent" ] } ], "page_info" : { "next_marker" : "secret-name-test", "previous_marker" : "secret-name-test", "current_count" : 1 } }
Status Codes
Status Code |
Description |
---|---|
200 |
Request succeeded. |
400 |
Invalid request parameter. |
401 |
A username and password are required. |
403 |
Authentication failed. |
404 |
The requested resource does not exist or is not found. |
500 |
Internal service error. |
502 |
The request failed to be fulfilled because the server received an invalid response from the upstream server. |
504 |
Gateway timed out. |
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.