Merge pull request #1975 from craiga/master
Add AllowedPattern to SSM describe_parameters response
This commit is contained in:
commit
e020d3222c
3
.gitignore
vendored
3
.gitignore
vendored
@ -15,4 +15,5 @@ python_env
|
|||||||
.ropeproject/
|
.ropeproject/
|
||||||
.pytest_cache/
|
.pytest_cache/
|
||||||
venv/
|
venv/
|
||||||
.vscode/
|
.python-version
|
||||||
|
.vscode/
|
@ -14,10 +14,12 @@ import itertools
|
|||||||
|
|
||||||
|
|
||||||
class Parameter(BaseModel):
|
class Parameter(BaseModel):
|
||||||
def __init__(self, name, value, type, description, keyid, last_modified_date, version):
|
def __init__(self, name, value, type, description, allowed_pattern, keyid,
|
||||||
|
last_modified_date, version):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.type = type
|
self.type = type
|
||||||
self.description = description
|
self.description = description
|
||||||
|
self.allowed_pattern = allowed_pattern
|
||||||
self.keyid = keyid
|
self.keyid = keyid
|
||||||
self.last_modified_date = last_modified_date
|
self.last_modified_date = last_modified_date
|
||||||
self.version = version
|
self.version = version
|
||||||
@ -58,6 +60,10 @@ class Parameter(BaseModel):
|
|||||||
|
|
||||||
if self.keyid:
|
if self.keyid:
|
||||||
r['KeyId'] = self.keyid
|
r['KeyId'] = self.keyid
|
||||||
|
|
||||||
|
if self.allowed_pattern:
|
||||||
|
r['AllowedPattern'] = self.allowed_pattern
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
@ -291,7 +297,8 @@ class SimpleSystemManagerBackend(BaseBackend):
|
|||||||
return self._parameters[name]
|
return self._parameters[name]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def put_parameter(self, name, description, value, type, keyid, overwrite):
|
def put_parameter(self, name, description, value, type, allowed_pattern,
|
||||||
|
keyid, overwrite):
|
||||||
previous_parameter = self._parameters.get(name)
|
previous_parameter = self._parameters.get(name)
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
@ -302,8 +309,8 @@ class SimpleSystemManagerBackend(BaseBackend):
|
|||||||
return
|
return
|
||||||
|
|
||||||
last_modified_date = time.time()
|
last_modified_date = time.time()
|
||||||
self._parameters[name] = Parameter(
|
self._parameters[name] = Parameter(name, value, type, description,
|
||||||
name, value, type, description, keyid, last_modified_date, version)
|
allowed_pattern, keyid, last_modified_date, version)
|
||||||
return version
|
return version
|
||||||
|
|
||||||
def add_tags_to_resource(self, resource_type, resource_id, tags):
|
def add_tags_to_resource(self, resource_type, resource_id, tags):
|
||||||
|
@ -160,11 +160,12 @@ class SimpleSystemManagerResponse(BaseResponse):
|
|||||||
description = self._get_param('Description')
|
description = self._get_param('Description')
|
||||||
value = self._get_param('Value')
|
value = self._get_param('Value')
|
||||||
type_ = self._get_param('Type')
|
type_ = self._get_param('Type')
|
||||||
|
allowed_pattern = self._get_param('AllowedPattern')
|
||||||
keyid = self._get_param('KeyId')
|
keyid = self._get_param('KeyId')
|
||||||
overwrite = self._get_param('Overwrite', False)
|
overwrite = self._get_param('Overwrite', False)
|
||||||
|
|
||||||
result = self.ssm_backend.put_parameter(
|
result = self.ssm_backend.put_parameter(
|
||||||
name, description, value, type_, keyid, overwrite)
|
name, description, value, type_, allowed_pattern, keyid, overwrite)
|
||||||
|
|
||||||
if result is None:
|
if result is None:
|
||||||
error = {
|
error = {
|
||||||
|
@ -319,13 +319,15 @@ def test_describe_parameters():
|
|||||||
Name='test',
|
Name='test',
|
||||||
Description='A test parameter',
|
Description='A test parameter',
|
||||||
Value='value',
|
Value='value',
|
||||||
Type='String')
|
Type='String',
|
||||||
|
AllowedPattern=r'.*')
|
||||||
|
|
||||||
response = client.describe_parameters()
|
response = client.describe_parameters()
|
||||||
|
|
||||||
len(response['Parameters']).should.equal(1)
|
len(response['Parameters']).should.equal(1)
|
||||||
response['Parameters'][0]['Name'].should.equal('test')
|
response['Parameters'][0]['Name'].should.equal('test')
|
||||||
response['Parameters'][0]['Type'].should.equal('String')
|
response['Parameters'][0]['Type'].should.equal('String')
|
||||||
|
response['Parameters'][0]['AllowedPattern'].should.equal(r'.*')
|
||||||
|
|
||||||
|
|
||||||
@mock_ssm
|
@mock_ssm
|
||||||
|
Loading…
Reference in New Issue
Block a user