Class: AdminModule::Command::Snapshot
- Inherits:
-
Thor
- Object
- Thor
- AdminModule::Command::Snapshot
- Includes:
- ClientAccess
- Defined in:
- lib/admin_module/command/snapshot.rb
Instance Method Summary collapse
- #export(filepath) ⇒ Object
- #import(filepath) ⇒ Object
- #list ⇒ Object
- #read(name) ⇒ Object
- #rename(src, dest) ⇒ Object
Instance Method Details
#export(filepath) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/admin_module/command/snapshot.rb', line 59 def export filepath cl = client.snapshots cl.export filepath ensure client.logout end |
#import(filepath) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/admin_module/command/snapshot.rb', line 42 def import filepath cl = client.snapshots cl.import filepath ensure client.logout end |
#list ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/admin_module/command/snapshot.rb', line 23 def list cl = client.snapshots list = cl.list list.each { |item| say item; } ensure client.logout end |
#read(name) ⇒ Object
98 99 100 101 102 103 104 105 106 107 |
# File 'lib/admin_module/command/snapshot.rb', line 98 def read name cl = client.snapshots data = cl.read name output = Hash.new output[name] = data $stdout << output.to_yaml ensure client.logout end |
#rename(src, dest) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/admin_module/command/snapshot.rb', line 77 def rename src, dest cl = client.snapshots cl.rename src, dest rescue ArgumentError => e say e., :red ensure client.logout end |