class Healthchecker::Checks::S3
Public Instance Methods
check!()
click to toggle source
# File lib/healthchecker/checks/s3.rb, line 6 def check! options[:buckets].each {|bucket| check_bucket_access(bucket)} nil end
check_bucket_access(bucket)
click to toggle source
# File lib/healthchecker/checks/s3.rb, line 15 def check_bucket_access(bucket) object_key = options[:object_key] || "healthchecker/#{Time.now.to_i}.json" client.put_object(body: 'ok', bucket: bucket, key: object_key) raise "Could not read object from bucket '#{bucket}'" unless client.get_object( bucket: bucket, key: object_key, ).body.read == 'ok' client.delete_object(bucket: bucket, key: object_key) end
client()
click to toggle source
# File lib/healthchecker/checks/s3.rb, line 11 def client options[:client] || Aws::S3::Client.new end