Class: Chef::Knife::AzureVnetList

Inherits:
Chef::Knife show all
Includes:
AzureBase
Defined in:
lib/chef/knife/azure_vnet_list.rb

Instance Method Summary collapse

Methods included from AzureBase

#connection, #find_file, included, #is_image_windows?, #locate_config_value, #msg_pair, #msg_server_summary, #parse_publish_settings_file, #validate!

Instance Method Details

#hlObject



30
31
32
# File 'lib/chef/knife/azure_vnet_list.rb', line 30

def hl
  @highline ||= HighLine.new
end

#runObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/chef/knife/azure_vnet_list.rb', line 34

def run
  $stdout.sync = true

  validate!

  cols = ['Name', 'Affinity Group', 'State']
  the_list = cols.map { |col| ui.color(col, :bold) }
  connection.vnets.all.each do |vnet|
    %w(name affinity_group state).each do |attr|
      the_list << vnet.send(attr).to_s
    end
  end

  puts "\n"
  puts hl.list(the_list, :uneven_columns_across, cols.size)
end