Skip to content

RFC: API Gateway Proxy Event utils #325

Closed
@michaelbrewer

Description

@michaelbrewer

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

Labels

Type

No type

Projects

Status

Triage

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions