Class: Belt::CLI::BackupRunner
- Inherits:
-
Object
- Object
- Belt::CLI::BackupRunner
- Defined in:
- lib/belt/cli/backup_runner.rb
Instance Method Summary collapse
-
#initialize(env, config, infra_dir:, app_name:) ⇒ BackupRunner
constructor
A new instance of BackupRunner.
- #run ⇒ Object
Constructor Details
#initialize(env, config, infra_dir:, app_name:) ⇒ BackupRunner
Returns a new instance of BackupRunner.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/belt/cli/backup_runner.rb', line 11 def initialize(env, config, infra_dir:, app_name:) @env = env @config = config @infra_dir = infra_dir @app_name = app_name @timestamp = Time.now.strftime('%Y%m%d-%H%M%S') @backup_bucket = sanitize_bucket_name("#{@app_name}-backups-#{@env}") @errors = [] @summary = [] end |
Instance Method Details
#run ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/belt/cli/backup_runner.rb', line 22 def run ensure_backup_bucket! backup_dynamodb if @config.dynamodb? backup_cognito if @config.cognito? backup_s3_buckets if @config.s3_buckets.any? cleanup_old_backups! print_summary abort "\n✗ Backup completed with errors (see above)" if @errors.any? end |