Sha256: 50576b740c9af111696edb9f026e97093d7f5cd3a74d389bd13ec3db731e7fdd

Contents?: true

Size: 860 Bytes

Versions: 9

Compression:

Stored size: 860 Bytes

Contents

class IpAddress < CloudstackCli::Base

  desc "release ID", "release public IP address"
  def release(id)
    puts "OK" if client.disassociate_ip_address(id)
  end

  desc "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"]]
  	client.list_public_ip_addresses(options).each do |address|
  		table << [address["ipaddress"], address["account"], address["zonename"]]
  	end
  	print_table table
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cloudstack-cli-0.3.1 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.2.2 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.2.1 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.2.0 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.1.7 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.1.6 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.1.5 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.1.4 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.1.3 lib/cloudstack-cli/commands/ip_address.rb