-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(event_handler): Add new EventHandler for Async Lambda #5799
base: develop
Are you sure you want to change the base?
feat(event_handler): Add new EventHandler for Async Lambda #5799
Conversation
Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need. |
Hi @sinofseven! Thank you so much for opening this PR. Do you need any help here? |
Hi, @anafalcao! Thanks very much for your suggestion! I have a few problems at the moment.
What must be done in tests other than unit testsFor the EventHandler implementation I am creating, I believe that the event samples provided for unit testing of data_classes are sufficient for testing. However, the EventHandler test for API Gateway implements E2E testing. Regarding the test case for the unit testThe unit test attempted to check all cases, including correct and incorrect values for all arguments of each Route class, as well as the presence or absence of arguments. Therefore, in creating the test, I wrote all the patterns of the test case in a Google Spreadsheet. https://docs.google.com/spreadsheets/d/1eioW7rALlFdkv2Q0y8ERZnMnJuJK3QWoPfhoJMTlqaA/edit?usp=sharing Following this, I implemented a unit test in Here is where I ran into a problem: I had a very large number of test cases in having many arguments Route class. Therefore, I am wondering how far to describe the test cases. |
|
Hi @sinofseven, first of all, sorry for the late reply, but I was super busy these days. I was reading the code and it covers most of the aspects we expect from this utility, such as: routing per key, detail, object, event name and others. I must say we have a SUPER SUPER nice work here, thank you very much for that. I have a proposal to follow with this PR and please let me know what do you think. Creating a RFCI'm going to start an RFC with what this implementation should cover. Powertools is available in 4 different languages and the idea is that this RFC can cover the design of this implementation, features that will be supported and resolvers that we will support in the first version. Don't worry we have people to implement in different languages. I need a week to have a v1 of this RFC and then you can contribute. Keeping this PR openI will keep this PR open while we discuss the RFC, which will probably take something like 1 month, because we need to hear from the community, from you, from the other maintainers and we need to agree on the implementation. I will also run local tests with this PR to get more insight into the codebase, changes we need to make and other things. IntegrationsWe have a utility called EventSource Data Class, where we map the event that comes from any service to Lambda, we can integrate this utility with this one and create an experience like: from aws_lambda_powertools.async_resolver import S3Resolver
app = S3Resolver()
@app.resolve_by_name(object_name="powertools.txt")
def resolve_by_name():
print(f"Event time {app.event_time}") # We can access the event properties We also have a utility called Parser where we use Pydantic templates to do data parsing and validation against S3 Events. We can think of an idea how to integrate with that. My personal opinionWhile I like the idea of having multiple resolvers like S3, EventBridge, SNS, SES, it might make sense to step back and agree to the following: 1 - Make the base router strong and consistent enough to support many types of resolvers I would love to hear your feedback and work together on this RFC to design this utility API and add this feature to Powertools. |
Quality Gate passedIssues Measures |
Issue number: #5627
Summary
Add
AsyncTriggerResolver
.Changes
Added EventHandler for asynchronous Lambda execution.
User experience
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Is this a breaking change?
RFC issue number:
Checklist:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.