Class: Backup::Storage::S3

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

Defined Under Namespace

Classes: Error

Instance Attribute Summary collapse

Attributes inherited from Base

#keep, #model, #package, #path, #storage_id

Instance Method Summary collapse

Methods inherited from Base

#perform!

Methods included from Config::Helpers

included

Constructor Details

#initialize(model, storage_id = nil) ⇒ S3

Returns a new instance of S3.



71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/backup/storage/s3.rb', line 71

def initialize(model, storage_id = nil)
  super

  @chunk_size     ||= 5 # MiB
  @max_retries    ||= 10
  @retry_waitsec  ||= 30
  @path           ||= 'backups'
  @storage_class  ||= :standard

  @path = @path.sub(/^\//, '')

  check_configuration
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Backup::Config::Helpers

Instance Attribute Details

#access_key_idObject

Amazon Simple Storage Service (S3) Credentials



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

def access_key_id
  @access_key_id
end

#bucketObject

Amazon S3 bucket name



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

def bucket
  @bucket
end

#chunk_sizeObject

Multipart chunk size, specified in MiB.

Each package file larger than chunk_size will be uploaded using S3 Multipart Upload.

Minimum: 5 (but may be disabled with 0) Maximum: 5120 Default: 5



31
32
33
# File 'lib/backup/storage/s3.rb', line 31

def chunk_size
  @chunk_size
end

#encryptionObject

Encryption algorithm to use for Amazon Server-Side Encryption

Supported values:

  • :aes256

Default: nil



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

def encryption
  @encryption
end

#fog_optionsObject

Additional options to pass along to fog. e.g. Fog::Storage.new({ :provider => ‘AWS’ }.merge(fog_options))



69
70
71
# File 'lib/backup/storage/s3.rb', line 69

def fog_options
  @fog_options
end

#max_retriesObject

Number of times to retry failed operations.

Default: 10



37
38
39
# File 'lib/backup/storage/s3.rb', line 37

def max_retries
  @max_retries
end

#regionObject

Region of the specified S3 bucket



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

def region
  @region
end

#retry_waitsecObject

Time in seconds to pause before each retry.

Default: 30



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

def retry_waitsec
  @retry_waitsec
end

#secret_access_keyObject

Amazon Simple Storage Service (S3) Credentials



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

def secret_access_key
  @secret_access_key
end

#storage_classObject

Storage class to use for the S3 objects uploaded

Supported values:

  • :standard (default)

  • :reduced_redundancy

Default: :standard



64
65
66
# File 'lib/backup/storage/s3.rb', line 64

def storage_class
  @storage_class
end

#use_iam_profileObject

Amazon Simple Storage Service (S3) Credentials



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

def use_iam_profile
  @use_iam_profile
end