Sha256: b3864317e4117723c6b60ff479ab20a8e1fda7d5330f96baa9179a712c591983
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
require 'thor' require 'thor/aws' module PreserveRdsSnapshot class CLI < Thor include Thor::Aws desc :list, 'Show list of RDS Snapshots' option :snapshot_type, aliases: [:t], type: :string, desc: "snapshot type (manual or automated)" def list begin resp = rds.client.describe_db_snapshots( snapshot_type: options[:snapshot_type] ) resp.db_snapshots.each do |s| puts "#{s.db_snapshot_identifier}\t#{s.snapshot_create_time}" end rescue ::Aws::Errors::ServiceError => e $stderr.puts e end end desc :preserve, 'copy automated snapshot to manual' option :source_db_snapshot_identifier, aliases: [:o], type: :string, desc: 'source snapshot identifier', required: true option :target_db_snapshot_identifier, aliases: [:t], type: :string, desc: 'target snapshot identifier', required: true def preserve begin resp = rds.client.copy_db_snapshot( source_db_snapshot_identifier: options[:source_db_snapshot_identifier], target_db_snapshot_identifier: options[:target_db_snapshot_identifier], tags: [key: 'type', value: 'preserve'] ) s = resp.db_snapshot puts "#{s.db_snapshot_identifier}\t#{s.snapshot_create_time}" rescue ::Aws::Errors::ServiceError => e $stderr.puts e end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
preserve-rds-snapshot-0.1.1 | lib/preserve-rds-snapshot/cli.rb |
preserve-rds-snapshot-0.1.0 | lib/preserve-rds-snapshot/cli.rb |