-
Notifications
You must be signed in to change notification settings - Fork 411
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. |
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
…ws-powertools#6058) * Adding new class to WebSocket Authorizer * Adding new class to WebSocket Authorizer * Making mypy happy * Making mypy happy --------- Co-authored-by: Ana Falcão <[email protected]>
…from 3.0.20 to 3.0.21 (aws-powertools#6064) chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions Bumps [zgosalvez/github-actions-ensure-sha-pinned-actions](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions) from 3.0.20 to 3.0.21. - [Release notes](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/releases) - [Commits](zgosalvez/github-actions-ensure-sha-pinned-actions@c3a2b64...6eb1abd) --- updated-dependencies: - dependency-name: zgosalvez/github-actions-ensure-sha-pinned-actions dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ools#6065) Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.6.2 to 9.6.3. - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG) - [Commits](squidfunk/mkdocs-material@9.6.2...9.6.3) --- updated-dependencies: - dependency-name: mkdocs-material dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Leandro Damascena <[email protected]>
…6067) Bumps [coverage](https://github.com/nedbat/coveragepy) from 7.6.10 to 7.6.11. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](nedbat/coveragepy@7.6.10...7.6.11) --- updated-dependencies: - dependency-name: coverage dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Leandro Damascena <[email protected]>
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.9.5 to 0.9.6. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](astral-sh/ruff@0.9.5...0.9.6) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Leandro Damascena <[email protected]>
…owertools#6046) * disable metrics env var cloudwatch * add for datadog * add tests * acept none env var * fix is disable metrics * add documentation * fix mypy * add datadog tests * disable when powertools dev * add disable to flush * remove print * Changing metrics flush decision * Changing metrics flush decision --------- Co-authored-by: Leandro Damascena <[email protected]>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]> Co-authored-by: Leandro Damascena <[email protected]>
) * add custom mask functionalities * change flags name to more intuitive * fix type check error * add draft documentation * change doc examples * style: format code with black * fix format base * add tests for new masks * sub header for custom mask in docs * masking rules to handle complex nest * add test for masking rules * modifications based on the feedback * mypy and tests modification * create more tests * Refactoring tests * Refactoring tests * Refactoring tests * Adding docstring + arg parameter * Adding docstring + arg parameter * Removing unnecessary code * Removing unnecessary code * Removing unnecessary code --------- Co-authored-by: Leandro Damascena <[email protected]>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]> Co-authored-by: Leandro Damascena <[email protected]>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]> Co-authored-by: Leandro Damascena <[email protected]>
…ions (aws-powertools#6074) Enforcing encryption context
…ools#6078) Bumps [boto3-stubs](https://github.com/youtype/mypy_boto3_builder) from 1.36.16 to 1.36.17. - [Release notes](https://github.com/youtype/mypy_boto3_builder/releases) - [Commits](https://github.com/youtype/mypy_boto3_builder/commits) --- updated-dependencies: - dependency-name: boto3-stubs dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…powertools#6079) Bumps [mkdocstrings-python](https://github.com/mkdocstrings/python) from 1.14.6 to 1.15.0. - [Release notes](https://github.com/mkdocstrings/python/releases) - [Changelog](https://github.com/mkdocstrings/python/blob/main/CHANGELOG.md) - [Commits](mkdocstrings/python@1.14.6...1.15.0) --- updated-dependencies: - dependency-name: mkdocstrings-python dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ana Falcão <[email protected]>
…6080) Bumps [coverage](https://github.com/nedbat/coveragepy) from 7.6.11 to 7.6.12. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](nedbat/coveragepy@7.6.11...7.6.12) --- updated-dependencies: - dependency-name: coverage dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
… 4.1.0 (aws-powertools#6082) chore(deps): bump aws-actions/configure-aws-credentials Bumps [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) from 4.0.3 to 4.1.0. - [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases) - [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md) - [Commits](aws-actions/configure-aws-credentials@4fc4975...ececac1) --- updated-dependencies: - dependency-name: aws-actions/configure-aws-credentials dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ana Falcão <[email protected]>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
* Adding roadmap * Roadmap
…4` in /docs (aws-powertools#6087) chore(deps): bump squidfunk/mkdocs-material in /docs Bumps squidfunk/mkdocs-material from `c62453b` to `f5bcec4`. --- updated-dependencies: - dependency-name: squidfunk/mkdocs-material dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#6089) Bumps [aws-cdk](https://github.com/aws/aws-cdk/tree/HEAD/packages/aws-cdk) from 2.178.1 to 2.178.2. - [Release notes](https://github.com/aws/aws-cdk/releases) - [Changelog](https://github.com/aws/aws-cdk/blob/v2.178.2/CHANGELOG.v2.md) - [Commits](https://github.com/aws/aws-cdk/commits/v2.178.2/packages/aws-cdk) --- updated-dependencies: - dependency-name: aws-cdk dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Leandro Damascena <[email protected]>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]> Co-authored-by: Leandro Damascena <[email protected]>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]> Co-authored-by: Leandro Damascena <[email protected]>
|
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.