class RightScaleCLI::Volumes
Represents Storage Volumes
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/rightscale_cli/volumes.rb, line 26 def initialize(*args) super @client = RightScaleCLI::Client.new(options) @logger = RightScaleCLI::Logger.new end
Public Instance Methods
list()
click to toggle source
# File lib/rightscale_cli/volumes.rb, line 71 def list filter = [] filter.push("datacenter_href==/api/clouds/#{options[:cloud]}/datacenters/#{options[:datacenter]}") if options[:datacenter] filter.push("description==#{options[:description]}") if options[:description] filter.push("name==#{options[:name]}") if options[:name] filter.push("parent_volume_snapshot_href==#{options[:parent]}") if options[:parent] filter.push("resource_uid==#{options[:resource_uid]}") if options[:resource_uid] @logger.debug "filter: #{filter}" if options[:debug] volumes = [] @client.client.clouds(id: options[:cloud]) .show.volumes(filter: filter).index.each do |volume| volumes.push(volume.raw) end @client.render(volumes, 'volumes') end
show(volume_id)
click to toggle source
# File lib/rightscale_cli/volumes.rb, line 95 def show(volume_id) @client.render(@client.client.clouds(id: options[:cloud]) .show.volumes(id: volume_id).show.raw, 'volume') end