Acl (OpenNebula Cloud API)
Description: declaration: package: org.opennebula.client.acl, class: Acl

Package org.opennebula.client.acl

# Class Acl

java.lang.Object
org.opennebula.client.PoolElement
org.opennebula.client.acl.Acl

public class Acl extends PoolElement
This class represents an OpenNebula ACL rule. It also offers static XML-RPC call wrappers.
There is not a public constructor, because the information for an individual ACL rule cannot be retrieved from OpenNebula.
Instead, Acl objects should be obtained using AclPool.getById, after the info method has been called.

See Also:
  - `AclPool.getById(int)`

- ## Field Summary

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

  `client, id, xml, xpath`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `Acl(Node xmlElement, Client client)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static OneResponse`
  `allocate(Client client, long user, long resource, long rights)`
  Allocates a new ACl rule in OpenNebula
  `static OneResponse`
  `allocate(Client client, long user, long resource, long rights, long zone)`
  Allocates a new ACl rule in OpenNebula
  `static OneResponse`
  `allocate(Client client, String rule)`
  Allocates a new ACl rule in OpenNebula
  `static OneResponse`
  `allocate(Client client, String user, String resource, String rights)`
  Allocates a new ACl rule in OpenNebula
  `static OneResponse`
  `allocate(Client client, String user, String resource, String rights, String zone)`
  Allocates a new ACl rule in OpenNebula
  `OneResponse`
  `delete()`
  Deletes the ACL rule from OpenNebula.
  `static OneResponse`
  `delete(Client client, int id)`
  Deletes an ACL rule from OpenNebula.
  `static String[]`
  `parseRule(String rule)`
  Parses a rule string, e.g.
  `long`
  `resource()`
  `long`
  `rights()`
  `String`
  `toString()`
  `long`
  `user()`
  `long`
  `zone()`

  ### 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, wait, wait, wait`

- ## Constructor Details

  - ### Acl

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

- ## Method Details

  - ### allocate

    public static OneResponse allocate(Client client, String user, String resource, String rights)
    Allocates a new ACl rule in OpenNebula
    Parameters:
      `client` - XML-RPC Client.
      `user` - A string containing a hex number, e.g. 0x100000001
      `resource` - A string containing a hex number, e.g. 0x2100000001
      `rights` - A string containing a hex number, e.g. 0x10
    Returns:
      If successful the message contains the associated id generated for this rule.

  - ### allocate

    public static OneResponse allocate(Client client, String user, String resource, String rights, String zone)
    Allocates a new ACl rule in OpenNebula
    Parameters:
      `client` - XML-RPC Client.
      `user` - A string containing a hex number, e.g. 0x100000001
      `resource` - A string containing a hex number, e.g. 0x2100000001
      `rights` - A string containing a hex number, e.g. 0x10
      `zone` - A string containing a hex number, e.g. 0x10
    Returns:
      If successful the message contains the associated id generated for this rule.

  - ### allocate

    public static OneResponse allocate(Client client, long user, long resource, long rights)
    Allocates a new ACl rule in OpenNebula
    Parameters:
      `client` - XML-RPC Client.
      `user` - 64b encoded user
      `resource` - 64b encoded user
      `rights` - 64b encoded user
    Returns:
      If successful the message contains the associated id generated for this rule.

  - ### allocate

    public static OneResponse allocate(Client client, long user, long resource, long rights, long zone)
    Allocates a new ACl rule in OpenNebula
    Parameters:
      `client` - XML-RPC Client.
      `user` - 64b encoded user
      `resource` - 64b encoded
      `rights` - 64b encoded
      `zone` - 64b encoded
    Returns:
      If successful the message contains the associated id generated for this rule.

  - ### allocate

    public static OneResponse allocate(Client client, String rule) throws RuleParseException
    Allocates a new ACl rule in OpenNebula
    Parameters:
      `client` - XML-RPC Client.
      `rule` - a rule string, e.g. "#5 HOST+VM/@12 INFO+CREATE+DELETE"
    Returns:
      If successful the message contains the associated id generated for this rule.
    Throws:
      `RuleParseException` - If the rule syntax is wrong.

  - ### delete

    public static OneResponse delete(Client client, int id)
    Deletes an ACL rule from OpenNebula.
    Parameters:
      `client` - XML-RPC Client.
      `id` - The ACL rule id.
    Returns:
      A encapsulated response.

  - ### delete

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

  - ### user

    public long user()

  - ### resource

    public long resource()

  - ### rights

    public long rights()

  - ### zone

    public long zone()

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### parseRule

    public static String[] parseRule(String rule) throws RuleParseException
    Parses a rule string, e.g. "#5 HOST+VM/@12 INFO+CREATE+DELETE"
    Parameters:
      `rule` - an ACL rule in string format
    Returns:
      an Array containing 4 Strings (hex 64b numbers). 3 if the rule does not have the zone component, for compatibility
    Throws:
      `RuleParseException` - If the rule syntax is wrong.