Package org.opennebula.client.vmgroup
Class VMGroup
- java.lang.Object
-
- org.opennebula.client.PoolElement
-
- org.opennebula.client.vmgroup.VMGroup
-
public class VMGroup extends PoolElement
This class represents an OpenNebula vmgroup. It also offers static XML-RPC call wrappers.
-
-
Field Summary
-
Fields inherited from class org.opennebula.client.PoolElement
client, id, xml, xpath
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OneResponse
allocate(Client client, java.lang.String description)
Allocates a new vmgroup in OpenNebula.OneResponse
chgrp(int gid)
Changes the groupOneResponse
chmod(int octet)
Changes the permissionsOneResponse
chmod(int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a)
Changes the vmgroup permissionsOneResponse
chmod(java.lang.String octet)
Changes the permissionsstatic OneResponse
chmod(Client client, int id, int octet)
Changes the permissionsstatic OneResponse
chmod(Client client, int id, int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a)
Changes the vmgroup permissionsstatic OneResponse
chmod(Client client, int id, java.lang.String octet)
Changes the permissionsOneResponse
chown(int uid)
Changes the ownerOneResponse
chown(int uid, int gid)
Changes the owner/groupstatic OneResponse
chown(Client client, int id, int uid, int gid)
Changes the owner/groupOneResponse
delete()
Deletes the vmgroup from OpenNebula.static OneResponse
delete(Client client, int id)
Deletes a vmgroup from OpenNebula.OneResponse
info()
Loads the xml representation of the vmgroup.static OneResponse
info(Client client, int id)
Retrieves the information of the given vmgroupstatic OneResponse
info(Client client, int id, boolean decrypt)
Retrieves the information of the given VMGroup.OneResponse
lock(int level)
Lock this vmgroupstatic OneResponse
lock(Client client, int id, int level)
lock this vmgroupOneResponse
rename(java.lang.String name)
Renames this vmgroupstatic OneResponse
rename(Client client, int id, java.lang.String name)
Renames this vmgroupOneResponse
roleAdd(java.lang.String roleTemplate)
Add VM Group rolestatic OneResponse
roleAdd(Client client, int id, java.lang.String roleTemplate)
Add VM Group roleOneResponse
roleDelete(int roleID)
Delete VM Group rolestatic OneResponse
roleDelete(Client client, int id, int roleID)
Delete VM Group roleOneResponse
roleUpdate(int roleID, java.lang.String roleTemplate)
Update VM Group rolestatic OneResponse
roleUpdate(Client client, int id, int roleID, java.lang.String roleTemplate)
Unlock this vmgroupOneResponse
unlock()
Unlock this vmgroupstatic OneResponse
unlock(Client client, int id)
Unlock this vmgroupOneResponse
update(java.lang.String new_template)
Replaces the vmgroup template contents.OneResponse
update(java.lang.String new_template, boolean append)
Replaces the vmgroup template contents.static OneResponse
update(Client client, int id, java.lang.String new_template, boolean append)
Replaces the vmgroup template contents.
-
-
-
Constructor Detail
-
VMGroup
public VMGroup(int id, Client client)
Creates a new vmgroup representation.- Parameters:
id
- The vmgroup id.client
- XML-RPC Client.
-
VMGroup
protected VMGroup(org.w3c.dom.Node xmlElement, Client client)
- See Also:
PoolElement
-
-
Method Detail
-
allocate
public static OneResponse allocate(Client client, java.lang.String description)
Allocates a new vmgroup in OpenNebula.- Parameters:
client
- XML-RPC Client.description
- A string containing the template of the vmgroup.- Returns:
- If successful the message contains the associated id generated for this vmgroup.
-
info
public static OneResponse info(Client client, int id)
Retrieves the information of the given vmgroup- Parameters:
client
- XML-RPC Client.id
- the id for the vmgroup to retrieve the information from.- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
info
public static OneResponse info(Client client, int id, boolean decrypt)
Retrieves the information of the given VMGroup.- Parameters:
client
- XML-RPC Client.id
- The VMGroup id for the VMGroup to retrieve the information fromdecrypt
- If true decrypt sensitive attributes- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
delete
public static OneResponse delete(Client client, int id)
Deletes a vmgroup from OpenNebula.- Parameters:
client
- XML-RPC Client.id
- The id of the target vmgroup.- Returns:
- A encapsulated response.
-
chown
public static OneResponse chown(Client client, int id, int uid, int gid)
Changes the owner/group- Parameters:
client
- XML-RPC Client.id
- The id of the target vmgroup.uid
- The new owner user ID. Set it to -1 to leave the current one.gid
- The new group ID. Set it to -1 to leave the current one.- Returns:
- If an error occurs the error message contains the reason.
-
chmod
public static OneResponse chmod(Client client, int id, int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a)
Changes the vmgroup permissions- Parameters:
client
- XML-RPC Client.id
- The id of the target vmgroup.owner_u
- 1 to allow, 0 deny, -1 do not changeowner_m
- 1 to allow, 0 deny, -1 do not changeowner_a
- 1 to allow, 0 deny, -1 do not changegroup_u
- 1 to allow, 0 deny, -1 do not changegroup_m
- 1 to allow, 0 deny, -1 do not changegroup_a
- 1 to allow, 0 deny, -1 do not changeother_u
- 1 to allow, 0 deny, -1 do not changeother_m
- 1 to allow, 0 deny, -1 do not changeother_a
- 1 to allow, 0 deny, -1 do not change- Returns:
- If an error occurs the error message contains the reason.
-
chmod
public static OneResponse chmod(Client client, int id, java.lang.String octet)
Changes the permissions- Parameters:
client
- XML-RPC Client.id
- The id of the target object.octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
chmod
public static OneResponse chmod(Client client, int id, int octet)
Changes the permissions- Parameters:
client
- XML-RPC Client.id
- The id of the target object.octet
- Permissions octed , e.g. 640- 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, boolean append)
Replaces the vmgroup template contents.- Parameters:
client
- XML-RPC Client.id
- The id of the target vmgroup we want to modify.new_template
- New template contents.append
- True to append new attributes instead of replace the whole template- Returns:
- If successful the message contains the vmgroup id.
-
rename
public static OneResponse rename(Client client, int id, java.lang.String name)
Renames this vmgroup- Parameters:
client
- XML-RPC Client.id
- The id of the target vmgroup.name
- New name for the vmgroup.- Returns:
- If an error occurs the error message contains the reason.
-
lock
public static OneResponse lock(Client client, int id, int level)
lock this vmgroup- Parameters:
client
- XML-RPC Client.id
- The id of the target vmgroup.level
- Lock level.- Returns:
- If an error occurs the error message contains the reason.
-
unlock
public static OneResponse unlock(Client client, int id)
Unlock this vmgroup- Parameters:
client
- XML-RPC Client.id
- The id of the target vmgroup.- Returns:
- If an error occurs the error message contains the reason.
-
roleAdd
public static OneResponse roleAdd(Client client, int id, java.lang.String roleTemplate)
Add VM Group role- Parameters:
client
- XML-RPC Client.id
- The id of the target VM Group.roleTemplate
- New template content.- Returns:
- If an error occurs the error message contains the reason.
-
roleDelete
public static OneResponse roleDelete(Client client, int id, int roleID)
Delete VM Group role- Parameters:
client
- XML-RPC Client.id
- The id of the target VM Group.roleID
- The id of the target role.- Returns:
- If an error occurs the error message contains the reason.
-
roleUpdate
public static OneResponse roleUpdate(Client client, int id, int roleID, java.lang.String roleTemplate)
Unlock this vmgroup- Parameters:
client
- XML-RPC Client.id
- The id of the target VM Group.roleID
- The id of the target role.roleTemplate
- Updated template content.- Returns:
- If an error occurs the error message contains the reason.
-
info
public OneResponse info()
Loads the xml representation of the vmgroup. The info is also stored internally.- See Also:
info(Client, int)
-
delete
public OneResponse delete()
Deletes the vmgroup from OpenNebula.- Returns:
- A encapsulated response.
-
chown
public OneResponse chown(int uid, int gid)
Changes the owner/group- Parameters:
uid
- The new owner user ID. Set it to -1 to leave the current one.gid
- The new group ID. Set it to -1 to leave the current one.- Returns:
- If an error occurs the error message contains the reason.
-
chown
public OneResponse chown(int uid)
Changes the owner- Parameters:
uid
- The new owner user ID.- Returns:
- If an error occurs the error message contains the reason.
-
chgrp
public OneResponse chgrp(int gid)
Changes the group- Parameters:
gid
- The new group ID.- Returns:
- If an error occurs the error message contains the reason.
-
chmod
public OneResponse chmod(int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a)
Changes the vmgroup permissions- Parameters:
owner_u
- 1 to allow, 0 deny, -1 do not changeowner_m
- 1 to allow, 0 deny, -1 do not changeowner_a
- 1 to allow, 0 deny, -1 do not changegroup_u
- 1 to allow, 0 deny, -1 do not changegroup_m
- 1 to allow, 0 deny, -1 do not changegroup_a
- 1 to allow, 0 deny, -1 do not changeother_u
- 1 to allow, 0 deny, -1 do not changeother_m
- 1 to allow, 0 deny, -1 do not changeother_a
- 1 to allow, 0 deny, -1 do not change- Returns:
- If an error occurs the error message contains the reason.
-
chmod
public OneResponse chmod(java.lang.String octet)
Changes the permissions- Parameters:
octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
chmod
public OneResponse chmod(int octet)
Changes the permissions- Parameters:
octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
update
public OneResponse update(java.lang.String new_template)
Replaces the vmgroup template contents.- Parameters:
new_template
- New template contents.- Returns:
- If successful the message contains the vmgroup id.
-
update
public OneResponse update(java.lang.String new_template, boolean append)
Replaces the vmgroup template contents.- Parameters:
new_template
- New template contents.append
- True to append new attributes instead of replace the whole template- Returns:
- If successful the message contains the vmgroup id.
-
rename
public OneResponse rename(java.lang.String name)
Renames this vmgroup- Parameters:
name
- New name for the vmgroup.- Returns:
- If an error occurs the error message contains the reason.
-
lock
public OneResponse lock(int level)
Lock this vmgroup- Parameters:
level
- Lock level.- Returns:
- If an error occurs the error message contains the reason.
-
unlock
public OneResponse unlock()
Unlock this vmgroup- Returns:
- If an error occurs the error message contains the reason.
-
roleAdd
public OneResponse roleAdd(java.lang.String roleTemplate)
Add VM Group role- Parameters:
roleTemplate
- Updated template content.- Returns:
- If an error occurs the error message contains the reason.
-
roleDelete
public OneResponse roleDelete(int roleID)
Delete VM Group role- Parameters:
roleID
- The id of the target role.- Returns:
- If an error occurs the error message contains the reason.
-
roleUpdate
public OneResponse roleUpdate(int roleID, java.lang.String roleTemplate)
Update VM Group role- Parameters:
roleID
- The id of the target role.roleTemplate
- Updated template content.- Returns:
- If an error occurs the error message contains the reason.
-
-