clear-skies-aws 1.10.1__py3-none-any.whl → 1.10.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: clear-skies-aws
3
- Version: 1.10.1
3
+ Version: 1.10.2
4
4
  Summary: clearskies bindings for working in AWS
5
5
  License: MIT
6
6
  Author: Conor Mancone
@@ -59,13 +59,13 @@ clearskies_aws/secrets/additional_configs/iam_db_auth.py,sha256=K6eLjo_D0uSxtCfq
59
59
  clearskies_aws/secrets/additional_configs/iam_db_auth_with_ssm.py,sha256=hzvR_WBwSoLcMdGXwhqkvKMKmjXzhZgimPWfm2MWSZQ,3467
60
60
  clearskies_aws/secrets/additional_configs/mysql_connection_dynamic_producer_via_ssh_cert_bastion.py,sha256=L2-E8Tm6BDHV-yJJ_M_Lo72jNY7uBaTp8SPrRuekcUE,3776
61
61
  clearskies_aws/secrets/additional_configs/mysql_connection_dynamic_producer_via_ssm_bastion.py,sha256=Llvg8uQW8J-qndAlDDtg9TY_Tvu2h9tUzchxxUtaRik,6444
62
- clearskies_aws/secrets/akeyless_with_ssm_cache.py,sha256=4_ep7P2SXei3hNbLrMhUSmr14GTzK69hkzjIYYU-dA4,1443
62
+ clearskies_aws/secrets/akeyless_with_ssm_cache.py,sha256=MFAnajwO_XtZWMZHxsHFZBZa8V9vQGH0NSK4I6uVaow,1559
63
63
  clearskies_aws/secrets/parameter_store.py,sha256=lxBlp_9d2-vVjGNfl5859XzZCcLVMMrZtlJG8lKGVPA,1810
64
64
  clearskies_aws/secrets/parameter_store_test.py,sha256=35fTNau4tq_D4elMwyyByIiLesnmn05QhC_X1FVQXsM,763
65
65
  clearskies_aws/secrets/secrets_manager.py,sha256=jlpfAFC23EeSpm50L8B-yrXg4IROQq-M_90zzXDp_ak,3056
66
66
  clearskies_aws/secrets/secrets_manager_test.py,sha256=__YSe-YRbbE1S1SBvZZFQd3brIX5DPX2_wE9MI_Ezx0,788
67
67
  clearskies_aws/web_socket_connection_model.py,sha256=d_Au_Pu7YXBfc7_lbuI7zz4MZ8ZOOwGM0oooppEofcI,1776
68
- clear_skies_aws-1.10.1.dist-info/LICENSE,sha256=3Ehd0g3YOpCj8sqj0Xjq5qbOtjjgk9qzhhD9YjRQgOA,1053
69
- clear_skies_aws-1.10.1.dist-info/METADATA,sha256=f3IkhGylUcnIZSITx8j56rD5LJWTEks69c5FTZjGqfI,8784
70
- clear_skies_aws-1.10.1.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
71
- clear_skies_aws-1.10.1.dist-info/RECORD,,
68
+ clear_skies_aws-1.10.2.dist-info/LICENSE,sha256=3Ehd0g3YOpCj8sqj0Xjq5qbOtjjgk9qzhhD9YjRQgOA,1053
69
+ clear_skies_aws-1.10.2.dist-info/METADATA,sha256=jgygnKXGfTw4rejQAglNblRFraGfcX0VeRcwG7NYGyk,8784
70
+ clear_skies_aws-1.10.2.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
71
+ clear_skies_aws-1.10.2.dist-info/RECORD,,
@@ -1,16 +1,24 @@
1
+ import re
2
+
1
3
  from clearskies.secrets import AKeyless
4
+
5
+
2
6
  class AkeylessWithSsmCache(AKeyless):
3
7
  _boto3 = None
8
+
4
9
  def __init__(self, requests, environment, boto3):
5
10
  super().__init__(requests, environment)
6
11
  self._boto3 = boto3
7
- if not self._environment.get('AWS_REGION', True):
8
- raise ValueError("To use parameter store you must use set the 'AWS_REGION' environment variable")
12
+ if not self._environment.get("AWS_REGION", True):
13
+ raise ValueError(
14
+ "To use parameter store you must use set the 'AWS_REGION' environment variable"
15
+ )
9
16
 
10
17
  def get(self, path, refresh=False):
11
- ssm = self._boto3.client('ssm', region_name='us-east-1')
12
- # we have spaces in our akeyless names but parameter store doesn't allow that
13
- ssm_name = path.replace(' ', '-')
18
+ ssm = self._boto3.client("ssm", region_name="us-east-1")
19
+ # AWS SSM parameter paths only allow a-z, A-Z, 0-9, -, _, ., /, @, and :
20
+ # Replace any disallowed characters with hyphens
21
+ ssm_name = re.sub(r"[^a-zA-Z0-9\-_\./@:]", "-", path)
14
22
  # if we're not forcing a refresh, then see if it is in paramater store
15
23
  if not refresh:
16
24
  missing = False
@@ -19,7 +27,7 @@ class AkeylessWithSsmCache(AKeyless):
19
27
  except ssm.exceptions.ParameterNotFound:
20
28
  missing = True
21
29
  if not missing:
22
- value = response['Parameter']['Value']
30
+ value = response["Parameter"]["Value"]
23
31
  if value:
24
32
  return value
25
33
 
@@ -31,7 +39,7 @@ class AkeylessWithSsmCache(AKeyless):
31
39
  ssm.put_parameter(
32
40
  Name=ssm_name,
33
41
  Value=value,
34
- Type='SecureString',
42
+ Type="SecureString",
35
43
  Overwrite=True,
36
44
  )
37
45