Class: IpAddress
- Inherits:
-
CloudstackCli::Base
- Object
- Thor
- CloudstackCli::Base
- IpAddress
- Defined in:
- lib/cloudstack-cli/commands/ip_address.rb
Instance Attribute Summary
Attributes inherited from CloudstackCli::Base
Instance Method Summary collapse
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 [: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 |
#list ⇒ Object
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().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 |