tencent cloud

文档反馈

ListSecrets

最后更新时间:2023-09-18 17:15:27

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 Params. The value used for this API: ListSecrets.
Version Yes String Common Params. The value used for this API: 2019-09-23.
Region No String Common Params. This parameter is not required for this API.
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.
3: Tencent Cloud API 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,
                "TargetUin": 0
            },
            {
                "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,
                "TargetUin": 0
            }
        ],
        "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.