Description
Key information
- RFC PR: (leave this empty)
- Related issue(s), if known:
- Area: Utilities
- Meet tenets: Yes
Summary
One paragraph explanation of the feature.
Add the ability to help map multiple API Gateway Proxy events to a single lambda much like how Chalice or Lambda Proxy does it, but in a very simple and light weight way and still be compatible with Powertools
Motivation
Simplify the work needed to setup API Gateway Proxy Lambdas that support multiple endpoints on a single lambda
Proposal
Build something like: https://github.com/vincentsarago/lambda-proxy
But also allow the develop to keep their existing handler
with all of the powertools decotators supported kind of like how
#324 works.
app = APIGatewayProxy()
@app.post(uri="/merchant")
def create_merchant(merchant: dict) -> dict:
# return a 200 OK response with JSON details
return {"id": ...}
@app.get(uri="/merchant/{uid}", include_header=True)
def get_merchant(uid: str, headers: dict):
return {"name":...}
def handler(event, context):
return app.resolve(event, context)
Drawbacks
Why should we not do this?
Do we need additional dependencies? Impact performance/package size?
No additional dependencies
Rationale and alternatives
- What other designs have been considered? Why not them?
- What is the impact of not doing this?
Unresolved questions
Optional, stash area for topics that need further development e.g. TBD
Metadata
Metadata
Assignees
Type
Projects
Status
Activity
[-]RFC: APIGateway utils[/-][+]RFC: API Gateway Proxy Event utils[/+]heitorlessa commentedon Mar 12, 2021
Hey @michaelbrewer - Could you let us know when the RFC body is ready to review? It's missing a few sections like drawbacks, rationale, a more complete proposal besides the link, and any open questions you might have (if any), etc.
[-]RFC: API Gateway Proxy Event utils[/-][+]RFC: API Gateway Proxy Event utils [DRAFT][/+][-]RFC: API Gateway Proxy Event utils [DRAFT][/-][+]RFC: API Gateway Proxy Event utils[/+]michaelbrewer commentedon Mar 27, 2021
@heitorlessa here is a super lightweight implementation:
And its usage:
michaelbrewer commentedon Apr 10, 2021
I have updated the RFC PR include a couple more feature ideas:
While still keeping the code to a minimum
heitorlessa commentedon May 6, 2021
This is now OUT, thanks a lot for the gigantic help here @michaelbrewer -- #423