-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlambda_function.py
executable file
·31 lines (28 loc) · 1.21 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
from LambdaHandler import LambdaHandler
from utils import build_response
from Constants import Operations
def lambda_handler(event, context):
if 'httpMethod' in event:
http_method = event['httpMethod']
lambda_handler_ecs: LambdaHandler = LambdaHandler(event)
if http_method == 'GET':
print("______________________get request__________________________")
response = lambda_handler_ecs.handle_request(
operation=Operations.GET_STATUS
)
print("Cluster_status: ", response)
return build_response(200, response)
# Handle GET request
elif http_method == 'POST':
print("_______________________post request________________________")
request = lambda_handler_ecs.handle_request(
operation=Operations.UPDATE_SERVICE
)
# Handle POST request
return build_response(200, "Services updated successfully!")
else:
# Handle other HTTP methods
return build_response(405, 'Unsupported HTTP method')
else:
# Handle case where HTTP method is not provided
return build_response(400, 'No HTTP method provided')