alertlogic-sdk-python 1.0.72__tar.gz → 1.0.74__tar.gz

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.
Files changed (59) hide show
  1. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/.github/workflows/release_pypi.yml +4 -4
  2. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/PKG-INFO +18 -1
  3. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/alertlogic_sdk_python.egg-info/PKG-INFO +18 -1
  4. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/alertlogic_sdk_python.egg-info/requires.txt +1 -1
  5. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/almdrlib/config.py +17 -12
  6. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/almdrlib/environment.py +35 -11
  7. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/almdrlib/version.py +2 -2
  8. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/tests/test_environment.py +23 -4
  9. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/.github/ISSUE_TEMPLATE.md +0 -0
  10. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/.github/workflows/test_all.yml +0 -0
  11. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/.gitignore +0 -0
  12. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/.readthedocs.yml +0 -0
  13. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/.travis.yml.defunct +0 -0
  14. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/AUTHORS.rst +0 -0
  15. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/LICENSE +0 -0
  16. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/MANIFEST.in +0 -0
  17. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/Makefile +0 -0
  18. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/README.md +0 -0
  19. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/alertlogic_sdk_python.egg-info/SOURCES.txt +0 -0
  20. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/alertlogic_sdk_python.egg-info/dependency_links.txt +0 -0
  21. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/alertlogic_sdk_python.egg-info/not-zip-safe +0 -0
  22. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/alertlogic_sdk_python.egg-info/top_level.txt +0 -0
  23. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/almdrlib/__init__.py +0 -0
  24. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/almdrlib/client.py +0 -0
  25. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/almdrlib/constants.py +0 -0
  26. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/almdrlib/docs/__init__.py +0 -0
  27. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/almdrlib/docs/service.py +0 -0
  28. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/almdrlib/exceptions.py +0 -0
  29. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/almdrlib/region.py +0 -0
  30. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/almdrlib/session.py +0 -0
  31. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/docs/Makefile +0 -0
  32. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/docs/_redoc_templates/AlertLogic_Logo_White.png +0 -0
  33. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/docs/_redoc_templates/content/AlertLogic_Logo_White.png +0 -0
  34. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/docs/_redoc_templates/content/custom.css +0 -0
  35. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/docs/_redoc_templates/page.html.hsb +0 -0
  36. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/docs/_static/AlertLogic_Logo_White.png +0 -0
  37. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/docs/_static/css/custom.css +0 -0
  38. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/docs/_templates/breadcrumbs.html +0 -0
  39. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/docs/_templates/layout.html +0 -0
  40. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/docs/conf.py +0 -0
  41. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/docs/index.rst +0 -0
  42. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/docs/requirements.txt +0 -0
  43. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/docs/site/guides/examples.rst +0 -0
  44. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/docs/site/guides/quickstart.rst +0 -0
  45. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/docs/site/services/index.rst +0 -0
  46. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/package.json +0 -0
  47. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/pyproject.toml +0 -0
  48. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/requirements.txt +0 -0
  49. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/requirements_dev.txt +0 -0
  50. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/setup.cfg +0 -0
  51. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/setup.py +0 -0
  52. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/tests/__init__.py +0 -0
  53. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/tests/apis/testapi/testapi.v1.yaml +0 -0
  54. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/tests/config +0 -0
  55. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/tests/data/test_open_api_support.json +0 -0
  56. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/tests/test_config.py +0 -0
  57. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/tests/test_help.py +0 -0
  58. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/tests/test_open_api_support.py +0 -0
  59. {alertlogic-sdk-python-1.0.72 → alertlogic-sdk-python-1.0.74}/tox.ini +0 -0
@@ -14,9 +14,9 @@ jobs:
14
14
  matrix:
15
15
  python-version: [3.7, 3.8, 3.9]
16
16
  steps:
17
- - uses: actions/checkout@v2
17
+ - uses: actions/checkout@v3
18
18
  - name: Set up Python ${{ matrix.python-version }}
19
- uses: actions/setup-python@v2
19
+ uses: actions/setup-python@v4
20
20
  with:
21
21
  python-version: ${{ matrix.python-version }}
22
22
  - name: Install dependencies
@@ -31,11 +31,11 @@ jobs:
31
31
  needs: test
32
32
  runs-on: ubuntu-latest
