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.
  • 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:
  • 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.