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

S3: Adding notification for eventbridge #7252

Merged
merged 14 commits into from
Feb 16, 2024

Conversation

tsugumi-sys
Copy link
Contributor

@tsugumi-sys tsugumi-sys commented Jan 26, 2024

Implement S3 EventBridge notification.

  • Expand notification configuration API.
  • Send notifications to EventBridge backend (skip tests when moto is in proxy or server mode).
  • Testing on put_object notification.

Document of EventBridge event message structure: https://docs.aws.amazon.com/AmazonS3/latest/userguide/ev-events.html

Document of EventBridge notification: https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventBridge.html

@tsugumi-sys tsugumi-sys marked this pull request as draft January 26, 2024 10:52
Copy link

codecov bot commented Feb 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9aef694) 95.88% compared to head (15c3b92) 95.88%.
Report is 19 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #7252    +/-   ##
========================================
  Coverage   95.88%   95.88%            
========================================
  Files         843      843            
  Lines       82578    82699   +121     
========================================
+ Hits        79178    79299   +121     
  Misses       3400     3400            
Flag Coverage Δ
servertests 32.57% <78.84%> (+0.05%) ⬆️
unittests 95.85% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@tsugumi-sys tsugumi-sys marked this pull request as ready for review February 11, 2024 06:16
@tsugumi-sys tsugumi-sys marked this pull request as draft February 12, 2024 07:17
@tsugumi-sys tsugumi-sys marked this pull request as ready for review February 12, 2024 09:35
Copy link
Collaborator

@bblommers bblommers left a comment

Choose a reason for hiding this comment

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

This looks really great @tsugumi-sys - just got a few minor comments.

moto/s3/models.py Show resolved Hide resolved
try:
from moto.events.models import events_backends

event = copy.deepcopy(_BASE_EVENT_MESSAGE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The _BASE_EVENT_MESSAGE-import should also be local

"key": key.name,
"size": key.size,
"eTag": key.etag.replace('"', ""),
"version-id": "IYV3p45BT0ac8hjHg1houSdS1a.Mro8e",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we use key.version_id here?

Copy link
Collaborator

@bblommers bblommers left a comment

Choose a reason for hiding this comment

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

That looks great - thank you @tsugumi-sys!

@bblommers bblommers added this to the 5.0.2 milestone Feb 16, 2024
@bblommers bblommers merged commit b9d7c20 into getmoto:master Feb 16, 2024
39 checks passed
Copy link
Contributor

This is now part of moto >= 5.0.2.dev24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support: EventBridgeConfiguration for S3.Client.put_bucket_notification_configuration request parameter
2 participants