Class: RightScaleCLI::Clouds

Inherits:
Thor
  • Object
show all
Defined in:
lib/rightscale_cli/clouds.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



68
69
70
# File 'lib/rightscale_cli/clouds.rb', line 68

def self.banner(task, namespace = true, subcommand = false)
  "#{basename} #{task.formatted_usage(self, true, subcommand)}"
end

Instance Method Details

#listObject



28
29
30
31
32
33
34
35
# File 'lib/rightscale_cli/clouds.rb', line 28

def list()
  rightscale = RightApi::Client.new(RightScaleCLI::Config::API)
  clouds = []
  rightscale.clouds.index.each { |cloud|
    clouds.push(cloud.raw)
  }  
  puts clouds.to_yaml
end

#searchObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/rightscale_cli/clouds.rb', line 48

def search()
  log = CLILogger.new

  filter = []
  filter.push("name==#{options[:name]}") if options[:name]
  filter.push("cloud_type==#{options[:cloud_type]}") if options[:cloud_type]
  filter.push("description==#{options[:cloud]}") if options[:description]

  log.info("Searching for clouds!")

  puts "filter: #{filter}" if options[:debug]
  
  rightscale = RightApi::Client.new(RightScaleCLI::Config::API)      
  clouds = []
  rightscale.clouds.index(:filter => filter).each { |cloud|
    clouds.push(cloud.raw)
  }  
  puts clouds.to_yaml
end

#show(cloud_id) ⇒ Object



38
39
40
41
42
# File 'lib/rightscale_cli/clouds.rb', line 38

def show(cloud_id)
  rightscale = RightApi::Client.new(RightScaleCLI::Config::API)
  cloud = rightscale.clouds(:id => cloud_id).show.raw
  puts cloud.to_yaml
end