File tree 2 files changed +39
-5
lines changed
2 files changed +39
-5
lines changed Original file line number Diff line number Diff line change 6
6
7
7
8
8
class LambdaFunctionUrlResolver (ApiGatewayResolver ):
9
+ """AWS Lambda Function URL resolver
10
+
11
+ Notes:
12
+ -----
13
+ For now, this seems to work the same way as API Gateway HTTP APIs Payload Format Version 2.0.
14
+
15
+ Documentation:
16
+ - https://docs.aws.amazon.com/lambda/latest/dg/urls-configuration.html
17
+ - https://docs.aws.amazon.com/lambda/latest/dg/urls-invocation.html#urls-payloads
18
+
19
+ Examples
20
+ --------
21
+ Simple example with a custom lambda handler using the Tracer capture_lambda_handler decorator
22
+
23
+ ```python
24
+ from aws_lambda_powertools import Tracer
25
+ from aws_lambda_powertools.event_handler import LambdaFunctoinUrlResolver
26
+
27
+ tracer = Tracer()
28
+ app = LambdaFunctoinUrlResolver()
29
+
30
+ @app.get("/get-call")
31
+ def simple_get():
32
+ return {"message": "Foo"}
33
+
34
+ @app.post("/post-call")
35
+ def simple_post():
36
+ post_data: dict = app.current_event.json_body
37
+ return {"message": post_data["value"]}
38
+
39
+ @tracer.capture_lambda_handler
40
+ def lambda_handler(event, context):
41
+ return app.resolve(event, context)
42
+ """
43
+
9
44
current_event : LambdaFunctionUrlEvent
10
45
11
46
def __init__ (
Original file line number Diff line number Diff line change @@ -6,14 +6,13 @@ class LambdaFunctionUrlEvent(APIGatewayProxyEventV2):
6
6
7
7
Notes:
8
8
-----
9
- For now, this seems to follow the exact payload as HTTP APIs Payload Format Version 2.0.
10
- Certain keys in this payload format don't make sense for function urls (e.g: `routeKey`).
11
- These keys will always be null .
9
+ For now, this seems to follow the exact same payload as HTTP APIs Payload Format Version 2.0.
10
+ Certain keys in this payload format don't make sense for function urls (e.g: `routeKey`, `stage` ).
11
+ These keys will have default values that come on the payload, but they are not useful since they can't be changed .
12
12
13
13
Documentation:
14
+ - https://docs.aws.amazon.com/lambda/latest/dg/urls-configuration.html
14
15
- https://docs.aws.amazon.com/lambda/latest/dg/urls-invocation.html#urls-payloads
15
- - https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
16
-
17
16
"""
18
17
19
18
pass
You can’t perform that action at this time.
0 commit comments