9 def list
10 resolve_domain
11 add_filters_to_options("listDiskOfferings") if options[:filter]
12 offerings = client.list_disk_offerings(options)
13 offerings = filter_objects(offerings) if options[:filter]
14 if offerings.size < 1
15 puts "No offerings found."
16 else
17 case options[:format].to_sym
18 when :yaml
19 puts({disk_offers: offerings}.to_yaml)
20 when :json
21 puts JSON.pretty_generate(disk_offers: offerings)
22 else
23 table = [["Name", "Displaytext", "Domain", "ID"]]
24 offerings.each do |offering|
25 table << [
26 offering["name"],
27 offering["displaytext"],
28 offering["domain"],
29 offering["id"]
30 ]
31 end
32 print_table table
33 say "Total number of offerings: #{offerings.size}"
34 end
35 end
36 end