Class: Belt::CLI::EnvironmentConfig::BackupDSL
- Inherits:
-
Object
- Object
- Belt::CLI::EnvironmentConfig::BackupDSL
- Defined in:
- lib/belt/cli/environment_config.rb
Overview
DSL for the backups block
Instance Method Summary collapse
- #cognito(*exports) ⇒ Object
- #dynamodb(scope = :all) ⇒ Object
-
#initialize(backup_config) ⇒ BackupDSL
constructor
A new instance of BackupDSL.
- #retention(opts = {}) ⇒ Object
- #s3(*buckets) ⇒ Object
Constructor Details
#initialize(backup_config) ⇒ BackupDSL
Returns a new instance of BackupDSL.
101 102 103 |
# File 'lib/belt/cli/environment_config.rb', line 101 def initialize(backup_config) @backup_config = backup_config end |
Instance Method Details
#cognito(*exports) ⇒ Object
114 115 116 |
# File 'lib/belt/cli/environment_config.rb', line 114 def cognito(*exports) @backup_config.instance_variable_set(:@cognito_exports, exports.flatten.map(&:to_sym)) end |
#dynamodb(scope = :all) ⇒ Object
105 106 107 108 109 110 111 112 |
# File 'lib/belt/cli/environment_config.rb', line 105 def dynamodb(scope = :all) if scope == :all @backup_config.instance_variable_set(:@dynamodb_tables, :all) else tables = Array(scope) @backup_config.instance_variable_set(:@dynamodb_tables, tables.map(&:to_s)) end end |
#retention(opts = {}) ⇒ Object
122 123 124 125 126 127 |
# File 'lib/belt/cli/environment_config.rb', line 122 def retention(opts = {}) current = @backup_config.instance_variable_get(:@retention) merged = current.merge(opts.transform_keys(&:to_sym)) merged.transform_values! { |v| v.respond_to?(:to_i) ? v.to_i : v } @backup_config.instance_variable_set(:@retention, merged) end |
#s3(*buckets) ⇒ Object
118 119 120 |
# File 'lib/belt/cli/environment_config.rb', line 118 def s3(*buckets) @backup_config.instance_variable_set(:@s3_buckets, buckets.flatten.map(&:to_sym)) end |