13 def list
14 add_filters_to_options("listIsos") if options[:filter]
15 resolve_project
16 resolve_zone
17 resolve_account
18 options[:isofilter] = options[:type]
19 options.delete :type
20 isos = client.list_isos(options)
21 isos = filter_objects(isos) if options[:filter]
22 if isos.size < 1
23 puts "No ISO's found."
24 else
25 case options[:format].to_sym
26 when :yaml
27 puts({isos: isos}.to_yaml)
28 when :json
29 puts JSON.pretty_generate(isos: isos)
30 else
31 table = [%w(Name Zone Bootable Public Featured)]
32 isos.each do |iso|
33 table << [
34 iso['name'],
35 iso['zonename'],
36 iso['bootable'],
37 iso['ispublic'],
38 iso['isfeatured']
39 ]
40 end
41 print_table(table)
42 say "Total number of ISO's: #{isos.size}"
43 end
44 end
45 end