Class: RightScaleCLI::Volumes
- Inherits:
-
Thor
- Object
- Thor
- RightScaleCLI::Volumes
- Defined in:
- lib/rightscale_cli/volumes.rb
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.
25 26 27 28 29 |
# File 'lib/rightscale_cli/volumes.rb', line 25 def initialize(*args) super @client = RightScaleCLI::Client.new() @logger = RightScaleCLI::Logger.new() end |
Class Method Details
.banner(task, namespace = true, subcommand = false) ⇒ Object
65 66 67 |
# File 'lib/rightscale_cli/volumes.rb', line 65 def self.(task, namespace = true, subcommand = false) "#{basename} #{task.formatted_usage(self, true, subcommand)}" end |
Instance Method Details
#list ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/rightscale_cli/volumes.rb', line 41 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 { |volume| volumes.push(volume.raw) } @client.render(volumes, 'volumes') end |
#show(volume_id) ⇒ Object
61 62 63 |
# File 'lib/rightscale_cli/volumes.rb', line 61 def show(volume_id) @client.render(@client.client.clouds(:id => [:cloud]).show.volumes(:id => volume_id).show.raw, 'volume') end |