-
Notifications
You must be signed in to change notification settings - Fork 0
/
lambda_function.py
31 lines (27 loc) · 1.16 KB
/
lambda_function.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from typing import List
from DynamoDatabaseInterface import DynamoDatabaseInterface
from Processor import Processor
from GovWeatherAlertInterface import GovWeatherAlertInterface
from MultiMessageInterfaceWrapper import MultiMessageInterfaceWrapper
from SNSMessageInterface import SNSMessageInterface
from RequestsNetworkInterface import RequestsNetworkInterface
from ConsoleMessageInterface import ConsoleMessageInterface
from LoggerMessageInterface import LoggerMessageInterface
import os
def lambda_handler(event, context) -> None:
# Set up configuration for which alerts to get
states: List[str] = [] # ['NH', 'NY', 'MA', 'ME']
zones: List[str] = ['NHC011']
# Dependency injection
Processor(
weatherInterface=GovWeatherAlertInterface(
RequestsNetworkInterface(), states, zones),
messageInterface=MultiMessageInterfaceWrapper([
ConsoleMessageInterface(),
LoggerMessageInterface(filename='weather_alerts.txt'),
SNSMessageInterface(
topicArn=os.environ['topicArn'])
]
),
databaseInterface=DynamoDatabaseInterface(tableName='weather')
).process()