Class: HealthCheck::S3HealthCheck

Inherits:
Object
  • Object
show all
Extended by:
BaseHealthCheck
Defined in:
lib/health_check/s3_health_check.rb

Class Method Summary collapse

Methods included from BaseHealthCheck

create_error

Class Method Details

.checkObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/health_check/s3_health_check.rb', line 8

def check
  raise "Wrong configuration. Missing 'aws-sdk' gem" unless defined?(::Aws)
  return create_error 's3', 'Could not connect to aws' if aws_s3_client.nil?

  HealthCheck.buckets.each do |bucket_name, permissions|
    permissions = %i[R W D] if permissions.nil? # backward compatible
    permissions.each do |permision|
      send(permision, bucket_name)
    rescue Exception => e
      raise "bucket:#{bucket_name}, permission:#{permision} - #{e.message}"
    end
  end
  ''
rescue Exception => e
  create_error 's3', e.message
end