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: put_bucket_lifecyle with multiple Transitions #6388

Closed
ccatterina opened this issue Jun 10, 2023 · 2 comments · Fixed by #6439
Closed

S3: put_bucket_lifecyle with multiple Transitions #6388

ccatterina opened this issue Jun 10, 2023 · 2 comments · Fixed by #6439
Labels

Comments

@ccatterina
Copy link
Contributor

Hi,
Moto implements the put_bucket_lifecycle API that should expect an array of AWS S3 Rule objects as input.
From what I understand from looking at the code, moto implementation instead of parsing a Rule parse an object very similar to a AWS S3 Lifecycle Rule with the only exception that accept a single Transition instead of an array of Transitions.

To fix this issue probably the best thing to do is to implement the put_bucket_lifecycle_configuration API, that expect an array of Lifecycle Rule objects (like the current rules but with an array of Transition instead of a single Transition), and fix the current put_bucket_lifecycle API in order to make it to accept an Array of Rule objects.

What do you think about it?

if it's okay with you I could work on it and open a PR.

@ccatterina ccatterina changed the title S3 Lifecycle Rule missing multiple transitions S3 put_bucket_lifecyle vs put_bucket_lifecycle_configuration Jun 10, 2023
@ccatterina ccatterina changed the title S3 put_bucket_lifecyle vs put_bucket_lifecycle_configuration S3 put_bucket_lifecyle vs put_bucket_lifecycle_configuration Jun 10, 2023
@bblommers
Copy link
Collaborator

Hi @ccatterina! We do already support put_bucket_lifecycle_configuration, as all our tests use that method: https://github.com/getmoto/moto/blob/master/tests/test_s3/test_s3_lifecycle.py

I'm assuming that boto3 automatically translates put_bucket_lifecycle, so that the incoming request for both methods look the same.
We then process them here:

def put_bucket_lifecycle(

Having multiple Transitions indeed fails against Moto, so if you want to create a fix (+ testcase) for this, that would be very welcome! Let us know if you need any help with this.

@bblommers bblommers added the bug label Jun 10, 2023
@ccatterina
Copy link
Contributor Author

I'm assuming that boto3 automatically translates put_bucket_lifecycle, so that the incoming request for both methods look the same.

Oh, ok. I didn't realize that! In that case it could also be helpful update the documentation, which now says that put_bucket_lifecycle_configuration is not supported.

Having multiple Transitions indeed fails against Moto, so if you want to create a fix (+ testcase) for this, that would be very welcome! Let us know if you need any help with this.

Sure, I'll work on it in the coming weeks! I will open a PR as soon as I have something ready.

@ccatterina ccatterina changed the title S3 put_bucket_lifecyle vs put_bucket_lifecycle_configuration S3: put_bucket_lifecyle with multiple Transitions Jun 10, 2023
ccatterina added a commit to ccatterina/moto that referenced this issue Jun 24, 2023
Handle multiple Transitions/NoncurrentVersionTranstions in bucket
lifecycle configuration.

Fixes getmoto#6388
@bblommers bblommers linked a pull request Jun 24, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants