From e698a36aa04a8eead227a60c702014ec6b3834d0 Mon Sep 17 00:00:00 2001 From: NextGenEng <58440325+THOR300@users.noreply.github.com> Date: Wed, 30 Oct 2024 13:50:20 +0000 Subject: [PATCH] Feature/add ssm param util code (#140) * Adding code to instantiate a vespa search adapter from ssm params. * updating to allow param names. * Adding type hints and return types. * Bumping the version. * Removing the get_vespa_search_adapter_from_aws_secrets function and tests. * removing the test_ssm module. --------- Co-authored-by: Mark --- src/cpr_sdk/ssm.py | 8 ++++++++ src/cpr_sdk/version.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 src/cpr_sdk/ssm.py diff --git a/src/cpr_sdk/ssm.py b/src/cpr_sdk/ssm.py new file mode 100644 index 0000000..fa1199e --- /dev/null +++ b/src/cpr_sdk/ssm.py @@ -0,0 +1,8 @@ +import boto3 + + +def get_aws_ssm_param(param_name: str, region_name: str = "eu-west-1") -> str: + """Retrieve a parameter from AWS SSM""" + ssm = boto3.client("ssm", region_name=region_name) + response = ssm.get_parameter(Name=param_name, WithDecryption=True) + return response["Parameter"]["Value"] diff --git a/src/cpr_sdk/version.py b/src/cpr_sdk/version.py index 7c9454d..1105582 100644 --- a/src/cpr_sdk/version.py +++ b/src/cpr_sdk/version.py @@ -1,6 +1,6 @@ _MAJOR = "1" _MINOR = "9" -_PATCH = "1" +_PATCH = "2" _SUFFIX = "" VERSION_SHORT = "{0}.{1}".format(_MAJOR, _MINOR)