Queries all secrets created by the current Alibaba Cloud account in the current region.
This operation returns the metadata information about the secrets and does not return encrypted secret values.
In this example, the secrets created by the current account in the current region are returned. The PageNumber
parameter is set to 1
, and the PageSize
parameter is set to 2
, which indicates that two secrets are to be returned on the current page.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ListSecrets | The operation that you want to perform. Set the value to ListSecrets. |
FetchTags | String | No | false | Specifies whether to return the resource tags of the secret. Valid values:
|
PageNumber | Integer | No. | 1 | The number of the page to return. Pages start from page 1. Default value: 1. |
PageSize | Integer | No. | 2 | The number of entries to return on each page. Valid values: 1 to 100. Default value: 10. |
Filters | String | No | [{"Key":"SecretName", "Values":["Val1","Val2"]}] | The secret filter. The filter consists of one or more key-value pairs. You can specify a maximum of 10 key-value pairs. If you use one tag key or tag value to filter resources, up to 4,000 resources can be queried. If you want to query more than 4,000 resources, call the ListResourceTags operation.
The logical relationship between values of the Values field in a key-value pair is OR. Example: |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
PageNumber | Integer | 1 | The page number of the returned page. |
PageSize | Integer | 2 | The number of entries returned per page. |
RequestId | String | 6a6287a0-ff34-4780-a790-fdfca900557f | The ID of the request, which is used to locate and troubleshoot issues. |
TotalCount | Integer | 55 | The number of returned secrets. |
SecretList | Array of Secret | The list of secrets. |
|
Secret | |||
SecretName | String | secret001 | The secret name. |
UpdateTime | String | 2022-07-17T07:59:05Z | The time when the secret was updated. |
SecretType | String | Generic | The type of the secret. Valid values:
|
PlannedDeleteTime | String | 2022-08-17T07:59:05Z | The time when the secret is scheduled to be deleted. |
CreateTime | String | 2022-07-17T07:59:05Z | The time when the secret was created. |
Tags | Array of Tag | The resource tags of the secret. This parameter is not returned if you set the FetchTags parameter to false or do not specify the FetchTags parameter. |
|
Tag | |||
TagValue | String | val1 | The value of the tag. |
TagKey | String | key1 | The key of the tag. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=ListSecrets
&FetchTags=false
&PageNumber=1
&PageSize=2
&Filters=[{"Key":"SecretName", "Values":["Val1","Val2"]}]
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<ListSecretsResponse>
<PageNumber>1</PageNumber>
<PageSize>2</PageSize>
<RequestId>6a6287a0-ff34-4780-a790-fdfca900557f</RequestId>
<TotalCount>55</TotalCount>
<SecretList>
<SecretName>secret001</SecretName>
<UpdateTime>2022-07-17T07:59:05Z</UpdateTime>
<SecretType>Generic</SecretType>
<PlannedDeleteTime>2022-08-17T07:59:05Z</PlannedDeleteTime>
<CreateTime>2022-07-17T07:59:05Z</CreateTime>
<Tags>
<TagValue>val1</TagValue>
<TagKey>key1</TagKey>
</Tags>
</SecretList>
</ListSecretsResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"PageNumber" : 1,
"PageSize" : 2,
"RequestId" : "6a6287a0-ff34-4780-a790-fdfca900557f",
"TotalCount" : 55,
"SecretList" : [ {
"SecretName" : "secret001",
"UpdateTime" : "2022-07-17T07:59:05Z",
"SecretType" : "Generic",
"PlannedDeleteTime" : "2022-08-17T07:59:05Z",
"CreateTime" : "2022-07-17T07:59:05Z",
"Tags" : [ {
"TagValue" : "val1",
"TagKey" : "key1"
} ]
} ]
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidParameter | The specified parameter is not valid. | The error message returned because the specified parameter is invalid. |
404 | InvalidAccessKeyId.NotFound | The Access Key ID provided does not exist in our records. | The error message returned because the specified AccessKey ID does not exist. |
For a list of error codes, see Service error codes.