Module: Awspec::Helper::Finder::S3

Included in:
Awspec::Helper::Finder
Defined in:
lib/awspec/helper/finder/s3.rb

Instance Method Summary collapse

Instance Method Details

#find_bucket(id) ⇒ Object



4
5
6
7
8
9
# File 'lib/awspec/helper/finder/s3.rb', line 4

def find_bucket(id)
  res = s3_client.list_buckets
  ret = s3_client.list_buckets[:buckets].find do |bucket|
    bucket.name == id
  end
end

#find_bucket_acl(id) ⇒ Object



11
12
13
14
15
# File 'lib/awspec/helper/finder/s3.rb', line 11

def find_bucket_acl(id)
  s3_client.get_bucket_acl(bucket: id)
rescue Aws::S3::Errors::NoSuchBucket
  nil
end

#find_bucket_cors(id) ⇒ Object



17
18
19
20
21
# File 'lib/awspec/helper/finder/s3.rb', line 17

def find_bucket_cors(id)
  s3_client.get_bucket_cors(bucket: id)
rescue Aws::S3::Errors::NoSuchBucket
  nil
end

#find_bucket_policy(id) ⇒ Object



23
24
25
26
27
# File 'lib/awspec/helper/finder/s3.rb', line 23

def find_bucket_policy(id)
  s3_client.get_bucket_policy(bucket: id)
rescue Aws::S3::Errors::NoSuchBucket
  nil
end

#select_all_bucketsObject



29
30
31
# File 'lib/awspec/helper/finder/s3.rb', line 29

def select_all_buckets
  s3_client.list_buckets.buckets
end