Class: FileStore::Providers::S3

Inherits:
Provider
  • Object
show all
Defined in:
lib/file_store/providers/s3.rb

Constant Summary collapse

REQUIRED_CONFIGS =
[:aws_access_key, :aws_access_secret, :aws_s3_bucket,
:aws_region].freeze
DEFAULT_S3_OPTIONS =
{
  server_side_encryption: 'AES256'.freeze,
  acl: 'private'.freeze
}.freeze

Instance Attribute Summary

Attributes inherited from Provider

#options

Instance Method Summary collapse

Methods inherited from Provider

#download_url, #mock!, #mock_download_url, #mock_upload, #mocked?, #upload

Constructor Details

#initialize(opts = {}) ⇒ S3

Returns a new instance of S3.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/file_store/providers/s3.rb', line 13

def initialize(opts = {})
  super

  @_synchronizer = Mutex.new
  @_s3_interface = ::Aws::S3::Resource.new(
    access_key_id: options[:aws_access_key],
    secret_access_key: options[:aws_access_secret],
    region: options[:aws_region]
  )
  @_s3_bucket = _s3_interface.bucket(_bucket_name)
end