Class Group


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

      • Group

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

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

      • allocate

        public static OneResponse allocate​(Client client,
                                           java.lang.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,
                                           java.lang.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.
      • update

        public static OneResponse update​(Client client,
                                         int id,
                                         java.lang.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)
      • setQuota

        public OneResponse setQuota​(java.lang.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.
      • update

        public OneResponse update​(java.lang.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​(java.lang.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