File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
src/aibs_informatics_aws_lambda/common Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,35 @@ class LambdaHandler(
4040 BaseExecutor [REQUEST , RESPONSE ],
4141 Generic [REQUEST , RESPONSE ],
4242):
43+ """Inherit from the LambdaHandler class to create a custom strongly typed lambda handler
44+ that expects a REQUEST object and returns a RESPONSE object that follow the `ModelProtocol`.
45+
46+ Example usage:
47+
48+ ```python
49+ from aibs_informatics_aps_utils.models.base.pydantic_model_base import PydanticModel
50+
51+ class MyLambdaRequestModel(PydanticModel):
52+ first_input_field_to_lambda: str
53+ second_input_field_to_lambda: int
54+
55+ # Example of if your lambda doesn't return a response
56+ # class MyLambdaResponseModel(PydanticModel):
57+ # pass
58+
59+ # Example if your lambda returns a simple response
60+ class MyLambdaResponseModel(PydanticModel):
61+ lambda_specific_return_value: int
62+
63+ @dataclass
64+ class MyCustomLambdaHandler(LambdaHandler[MyLambdaRequestModel, MyLambdaResponseModel]):
65+ ...
66+
67+ ```
68+
69+ NOTE: Classes that inherit from `LambdaHandler` MUST specify the REQUEST and RESPONSE models!
70+ """
71+
4372 def __post_init__ (self ):
4473 self .context = LambdaContext ()
4574 super ().__post_init__ ()
You can’t perform that action at this time.
0 commit comments