EMCECS / ecs-browser

Object browser for manipulating content in ECS.
10 stars 4 forks source link

Request - Add Bucket Lifecycle Configuration for Version Expiration #6

Open jon-lindner opened 6 years ago

jon-lindner commented 6 years ago

On the Version’s option for the Buckets, add a section to Enable - Bucket Lifecycle Versioning Expiration for Current and/or NonCurrent Objects.

You would just be allowing a checkbox of Enabled for Version Expiration for either Current Object or Non-Current objects and receiving an input for number of Days to set expiration policy. The selection captures can then be passed as the following command: ** Apply Bucket Lifecycle using AWS CLI aws s3api put-bucket-lifecycle-configuration --bucket agents --lifecycle-configuration file://expire-lp.json --endpoint-url http://ecs-ip:9020

Depending on what you use on the backend to pass the S3 commands, the Day integer value would have to be added to the JSON or XML lifecycle configuration policy. I have attached the JSON one that I made and tried to set just the non-current and current version expiration.

NonCurrentExpiration - JSON { "Rules": [ { "ID": "Expire NonCurrent 5 Days", "Prefix": "", "Status": "Enabled", "NoncurrentVersionExpiration": { "NoncurrentDays": 5 } } ] }

CurrentVersionExpiration - JSON { "Rules": [ { "ID": "Expire Current 5 Days", "Prefix": "", "Status": "Enabled", "Expiration": { "Days": 5 } } ] }