From 5d5551eb6d654ddbea55577e0e2ee14c16266518 Mon Sep 17 00:00:00 2001 From: Gavin Inglis <43075615+ginglis13@users.noreply.github.com> Date: Tue, 17 Oct 2023 11:01:22 -0700 Subject: [PATCH] fix: remove type hints from unimported libs (#450) Lambda func is not bundled with a layer that includes the aws_lambda_powertools python package. Since this package was only used for type hinting, and since those types are encapsulated in docstrings for relevant functions, remove the imports. Signed-off-by: Gavin Inglis --- .../main.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/image-scanning-notifications-lambda-handler/main.py b/lib/image-scanning-notifications-lambda-handler/main.py index 5ce76bb..ec1b939 100644 --- a/lib/image-scanning-notifications-lambda-handler/main.py +++ b/lib/image-scanning-notifications-lambda-handler/main.py @@ -4,10 +4,8 @@ ''' import boto3 import os -from aws_lambda_powertools.utilities.data_classes import EventBridgeEvent -from aws_lambda_powertools.utilities.typing import LambdaContext -def build_message(event: EventBridgeEvent): +def build_message(event): '''build_message reads an {event} from Inspector image scanning and builds the body of reporting email with vulnerability findings. @@ -50,7 +48,12 @@ def send_sns(subject: str, message: str): topic_arn = os.environ["SNS_ARN"] client.publish(TopicArn=topic_arn, Message=message, Subject=subject) -def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> dict: +def lambda_handler(event, context) -> dict: + '''lambda_handler handles EventBridge events, calling send_sns to send an email for security findings. + + :param EventBridgeEvent event: the EventBridge event + :param LambdaContext context: the Lambda execution context + ''' detailType = event["detail-type"] if (detailType == "Inspector2 Finding"):