Sha256: e3f74e9adc8d1069230858e165c3a97e9c9c0f2f328fe085d2c7bba8e7f61b58
Contents?: true
Size: 1.13 KB
Versions: 25
Compression:
Stored size: 1.13 KB
Contents
class DiskOffer < CloudstackCli::Base desc 'list', 'list disk offerings' option :domain, desc: "the domain of the disk offering" option :format, default: "table", enum: %w(table json yaml) option :filter, type: :hash, desc: "filter objects based on arrtibutes: (attr1:regex attr2:regex ...)" def list resolve_domain add_filters_to_options("listDiskOfferings") if options[:filter] offerings = client.list_disk_offerings(options) offerings = filter_objects(offerings) if options[:filter] if offerings.size < 1 puts "No offerings found." else case options[:format].to_sym when :yaml puts({disk_offers: offerings}.to_yaml) when :json puts JSON.pretty_generate(disk_offers: offerings) else table = [["Name", "Displaytext", "Domain", "ID"]] offerings.each do |offering| table << [ offering["name"], offering["displaytext"], offering["domain"], offering["id"] ] end print_table table say "Total number of offerings: #{offerings.size}" end end end end
Version data entries
25 entries across 25 versions & 1 rubygems