bucket lifecycle configuration is not supported
Bucket lifecycle configuration doesn't seem to be supported with the version 2.1.28. would it be possible to support it? This is the code snippet:
var lifeCycleConfig = s3Client.getBucketLifecycleConfiguration(bucketName);
lifeCycleConfig.getRules().add(new BucketLifecycleConfiguration.Rule()
.withId("myRule")
.withFilter(new LifecycleFilter(new LifecycleAndOperator(List.of(
new LifecyclePrefixPredicate("myFolder/"),
new LifecycleTagPredicate(new Tag("myKey", "myValue"))))))
.addTransition(new Transition().withDays(0).withStorageClass(StorageClass.Glacier))
.withStatus(BucketLifecycleConfiguration.ENABLED));
s3Client.setBucketLifecycleConfiguration(bucketName, lifeCycleConfig);
var updated = s3Client.getBucketLifecycleConfiguration(bucketName);
assertEquals(lifeCycleConfig , updated)
Hi, any plan for this?
Thanks for the bump. Yes, I am planning on implementing this, my main impediment is that I will have to refactor the S3Mock quite a bit to store this and other information with the bucket and objects (this is not the only API still to be implemented).
For people using the S3Mock directly in Java code / Unit tests, every public method and class could be in use. This makes refactorings hard, I will have to break quite a few things to get everything implemented. See also #418 for an explanation RE: refactorings.
The first implementation step here would be that the S3Mock API accepts, stores and returns the LifeCycleConfig for a bucket. Not sure if it makes sense to implement actions on objects like changing the storage class in your example.
Thanks for explanation @afranken. For us, saving and retrieving the lifecycle configuration is necessary at this moment. Actions to objects might be good to have, but not required.
A bit of good news: I refactored almost all of the S3Mock core in version 2.5.0, so it is now possible to store BucketLifeCycle and other information (LegalHold, ...) in the updated data structures. Not sure when I'll get around to this, but it should be soon-ish. Been looking at Object ACLs, LegalHold, Retention first since those requests are older than this one.
Thanks for your patience.
Thanks a lot @afranken
@jerry-cherry just released 2.8.0 containing this feature.