Class: VagrantPlugins::Openstack::Command::FloatingIpList
- Inherits:
-
OpenstackCommand
- Object
- AbstractCommand
- OpenstackCommand
- VagrantPlugins::Openstack::Command::FloatingIpList
- Defined in:
- lib/vagrant-openstack-illuin-provider/command/floatingip_list.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from OpenstackCommand
Methods included from Utils
#display_item_list, #display_table
Methods inherited from AbstractCommand
#before_cmd, #execute, #initialize, #normalize_args
Constructor Details
This class inherits a constructor from VagrantPlugins::Openstack::Command::AbstractCommand
Class Method Details
.synopsis ⇒ Object
7 8 9 |
# File 'lib/vagrant-openstack-illuin-provider/command/floatingip_list.rb', line 7 def self.synopsis I18n.t('vagrant_openstack.command.flaotingip_list_synopsis') end |
Instance Method Details
#cmd(name, argv, env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vagrant-openstack-illuin-provider/command/floatingip_list.rb', line 11 def cmd(name, argv, env) fail Errors::NoArgRequiredForCommand, cmd: name unless argv.size == 0 floating_ip_pools = env[:openstack_client].nova.get_floating_ip_pools(env) floating_ips = env[:openstack_client].nova.get_floating_ips(env) rows = [] floating_ip_pools.each do |floating_ip_pool| rows << [floating_ip_pool['name']] end display_table(env, ['Floating IP pools'], rows) rows = [] floating_ips.each do |floating_ip| rows << [floating_ip['id'], floating_ip['ip'], floating_ip['pool'], floating_ip['instance_id']] end display_table(env, ['ID', 'IP', 'Pool', 'Instance ID'], rows) end |