Sha256: f3bf1b1b1ed5cf8efef53ef75f336aa944cbbb250fd7c2a9978dadfdb43fe0a0

Contents?: true

Size: 684 Bytes

Versions: 25

Compression:

Stored size: 684 Bytes

Contents

class Region < CloudstackCli::Base

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