lib/cloudstack-cli/commands/project.rb in cloudstack-cli-0.14.0 vs lib/cloudstack-cli/commands/project.rb in cloudstack-cli-0.14.1

- old
+ new

@@ -25,6 +25,31 @@ print_table(table) say "Total number of projects: #{projects.count}" end end + desc "list_accounts PROJECT_NAME", "show accounts belonging to a project" + 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 + end