33
33
  steps:
34
- - uses: actions/checkout@v2
34
+ - uses: actions/checkout@v3
35
35
  with:
36
36
  fetch-depth: 0
37
37
  - name: Set up Python
38
- uses: actions/setup-python@v2
38
+ uses: actions/setup-python@v4
39
39
  with:
40
40
  python-version: '3.x'
41
41
  - name: Install dependencies
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: alertlogic-sdk-python
3
- Version: 1.0.72
3
+ Version: 1.0.74
4
4
  Summary: Alert Logic Software Development Kit for Python.
5
5
  Home-page: https://github.com/alertlogic/alertlogic-sdk-python
6
6
  Author: Alert Logic Inc.
@@ -151,6 +151,23 @@ export ALERTLOGIC_ENDPOINT="http://api.aesolo.com:3001"
151
151
 
152
152
  ## History
153
153
 
154
+ ### v1.0.74
155
+
156
+ * Wed, 8 Mar 2023 08:54:55 -0600 - Merge pull request #123 from EvanBrown96/fix-service-name-bug-environment-creation
157
+ * Tue, 7 Mar 2023 11:05:42 -0600 - Merge pull request #122 from alertlogic/update_workflow
158
+ * Mon, 6 Mar 2023 13:16:59 -0500 - fix bug where the service name was not being used correctly when querying dynamodb/ssm for credentials
159
+ * Fri, 3 Mar 2023 11:20:19 -0600 - Update workflow to stop using depricated node versions
160
+
161
+ ### v1.0.73
162
+
163
+ * Thu, 2 Mar 2023 09:09:13 -0600 - Merge pull request #121 from EvanBrown96/add-ssm-keys-check-2
164
+ * Tue, 28 Feb 2023 13:58:20 -0500 - use raise from
165
+ * Tue, 28 Feb 2023 13:52:05 -0500 - documentation clarity
166
+ * Tue, 28 Feb 2023 13:50:37 -0500 - re-add both-source functionality
167
+ * Tue, 28 Feb 2023 10:34:25 -0500 - fix a couple bugs and update tests
168
+ * Tue, 28 Feb 2023 10:09:12 -0500 - switch to just one application in AlEnv creation
169
+ * Tue, 28 Feb 2023 09:55:27 -0500 - update to fix bugs/better implementation
170
+
154
171
  ### v1.0.72
155
172
 
156
173
  * Thu, 23 Feb 2023 16:11:36 -0600 - Merge pull request #114 from alertlogic/fix_deprication_warning
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: alertlogic-sdk-python
3
- Version: 1.0.72
3
+ Version: 1.0.74
4
4
  Summary: Alert Logic Software Development Kit for Python.
5
5
  Home-page: https://github.com/alertlogic/alertlogic-sdk-python
6
6
  Author: Alert Logic Inc.
@@ -151,6 +151,23 @@ export ALERTLOGIC_ENDPOINT="http://api.aesolo.com:3001"
151
151
 
152
152
  ## History
153
153
 
154
+ ### v1.0.74
155
+
156
+ * Wed, 8 Mar 2023 08:54:55 -0600 - Merge pull request #123 from EvanBrown96/fix-service-name-bug-environment-creation
157
+ * Tue, 7 Mar 2023 11:05:42 -0600 - Merge pull request #122 from alertlogic/update_workflow
158
+ * Mon, 6 Mar 2023 13:16:59 -0500 - fix bug where the service name was not being used correctly when querying dynamodb/ssm for credentials
159
+ * Fri, 3 Mar 2023 11:20:19 -0600 - Update workflow to stop using depricated node versions
160
+
161
+ ### v1.0.73
162
+
163
+ * Thu, 2 Mar 2023 09:09:13 -0600 - Merge pull request #121 from EvanBrown96/add-ssm-keys-check-2
164
+ * Tue, 28 Feb 2023 13:58:20 -0500 - use raise from
165
+ * Tue, 28 Feb 2023 13:52:05 -0500 - documentation clarity
166
+ * Tue, 28 Feb 2023 13:50:37 -0500 - re-add both-source functionality
167
+ * Tue, 28 Feb 2023 10:34:25 -0500 - fix a couple bugs and update tests
168
+ * Tue, 28 Feb 2023 10:09:12 -0500 - switch to just one application in AlEnv creation
169
+ * Tue, 28 Feb 2023 09:55:27 -0500 - update to fix bugs/better implementation
170
+
154
171
  ### v1.0.72
