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

Version Path
cloudstack-cli-1.6.10 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.6.9 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.6.8 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.6.7 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.6.6 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.6.5 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.6.4 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.6.3 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.6.2 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.6.1 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.6.0 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.5.13 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.5.12 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.5.10 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.5.9 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.5.8 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.5.7 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.5.6 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.5.5 lib/cloudstack-cli/commands/disk_offer.rb
cloudstack-cli-1.5.4 lib/cloudstack-cli/commands/disk_offer.rb