Class: S3Secure::Versioning::Enable

Inherits:
Base show all
Defined in:
lib/s3_secure/versioning/enable.rb

Instance Method Summary collapse

Methods inherited from CLI::Base

#buckets, #initialize

Methods included from CLI::Say

#say

Methods included from AwsServices

#sts

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

#runObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/s3_secure/versioning/enable.rb', line 3

def run
  show = Show.new(@options)
  if show.enabled?
    say "Bucket #{@bucket} is has versioning already enabled."
  else
    s3.put_bucket_versioning(
      bucket: @bucket,
      versioning_configuration: {
        # mfa_delete: "Disabled",
        status: "Enabled",
      },
    )
    say "Versioning enabled on bucket #{@bucket}"
  end
end