Hook (OpenNebula Cloud API)
Description: declaration: package: org.opennebula.client.hook, class: Hook

Package org.opennebula.client.hook

# Class Hook

java.lang.Object
org.opennebula.client.PoolElement
org.opennebula.client.hook.Hook

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static OneResponse`
  `allocate(Client client, String description)`
  Allocates a new Hook in OpenNebula.
  `OneResponse`
  `delete()`
  Deletes the Hook from OpenNebula.
  `static OneResponse`
  `delete(Client client, int id)`
  Deletes a Hook from OpenNebula.
  `OneResponse`
  `info()`
  Retrieves the information of the Hook.
  `static OneResponse`
  `info(Client client, int id)`
  Retrieves the information of the given Hook.
  `OneResponse`
  `lock(int level)`
  Lock this Hook
  `static OneResponse`
  `lock(Client client, int id, int level)`
  lock this Hook
  `OneResponse`
  `rename(String name)`
  Renames this Hook
  `static OneResponse`
  `rename(Client client, int id, String name)`
  Renames this Hook
  `OneResponse`
  `retry(int exec_id)`
  Retry this Hook
  `static OneResponse`
  `retry(Client client, int id, int exec_id)`
  Retry this Hook
  `OneResponse`
  `unlock()`
  Unlock this Hook
  `static OneResponse`
  `unlock(Client client, int id)`
  Unlock this Hook
  `OneResponse`
  `update(String new_template)`
  Replaces the Hook contents.
  `OneResponse`
  `update(String new_template, boolean append)`
  Replaces the Hook contents.
  `static OneResponse`
  `update(Client client, int id, String new_template, boolean append)`
  Replaces the Hook 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

  - ### Hook

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

  - ### Hook

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

- ## Method Details

  - ### allocate

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

  - ### info

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

  - ### update

    public static OneResponse update(Client client, int id, String new_template, boolean append)
    Replaces the Hook contents.
    Parameters:
      `client` - XML-RPC Client.
      `id` - The Hook id of the target Hook we want to modify.
      `new_template` - New Hook contents.
      `append` - True to append new attributes instead of replace the whole Hook
    Returns:
      If successful the message contains the Hook id.

  - ### rename

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

  - ### lock

    public static OneResponse lock(Client client, int id, int level)
    lock this Hook
    Parameters:
      `client` - XML-RPC Client.
      `id` - The hook id.
      `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 Hook
    Parameters:
      `client` - XML-RPC Client.
      `id` - The Hook id.
    Returns:
      If an error occurs the error message contains the reason.

  - ### retry

    public static OneResponse retry(Client client, int id, int exec_id)
    Retry this Hook
    Parameters:
      `client` - XML-RPC Client.
      `id` - The Hook id.
      `exec_id` - the hook execution id.
    Returns:
      If an error occurs the error message contains the reason.

  - ### info

    public OneResponse info()
    Retrieves the information of the Hook.
    Returns:
      If successful the message contains the string with the information returned by OpenNebula.

  - ### delete

    public OneResponse delete()
    Deletes the Hook from OpenNebula.
    Returns:
      A encapsulated response.

  - ### update

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

  - ### update

    public OneResponse update(String new_template, boolean append)
    Replaces the Hook contents.
    Parameters:
      `new_template` - New Hook contents.
      `append` - True to append new attributes instead of replace the whole Hook
    Returns:
      If successful the message contains the hook id.

  - ### rename

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

  - ### lock

    public OneResponse lock(int level)
    Lock this Hook
    Parameters:
      `level` - Lock level.
    Returns:
      If an error occurs the error message contains the reason.

  - ### unlock

    public OneResponse unlock()
    Unlock this Hook
    Returns:
      If an error occurs the error message contains the reason.

  - ### retry

    public OneResponse retry(int exec_id)
    Retry this Hook
    Parameters:
      `exec_id` - the hook execution id.
    Returns:
      If an error occurs the error message contains the reason.