class S3Secure::Policy::Show

Public Instance Methods

policy() click to toggle source
# File lib/s3_secure/policy/show.rb, line 12
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
run() click to toggle source
# File lib/s3_secure/policy/show.rb, line 3
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