Class: IpAddress

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

Instance Attribute Summary

Attributes inherited from CloudstackCli::Base

#config

Instance Method Summary collapse

Methods inherited from CloudstackCli::Base

exit_on_failure?

Instance Method Details

#assign(network) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/cloudstack-cli/commands/ip_address.rb', line 10

def assign(network)
  project = find_project if options[:project]
  unless network = client.get_network(network, project ? project["id"] : nil)
    error "Network #{network} not found."
    exit 1
  end
  ip = client.associate_ip_address(network["id"])
  puts
  say ip['ipaddress']
end

#listObject



25
26
27
28
29
30
31
# File 'lib/cloudstack-cli/commands/ip_address.rb', line 25

def list
  table = [["Address", "Account", "Zone"]]
  client.list_public_ip_addresses(options).each do |address|
    table << [address["ipaddress"], address["account"], address["zonename"]]
  end
  print_table table
end

#release(id) ⇒ Object



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

def release(id)
  puts "OK" if client.disassociate_ip_address(id)
end