ListSecrets

Last updated: 2021-10-08 15:34:41

1. API Description

Domain name for API request: ssm.tencentcloudapi.com.

This API is used to obtain the detailed information list of all Secrets. You can specify the filter fields and sorting order as needed.

A maximum of 30 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common parameter. The value used for this API: ListSecrets.
Version Yes String Common parameter. The value used for this API: 2019-09-23.
Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
Offset No Integer Starting position of the list, starting at 0. If not specified, 0 is used by default.
Limit No Integer Maximum number of returned Secrets in a query. If not set or set to 0, 20 is used by default.
OrderType No Integer Sorting order according to the creation time. If not set or set to 0, descending order is used; if set to 1, ascending order is used.
State No Integer Filter based on credential status.
The default value is 0, indicating to query all.
1: query the list of credentials in Enabled status.
2: query the list of credentials in Disabled status.
3: query the list of credentials in PendingDelete status.
4: query the list of credentials in PendingCreate status.
5: query the list of credentials in CreateFailed status.
The PendingCreate and CreateFailed status only take effect when SecretType is Tencent Cloud service credential
SearchSecretName No String Filter according to Secret names. If left empty, this filter is not applied.
TagFilters.N No Array of TagFilter Tag filter.
SecretType No Integer 0 (default): user-defined secret.
1: Tencent Cloud services secret.
2: SSH key secret.
ProductName No String This parameter is valid only when SecretType is 1.

An empty value indicates querying all types of Tencent Cloud service secrets.
Mysql: queries MySQL database credentials.
Tdsql-mysql: queries TDSQL MySQL database credentials.

3. Output Parameters

Parameter Name Type Description
TotalCount Integer Number of filtered Secrets according to State and SearchSecretName.
SecretMetadatas Array of SecretMetadata List of Secret information.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Obtaining the list of secret details

Input Example

https://ssm.tencentcloudapi.com/?Action=ListSecrets
&Limit=2
&SecretType=0
&<Common request parameters>

Output Example

{
  "Response": {
    "TotalCount": 1,
    "SecretMetadatas": [
      {
        "Status": "xx",
        "Description": "xx",
        "AssociatedInstanceIDs": [
          "xx"
        ],
        "CreateUin": 1,
        "ProjectID": 0,
        "ProductName": "xx",
        "RotationStatus": 0,
        "SecretType": 0,
        "KmsKeyId": "xx",
        "KmsKeyType": "xx",
        "SecretName": "xx",
        "ResourceName": "xx",
        "DeleteTime": 1,
        "CreateTime": 1,
        "NextRotationTime": 1
      },
      {
        "Status": "xx",
        "Description": "xx",
        "AssociatedInstanceIDs": [
          "xx"
        ],
        "CreateUin": 1,
        "SecretName": "xx",
        "KmsKeyType": "xx",
        "ProductName": "xx",
        "SecretType": 0,
        "KmsKeyId": "xx",
        "RotationStatus": 0,
        "ProjectID": 0,
        "ResourceName": "xx",
        "DeleteTime": 1,
        "CreateTime": 1,
        "NextRotationTime": 1
      }
    ],
    "RequestId": "xx"
  }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InternalError An internal error occurred.
InvalidParameterValue The parameter value is invalid.
ResourceUnavailable.NotPurchased The service is not purchased.
UnauthorizedOperation The operation is unauthorized.