155
172
 
156
173
  * Thu, 23 Feb 2023 16:11:36 -0600 - Merge pull request #114 from alertlogic/fix_deprication_warning
@@ -4,7 +4,7 @@ pyyaml>=5.4.1
4
4
  jsonschema[format_nongpl]==3.2.0
5
5
  m2r2==0.3.2
6
6
  boto3>=1.16.57
7
- alertlogic-sdk-definitions>=0.1.109
7
+ alertlogic-sdk-definitions>=0.1.110
8
8
 
9
9
  [dev]
10
10
  pytest>=3
@@ -104,26 +104,31 @@ class Config():
104
104
  else:
105
105
  self._initialize_defaults()
106
106
 
107
- self._init_al_env_credentials(service_name)
107
+ self._init_al_env_credentials()
108
108
 
109
109
  logger.debug("Finished configuraiton initialization. " +
110
110
  f"access_key_id={self._access_key_id}, " +
111
111
  f"account_id={self._account_id}, " +
112
112
  f"global_endpoint={self._global_endpoint}")
113
113
 
114
- def _init_al_env_credentials(self, service_name):
115
- try:
116
- if self._access_key_id is None or self._secret_key is None:
117
- service_name_key = f"{service_name}.aims_authc",
118
- env = AlEnv(service_name_key)
119
- # attempt SSM first, then dynamoDB
114
+ def _init_al_env_credentials(self):
115
+ if self._access_key_id is None or self._secret_key is None:
116
+ try:
117
+ # attempt ssm first
118
+ env = AlEnv(self._service_name, "aims_authc", "ssm")
120
119
  self._access_key_id = env.get_parameter('access_key_id', decrypt=True)
121
120
  self._secret_key = env.get_parameter('secret_access_key', decrypt=True)
122
- if self._access_key_id is None or self._secret_key is None:
123
- self._access_key_id = env.get('access_key_id')
124
- self._secret_key = env.get('secret_access_key')
125
- except Exception as e:
126
- logger.debug(f"Did not initialise aims credentials for {service_name} because {e}")
121
+ except Exception as e:
122
+ logger.debug(f"Did not initialise aims credentials via SSM for {self._service_name} because {e}")
123
+ if self._access_key_id is None or self._secret_key is None:
124
+ try:
125
+ # if that doesn't work, attempt dynamodb
126
+ env = AlEnv(self._service_name, "aims_authc", "dynamodb")
127
+ self._access_key_id = env.get('access_key_id')
128
+ self._secret_key = env.get('secret_access_key')
129
+ except Exception as e:
130
+ logger.debug(f"Did not initialise aims credentials via dynamodb for {self._service_name} because {e}")
131
+
127
132
 
128
133
  def _read_config_file(self):
129
134
  try:
@@ -15,6 +15,8 @@ Network or io errors are not handled.
15
15
  Usage:
16
16
  # export ALERTLOGIC_STACK_REGION=us-east-1
17
17
  # export ALERTLOGIC_STACK_NAME=integration
18
+
19
+ Dynamodb usage:
18
20
  >> env = AlEnv("myapplication")
19
21
  # Assuming parameter is stored in ddb as '"value"'
20
22
  >> env.get("my_parameter")
@@ -29,6 +31,9 @@ Usage:
29
31
  # Assuming parameter is stored in ddb as '"true"'
30
32
  >> env.get("my_parameter", type='boolean')
31
33
  True
34
+
35
+ SSM usage:
36
+ >> env = AlEnv("myapplication", source="ssm")
32
37
  # For String types in SSM:
33
38
  >> env.get_parameter("my_parameter")
34
39
  'value'
@@ -54,27 +59,36 @@ class AlEnvAwsConfigurationException(AlEnvException):
54
59
  class AlEnvConfigurationTableUnavailableException(AlEnvException):
55
60
  pass
56
61
 
62
+ class AlmdrlibSourceNotEnabledError(AlEnvException):
63
+ pass
64
+
57
65
 
58
66
  class AlEnv:
