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

Version Path
cloudstack-cli-0.15.1 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.15.0 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.14.1 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.14.0 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.13.1 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.13.0 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.12.3 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.12.2 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.12.1 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.12.0 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.11.2 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.11.1 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.11.0 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.10.2 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.10.1 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.10.0 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.9.1 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.9.0 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.8.3 lib/cloudstack-cli/commands/ip_address.rb
cloudstack-cli-0.8.2 lib/cloudstack-cli/commands/ip_address.rb