OpenNebula
Cloud API

org.opennebula.client.user
Class User

java.lang.Object
  extended by org.opennebula.client.PoolElement
      extended by org.opennebula.client.user.User

public class User
extends PoolElement

This class represents an OpenNebula User. It also offers static XML-RPC call wrappers.


Field Summary
 
Fields inherited from class org.opennebula.client.PoolElement
client, id, xml, xpath
 
Constructor Summary
  User(int id, Client client)
          Creates a new User representation.
protected User(org.w3c.dom.Node xmlElement, Client client)
           
 
Method Summary
static OneResponse allocate(Client client, java.lang.String username, java.lang.String password)
          Allocates a new user in OpenNebula.
static OneResponse allocate(Client client, java.lang.String username, java.lang.String password, java.lang.String auth)
          Allocates a new user in OpenNebula.
static OneResponse chauth(Client client, int id, java.lang.String auth, java.lang.String password)
          Changes the auth driver and the password of the given user
 OneResponse chauth(java.lang.String auth)
          Changes the auth driver of the given user
 OneResponse chauth(java.lang.String auth, java.lang.String password)
          Changes the auth driver and the password of the given user
static OneResponse chgrp(Client client, int id, int gid)
          Changes the main group of the given user
 OneResponse chgrp(int gid)
          Changes the main group of the given user
 OneResponse delete()
          Deletes the user from OpenNebula.
static OneResponse delete(Client client, int id)
          Deletes a user from OpenNebula.
 OneResponse info()
          Loads the xml representation of the user.
static OneResponse info(Client client, int id)
          Retrieves the information of the given user.
 boolean isEnabled()
          Returns true if the user is enabled.
static OneResponse passwd(Client client, int id, java.lang.String password)
          Changes the password for the given user.
 OneResponse passwd(java.lang.String password)
          Changes the password for the user.
static OneResponse setQuota(Client client, int id, java.lang.String quota_template)
          Replaces the user quota template contents.
 OneResponse setQuota(java.lang.String quota_template)
          Replaces the user quota template contents.
static OneResponse update(Client client, int id, java.lang.String new_template)
          Replaces the user template contents.
 OneResponse update(java.lang.String new_template)
          Replaces the user template contents.
 
Methods inherited from class org.opennebula.client.PoolElement
chmod, chmod, chmod, getId, getName, gid, id, processInfo, state, uid, xpath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

User

public User(int id,
            Client client)
Creates a new User representation.

Parameters:
id - The user id (uid).
client - XML-RPC Client.

User

protected User(org.w3c.dom.Node xmlElement,
               Client client)
See Also:
PoolElement
Method Detail

allocate

public static OneResponse allocate(Client client,
                                   java.lang.String username,
                                   java.lang.String password)
Allocates a new user in OpenNebula.

Parameters:
client - XML-RPC Client.
username - Username for the new user.
password - Password for the new user
Returns:
If successful the message contains the associated id (int uid) generated for this user.

allocate

public static OneResponse allocate(Client client,
                                   java.lang.String username,
                                   java.lang.String password,
                                   java.lang.String auth)
Allocates a new user in OpenNebula.

Parameters:
client - XML-RPC Client.
username - Username for the new user.
password - Password for the new user
auth - Auth driver for the new user.
Returns:
If successful the message contains the associated id (int uid) generated for this user.

info

public static OneResponse info(Client client,
                               int id)
Retrieves the information of the given user.

Parameters:
client - XML-RPC Client.
id - The user id (uid) for the user to retrieve the information from.
Returns:
if successful the message contains the string with the information about the user returned by OpenNebula.

delete

public static OneResponse delete(Client client,
                                 int id)
Deletes a user from OpenNebula.

Parameters:
client - XML-RPC Client.
id - The user id (uid) of the target user we want to delete.
Returns:
If an error occurs the error message contains the reason.

passwd

public static OneResponse passwd(Client client,
                                 int id,
                                 java.lang.String password)
Changes the password for the given user.

Parameters:
client - XML-RPC Client.
id - The user id (uid) of the target user we want to modify.
password - The new password.
Returns:
If an error occurs the error message contains the reason.

chgrp

public static OneResponse chgrp(Client client,
                                int id,
                                int gid)
Changes the main group of the given user

Parameters:
client - XML-RPC Client.
id - The user id (uid) of the target user we want to modify.
gid - The new group ID.
Returns:
If an error occurs the error message contains the reason.

chauth

public static OneResponse chauth(Client client,
                                 int id,
                                 java.lang.String auth,
                                 java.lang.String password)
Changes the auth driver and the password of the given user

Parameters:
client - XML-RPC Client.
id - The user id (uid) of the target user we want to modify.
auth - The new auth driver.
password - The new password. If it is an empty string, the user password is not changed
Returns:
If an error occurs the error message contains the reason.

update

public static OneResponse update(Client client,
                                 int id,
                                 java.lang.String new_template)
Replaces the user template contents.

Parameters:
client - XML-RPC Client.
id - The user id of the target user we want to modify.
new_template - New template contents.
Returns:
If successful the message contains the user id.

setQuota

public static OneResponse setQuota(Client client,
                                   int id,
                                   java.lang.String quota_template)
Replaces the user quota template contents.

Parameters:
client - XML-RPC Client.
id - The user id of the target user we want to modify.
quota_template - New quota template contents.
Returns:
If successful the message contains the user id.

info

public OneResponse info()
Loads the xml representation of the user. The info is also stored internally.

See Also:
info(Client, int)

delete

public OneResponse delete()
Deletes the user from OpenNebula.

See Also:
delete(Client, int)

passwd

public OneResponse passwd(java.lang.String password)
Changes the password for the user.

Parameters:
password - The new password.
Returns:
If an error occurs the error message contains the reason.

chgrp

public OneResponse chgrp(int gid)
Changes the main group of the given user

Parameters:
gid - The new group ID.
Returns:
If an error occurs the error message contains the reason.

chauth

public OneResponse chauth(java.lang.String auth,
                          java.lang.String password)
Changes the auth driver and the password of the given user

Parameters:
auth - The new auth driver.
password - The new password. If it is an empty string, the user password is not changed
Returns:
If an error occurs the error message contains the reason.

chauth

public OneResponse chauth(java.lang.String auth)
Changes the auth driver of the given user

Parameters:
auth - The new auth driver.
Returns:
If an error occurs the error message contains the reason.

update

public OneResponse update(java.lang.String new_template)
Replaces the user template contents.

Parameters:
new_template - New template contents.
Returns:
If successful the message contains the user id.

setQuota

public OneResponse setQuota(java.lang.String quota_template)
Replaces the user quota template contents.

Parameters:
quota_template - New quota template contents.
Returns:
If successful the message contains the user id.

isEnabled

public boolean isEnabled()
Returns true if the user is enabled.

Returns:
True if the user is enabled.

OpenNebula
Cloud API

Visit OpenNebula.org
Copyright 2002-2012 © OpenNebula Project Leads (OpenNebula.org).