Class: S3Secure::Versioning::List

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

Instance Method Summary collapse

Methods inherited from AbstractBase

#buckets, #initialize

Methods included from Say

#say

Methods included from AwsServices::S3

#check_bucket!, #new_s3_regional_client, #region, #region_map, #s3, #s3_client

Constructor Details

This class inherits a constructor from S3Secure::AbstractBase

Instance Method Details

#runObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/s3_secure/versioning/list.rb', line 3

def run
  presenter = CliFormat::Presenter.new(@options)
  presenter.header = ["Bucket", "Has Versioning?"]

  buckets.each do |bucket|
    $stderr.puts "Getting versioning for bucket #{bucket.color(:green)}"

    show = Show.new(bucket: bucket)
    row = [bucket, show.enabled?]
    if @options[:versioning].nil?
      presenter.rows << row # always show policy
    elsif @options[:versioning]
      presenter.rows << row if show.enabled? # only show if bucket has some encryption rules
    else
      presenter.rows << row unless show.enabled? # only show if bucket doesnt have any encryption rules
    end
  end

  presenter.show
end