Sha256: 730cafb1f1595bc6db63ba5c0f7a032b90a92661744583fca782c0cbd565bde6
Contents?: true
Size: 1.03 KB
Versions: 29
Compression:
Stored size: 1.03 KB
Contents
class IpAddress < CloudstackCli::Base desc "release ID", "release public IP address" def release(id) say("OK", :green) if client.disassociate_ip_address(id) end desc "ip_address assign NETWORK", "assign a public IP address" option :project 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 desc "list", "list public IP address" option :project option :account option :listall def list table = [["Address", "Account", "Zone"]] addresses = client.list_public_ip_addresses(options) if addresses.size < 1 say "No ip addresses found." else addresses.each do |address| table << [address["ipaddress"], address["account"], address["zonename"]] end print_table table say "Total number of addresses: #{addresses.size}" end end end
Version data entries
29 entries across 29 versions & 1 rubygems