Class: RightScaleSelfService::Cli::Execution

Inherits:
Base
  • Object
show all
Defined in:
lib/rightscale_selfservice/cli/execution.rb

Instance Method Summary collapse

Instance Method Details

#listObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/rightscale_selfservice/cli/execution.rb', line 28

def list
  client = get_api_client()

  begin
    response = client.manager.execution.index
    executions = JSON.parse(response.body)
    if @options["property"]
      executions.each do |execution|
        execution.delete_if{|k,v| !(@options["property"].include?(k))}
      end
    end
    puts JSON.pretty_generate(executions)
  rescue RestClient::ExceptionWithResponse => e
    shell = Thor::Shell::Color.new
    message = "Failed to list executions\n\n#{RightScaleSelfService::Api::Client.format_error(e)}"
    logger.error(shell.set_color message, :red)
  end
end