
Constants
USER_METHODS | = | { :info => "user.info", :allocate => "user.allocate", :delete => "user.delete", :passwd => "user.passwd" } |
Constants and Class Methods |
Public class methods
Creates a User description with just its identifier this method should be used to create plain User objects. id the id of the user
Example:
user = User.new(User.build_xml(3),rpc_client)
# File OpenNebula/User.rb, line 22 22: def User.build_xml(pe_id=nil) 23: if pe_id 24: user_xml = "<USER><ID>#{pe_id}</ID></USER>" 25: else 26: user_xml = "<USER></USER>" 27: end 28: 29: XMLElement.build_xml(user_xml, 'USER') 30: end
Class constructor
# File OpenNebula/User.rb, line 35 35: def initialize(xml, client) 36: super(xml,client) 37: 38: @client = client 39: end
Public instance methods
Allocates a new User in OpenNebula
username Name of the new user.
password Password for the new user
# File OpenNebula/User.rb, line 55 55: def allocate(username, password) 56: super(USER_METHODS[:allocate], username, password) 57: end
Deletes the User
# File OpenNebula/User.rb, line 60 60: def delete() 61: super(USER_METHODS[:delete]) 62: end
Retrieves the information of the given User.
# File OpenNebula/User.rb, line 46 46: def info() 47: super(USER_METHODS[:info], 'USER') 48: end
Changes the password of the given User
password String containing the new password
# File OpenNebula/User.rb, line 67 67: def passwd(password) 68: return Error.new('ID not defined') if !@pe_id 69: 70: rc = @client.call(USER_METHODS[:passwd], @pe_id, password) 71: rc = nil if !OpenNebula.is_error?(rc) 72: 73: return rc 74: end