|
14 | 14 | import os |
15 | 15 | import re |
16 | 16 | from time import sleep |
17 | | -from typing import TYPE_CHECKING, Any, List, Literal, Optional, Sequence, Union, cast |
| 17 | +from typing import TYPE_CHECKING, Any, List, Literal, Optional, Sequence, Union |
18 | 18 |
|
19 | 19 | import boto3 |
20 | 20 | from botocore.config import Config |
21 | 21 | from botocore.exceptions import ClientError, EndpointConnectionError |
22 | 22 |
|
23 | 23 | if TYPE_CHECKING: |
24 | | - from aws_lambda_typing.context import Context |
25 | 24 | from aws_lambda_typing.events import CloudFormationCustomResourceEvent |
26 | 25 | from mypy_boto3_cloudformation import CloudFormationClient |
27 | 26 | from mypy_boto3_organizations import OrganizationsClient |
28 | 27 | from mypy_boto3_ssm import SSMClient |
29 | 28 | from mypy_boto3_ssm.type_defs import TagTypeDef |
30 | 29 |
|
31 | 30 |
|
32 | | -class sra_ssm_params: |
| 31 | +class SRASSMParams: |
| 32 | + """Class to manage SSM Parameters.""" |
| 33 | + |
33 | 34 | # Setup Default Logger |
34 | 35 | LOGGER = logging.getLogger(__name__) |
35 | 36 | log_level: str = os.environ.get("LOG_LEVEL", "INFO") |
@@ -60,7 +61,6 @@ class sra_ssm_params: |
60 | 61 | "/sra/regions/customer-control-tower-regions-without-home-region", |
61 | 62 | "/sra/staging-s3-bucket-name", |
62 | 63 | ] |
63 | | - # todo(liamschn): in the common prerequisite solution add an sra execution/configuration role parameter |
64 | 64 |
|
65 | 65 | SRA_STAGING_BUCKET: str = "" |
66 | 66 | UNEXPECTED = "Unexpected!" |
@@ -565,8 +565,7 @@ def get_ssm_parameter(self, session: Any, region: str, parameter: str) -> tuple[ |
565 | 565 | if e.response["Error"]["Code"] == "ParameterNotFound": |
566 | 566 | self.LOGGER.info(f"SSM parameter '{parameter}' not found.") |
567 | 567 | return False, "" |
568 | | - else: |
569 | | - self.LOGGER.info(f"Error getting SSM parameter '{parameter}': {e.response['Error']['Message']}") |
570 | | - return False, "" |
| 568 | + self.LOGGER.info(f"Error getting SSM parameter '{parameter}': {e.response['Error']['Message']}") |
| 569 | + return False, "" |
571 | 570 | self.LOGGER.info(f"SSM parameter '{parameter}' found.") |
572 | 571 | return True, response["Parameter"]["Value"] |
0 commit comments