Sha256: b338c37acf87fc963b8a83e6ebdcc14e83f7b2554150da14d8451e02bb00aff3

Contents?: true

Size: 789 Bytes

Versions: 6

Compression:

Stored size: 789 Bytes

Contents

class S3Secure::Encryption
  class List < Base
    def run
      buckets.each do |bucket|
        @s3 = s3_regional_client(bucket)
        puts "Policy for bucket #{bucket.color(:green)}"
        encryption_rules = get_encryption_rules(bucket)

        if encryption_rules
          puts encryption_rules
        else
          puts "Bucket does not have bucket encryption enabled"
        end
      end
    end

    def get_encryption_rules(bucket)
      resp = @s3.get_bucket_encryption(bucket: bucket)
      resp.server_side_encryption_configuration.rules # Aws::Xml::DefaultList object
    rescue Aws::S3::Errors::ServerSideEncryptionConfigurationNotFoundError
    end

    # Useful when calling List outside of the list CLI
    def set_s3(client)
      @s3 = client
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
s3-secure-0.4.2 lib/s3_secure/encryption/list.rb
s3-secure-0.4.1 lib/s3_secure/encryption/list.rb
s3-secure-0.4.0 lib/s3_secure/encryption/list.rb
s3-secure-0.3.0 lib/s3_secure/encryption/list.rb
s3-secure-0.2.0 lib/s3_secure/encryption/list.rb
s3-secure-0.1.0 lib/s3_secure/encryption/list.rb