Sha256: 6517bf1ee9a4e71130c1de2d4c16d4d5a4b315ff2a1883a59e8cb5785358236a
Contents?: true
Size: 1.51 KB
Versions: 3
Compression:
Stored size: 1.51 KB
Contents
class S3Secure::Summary class Items < S3Secure::AbstractBase extend Memoist # override initialize def initialize(options, buckets) @options, @buckets = options, buckets @ssl, @encrypted = @options[:ssl], @options[:encrypted] end def filtered_items items = all_items.select do |item| case @ssl when "yes", "no" @ssl == item.ssl else # any or fallback true end end items.select do |item| case @encrypted when "yes", "no" @encrypted == item.encrypted else # any or fallback true end end end # Triggers loading of items def all_items load_items! end def load_items! @buckets.map do |bucket| Item.new(bucket, ssl: ssl?(bucket) ? "yes" : "no", encrypted: encrypted?(bucket) ? "yes" : "no") end end memoize :load_items! private def ssl?(bucket) s3 = s3_regional_client(bucket) list = S3Secure::Policy::List.new(@options) list.set_s3(s3) bucket_policy = list.get_policy(bucket) document = S3Secure::Policy::Document.new(bucket, bucket_policy) document.has?("ForceSSLOnlyAccess") end memoize :ssl? def encrypted?(bucket) s3 = s3_regional_client(bucket) list = S3Secure::Encryption::List.new(@options) list.set_s3(s3) rules = list.get_encryption_rules(bucket) !!rules end memoize :encrypted? end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
s3-secure-0.4.2 | lib/s3_secure/summary/items.rb |
s3-secure-0.4.1 | lib/s3_secure/summary/items.rb |
s3-secure-0.4.0 | lib/s3_secure/summary/items.rb |