
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 38 38: def User.build_xml(pe_id=nil) 39: if pe_id 40: user_xml = "<USER><ID>#{pe_id}</ID></USER>" 41: else 42: user_xml = "<USER></USER>" 43: end 44: 45: XMLElement.build_xml(user_xml, 'USER') 46: end
Class constructor
# File OpenNebula/User.rb, line 51 51: def initialize(xml, client) 52: super(xml,client) 53: 54: @client = client 55: 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 71 71: def allocate(username, password) 72: super(USER_METHODS[:allocate], username, password) 73: end
Deletes the User
# File OpenNebula/User.rb, line 76 76: def delete() 77: super(USER_METHODS[:delete]) 78: end
Retrieves the information of the given User.
# File OpenNebula/User.rb, line 62 62: def info() 63: super(USER_METHODS[:info], 'USER') 64: end
Changes the password of the given User
password String containing the new password
# File OpenNebula/User.rb, line 83 83: def passwd(password) 84: return Error.new('ID not defined') if !@pe_id 85: 86: rc = @client.call(USER_METHODS[:passwd], @pe_id, password) 87: rc = nil if !OpenNebula.is_error?(rc) 88: 89: return rc 90: end