After creating a Minio bucket, I set the bucket's lifecycle rules. The LifeCycleRule takes up the expiration variable that is set for just 1 day. When checking the status of my bucket through minio client (mc), mc ilm ls mycloud/bucketName , I notice that the Lifecycle rule was successfully applied on to the designated bucket. However, when checking back on Minio after 1 day, the bucket is still there. Is there something else that I need to add to the LifeCycleRule in order to delete Minio Bucket properly?
Note, I've been using Minio SDKs Java Client API as reference.
fun createBucket(bucketName: String){
client.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build())
setBucketLifeCycle(bucketName)
}
private fun setBucketLifeCycle(bucketName: String){
// Setting the expiration for one day.
val expiration = Expiration(null as ZonedDateTime?, 1, null)
var lifeCycleRuleList = mutableListOf<LifecycleRule>()
val lifecycleRuleExpiry = LifecycleRule(
Status.ENABLED,
null,
expiration,
RuleFilter("expiry/logs"),
"rule 1",
null,
null,
null)
lifecycleRuleList.add(lifecycleRuleExpiry)
var lifecycleConfig = LifecycleConfiguration(lifecycleRuleList)
// Applies the lifecycleConfig on to target bucket.
client.setBucketLifecycle(SetBucketLifecycleArgs.buider()
.bucket(bucketName).config(lifecycleConfig).build())
}
Questions
- Am I missing something more on my LifeCycleRule?
- Could it be that the bucket does not get automatically deleted because it has objects inside of it?
- I did notice on the minio client that when the bucket has items on it,
mc rb mycloud/bucketNamewill fail to remove the the bucket, but forcing it withmc rb -force mycloud/bucketNamewill successfully remove it. Is there a way to speficy "force" on the lifecycle parameters?
- I did notice on the minio client that when the bucket has items on it,