Class: Chef::Knife::SoftlayerVlanShow
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::SoftlayerVlanShow
- Includes:
- SoftlayerBase
- Defined in:
- lib/chef/knife/softlayer_vlan_show.rb
Constant Summary
Constants included from SoftlayerBase
Chef::Knife::SoftlayerBase::USER_AGENT
Instance Method Summary collapse
Methods included from SoftlayerBase
#compute, #connection, included, #locate_config_value, #msg_pair, #network
Instance Method Details
#run ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/chef/knife/softlayer_vlan_show.rb', line 18 def run unless name_args.size == 1 puts ui.color("Specify exactly one vlan to show.", :red) show_usage exit 1 end $stdout.sync = true vlan = connection(:network).networks.get(name_args[0]) puts "#{ui.color("ID:", :green)} #{vlan.id}" puts "#{ui.color("Name:", :green)} #{vlan.name ? vlan.name : '[none]'}" puts "#{ui.color("Datacenter:", :green)} #{vlan.datacenter.name}" puts "#{ui.color("Network Space:", :green)} #{vlan.network_space}" puts "#{ui.color("Router:", :green)} #{vlan.router['hostname']}" puts "#{ui.color("Subnets:", :green)}" puts Formatador.display_table(vlan.subnets.map { |s| s.attributes.reject { |k,v| k.is_a?(String) } }, [:id, :cidr, :gateway_ip, :network_id, :broadcast, :type, :datacenter, :ip_version]) end |