Sha256: 5da857aac194005583d189f46a374f15340086991d22c674560ce3b3499fd00b

Contents?: true

Size: 766 Bytes

Versions: 12

Compression:

Stored size: 766 Bytes

Contents

class Capacity < CloudstackCli::Base
	TYPES = {
		0 => "Memory",
		1 => "CPU",
		2 => "Storage",
		3 => "Storage Allocated",
		4 => "Public IP's",
		5 => "Private IP's",
		6 => "Secondary Storage",
		7 => "VLAN",
		8 => "Direct Attached Public IP's",
		9 => "Local Storage"
	}

  desc "list", "list system capacity"
  option :zone
  def list
  	capacities = client.list_capacity
  	table = []
    header = ["Zone", "Type", "Capacity Used", "Capacity Total", "Used"]
    capacities.each do |c|
    	table << [
    		c['zonename'],
    	 	TYPES[c['type']],
    	 	c['capacityused'],
    	 	c['capacitytotal'],
    	 	"#{c['percentused']}%"
    	]
    end
    table = table.sort {|a, b|  [a[0], a[1]] <=> [b[0], b[1]]}.insert(0, header)
    print_table table
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cloudstack-cli-0.3.1 lib/cloudstack-cli/commands/capacity.rb
cloudstack-cli-0.2.2 lib/cloudstack-cli/commands/capacity.rb
cloudstack-cli-0.2.1 lib/cloudstack-cli/commands/capacity.rb
cloudstack-cli-0.2.0 lib/cloudstack-cli/commands/capacity.rb
cloudstack-cli-0.1.7 lib/cloudstack-cli/commands/capacity.rb
cloudstack-cli-0.1.6 lib/cloudstack-cli/commands/capacity.rb
cloudstack-cli-0.1.5 lib/cloudstack-cli/commands/capacity.rb
cloudstack-cli-0.1.4 lib/cloudstack-cli/commands/capacity.rb
cloudstack-cli-0.1.3 lib/cloudstack-cli/commands/capacity.rb
cloudstack-cli-0.1.2 lib/cloudstack-cli/commands/capacity.rb
cloudstack-cli-0.1.1 lib/cloudstack-cli/commands/capacity.rb
cloudstack-cli-0.1.0 lib/cloudstack-cli/commands/capacity.rb