@@ -735,3 +735,84 @@ def register_route(func: Callable):
735
735
self ._routes [(rule , methods , cors , compress , cache_control )] = func
736
736
737
737
return register_route
738
+
739
+
740
+ class APIGatewayProxyEventResolver (ApiGatewayResolver ):
741
+ current_event : APIGatewayProxyEvent
742
+
743
+ def __init__ (
744
+ self ,
745
+ cors : Optional [CORSConfig ] = None ,
746
+ debug : Optional [bool ] = None ,
747
+ serializer : Optional [Callable [[Dict ], str ]] = None ,
748
+ strip_prefixes : Optional [List [str ]] = None ,
749
+ ):
750
+ """
751
+ Parameters
752
+ ----------
753
+ cors: CORSConfig
754
+ Optionally configure and enabled CORS. Not each route will need to have to cors=True
755
+ debug: Optional[bool]
756
+ Enables debug mode, by default False. Can be also be enabled by "POWERTOOLS_EVENT_HANDLER_DEBUG"
757
+ environment variable
758
+ serializer : Callable, optional
759
+ function to serialize `obj` to a JSON formatted `str`, by default json.dumps
760
+ strip_prefixes: List[str], optional
761
+ list of prefixes to be removed from the request path before doing the routing. This is often used
762
+ with api gateways with multiple custom mappings.
763
+ """
764
+ super ().__init__ (ProxyEventType .APIGatewayProxyEvent , cors , debug , serializer , strip_prefixes )
765
+
766
+
767
+ class APIGatewayProxyEventV2Resolver (ApiGatewayResolver ):
768
+ current_event : APIGatewayProxyEventV2
769
+
770
+ def __init__ (
771
+ self ,
772
+ cors : Optional [CORSConfig ] = None ,
773
+ debug : Optional [bool ] = None ,
774
+ serializer : Optional [Callable [[Dict ], str ]] = None ,
775
+ strip_prefixes : Optional [List [str ]] = None ,
776
+ ):
777
+ """
778
+ Parameters
779
+ ----------
780
+ cors: CORSConfig
781
+ Optionally configure and enabled CORS. Not each route will need to have to cors=True
782
+ debug: Optional[bool]
783
+ Enables debug mode, by default False. Can be also be enabled by "POWERTOOLS_EVENT_HANDLER_DEBUG"
784
+ environment variable
785
+ serializer : Callable, optional
786
+ function to serialize `obj` to a JSON formatted `str`, by default json.dumps
787
+ strip_prefixes: List[str], optional
788
+ list of prefixes to be removed from the request path before doing the routing. This is often used
789
+ with api gateways with multiple custom mappings.
790
+ """
791
+ super ().__init__ (ProxyEventType .APIGatewayProxyEventV2 , cors , debug , serializer , strip_prefixes )
792
+
793
+
794
+ class ALBEventResolver (ApiGatewayResolver ):
795
+ current_event : ALBEvent
796
+
797
+ def __init__ (
798
+ self ,
799
+ cors : Optional [CORSConfig ] = None ,
800
+ debug : Optional [bool ] = None ,
801
+ serializer : Optional [Callable [[Dict ], str ]] = None ,
802
+ strip_prefixes : Optional [List [str ]] = None ,
803
+ ):
804
+ """
805
+ Parameters
806
+ ----------
807
+ cors: CORSConfig
808
+ Optionally configure and enabled CORS. Not each route will need to have to cors=True
809
+ debug: Optional[bool]
810
+ Enables debug mode, by default False. Can be also be enabled by "POWERTOOLS_EVENT_HANDLER_DEBUG"
811
+ environment variable
812
+ serializer : Callable, optional
813
+ function to serialize `obj` to a JSON formatted `str`, by default json.dumps
814
+ strip_prefixes: List[str], optional
815
+ list of prefixes to be removed from the request path before doing the routing. This is often used
816
+ with api gateways with multiple custom mappings.
817
+ """
818
+ super ().__init__ (ProxyEventType .ALBEvent , cors , debug , serializer , strip_prefixes )
0 commit comments