Class: S3Secure::Encryption::Disable

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

Instance Method Summary collapse

Methods inherited from AbstractBase

#buckets, #initialize

Methods included from AwsServices

#new_s3_regional_client, #s3_client, #s3_regional_client

Constructor Details

This class inherits a constructor from S3Secure::AbstractBase

Instance Method Details

#runObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/s3_secure/encryption/disable.rb', line 3

def run
  @s3 = s3_regional_client(@bucket)

  list = S3Secure::Encryption::List.new(@options)
  list.set_s3(@s3)

  rules = list.get_encryption_rules(@bucket)
  if rules
    @s3.delete_bucket_encryption(bucket: @bucket) # returns resp = #<struct Aws::EmptyStructure>
    puts "Bucket #{@bucket} encryption has been removed"
  else
    puts "WARN: Bucket #{@bucket} is not configured with encryption at the bucket level".color(:yellow)
  end
end