Sha256: 8e587e141e9f98fcde95cf6300843532722593f4250f44f683d305d0f0849548
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
class S3Secure::AccessLogs class Enable < Base def run @show = Show.new(bucket: @bucket) add_bucket_acl enable_access_logging end # Bucket ACL applies on the target bucket only def add_bucket_acl if @show.acl_enabled? say "Bucket acl already has log delivery ACL" return end s3.put_bucket_acl( bucket: @bucket, access_control_policy: @show.access_control_policy_with_log_delivery_permissions, ) say "Added to bucket acl that grants log delivery" end def enable_access_logging if @show.logging_enabled? say "Bucket access logging already enabled" return end s3.put_bucket_logging( bucket: @bucket, # source bucket_logging_status: { logging_enabled: { target_bucket: @show.target_bucket, target_prefix: @show.target_prefix, }, }, ) say "Enabled access logging on the source bucket #{@bucket} to be delivered to the target bucket #{@show.target_bucket}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
s3-secure-0.5.1 | lib/s3_secure/access_logs/enable.rb |