moto icon indicating copy to clipboard operation
moto copied to clipboard

S3: Sending notification to EventBridge `LIFECYCLE_TRANSITION_EVENT`

Open tsugumi-sys opened this issue 1 year ago • 4 comments

  • Sending an event to EventBridge when the object storage class is changed.
  • (Object storage class is also changed by bucket lifecycle, but I think we cannot detect it in the current moto implementation.)

from docs;

You can also change the storage class of an object that is already stored in Amazon S3 to any other storage class by making a copy of the object by using the PUT Object - Copy API operation.

(I thought we can change object's storage class with restore_object request, but we can't based on the document.)

tsugumi-sys avatar Mar 09 '24 08:03 tsugumi-sys

Codecov Report

Attention: Patch coverage is 40.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 95.80%. Comparing base (9aef694) to head (892ff9c). Report is 98 commits behind head on master.

Files Patch % Lines
moto/s3/models.py 40.00% 3 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7448      +/-   ##
==========================================
- Coverage   95.88%   95.80%   -0.08%     
==========================================
  Files         843      854      +11     
  Lines       82578    83957    +1379     
==========================================
+ Hits        79178    80437    +1259     
- Misses       3400     3520     +120     
Flag Coverage Δ
servertests 32.22% <40.00%> (-0.30%) :arrow_down:
unittests 95.77% <40.00%> (-0.08%) :arrow_down:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 09 '24 08:03 codecov[bot]

This sounds like a good usecase to introduce a getter/setter method for the storage_class attribute.

I totally agree with this :) Thanks @bblommers ! I'll implement a setter and getter for storage class attribute in this PR.

tsugumi-sys avatar Mar 10 '24 13:03 tsugumi-sys

we need the FakeKey.status property implementation in this PR https://github.com/getmoto/moto/pull/7455

tsugumi-sys avatar Mar 10 '24 14:03 tsugumi-sys

The status-attribute should already be there @tsugumi-sys - it's defined in the parent class. My PR just overrides it and adds additional functionality.

bblommers avatar Mar 10 '24 14:03 bblommers