Sha256: 07372103f95f61ed462c4f4d59d5c89a9688ede48516667e0ecf4ef9f148dda6

Contents?: true

Size: 902 Bytes

Versions: 25

Compression:

Stored size: 902 Bytes

Contents

class Cluster < CloudstackCli::Base

  desc 'list', 'list clusters'
  option :zone, desc: "lists clusters by zone"
  option :format, default: "table",
    enum: %w(table json yaml)
  def list
    resolve_zone if options[:zone]
    clusters = client.list_clusters(options)
    if clusters.size < 1
      say "No clusters found."
    else
      case options[:format].to_sym
      when :yaml
        puts({clusters: clusters}.to_yaml)
      when :json
        puts JSON.pretty_generate(clusters: clusters)
      else
        table = [%w(Name Pod_Name Type Zone State)]
        clusters.each do |cluster|
          table << [
          	cluster['name'], cluster['podname'],
            cluster['hypervisortype'], cluster['zonename'],
            cluster['managedstate']
          ]
        end
        print_table table
        say "Total number of clusters: #{clusters.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/cluster.rb
cloudstack-cli-1.6.9 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.6.8 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.6.7 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.6.6 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.6.5 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.6.4 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.6.3 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.6.2 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.6.1 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.6.0 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.5.13 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.5.12 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.5.10 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.5.9 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.5.8 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.5.7 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.5.6 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.5.5 lib/cloudstack-cli/commands/cluster.rb
cloudstack-cli-1.5.4 lib/cloudstack-cli/commands/cluster.rb