59
- def __init__(self, application_name):
67
+ def __init__(self, application_name, client=None, source=("dynamodb",)):
60
68
  self.application_name = application_name
69
+ self.client = client
70
+ self.source = source if type(source) in [tuple, list] else (source,)
61
71
  self.region = AlEnv._get_region()
62
72
  self.stack_name = AlEnv._get_stack_name()
63
73
  self.table_name = AlEnv._table_name(self.region, self.stack_name)
64
74
  try:
65
75
  self.dynamodb = boto3.resource('dynamodb')
66
- self.table = self.dynamodb.Table(self.table_name)
67
- self._table_date_time = self.table.creation_date_time
68
76
  self.ssm = boto3.client('ssm')
69
- except botocore.exceptions.ClientError as e:
70
- if e.response['Error']['Code'] == 'ResourceNotFoundException':
71
- raise AlEnvConfigurationTableUnavailableException(self.table_name)
72
- else:
73
- raise AlEnvException(e)
74
77
  except (botocore.exceptions.NoRegionError, botocore.exceptions.NoCredentialsError) as e:
75
- raise AlEnvAwsConfigurationException(f'Please validate your AWS configuration: {e}')
78
+ raise AlEnvAwsConfigurationException(f'Please validate your AWS configuration') from e
79
+ if "dynamodb" in source:
80
+ try:
81
+ self.table = self.dynamodb.Table(self.table_name)
82
+ self._table_date_time = self.table.creation_date_time
83
+ except botocore.exceptions.ClientError as e:
84
+ if e.response['Error']['Code'] == 'ResourceNotFoundException':
85
+ raise AlEnvConfigurationTableUnavailableException(self.table_name)
86
+ else:
87
+ raise AlEnvException() from e
76
88
 
77
89
  def get(self, key, default=None, format='decoded', type=None):
90
+ if "dynamodb" not in self.source:
91
+ raise AlmdrlibSourceNotEnabledError("dynamodb is not enabled for this environment")
78
92
  fetched_value = self.table.get_item(Key={"key": self._make_ddb_key(key)}).get('Item', {}).get('value')
79
93
  converted = AlEnv._convert(fetched_value, format, type)
80
94
  if converted is not None:
@@ -83,18 +97,28 @@ class AlEnv:
83
97
  return default
84
98
 
85
99
  def get_parameter(self, key, default=None, decrypt=False):
100
+ if "ssm" not in self.source:
101
+ raise AlmdrlibSourceNotEnabledError("ssm is not enabled for this environment")
86
102
  try:
87
103
  parameter = self.ssm.get_parameter(Name=self._make_ssm_key(key), WithDecryption=decrypt)
88
104
  except self.ssm.exceptions.ParameterNotFound:
89
105
  return default
106
+ except botocore.exceptions.ClientError as e:
107
+ raise AlEnvException() from e
90
108
  return parameter["Parameter"]["Value"]
91
109
 
92
110
  def _make_ssm_key(self, option_key):
93
- return f"/deployments/{self._get_region()}/env-settings/{self._make_ddb_key(option_key)}"
111
+ return f"/deployments/{self.stack_name}/{self._get_region()}/env-settings/{self.application_name}/{self._make_client_option_key(option_key)}"
94
112
 
95
113
  def _make_ddb_key(self, option_key):
96
- return f"{self.application_name}.{option_key}"
114
+ return f"{self.application_name}.{self._make_client_option_key(option_key)}"
97
115
 
116
+ def _make_client_option_key(self, option_key):
117
+ if self.client is None:
118
+ return option_key
119
+ else:
120
+ return f"{self.client}.{option_key}"
121
+
98
122
  @staticmethod
99
123
  def _convert(value, format, type):
100
124
  if format == 'raw' and value:
@@ -1,4 +1,4 @@
1
1
  # file generated by setuptools_scm
2
2
  # don't change, don't track in version control
3
- __version__ = version = '1.0.72'
4
- __version_tuple__ = version_tuple = (1, 0, 72)
3
+ __version__ = version = '1.0.74'
4
+ __version_tuple__ = version_tuple = (1, 0, 74)
@@ -1,6 +1,6 @@
1
1
  import unittest
2
2
  from unittest.mock import MagicMock
3
- from almdrlib.environment import AlEnv
3
+ from almdrlib.environment import AlEnv, AlmdrlibSourceNotEnabledError
4
4
  import os
