Group (OpenNebula Cloud API)
Description: declaration: package: org.opennebula.client.group, class: Group

Package org.opennebula.client.group

# Class Group

java.lang.Object
org.opennebula.client.PoolElement
org.opennebula.client.group.Group

public class Group extends PoolElement
This class represents an OpenNebula group. It also offers static XML-RPC call wrappers.

- ## Field Summary

  ### Fields inherited from class org.opennebula.client.PoolElement

  `client, id, xml, xpath`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  ``
  `Group(int id, Client client)`
  Creates a new Group representation.
  `protected`
  `Group(Node xmlElement, Client client)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `OneResponse`
  `addAdmin(int uid)`
  Adds a User to the Group administrators set
  `static OneResponse`
  `addAdmin(Client client, int id, int uid)`
  Adds a User to the Group administrators set
  `static OneResponse`
  `allocate(Client client, String name)`
  Allocates a new group in OpenNebula
  `boolean`
  `contains(int uid)`
  Returns whether or not the user is part of this group
  `boolean`
  `containsAdmin(int uid)`
  Returns whether or not the user is an admin of this group
  `OneResponse`
  `delAdmin(int uid)`
  Removes a User from the Group administrators set
  `static OneResponse`
  `delAdmin(Client client, int id, int uid)`
  Removes a User from the Group administrators set
  `OneResponse`
  `delete()`
  Deletes the group from OpenNebula.
  `static OneResponse`
  `delete(Client client, int id)`
  Deletes a group from OpenNebula.
  `OneResponse`
  `info()`
  Loads the xml representation of the group.
  `static OneResponse`
  `info(Client client, int id)`
  Retrieves the information of the given group.
  `static OneResponse`
  `info(Client client, int id, boolean decrypt)`
  Retrieves the information of the given Group.
  `OneResponse`
  `setQuota(String quota_template)`
  Replaces the group quota template contents.
  `static OneResponse`
  `setQuota(Client client, int id, String quota_template)`
  Replaces the group quota template contents.
  `OneResponse`
  `update(String new_template)`
  Replaces the template contents.
  `OneResponse`
  `update(String new_template, boolean append)`
  Replaces the template contents.
  `static OneResponse`
  `update(Client client, int id, String new_template, boolean append)`
  Replaces the template contents.
  `OneResponse`
  `vlan(String vlan_template)`
  Sets the group VLAN rules contents.
  `static OneResponse`
  `vlan(Client client, int id, String vlan_template)`
  Sets the group VLAN rules 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 Details

  - ### Group

    public Group(int id, Client client)
    Creates a new Group representation.
    Parameters:
      `id` - The group id.
      `client` - XML-RPC Client.

  - ### Group

    protected Group(Node xmlElement, Client client)
    See Also:
      - `PoolElement`

- ## Method Details

  - ### allocate

    public static OneResponse allocate(Client client, String name)
    Allocates a new group in OpenNebula
    Parameters:
      `client` - XML-RPC Client.
      `name` - Name for the new group.
    Returns:
      If successful the message contains the associated id generated for this group.

  - ### info

    public static OneResponse info(Client client, int id)
    Retrieves the information of the given group.
    Parameters:
      `client` - XML-RPC Client.
      `id` - The group id.
    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 Group.
    Parameters:
      `client` - XML-RPC Client.
      `id` - The Group id for the Group to retrieve the information from
      `decrypt` - 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 group from OpenNebula.
    Parameters:
      `client` - XML-RPC Client.
      `id` - The group id.
    Returns:
      A encapsulated response.

  - ### setQuota

    public static OneResponse setQuota(Client client, int id, String quota_template)
    Replaces the group quota template contents.
    Parameters:
      `client` - XML-RPC Client.
      `id` - The group id of the target group we want to modify.
      `quota_template` - New quota template contents.
    Returns:
      If successful the message contains the group id.

  - ### vlan

    public static OneResponse vlan(Client client, int id, String vlan_template)
    Sets the group VLAN rules contents.
    Parameters:
      `client` - XML-RPC Client.
      `id` - The group id of the target group we want to modify.
      `vlan_template` - New VLAN rules template contents.
    Returns:
      If successful the message contains the group id.

  - ### update

    public static OneResponse update(Client client, int id, String new_template, boolean append)
    Replaces the template contents.
    Parameters:
      `client` - XML-RPC Client.
      `id` - The group id of the target group 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 group id.

  - ### addAdmin

    public static OneResponse addAdmin(Client client, int id, int uid)
    Adds a User to the Group administrators set
    Parameters:
      `client` - XML-RPC Client.
      `id` - The group id of the target group we want to modify.
      `uid` - User ID
    Returns:
      If successful the message contains the group id.

  - ### delAdmin

    public static OneResponse delAdmin(Client client, int id, int uid)
    Removes a User from the Group administrators set
    Parameters:
      `client` - XML-RPC Client.
      `id` - The group id of the target group we want to modify.
      `uid` - User ID
    Returns:
      If successful the message contains the group id.

  - ### info

    public OneResponse info()
    Loads the xml representation of the group. The info is also stored internally.
    See Also:
      - `info(Client, int)`

  - ### delete

    public OneResponse delete()
    Deletes the group from OpenNebula.
    See Also:
      - `delete(Client, int)`

  - ### setQuota

    public OneResponse setQuota(String quota_template)
    Replaces the group quota template contents.
    Parameters:
      `quota_template` - New quota template contents.
    Returns:
      If successful the message contains the group id.

  - ### vlan

    public OneResponse vlan(String vlan_template)
    Sets the group VLAN rules contents.
    Parameters:
      `vlan_template` - New VLAN rules template contents.
    Returns:
      If successful the message contains the group id.

  - ### update

    public OneResponse update(String new_template)
    Replaces the template contents.
    Parameters:
      `new_template` - New template contents
    Returns:
      If successful the message contains the group id.

  - ### update

    public OneResponse update(String new_template, boolean append)
    Replaces the 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 group id.

  - ### addAdmin

    public OneResponse addAdmin(int uid)
    Adds a User to the Group administrators set
    Parameters:
      `uid` - User ID
    Returns:
      If successful the message contains the group id.

  - ### delAdmin

    public OneResponse delAdmin(int uid)
    Removes a User from the Group administrators set
    Parameters:
      `uid` - User ID
    Returns:
      If successful the message contains the group id.

  - ### contains

    public boolean contains(int uid)
    Returns whether or not the user is part of this group
    Parameters:
      `uid` - The user ID.
    Returns:
      Whether or not the user is part of this group.

  - ### containsAdmin

    public boolean containsAdmin(int uid)
    Returns whether or not the user is an admin of this group
    Parameters:
      `uid` - The user ID.
    Returns:
      Whether or not the user is an admin of this group