class Cluster
Public Instance Methods
list()
click to toggle source
# File lib/cloudstack-cli/commands/cluster.rb 7 def list 8 resolve_zone if options[:zone] 9 clusters = client.list_clusters(options) 10 if clusters.size < 1 11 say "No clusters found." 12 else 13 case options[:format].to_sym 14 when :yaml 15 puts({clusters: clusters}.to_yaml) 16 when :json 17 puts JSON.pretty_generate(clusters: clusters) 18 else 19 table = [%w(Name Pod_Name Type Zone State)] 20 clusters.each do |cluster| 21 table << [ 22 cluster['name'], cluster['podname'], 23 cluster['hypervisortype'], cluster['zonename'], 24 cluster['managedstate'] 25 ] 26 end 27 print_table table 28 say "Total number of clusters: #{clusters.size}" 29 end 30 end 31 end