SecurityGroup (OpenNebula Cloud API)
Description: declaration: package: org.opennebula.client.secgroup, class: SecurityGroup

Package org.opennebula.client.secgroup

# Class SecurityGroup

java.lang.Object
org.opennebula.client.PoolElement
org.opennebula.client.secgroup.SecurityGroup

public class SecurityGroup extends PoolElement
This class represents an OpenNebula security 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
  ``
  `SecurityGroup(int id, Client client)`
  Creates a new security group representation.
  `protected`
  `SecurityGroup(Node xmlElement, Client client)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static OneResponse`
  `allocate(Client client, String description)`
  Allocates a new security group in OpenNebula.
  `OneResponse`
  `chgrp(int gid)`
  Changes the group
  `OneResponse`
  `chmod(int octet)`
  Changes the permissions
  `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 security group permissions
  `OneResponse`
  `chmod(String octet)`
  Changes the permissions
  `static OneResponse`
  `chmod(Client client, int id, int octet)`
  Changes the permissions
  `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 security group permissions
  `static OneResponse`
  `chmod(Client client, int id, String octet)`
  Changes the permissions
  `OneResponse`
  `chown(int uid)`
  Changes the owner
  `OneResponse`
  `chown(int uid, int gid)`
  Changes the owner/group
  `static OneResponse`
  `chown(Client client, int id, int uid, int gid)`
  Changes the owner/group
  `OneResponse`
  `clone(String name)`
  Clones this security group into a new one
  `static OneResponse`
  `clone(Client client, int id, String name)`
  Clones this security group into a new one
  `OneResponse`
  `commit(boolean recover)`
  Commit security group changes to associated VMs
  `static OneResponse`
  `commit(Client client, int id, boolean recover)`
  Commit security group changes to associated VMs
  `OneResponse`
  `delete()`
  Deletes the security group from OpenNebula.
  `static OneResponse`
  `delete(Client client, int id)`
  Deletes a security group from OpenNebula.
  `OneResponse`
  `info()`
  Loads the xml representation of the security group.
  `static OneResponse`
  `info(Client client, int id)`
  Retrieves the information of the given security group
  `static OneResponse`
  `info(Client client, int id, boolean decrypt)`
  Retrieves the information of the given Security Group.
  `OneResponse`
  `rename(String name)`
  Renames this security group
  `static OneResponse`
  `rename(Client client, int id, String name)`
  Renames this security group
  `OneResponse`
  `update(String new_template)`
  Replaces the security group template contents.
  `OneResponse`
  `update(String new_template, boolean append)`
  Replaces the security group template contents.
  `static OneResponse`
  `update(Client client, int id, String new_template, boolean append)`
  Replaces the security group 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 Details

  - ### SecurityGroup

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

  - ### SecurityGroup

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

- ## Method Details

  - ### allocate

    public static OneResponse allocate(Client client, String description)
    Allocates a new security group in OpenNebula.
    Parameters:
      `client` - XML-RPC Client.
      `description` - A string containing the template of the security group.
    Returns:
      If successful the message contains the associated id generated for this security group.

  - ### info

    public static OneResponse info(Client client, int id)
    Retrieves the information of the given security group
    Parameters:
      `client` - XML-RPC Client.
      `id` - the id for the security group 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 Security Group.
    Parameters:
      `client` - XML-RPC Client.
      `id` - The Security Group id for the Security 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 security group from OpenNebula.
    Parameters:
      `client` - XML-RPC Client.
      `id` - The id of the target security group.
    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 security group.
      `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 security group permissions
    Parameters:
      `client` - XML-RPC Client.
      `id` - The id of the target security group.
      `owner_u` - 1 to allow, 0 deny, -1 do not change
      `owner_m` - 1 to allow, 0 deny, -1 do not change
      `owner_a` - 1 to allow, 0 deny, -1 do not change
      `group_u` - 1 to allow, 0 deny, -1 do not change
      `group_m` - 1 to allow, 0 deny, -1 do not change
      `group_a` - 1 to allow, 0 deny, -1 do not change
      `other_u` - 1 to allow, 0 deny, -1 do not change
      `other_m` - 1 to allow, 0 deny, -1 do not change
      `other_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, 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, String new_template, boolean append)
    Replaces the security group template contents.
    Parameters:
      `client` - XML-RPC Client.
      `id` - The id of the target security 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 security group id.

  - ### clone

    public static OneResponse clone(Client client, int id, String name)
    Clones this security group into a new one
    Parameters:
      `client` - XML-RPC Client.
      `id` - The id of the target security group.
      `name` - Name for the new template.
    Returns:
      If successful the message contains the new security group ID.

  - ### rename

    public static OneResponse rename(Client client, int id, String name)
    Renames this security group
    Parameters:
      `client` - XML-RPC Client.
      `id` - The id of the target security group.
      `name` - New name for the security group.
    Returns:
      If an error occurs the error message contains the reason.

  - ### commit

    public static OneResponse commit(Client client, int id, boolean recover)
    Commit security group changes to associated VMs
    Parameters:
      `client` - XML-RPC Client.
      `id` - The id of the target security group.
      `recover` - If true will only operate on outdated and error VMs. This is intended for retrying updates of VMs or reinitialize the updating process if oned stopped or fail.
    Returns:
      If an error occurs the error message contains the reason.

  - ### info

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

  - ### delete

    public OneResponse delete()
    Deletes the security group 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 security group permissions
    Parameters:
      `owner_u` - 1 to allow, 0 deny, -1 do not change
      `owner_m` - 1 to allow, 0 deny, -1 do not change
      `owner_a` - 1 to allow, 0 deny, -1 do not change
      `group_u` - 1 to allow, 0 deny, -1 do not change
      `group_m` - 1 to allow, 0 deny, -1 do not change
      `group_a` - 1 to allow, 0 deny, -1 do not change
      `other_u` - 1 to allow, 0 deny, -1 do not change
      `other_m` - 1 to allow, 0 deny, -1 do not change
      `other_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(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(String new_template)
    Replaces the security group template contents.
    Parameters:
      `new_template` - New template contents.
    Returns:
      If successful the message contains the security group id.

  - ### update

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

  - ### clone

    public OneResponse clone(String name)
    Clones this security group into a new one
    Parameters:
      `name` - Name for the new security group.
    Returns:
      If successful the message contains the new security group ID.

  - ### rename

    public OneResponse rename(String name)
    Renames this security group
    Parameters:
      `name` - New name for the security group.
    Returns:
      If an error occurs the error message contains the reason.

  - ### commit

    public OneResponse commit(boolean recover)
    Commit security group changes to associated VMs
    Parameters:
      `recover` - If true will only operate on outdated and error VMs. This is intended for retrying updates of VMs or reinitialize the updating process if oned stopped or fail.
    Returns:
      If an error occurs the error message contains the reason.