Method: Awspec::Helper::Finder::S3#head_object

Defined in:
lib/awspec/helper/finder/s3.rb

#head_object(id, key) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/awspec/helper/finder/s3.rb', line 18

def head_object(id, key)
  res = s3_client.head_object({
                                bucket: id,
                                key: key.sub(%r{\A/}, '')
                              })
  res.data.instance_of?(Aws::S3::Types::HeadObjectOutput)
rescue Aws::S3::Errors::NotFound
  false
end