class Region

Public Instance Methods

list() click to toggle source
   # File lib/cloudstack-cli/commands/region.rb
 6 def list
 7   regions = client.list_regions
 8   if regions.size < 1
 9     say "No regions found."
10   else
11     case options[:format].to_sym
12     when :yaml
13       puts({regions: regions}.to_yaml)
14     when :json
15       puts JSON.pretty_generate(regions: regions)
16     else
17       table = [%w(Name, Endpoint)]
18       regions.each do |region|
19         table << [
20               region['name'], region['endpoint']
21         ]
22       end
23       print_table table
24       say "Total number of regions: #{regions.size}"
25     end
26   end
27 end