Sha256: 40a0080c8de96f3a88f455092b461091f049281369a50b389369ab8df3b70e04
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
module 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
s3-secure-0.6.1 | lib/s3_secure/access_logs/enable.rb |
s3-secure-0.6.0 | lib/s3_secure/access_logs/enable.rb |