Module: Crashbreak::AWS

Included in:
DatabaseDumper, DatabaseRestorer
Defined in:
lib/crashbreak/AWS.rb

Instance Method Summary collapse

Instance Method Details

#aws_key_idObject



19
20
21
# File 'lib/crashbreak/AWS.rb', line 19

def aws_key_id
  Crashbreak.configure.dumper_options[:aws_access_key_id] || ENV['AWS_ACCESS_KEY_ID']
end

#aws_regionObject



15
16
17
# File 'lib/crashbreak/AWS.rb', line 15

def aws_region
  Crashbreak.configure.dumper_options[:aws_region] || ENV['AWS_REGION']
end

#aws_resource_bucketObject



7
8
9
# File 'lib/crashbreak/AWS.rb', line 7

def aws_resource_bucket
  @aws_resource_bucket ||= Aws::S3::Resource.new.bucket(bucket_name)
end

#aws_secret_keyObject



23
24
25
# File 'lib/crashbreak/AWS.rb', line 23

def aws_secret_key
  Crashbreak.configure.dumper_options[:aws_secret_access_key] || ENV['AWS_SECRET_ACCESS_KEY']
end

#bucket_nameObject



11
12
13
# File 'lib/crashbreak/AWS.rb', line 11

def bucket_name
  Crashbreak.configure.dumper_options[:aws_bucket_name]
end

#clientObject



3
4
5
# File 'lib/crashbreak/AWS.rb', line 3

def client
  @client ||= Aws::S3::Client.new
end

#prepare_awsObject



27
28
29
30
31
32
# File 'lib/crashbreak/AWS.rb', line 27

def prepare_aws
  Aws.config.update(
      credentials: Aws::Credentials.new(aws_key_id, aws_secret_key),
      s3: { region: aws_region }
  )
end