Class: Project

Inherits:
CloudstackCli::Base show all
Defined in:
lib/cloudstack-cli/commands/project.rb

Constant Summary

Constants included from CloudstackCli::Helper

CloudstackCli::Helper::ASYNC_STATES

Instance Attribute Summary

Attributes inherited from CloudstackCli::Base

#config

Instance Method Summary collapse

Methods inherited from CloudstackCli::Base

exit_on_failure?

Methods included from CloudstackCli::Helper

#ask_number, #bootstrap_server, #bootstrap_server_interactive, #create_port_rules, #create_server, #print_job_status, #print_options, #update_job_status, #watch_jobs

Instance Method Details

#listObject



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cloudstack-cli/commands/project.rb', line 17

def list
  projects = client.list_projects
  if projects.size < 1
    puts "No projects found."
  else
    table = [["Name", "Displaytext", "Domain"]]
    projects.each do |project|
      table << [project['name'], project['displaytext'], project['domain']]
    end
    print_table(table)
    say "Total number of projects: #{projects.count}"
  end
end

#show(name) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/cloudstack-cli/commands/project.rb', line 5

def show(name)
  unless project = client.get_project(name)
    puts "No project with name #{name} found."
  else
    project.each do |key, value|
      say "#{key}: ", :yellow
      say "#{value}"
    end
  end
end