Sha256: 51cc5f39c87bda361083e04ca4e2fe38d7dd72d87585cadf77d12bfde07ff1e2

Contents?: true

Size: 618 Bytes

Versions: 2

Compression:

Stored size: 618 Bytes

Contents

class Volume < Thor
  desc "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.3 lib/cloudstack-cli/commands/volume.rb
cloudstack-cli-0.0.2 lib/cloudstack-cli/commands/volume.rb