lib/s3_secure/policy/enforce.rb in s3-secure-0.4.2 vs lib/s3_secure/policy/enforce.rb in s3-secure-0.5.0
- old
+ new
@@ -4,16 +4,13 @@
super
@sid = options[:sid]
end
def run
- @s3 = s3_regional_client(@bucket)
+ show = S3Secure::Policy::Show.new(@options)
- list = S3Secure::Policy::List.new(@options)
- list.set_s3(@s3)
-
- bucket_policy = list.get_policy(@bucket)
+ bucket_policy = show.policy
document = Document.new(@bucket, bucket_policy)
if document.has?(@sid)
puts "Bucket policy for #{@bucket} has ForceSSLOnlyAccess policy statement already:"
puts bucket_policy
else
@@ -22,10 +19,10 @@
# API docs: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ServerSideEncryptionByDefault.html
#
# put_bucket_policy returns #<struct Aws::EmptyStructure>
#
policy_document = document.policy_document(@sid)
- @s3.put_bucket_policy(
+ s3.put_bucket_policy(
bucket: @bucket,
policy: policy_document,
)
puts "Add bucket policy to bucket #{@bucket}:"
puts policy_document