Added support for SSM get_parameters_by_path. (#1299)

* Added support for SSM get_parameters_by_path.

Signed-off-by: Kai Xia <xiaket@gmail.com>

* add logic to handle trailing '/'.

Also, fix pep8.

Signed-off-by: Kai Xia <kai.xia@sportsbet.com.au>

* add tests for parameter value in response.

Signed-off-by: Kai Xia <kai.xia@sportsbet.com.au>
This commit is contained in:
Kai Xia(夏恺) 2017-11-06 20:44:54 +11:00 committed by Terry Cain
commit 3740db8059
3 changed files with 79 additions and 0 deletions

View file

@ -75,6 +75,21 @@ class SimpleSystemManagerBackend(BaseBackend):
result.append(self._parameters[name])
return result
def get_parameters_by_path(self, path, with_decryption, recursive):
"""Implement the get-parameters-by-path-API in the backend."""
result = []
# path could be with or without a trailing /. we handle this
# difference here.
path = path.rstrip('/') + '/'
for param in self._parameters:
if not param.startswith(path):
continue
if '/' in param[len(path) + 1:] and not recursive:
continue
result.append(self._parameters[param])
return result
def get_parameter(self, name, with_decryption):
if name in self._parameters:
return self._parameters[name]