Class: RightScaleCLI::Volumes
- Inherits:
-
Thor
- Object
- Thor
- RightScaleCLI::Volumes
- Defined in:
- lib/rightscale_cli/volumes.rb
Overview
Represents Storage Volumes
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ Volumes
constructor
A new instance of Volumes.
- #list ⇒ Object
- #show(volume_id) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Volumes
Returns a new instance of Volumes.
26 27 28 29 30 |
# File 'lib/rightscale_cli/volumes.rb', line 26 def initialize(*args) super @client = RightScaleCLI::Client.new() @logger = RightScaleCLI::Logger.new end |
Class Method Details
.banner(task, _namespace = true, subcommand = false) ⇒ Object
100 101 102 |
# File 'lib/rightscale_cli/volumes.rb', line 100 def self.(task, _namespace = true, subcommand = false) "#{basename} #{task.formatted_usage(self, true, subcommand)}" end |
Instance Method Details
#list ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/rightscale_cli/volumes.rb', line 71 def list filter = [] filter.push("datacenter_href==/api/clouds/#{[:cloud]}/datacenters/#{[:datacenter]}") if [:datacenter] filter.push("description==#{[:description]}") if [:description] filter.push("name==#{[:name]}") if [:name] filter.push("parent_volume_snapshot_href==#{[:parent]}") if [:parent] filter.push("resource_uid==#{[:resource_uid]}") if [:resource_uid] @logger.debug "filter: #{filter}" if [:debug] volumes = [] @client.client.clouds(id: [:cloud]) .show.volumes(filter: filter).index.each do |volume| volumes.push(volume.raw) end @client.render(volumes, 'volumes') end |
#show(volume_id) ⇒ Object
95 96 97 98 |
# File 'lib/rightscale_cli/volumes.rb', line 95 def show(volume_id) @client.render(@client.client.clouds(id: [:cloud]) .show.volumes(id: volume_id).show.raw, 'volume') end |