Class: S3Secure::Lifecycle::Remove
- Defined in:
- lib/s3_secure/lifecycle/remove.rb
Constant Summary collapse
Instance Method Summary collapse
Methods inherited from CLI::Base
Methods included from CLI::Say
Methods included from AwsServices
Methods included from AwsServices::S3
#check_bucket!, #new_s3_regional_client, #region, #region_map, #s3, #s3_client, #s3_regional_client
Constructor Details
This class inherits a constructor from S3Secure::CLI::Base
Instance Method Details
#run ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/s3_secure/lifecycle/remove.rb', line 5 def run show = Show.new(@options) unless show.has?(RULE_ID) say "Bucket #{@bucket} already does not have the #{RULE_ID} lifecycle rule." return end builder = Builder.new(show.get_lifecycle_rules(@bucket)) rules = builder.rules_with_removal if rules.empty? s3.delete_bucket_lifecycle(bucket: @bucket) else # update config with removal s3.put_bucket_lifecycle_configuration( bucket: @bucket, # required # content_md5: "ContentMD5", lifecycle_configuration: {rules: rules} ) end say "Removed the #{RULE_ID} lifecycle rule on bucket #{@bucket}" end |