Class: Martilla::S3

Inherits:
Storage show all
Defined in:
lib/martilla/storages/s3.rb

Instance Attribute Summary

Attributes inherited from Storage

#options

Instance Method Summary collapse

Methods inherited from Storage

#append_datetime_suffix, #config_error, create, #initialize, #invalid_options_msg, #output_filename, #suffix?

Methods inherited from Component

#bash

Constructor Details

This class inherits a constructor from Martilla::Storage

Instance Method Details

#persist(tmp_file:, gzip:) ⇒ Object

Raises:



5
6
7
8
9
10
11
12
# File 'lib/martilla/storages/s3.rb', line 5

def persist(tmp_file:, gzip:)
  path = output_filename(gzip)
  obj = s3_resource.bucket(bucket_name).object(path)

  # Upload it
  return nil if obj.upload_file(tmp_file)
  raise Error.new('Error uploading backup to bucket')
end