Class: S3Secure::AccessLogs::Disable

Inherits:
Base show all
Defined in:
lib/s3_secure/access_logs/disable.rb

Instance Method Summary collapse

Methods inherited from CLI::Base

#buckets, #initialize

Methods included from CLI::Say

#say

Methods included from S3Secure::AwsServices

#sts

Methods included from S3Secure::AwsServices::S3

#check_bucket!, #new_s3_regional_client, #region, #region_map, #s3, #s3_client, #s3_regional_client

Constructor Details

This class inherits a constructor from S3Secure::CLI::Base

Instance Method Details

#remove_access_loggingObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/s3_secure/access_logs/disable.rb', line 10

def remove_access_logging
  unless @show.logging_enabled?
    say "Bucket #{@bucket} is not configured with access logging. So nothing to remove."
    return
  end

  s3.put_bucket_logging(
    bucket: @bucket, # source
    bucket_logging_status: {}, # empty hash to remove
  )
  say "Bucket #{@bucket} access logging removed"
end

#remove_bucket_aclObject



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/s3_secure/access_logs/disable.rb', line 23

def remove_bucket_acl
  unless @show.acl_enabled?
    say "Bucket #{@bucket} is not configured the log delivery ACL. So nothing to remove."
    return
  end

  access_control_policy = @show.access_control_policy_without_log_delivery_permissions
  s3.put_bucket_acl(
    bucket: @bucket,
    access_control_policy: access_control_policy,
  )
  say "Bucket #{@bucket} ACL Log Delivery removed"
end

#runObject



3
4
5
6
7
8
# File 'lib/s3_secure/access_logs/disable.rb', line 3

def run
  @show = Show.new(bucket: @bucket)

  remove_access_logging
  remove_bucket_acl
end