Files
Neha RungtaandNeha Rungta 462bad3da3 feat(examples): add synthetic security workflow benchmarks (#2618)
* feat(examples): add synthetic security workflow benchmark

* feat(examples): add deployed VPC reachability benchmark

---------

Co-authored-by: Neha Rungta <rungta@amazon.com>
2026-11-12 21:49:33 -08:00

32 lines
993 B
Python

"""API Gateway HTTP API adapter for the synthetic order service."""
import json
from .data import create_database
from .server import route_request
def handler(event, _context):
method = event.get("requestContext", {}).get("http", {}).get("method", "GET")
if method != "GET":
return {
"statusCode": 405,
"headers": {"content-type": "application/json"},
"body": json.dumps({"error": "method not allowed"}),
}
path = event.get("rawPath", "/")
query = event.get("rawQueryString", "")
if query:
path = f"{path}?{query}"
headers = {key.lower(): value for key, value in event.get("headers", {}).items()}
database = create_database()
try:
status, body = route_request(path, headers.get("authorization", ""), database)
finally:
database.close()
return {
"statusCode": status,
"headers": {"content-type": "application/json"},
"body": json.dumps(body),
}