class Backup::Syncer::Cloud::S3
Attributes
access_key_id[RW]
Amazon Simple Storage Service (S3) Credentials
bucket[RW]
Amazon S3 bucket name
encryption[RW]
Encryption algorithm to use for Amazon Server-Side Encryption
Supported values:
-
:aes256
Default: nil
fog_options[RW]
Additional options to pass along to fog. e.g. Fog::Storage.new({ :provider => 'AWS' }.merge(fog_options))
region[RW]
Region of the specified S3 bucket
secret_access_key[RW]
Amazon Simple Storage Service (S3) Credentials
storage_class[RW]
use_iam_profile[RW]
Amazon Simple Storage Service (S3) Credentials
Public Class Methods
new(syncer_id = nil)
click to toggle source
Calls superclass method
Backup::Syncer::Cloud::Base.new
# File lib/backup/syncer/cloud/s3.rb, line 47 def initialize(syncer_id = nil) super @storage_class ||= :standard check_configuration end
Private Instance Methods
check_configuration()
click to toggle source
# File lib/backup/syncer/cloud/s3.rb, line 83 def check_configuration if use_iam_profile required = %w{ bucket } else required = %w{ access_key_id secret_access_key bucket } end raise Error, " Configuration Error #{ required.map {|name| "##{ name }"}.join(', ') } are all required " if required.map {|name| send(name) }.any?(&:nil?) raise Error, " Configuration Error #encryption must be :aes256 or nil " if encryption && encryption.to_s.upcase != 'AES256' classes = ['STANDARD', 'REDUCED_REDUNDANCY'] raise Error, " Configuration Error #storage_class must be :standard or :reduced_redundancy " unless classes.include?(storage_class.to_s.upcase) end
cloud_io()
click to toggle source
# File lib/backup/syncer/cloud/s3.rb, line 57 def cloud_io @cloud_io ||= CloudIO::S3.new( :access_key_id => access_key_id, :secret_access_key => secret_access_key, :use_iam_profile => use_iam_profile, :bucket => bucket, :region => region, :encryption => encryption, :storage_class => storage_class, :max_retries => max_retries, :retry_waitsec => retry_waitsec, # Syncer can not use multipart upload. :chunk_size => 0, :fog_options => fog_options ) end
get_remote_files(remote_base)
click to toggle source
# File lib/backup/syncer/cloud/s3.rb, line 74 def get_remote_files(remote_base) hash = {} cloud_io.objects(remote_base).each do |object| relative_path = object.key.sub(remote_base + '/', '') hash[relative_path] = object.etag end hash end