Class: Network

Inherits:
CloudstackCli::Base show all
Defined in:
lib/cloudstack-cli/commands/network.rb

Instance Attribute Summary

Attributes inherited from CloudstackCli::Base

#config

Instance Method Summary collapse

Instance Method Details

#create(name) ⇒ Object



4
5
6
# File 'lib/cloudstack-cli/commands/network.rb', line 4

def create(name)
  # TODO
end

#listObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/cloudstack-cli/commands/network.rb', line 11

def list
  project = find_project if options[:project]

  networks = []
  if project
    networks = client.list_networks(project['id'])
  else
    networks = client.list_networks(-1, options[:account] != '' ? options[:account] : nil )
    networks + client.list_networks(nil, options[:account] != '' ? options[:account] : nil )
  end

  if networks.size < 1
    puts "No networks found"
  else
    table = [["Name", "Displaytext", "Account", "Project", "State", "ID"]]
    networks.each do |network|
      table << [
        network["name"],
        network["displaytext"],
        network["account"],
        network["project"],
        network["state"],
        network["id"]
      ]
    end
    print_table table
  end
end