5
5
  import boto3
6
6
 
@@ -22,6 +22,8 @@ class MockDDBTable:
22
22
  return {"Item": {"key": Key, "value": "\"true\""}}
23
23
  elif Key == 'someapplication.boolkeyfalse':
24
24
  return {"Item": {"key": Key, "value": "\"false\""}}
25
+ elif Key == 'otherapplication.authc.strkey':
26
+ return {"Item": {"key": Key, "value": "\"strvalue\""}}
25
27
 
26
28
 
27
29
  class MockBotoDDB:
@@ -47,13 +49,15 @@ class MockBotoSSM:
47
49
  Name = kwargs.get('Name')
48
50
  WithDecryption = kwargs.get('WithDecryption')
49
51
 
50
- if Name == '/deployments/us-west-1/env-settings/someapplication.stringparam':
52
+ if Name == '/deployments/production/us-west-1/env-settings/someapplication/stringparam':
51
53
  return {'Parameter': {'Value': 'testingtesting'}}
52
- elif Name == '/deployments/us-west-1/env-settings/someapplication.securestringparam':
54
+ elif Name == '/deployments/production/us-west-1/env-settings/someapplication/securestringparam':
53
55
  if WithDecryption:
54
56
  return {'Parameter': {'Value': 'testingtestingtesting'}}
55
57
  else:
56
58
  return {'Parameter': {'Value': 'AQICAHhxjBnL9Dhpl/8CUT7/NC07HUYnX+P'}}
59
+ elif Name == '/deployments/production/us-west-1/env-settings/otherapplication/authc.stringparam':
60
+ return {'Parameter': {'Value': 'testingtesting'}}
57
61
  else:
58
62
  raise MockBotoSSM.exceptions.ParameterNotFound()
59
63
 
@@ -64,7 +68,7 @@ class TestAlEnv(unittest.TestCase):
64
68
  boto3.client = MagicMock(return_value=MockBotoSSM)
65
69
  os.environ['ALERTLOGIC_STACK_REGION'] = 'us-west-1'
66
70
  os.environ['ALERTLOGIC_STACK_NAME'] = 'production'
67
- env = AlEnv("someapplication")
71
+ env = AlEnv("someapplication", source="dynamodb")
68
72
  assert env.table_name == 'us-west-1.production.dev.global.settings'
69
73
  assert env.get("strkey") == 'strvalue'
70
74
  assert env.get("strkey", format='raw') == '"strvalue"'
@@ -75,11 +79,26 @@ class TestAlEnv(unittest.TestCase):
75
79
  assert env.get("boolkeytrue", type='boolean') is True
76
80
  assert env.get("floatkey") == '1.0'
77
81
  assert env.get("floatkey", type='float') == 1.0
82
+ with self.assertRaises(AlmdrlibSourceNotEnabledError):
83
+ assert env.get_parameter("testparam")
84
+ env = AlEnv("otherapplication", "authc", source="dynamodb")
85
+ assert env.get("strkey") == 'strvalue'
86
+
87
+ env = AlEnv("someapplication", source="ssm")
78
88
  assert env.get_parameter("stringparam") == 'testingtesting'
79
89
  assert env.get_parameter("securestringparam") == 'AQICAHhxjBnL9Dhpl/8CUT7/NC07HUYnX+P'
80
90
  assert env.get_parameter("securestringparam", decrypt=False) == 'AQICAHhxjBnL9Dhpl/8CUT7/NC07HUYnX+P'
81
91
  assert env.get_parameter("securestringparam", decrypt=True) == 'testingtestingtesting'
82
92
  assert env.get_parameter("invalidparam", "default") == 'default'
93
+ with self.assertRaises(AlmdrlibSourceNotEnabledError):
94
+ assert env.get("testparam")
95
+ env = AlEnv("otherapplication", "authc", source="ssm")
96
+ assert env.get_parameter("stringparam") == 'testingtesting'
97
+
98
+ env = AlEnv("someapplication", source=("ssm", "dynamodb"))
99
+ assert env.get("strkey") == 'strvalue'
100
+ assert env.get_parameter("stringparam") == 'testingtesting'
101
+
83
102
 
84
103
  if __name__ == '__main__':
85
104
  unittest.main()