generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 467
Open
Labels
feature-requestfeature requestfeature requestneed-customer-feedbackRequires more customers feedback before making or revisiting a decisionRequires more customers feedback before making or revisiting a decisionon-holdThis item is on-hold and will be revisited in the futureThis item is on-hold and will be revisited in the future
Description
Use case
HTTP resolver middlewares should have access to path parameters to help with use cases like resource-specific authnz, logging enrichment, etc. Access is already available in an undocumented manner that may be considered "private" according to PEP 8 (see "User Experience" below).
Solution/User Experience
Current:
def middleware(app: APIGatewayRestResolver, next_middleware: NextMiddleware) -> Response:
path_params = app.context.get("_route_args")
logger.append_keys(path_params=path_params)
return next_middleware(app)New:
def middleware(app: APIGatewayRestResolver, next_middleware: NextMiddleware) -> Response:
path_params = app.context.path_parameters
logger.append_keys(path_params=path_params)
return next_middleware(app)Alternative solutions
Perhaps it would be ideal to have the parsed path parameters available via app.current_event instead (as with API Gateway resolvers), but using app.context is certainly easier and more in line with the current state. Providing data in the powertools app.current_event that is not present in a typical Lambda handler's event could also lead to confusion.
Acknowledgment
- This feature request meets Powertools for AWS Lambda (Python) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Java, TypeScript, and .NET
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature-requestfeature requestfeature requestneed-customer-feedbackRequires more customers feedback before making or revisiting a decisionRequires more customers feedback before making or revisiting a decisionon-holdThis item is on-hold and will be revisited in the futureThis item is on-hold and will be revisited in the future
Type
Projects
Status
Ideas