File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
examples/event_handler_rest/src Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -470,7 +470,7 @@ You can use specialized router classes according to the type of event that you a
470
470
| ALBRouter | ALBResolver | ALBEvent |
471
471
| LambdaFunctionUrlRouter | LambdaFunctionUrlResolver | LambdaFunctionUrlEvent |
472
472
473
- ``` python hl_lines="3 9"
473
+ ``` python hl_lines="1 5 9"
474
474
-- 8 < -- " examples/event_handler_rest/src/split_route_specialized_router.py"
475
475
```
476
476
Original file line number Diff line number Diff line change
1
+ from aws_lambda_powertools .event_handler import APIGatewayRestResolver
1
2
from aws_lambda_powertools .event_handler .router import APIGatewayRouter
2
3
4
+ app = APIGatewayRestResolver ()
3
5
router = APIGatewayRouter ()
4
6
5
7
6
8
@router .get ("/me" )
7
9
def get_self ():
8
10
# router.current_event is a APIGatewayProxyEvent
9
- principal_id = router .current_event .request_context .authorizer . principal_id
11
+ account_id = router .current_event .request_context .account_id
10
12
11
- return {"principal_id" : principal_id }
13
+ return {"account_id" : account_id }
14
+
15
+
16
+ app .include_router (router )
17
+
18
+
19
+ def lambda_handler (event , context ):
20
+ return app .resolve (event , context )
You can’t perform that action at this time.
0 commit comments