Skip to content
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(parser): add support for parsing SQS events wrapped in Kinesis Firehose #2294

Merged

Conversation

leandrodamascena
Copy link
Contributor

Issue number: #2293

Summary

Changes

In this update, we enhance the parser to handle SQS events that are wrapped in Kinesis Firehose.

parser_sqs

User experience

With this new Model, you can easily extract relevant information from SQS events within the Kinesis Firehose ecosystem.

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

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.

@leandrodamascena leandrodamascena requested a review from a team as a code owner May 19, 2023 00:58
@leandrodamascena leandrodamascena requested review from rubenfonseca and removed request for a team May 19, 2023 00:58
@boring-cyborg boring-cyborg bot added documentation Improvements or additions to documentation tests labels May 19, 2023
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 19, 2023
@github-actions github-actions bot added the feature New feature or functionality label May 19, 2023
@codecov-commenter
Copy link

codecov-commenter commented May 19, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (653db45) 97.46% compared to head (a9cd9ba) 97.47%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2294   +/-   ##
========================================
  Coverage    97.46%   97.47%           
========================================
  Files          149      150    +1     
  Lines         6901     6922   +21     
  Branches       509      509           
========================================
+ Hits          6726     6747   +21     
  Misses         137      137           
  Partials        38       38           
Impacted Files Coverage Δ
...bda_powertools/utilities/parser/models/__init__.py 100.00% <100.00%> (ø)
...ls/utilities/parser/models/kinesis_firehose_sqs.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@rubenfonseca
Copy link
Contributor

Looking at this now


@validator("data", pre=True, allow_reuse=True)
def data_base64_decode(cls, value):
# Firehose payload is encoded twice
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😱

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruben, I will validate this one more time before merging. But scare me too.

Copy link
Contributor

@rubenfonseca rubenfonseca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job, the double encoding is really scary :D

@leandrodamascena
Copy link
Contributor Author

Awesome job, the double encoding is really scary :D

Ruben, your comment confused me about this and I investigated again. I was using the wrong event coming from EventBridge and indeed it's encoded once and not twice. Sorry about that, now it's ok!

Copy link
Contributor

@rubenfonseca rubenfonseca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rubenfonseca rubenfonseca merged commit ab47c92 into aws-powertools:develop May 24, 2023
6 checks passed
heitorlessa added a commit to heitorlessa/aws-lambda-powertools-python that referenced this pull request May 26, 2023
* develop:
  chore(deps-dev): bump aws-cdk from 2.80.0 to 2.81.0 (aws-powertools#2332)
  chore(deps-dev): bump coverage from 7.2.5 to 7.2.6 (aws-powertools#2326)
  chore(deps-dev): bump pytest-cov from 4.0.0 to 4.1.0 (aws-powertools#2327)
  chore(deps): bump actions/setup-python from 4.6.0 to 4.6.1 (aws-powertools#2325)
  fix(docs): use concrete secrets from settings (aws-powertools#2322)
  fix(logger): add setLevel function to set level programmatically (aws-powertools#2320)
  feat(parser): add support for parsing SQS events wrapped in Kinesis Firehose (aws-powertools#2294)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature New feature or functionality size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Parsing SQS events wrapped in Kinesis Firehose events
3 participants