Class: Backup::Storage::S3

Inherits:
Base
  • Object
show all
Defined in:
lib/backup/storage/s3.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#keep, #time

Instance Method Summary collapse

Methods inherited from Base

#cycle!, #local_file, #local_path, #remote_file

Methods included from Configuration::Helpers

#clear_defaults!, #getter_methods, #load_defaults!, #setter_methods

Constructor Details

#initialize(&block) ⇒ S3

Creates a new instance of the Amazon S3 storage object First it sets the defaults (if any exist) and then evaluates the configuration block which may overwrite these defaults

Currently available regions:

eu-west-1, us-east-1, ap-southeast-1, us-west-1


30
31
32
33
34
35
36
37
38
# File 'lib/backup/storage/s3.rb', line 30

def initialize(&block)
  load_defaults!

  @path ||= 'backups'

  instance_eval(&block) if block_given?

  @time = TIME
end

Instance Attribute Details

#access_key_idObject

Amazon Simple Storage Service (S3) Credentials



13
14
15
# File 'lib/backup/storage/s3.rb', line 13

def access_key_id
  @access_key_id
end

#bucketObject

Amazon S3 bucket name and path



17
18
19
# File 'lib/backup/storage/s3.rb', line 17

def bucket
  @bucket
end

#pathObject

Amazon S3 bucket name and path



17
18
19
# File 'lib/backup/storage/s3.rb', line 17

def path
  @path
end

#regionObject

Region of the specified S3 bucket



21
22
23
# File 'lib/backup/storage/s3.rb', line 21

def region
  @region
end

#secret_access_keyObject

Amazon Simple Storage Service (S3) Credentials



13
14
15
# File 'lib/backup/storage/s3.rb', line 13

def secret_access_key
  @secret_access_key
end

Instance Method Details

#perform!Object

Performs the backup transfer



54
55
56
57
# File 'lib/backup/storage/s3.rb', line 54

def perform!
  transfer!
  cycle!
end

#providerObject

This is the provider that Fog uses for the S3 Storage



48
49
50
# File 'lib/backup/storage/s3.rb', line 48

def provider
  'AWS'
end

#remote_pathObject

This is the remote path to where the backup files will be stored



42
43
44
# File 'lib/backup/storage/s3.rb', line 42

def remote_path
  File.join(path, TRIGGER).sub(/^\//, '')
end