From 120874e408515f5bdf91d5915f9c813c96183ad4 Mon Sep 17 00:00:00 2001 From: Chris K Date: Fri, 5 Apr 2019 11:00:02 +0100 Subject: [PATCH] Feature: AWS Secrets Manager list-secrets --- moto/secretsmanager/models.py | 4 ++++ moto/secretsmanager/responses.py | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/moto/secretsmanager/models.py b/moto/secretsmanager/models.py index 1350ab469..0d276c944 100644 --- a/moto/secretsmanager/models.py +++ b/moto/secretsmanager/models.py @@ -188,6 +188,10 @@ class SecretsManagerBackend(BaseBackend): return response + def list_secrets(self, max_results, next_token): + # implement here + return secret_list, next_token + available_regions = ( boto3.session.Session().get_available_regions("secretsmanager") diff --git a/moto/secretsmanager/responses.py b/moto/secretsmanager/responses.py index 932e7bfd7..73921a11a 100644 --- a/moto/secretsmanager/responses.py +++ b/moto/secretsmanager/responses.py @@ -64,3 +64,13 @@ class SecretsManagerResponse(BaseResponse): rotation_lambda_arn=rotation_lambda_arn, rotation_rules=rotation_rules ) + + def list_secrets(self): + max_results = self._get_int_param("MaxResults") + next_token = self._get_param("NextToken") + secret_list, next_token = self.secretsmanager_backend.list_secrets( + max_results=max_results, + next_token=next_token, + ) + # TODO: adjust response + return json.dumps(dict(secretList=secret_list, nextToken=next_token))