Class: Project
Constant Summary
CloudstackCli::Helper::ASYNC_STATES
Instance Attribute Summary
#config
Instance Method Summary
collapse
exit_on_failure?
#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
#list ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/cloudstack-cli/commands/project.rb', line 16
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
|
#list_accounts(name) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/cloudstack-cli/commands/project.rb', line 31
def list_accounts(name)
unless project = client.get_project(name)
say "No project with name #{name} found."
else
accounts = client.list_project_accounts(project['id'], options)
if accounts.size < 1
say "No project accounts found."
else
table = [%w(Name Type Domain State)]
accounts.each do |account|
table << [
account['name'],
TYPES[account['accounttype']],
account['domain'],
account['state']
]
end
print_table table
say "Total number of project accounts: #{accounts.size}"
print_table table
end
end
end
|
#show(name) ⇒ Object
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/cloudstack-cli/commands/project.rb', line 4
def show(name)
unless project = client.get_project(name)
puts "No project with name #{name} found."
else
table = project.map do |key, value|
[ set_color("#{key}", :yellow), "#{value}" ]
end
print_table table
end
end
|