list_secrets
¶
list_secrets(
*,
config_overrides: Optional[SecretsManagerClientConfig] = None,
include_planned_deletion: Optional[BooleanType] = None,
max_results: Optional[MaxResultsType] = None,
next_token: Optional[NextTokenType] = None,
filters: Optional[FiltersListType] = None,
sort_order: Optional[SortOrderType] = None,
sort_by: Optional[SortByType] = None,
) -> ListSecretsResponse
Lists the secrets that are stored by Secrets Manager in the Amazon Web Services account, not including secrets that are marked for deletion. To see secrets marked for deletion, use the Secrets Manager console.
All Secrets Manager operations are eventually consistent. ListSecrets might not reflect changes from the last five minutes. You can get more recent information for a specific secret by calling DescribeSecret.
To list the versions of a secret, use ListSecretVersionIds.
To retrieve the values for the secrets, call BatchGetSecretValue or GetSecretValue.
For information about finding secrets in the console, see Find secrets in Secrets Manager.
Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see Logging Secrets Manager events with CloudTrail.
Required permissions: secretsmanager:ListSecrets. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.
Parameters:
-
include_planned_deletion(Optional[BooleanType], default:None) –Specifies whether to include secrets scheduled for deletion. By default, secrets scheduled for deletion aren't included.
-
max_results(Optional[MaxResultsType], default:None) –The number of results to include in the response.
If there are more results available, in the response, Secrets Manager includes
NextToken. To get the next results, callListSecretsagain with the value fromNextToken. -
next_token(Optional[NextTokenType], default:None) –A token that indicates where the output should continue from, if a previous call did not show all results. To get the next results, call
ListSecretsagain with this value. -
filters(Optional[FiltersListType], default:None) –The filters to apply to the list of secrets.
-
sort_order(Optional[SortOrderType], default:None) –Secrets are listed by
CreatedDate. -
sort_by(Optional[SortByType], default:None) –If not specified, secrets are listed by
CreatedDate.
Raises:
-
InternalServiceError–An error occurred on the server side.
-
InvalidNextTokenException–The
NextTokenvalue is invalid. -
InvalidParameterException–The parameter name or value is invalid.
-
InvalidRequestException–A parameter value is not valid for the current state of the resource.
Possible causes:
-
The secret is scheduled for deletion.
-
You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call.
-
The secret is managed by another service, and you must use that service to update it. For more information, see Secrets managed by other Amazon Web Services services.
-
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To list the secrets in your account The following example shows how to list all of the secrets in your account.
Source code in docs_src/capo_secrets_manager/_services/secrets_manager.py
923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 | |