Sha256: 8d2e29e55d117b1fb8706b174c4797ae224d1f88c62d513aca253565ef41a22e

Contents?: true

Size: 713 Bytes

Versions: 1

Compression:

Stored size: 713 Bytes

Contents

class 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

1 entries across 1 versions & 1 rubygems

Version Path
s3-secure-0.5.1 lib/s3_secure/versioning/show.rb