Sha256: ea82c7f9caf3b2492e750813f1ff77430cc7c0c63f5eb6315ef79e82de9cf1f4

Contents?: true

Size: 483 Bytes

Versions: 3

Compression:

Stored size: 483 Bytes

Contents

module S3Secure::Policy
  class Show < Base
    def run
      if policy
        say "Bucket #{@bucket} is configured with this policy:"
        say policy
      else
        say "Bucket #{@bucket} is not configured bucket policy"
      end
    end

    def policy
      resp = s3.get_bucket_policy(bucket: @bucket)
      data = JSON.load(resp.policy.read) # String
      JSON.pretty_generate(data)
    rescue Aws::S3::Errors::NoSuchBucketPolicy
    end
    memoize :policy
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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