Class: RightScaleCLI::Clouds

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Clouds

Returns a new instance of Clouds.



25
26
27
28
29
# File 'lib/rightscale_cli/clouds.rb', line 25

def initialize(*args)
  super
  @client = RightScaleCLI::Client.new(options)
  @logger = RightScaleCLI::Logger.new()
end

Class Method Details



66
67
68
# File 'lib/rightscale_cli/clouds.rb', line 66

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

Instance Method Details

#listObject



35
36
37
# File 'lib/rightscale_cli/clouds.rb', line 35

def list()
  @client.render(@client.get('clouds'), 'clouds')
end

#searchObject



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

def search()
  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]

  @logger.info "Searching for clouds!"

  puts "filter: #{filter}" if options[:debug]
  
  clouds = []
  @client.client.clouds.index(:filter => filter).each { |cloud|
    clouds.push(cloud.raw)
  }  

  @client.render(clouds, 'clouds')
end

#show(cloud_id) ⇒ Object



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

def show(cloud_id)
  @client.render(@client.show('clouds', cloud_id), 'cloud')
end