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(event_source): Add support for policyLevel field in CloudWatch Logs event and parser #3624

Conversation

leandrodamascena
Copy link
Contributor

Issue number: #3623

Summary

Changes

AWS announced support for an account-level subscription for CloudWatch Logs. This introduced a new field called policyLevel and customers must have access to it.

User experience

from aws_lambda_powertools.utilities.data_classes import event_source, CloudWatchLogsEvent
from aws_lambda_powertools.utilities.data_classes.cloud_watch_logs_event import CloudWatchLogsDecodedData

@event_source(data_class=CloudWatchLogsEvent)
def lambda_handler(event: CloudWatchLogsEvent, context):
    decompressed_log: CloudWatchLogsDecodedData = event.parse_logs_data()
    do_something_with(decompressed_log.policy_level)

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 January 12, 2024 18:06
@boring-cyborg boring-cyborg bot added the tests label Jan 12, 2024
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 12, 2024
Copy link

sonarcloud bot commented Jan 12, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a7ebb3d) 95.49% compared to head (61b7f2f) 95.50%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3624   +/-   ##
========================================
  Coverage    95.49%   95.50%           
========================================
  Files          211      211           
  Lines         9821     9825    +4     
  Branches      1791     1792    +1     
========================================
+ Hits          9379     9383    +4     
  Misses         329      329           
  Partials       113      113           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rubenfonseca rubenfonseca self-requested a review January 15, 2024 09:03
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.

Nice!

@leandrodamascena leandrodamascena added parser Parser (Pydantic) utility event_sources Event Source Data Class utility labels Jan 15, 2024
@leandrodamascena leandrodamascena merged commit a15982f into aws-powertools:develop Jan 15, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event_sources Event Source Data Class utility parser Parser (Pydantic) utility 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: Add support for new policyLevel field in Cloudwatch Logs Event Source and Parse
3 participants