Class: Volume

Inherits:
Thor
  • Object
show all
Defined in:
lib/cloudstack-cli/commands/volume.rb

Instance Method Summary collapse

Instance Method Details

#listObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/cloudstack-cli/commands/volume.rb', line 4

def list
  cs_cli = CloudstackCli::Helper.new(options[:config])
  if options[:project]
    project = cs_cli.projects.select { |p| p['name'] == options[:project] }.first
    raise "Project '#{options[:project]}' not found" unless project
  end
  
  networks = cs_cli.networks(project ? project['id'] : nil)
  if networks.size < 1
    puts "No networks found"
  else
    networks.each do |network|
      puts "#{network['name']} - #{network['displaytext']} #{' - Default' if network['isdefault']}"
    end
  end
end