Sha256: 2178b5d2339492baf159d39c74583a70ff7347ba6ef780387634d06508cae8ca

Contents?: true

Size: 714 Bytes

Versions: 3

Compression:

Stored size: 714 Bytes

Contents

module S3Secure::Versioning
  class Show < Base
    def run
      if enabled?
        say "This S3 bucket has versioning enabled"
      else
        say "This S3 bucket does not have versioning enabled"
      end
      details = get_versioning(@bucket).to_h
      unless details.empty?
        say "Bucket versioning details: "
        pp details
      end
    end

    def enabled?
      versioning = get_versioning(@bucket)
      versioning.status == "Enabled" # Can be Enabled, Suspended, or nil
    end

    def get_versioning(bucket)
      s3.get_bucket_versioning(bucket: bucket) # resp
    rescue Aws::S3::Errors::ServerSideEncryptionConfigurationNotFoundError
    end
    memoize :get_versioning
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
s3-secure-0.7.0 lib/s3_secure/versioning/show.rb
s3-secure-0.6.1 lib/s3_secure/versioning/show.rb
s3-secure-0.6.0 lib/s3_secure/versioning/show.rb