Sha256: 34ecaa2c1eb8c945e5ae355e4e43ca0725a80538ab3681298ec20fef518e3c89

Contents?: true

Size: 625 Bytes

Versions: 2

Compression:

Stored size: 625 Bytes

Contents

class Volume < Thor
  desc "volume list", "list networks"
  option :project
  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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cloudstack-cli-0.0.5 lib/cloudstack-cli/commands/volume.rb
cloudstack-cli-0.0.4 lib/cloudstack-cli/commands/volume.rb