Querying a Secret Instance

Function

  • This API is used to query a secret instance. You can query a secret by tag.

Debugging

You can debug this API in API Explorer.

URI

POST /{version_id}/{project_id}/csms/{resource_instances}/action

Table 1 URI parameters

Parameter

Mandatory

Type

Description

resource_instances

Yes

String

Resource instance. Its value is resource_instances.

project_id

Yes

String

Project ID.

version_id

Yes

String

API version

Request Parameters

Table 2 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. The token can be obtained by calling the IAM API. (The token is the value of X-Subject-Token in the response header.)

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

limit

No

String

Number of records in a query. If action is set to count, you do not need to set this parameter. If action is set to filter, the default value of this parameter is 10. The value range is 1 to 1000.

offset

No

String

Index location. The query starts from the next piece of data indexed by this parameter. When data on a page is queried, the value in the response body of the previous page is transferred to this parameter. (If action is to count, you do not need to set this parameter.) If the action value is filter, the default value is 0. The value must be a numeral and cannot be a negative number.

action

No

String

Operation type. It can be:

  • filter: Filter records.

  • count: Count all the records.

tags

No

Array of Tag objects

List of tags, including tag keys and tag values.

  • key indicates the tag key. A secret can have a maximum of 10 keys, and each of them must be unique and cannot be empty. A key cannot have duplicate values. The value of key contains a maximum of 36 characters. A query result contains all the keys in searched tags.

  • value indicates the tag value. Each tag value can contain a maximum of 43 characters. A query result does not contain all the values in searched tags.

matches

No

Array of TagItem objects

Search field.

  • key is an exact match field. Currently, its value can only be resource_name.

  • value is a fuzzy match field. It can contain a maximum of 255 characters. If this parameter is not specified, an empty value will be returned.

sequence

No

String

36-byte serial number of a request message. Example: 919c82d4-8046-4722-9094-35c3c6524cff

Table 4 Tag

Parameter

Mandatory

Type

Description

key

No

String

Key. The value contains a maximum of 36 Unicode characters. The value of key cannot be empty. It cannot contain ASCII characters (0–31), asterisks (*), angle brackets (< and >), backslashes (\), or equal signs (=).

values

No

Array of strings

Tag value set

Table 5 TagItem

Parameter

Mandatory

Type

Description

key

No

String

Key. The value contains a maximum of 36 Unicode characters. The value of key cannot be empty. It cannot contain ASCII characters (0–31), asterisks (*), angle brackets (< and >), backslashes (\), or equal signs (=).

value

No

String

Value. Each value contains a maximum of 43 Unicode characters and can be an empty string. It cannot contain ASCII characters (0–31), asterisks (*), angle brackets (< and >), backslashes (\), and equal signs (=).

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

resources

Array of ActionResources objects

Resource instance list.

total_count

Integer

Total number of resources.

Table 7 ActionResources

Parameter

Type

Description

resource_id

String

Resource ID

resource_detail

Secret object

Secret

resource_name

String

Resource name. This parameter is an empty string by default.

tags

Array of TagItem objects

Tag list. If there is no tag in the list, an empty array is returned.

Table 8 Secret

Parameter

Type

Description

id

String

Secret ID

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 secret values

description

String

Description of a secret

create_time

Long

Secret creation time. The timestamp indicates the total seconds past the start of the epoch date (January 1, 1970).

update_time

Long

Time when a secret was last updated. The timestamp indicates the total seconds past the start of the epoch date (January 1, 1970).

scheduled_delete_time

Long

Time when a secret will be deleted as scheduled. The timestamp indicates the total seconds past the start of the epoch date (January 1, 1970).

If a secret is not in Pending deletion state, the value of this parameter is null.

Table 9 TagItem

Parameter

Type

Description

key

String

Key. The value contains a maximum of 36 Unicode characters. The value of key cannot be empty. It cannot contain ASCII characters (0–31), asterisks (*), angle brackets (< and >), backslashes (\), and equal signs (=).

value

String

Value. Each value contains a maximum of 43 Unicode characters and can be an empty string. It cannot contain ASCII characters (0–31), asterisks (*), angle brackets (< and >), backslashes (\), and equal signs (=).

Status code: 400

Table 10 Response body parameter

Parameter

Type

Description

error

ErrorDetail object

Table 11 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Status code: 401

Table 12 Response body parameter

Parameter

Type

Description

error

ErrorDetail object

Table 13 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Status code: 403

Table 14 Response body parameter

Parameter

Type

Description

error

ErrorDetail object

Table 15 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Status code: 404

Table 16 Response body parameter

Parameter

Type

Description

error

ErrorDetail object

Table 17 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Status code: 500

Table 18 Response body parameter

Parameter

Type

Description

error

ErrorDetail object

Table 19 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Status code: 502

Table 20 Response body parameter

Parameter

Type

Description

error

ErrorDetail object

Table 21 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Status code: 504

Table 22 Response body parameter

Parameter

Type

Description

error

ErrorDetail object

Table 23 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Example Request

None

Example Response

None

Status Code

Status Code

Description

200

The request has succeeded.

400

Invalid request parameters.

401

Username and password are required to access the page requested.

403

Authentication failed.

404

The requested resource does not exist or is not found.

500

Internal service error.

502

Failed to complete the request. The server receives an invalid response from the upstream server.

504

Gateway timed out.

Error Code

For details, see Error Code.