Implement secretsmanager.DescribeSecret and tests.
This commit is contained in:
parent
2e5e7e7f5e
commit
cce3a678aa
4 changed files with 98 additions and 0 deletions
|
|
@ -33,6 +33,9 @@ class SecretsManagerBackend(BaseBackend):
|
|||
self.name = kwargs.get('name', '')
|
||||
self.createdate = int(time.time())
|
||||
self.secret_string = ''
|
||||
self.rotation_enabled = False
|
||||
self.rotation_lambda_arn = ''
|
||||
self.auto_rotate_after_days = 1
|
||||
|
||||
def reset(self):
|
||||
region_name = self.region
|
||||
|
|
@ -70,6 +73,34 @@ class SecretsManagerBackend(BaseBackend):
|
|||
|
||||
return response
|
||||
|
||||
def describe_secret(self, secret_id):
|
||||
if self.secret_id == '':
|
||||
raise ResourceNotFoundException
|
||||
|
||||
response = json.dumps({
|
||||
"ARN": secret_arn(self.region, self.secret_id),
|
||||
"Name": self.secret_id,
|
||||
"Description": "",
|
||||
"KmsKeyId": "",
|
||||
"RotationEnabled": self.rotation_enabled,
|
||||
"RotationLambdaARN": self.rotation_lambda_arn,
|
||||
"RotationRules": {
|
||||
"AutomaticallyAfterDays": self.auto_rotate_after_days
|
||||
},
|
||||
"LastRotatedDate": None,
|
||||
"LastChangedDate": None,
|
||||
"LastAccessedDate": None,
|
||||
"DeletedDate": None,
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "",
|
||||
"Value": ""
|
||||
},
|
||||
]
|
||||
})
|
||||
|
||||
return response
|
||||
|
||||
def get_random_password(self, password_length,
|
||||
exclude_characters, exclude_numbers,
|
||||
exclude_punctuation, exclude_uppercase,
|
||||
|
|
|
|||
|
|
@ -44,3 +44,9 @@ class SecretsManagerResponse(BaseResponse):
|
|||
include_space=include_space,
|
||||
require_each_included_type=require_each_included_type
|
||||
)
|
||||
|
||||
def describe_secret(self):
|
||||
secret_id = self._get_param('SecretId')
|
||||
return secretsmanager_backends[self.region].describe_secret(
|
||||
secret_id=secret_id
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue