Class: S3Secure::PublicAccess::Show

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

Instance Method Summary collapse

Methods inherited from Base

#account_id

Methods inherited from CLI::Base

#buckets, #initialize

Methods included from CLI::Say

#say

Methods included from AwsServices

#sts

Methods included from 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

#blocked?Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/s3_secure/public_access/show.rb', line 13

def blocked?
  resp = s3.get_public_access_block(
    bucket: @bucket,
  )
  resp.to_h[:public_access_block_configuration] == {
    block_public_acls: true,
    block_public_policy: true,
    ignore_public_acls: true,
    restrict_public_buckets: true,
  }
rescue Aws::S3::Errors::NoSuchPublicAccessBlockConfiguration
  false
end

#runObject



3
4
5
6
7
8
9
10
11
# File 'lib/s3_secure/public_access/show.rb', line 3

def run
  resp = s3.get_public_access_block(
    bucket: @bucket,
  )
  say(resp.to_h)
  resp
rescue Aws::S3::Errors::NoSuchPublicAccessBlockConfiguration
  say "No public access block configuration found for bucket: #{@bucket}"
end