Skip to content

Commit 4f39f14

Browse files
committed
fixing flake8 issues in ssm params module
1 parent 537d5b4 commit 4f39f14

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

aws_sra_examples/solutions/genai/bedrock_org/lambda/src/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def load_sra_cloudwatch_dashboard() -> dict:
191191

192192
# Instantiate sra class objects
193193
# TODO(liamschn): can these files exist in some central location to be shared with other solutions?
194-
ssm_params = sra_ssm_params.sra_ssm_params()
194+
ssm_params = sra_ssm_params.SRASSMParams()
195195
iam = sra_iam.SRAIAM()
196196
dynamodb = sra_dynamodb.SRADynamoDB()
197197
sts = sra_sts.sra_sts()

aws_sra_examples/solutions/genai/bedrock_org/lambda/src/sra_ssm_params.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,23 @@
1414
import os
1515
import re
1616
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
1818

1919
import boto3
2020
from botocore.config import Config
2121
from botocore.exceptions import ClientError, EndpointConnectionError
2222

2323
if TYPE_CHECKING:
24-
from aws_lambda_typing.context import Context
2524
from aws_lambda_typing.events import CloudFormationCustomResourceEvent
2625
from mypy_boto3_cloudformation import CloudFormationClient
2726
from mypy_boto3_organizations import OrganizationsClient
2827
from mypy_boto3_ssm import SSMClient
2928
from mypy_boto3_ssm.type_defs import TagTypeDef
3029

3130

32-
class sra_ssm_params:
31+
class SRASSMParams:
32+
"""Class to manage SSM Parameters."""
33+
3334
# Setup Default Logger
3435
LOGGER = logging.getLogger(__name__)
3536
log_level: str = os.environ.get("LOG_LEVEL", "INFO")
@@ -60,7 +61,6 @@ class sra_ssm_params:
6061
"/sra/regions/customer-control-tower-regions-without-home-region",
6162
"/sra/staging-s3-bucket-name",
6263
]
63-
# todo(liamschn): in the common prerequisite solution add an sra execution/configuration role parameter
6464

6565
SRA_STAGING_BUCKET: str = ""
6666
UNEXPECTED = "Unexpected!"
@@ -565,8 +565,7 @@ def get_ssm_parameter(self, session: Any, region: str, parameter: str) -> tuple[
565565
if e.response["Error"]["Code"] == "ParameterNotFound":
566566
self.LOGGER.info(f"SSM parameter '{parameter}' not found.")
567567
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, ""
571570
self.LOGGER.info(f"SSM parameter '{parameter}' found.")
572571
return True, response["Parameter"]["Value"]

0 commit comments

Comments
 (0)