Class: Chef::Knife::NcImageList

Inherits:
Chef::Knife show all
Includes:
NcBase
Defined in:
lib/chef/knife/nc_image_list.rb

Instance Method Summary collapse

Methods included from NcBase

#connection, included, #locate_config_value, #msg_pair, #validate!

Instance Method Details

#runObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/chef/knife/nc_image_list.rb', line 29

def run
  $stdout.sync = true

  validate!

  image_list = [
    ui.color('Image ID', :bold),
    ui.color('Name', :bold),
    ui.color('Owner', :bold),
    ui.color('State', :bold)
  ]
  connection.describe_images.imagesSet.item.each do |image|
    image_list << image.imageId
    image_list << image.name
    image_list << "#{image.imageOwnerId} (#{image.imageOwnerAlias})"
    image_list << "#{image.imageState} (#{image.isPublic ? 'public' : 'private'})"
  end
  puts ui.list(image_list, :columns_across, 4)

end