Sha256: 09f452dc5393c093984b79fdacd7d3ca697248810788f56c2d3c864f99780001

Contents?: true

Size: 629 Bytes

Versions: 7

Compression:

Stored size: 629 Bytes

Contents

class User < CloudstackCli::Base

  USER_TYPES = {
    0 => 'user',
    1 => 'domain-admin',
    2 => 'admin'
  }

  desc 'list', 'list users'
  option :listall
  option :account
  def list
    users = client.list_users(options)
    if users.size < 1
      say "No users found."
    else
      table = [["Account", "Type", "Name", "Email", "State", "Domain"]]
      users.each do |user|
        table << [
          user['account'], USER_TYPES[user['accounttype']], "#{user['firstname']} #{user['lastname']}",
          user['email'], user['state'], user['domain']
        ]
      end
      print_table table
    end
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cloudstack-cli-0.5.8 lib/cloudstack-cli/commands/user.rb
cloudstack-cli-0.5.5 lib/cloudstack-cli/commands/user.rb
cloudstack-cli-0.5.4 lib/cloudstack-cli/commands/user.rb
cloudstack-cli-0.5.3 lib/cloudstack-cli/commands/user.rb
cloudstack-cli-0.5.2 lib/cloudstack-cli/commands/user.rb
cloudstack-cli-0.5.1 lib/cloudstack-cli/commands/user.rb
cloudstack-cli-0.5.0 lib/cloudstack-cli/commands/user.rb