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 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
new (xml, client)

Class constructor


[show source]
    # File OpenNebula/User.rb, line 35
35:         def initialize(xml, client)
36:             super(xml,client)
37: 
38:             @client = client
39:         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 55
55:         def allocate(username, password)
56:             super(USER_METHODS[:allocate], username, password)
57:         end
delete ()

Deletes the User

[show source]
    # File OpenNebula/User.rb, line 60
60:         def delete()
61:             super(USER_METHODS[:delete])
62:         end
info ()

Retrieves the information of the given User.

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

Changes the password of the given User

password String containing the new password

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