Class: Belt::CLI::BackupConfig
- Inherits:
-
Object
- Object
- Belt::CLI::BackupConfig
- Defined in:
- lib/belt/cli/backup_config.rb
Instance Attribute Summary collapse
-
#cognito_exports ⇒ Object
readonly
Returns the value of attribute cognito_exports.
-
#dynamodb_tables ⇒ Object
readonly
Returns the value of attribute dynamodb_tables.
-
#retention ⇒ Object
readonly
Returns the value of attribute retention.
-
#s3_buckets ⇒ Object
readonly
Returns the value of attribute s3_buckets.
Class Method Summary collapse
-
.load(env, infra_dir: nil) ⇒ Object
Load backup config from infrastructure/
/belt.rb Returns nil if no config file exists or backups aren't configured NOTE: Prefer EnvironmentConfig.load which loads the full config including backups.
Instance Method Summary collapse
- #any? ⇒ Boolean
- #cognito? ⇒ Boolean
- #dynamodb? ⇒ Boolean
-
#initialize ⇒ BackupConfig
constructor
A new instance of BackupConfig.
Constructor Details
#initialize ⇒ BackupConfig
Returns a new instance of BackupConfig.
17 18 19 20 21 22 |
# File 'lib/belt/cli/backup_config.rb', line 17 def initialize @dynamodb_tables = nil # nil = not configured, :all = all tables, Array = specific tables @cognito_exports = [] # e.g. [:users, :pool_config] @s3_buckets = [] # e.g. [:legal_documents] @retention = { snapshots: 90, cognito: 10, s3: 10 } end |
Instance Attribute Details
#cognito_exports ⇒ Object (readonly)
Returns the value of attribute cognito_exports.
6 7 8 |
# File 'lib/belt/cli/backup_config.rb', line 6 def cognito_exports @cognito_exports end |
#dynamodb_tables ⇒ Object (readonly)
Returns the value of attribute dynamodb_tables.
6 7 8 |
# File 'lib/belt/cli/backup_config.rb', line 6 def dynamodb_tables @dynamodb_tables end |
#retention ⇒ Object (readonly)
Returns the value of attribute retention.
6 7 8 |
# File 'lib/belt/cli/backup_config.rb', line 6 def retention @retention end |
#s3_buckets ⇒ Object (readonly)
Returns the value of attribute s3_buckets.
6 7 8 |
# File 'lib/belt/cli/backup_config.rb', line 6 def s3_buckets @s3_buckets end |
Class Method Details
.load(env, infra_dir: nil) ⇒ Object
Load backup config from infrastructure/
12 13 14 15 |
# File 'lib/belt/cli/backup_config.rb', line 12 def self.load(env, infra_dir: nil) env_config = EnvironmentConfig.load(env, infra_dir: infra_dir) env_config.backups? ? env_config.backup_config : nil end |
Instance Method Details
#any? ⇒ Boolean
32 33 34 |
# File 'lib/belt/cli/backup_config.rb', line 32 def any? dynamodb? || cognito? || @s3_buckets.any? end |
#cognito? ⇒ Boolean
28 29 30 |
# File 'lib/belt/cli/backup_config.rb', line 28 def cognito? @cognito_exports.any? end |
#dynamodb? ⇒ Boolean
24 25 26 |
# File 'lib/belt/cli/backup_config.rb', line 24 def dynamodb? !@dynamodb_tables.nil? end |