Skip to content

Commit

Permalink
fix: remove type hints from unimported libs (#450)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ginglis13 authored Oct 17, 2023
1 parent 8dfee65 commit 5d5551e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/image-scanning-notifications-lambda-handler/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"):
Expand Down

0 comments on commit 5d5551e

Please sign in to comment.