Class OpenNebula::User

  1. OpenNebula/User.rb
Pool VirtualNetworkPool ClusterPool ImagePool VirtualMachinePool HostPool UserPool XMLElement PoolElement XMLPool User VirtualNetwork Cluster Image VirtualMachine Host Enumerable Client ImageRepository Error OpenNebula dot/f_0.png

Methods

public class

  1. build_xml
  2. new

public instance

  1. allocate
  2. delete
  3. info
  4. passwd

Constants

USER_METHODS = { :info => "user.info", :allocate => "user.allocate", :delete => "user.delete", :passwd => "user.passwd" }  

Constants and Class Methods


Public class methods

build_xml (pe_id=nil)

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)
[show source]
    # 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
new (xml, client)

Class constructor


[show source]
    # File OpenNebula/User.rb, line 51
51:         def initialize(xml, client)
52:             super(xml,client)
53: 
54:             @client = client
55:         end

Public instance methods

allocate (username, password)

Allocates a new User in OpenNebula

username Name of the new user.

password Password for the new user

[show source]
    # File OpenNebula/User.rb, line 71
71:         def allocate(username, password)
72:             super(USER_METHODS[:allocate], username, password)
73:         end
delete ()

Deletes the User

[show source]
    # File OpenNebula/User.rb, line 76
76:         def delete()
77:             super(USER_METHODS[:delete])
78:         end
info ()

Retrieves the information of the given User.

[show source]
    # File OpenNebula/User.rb, line 62
62:         def info()
63:             super(USER_METHODS[:info], 'USER')
64:         end
passwd (password)

Changes the password of the given User

password String containing the new password

[show source]
    # 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