Zone (OpenNebula Cloud API)
Description: declaration: package: org.opennebula.client.zone, class: Zone

Package org.opennebula.client.zone

# Class Zone

java.lang.Object
org.opennebula.client.PoolElement
org.opennebula.client.zone.Zone

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static OneResponse`
  `allocate(Client client, String description)`
  Allocates a new Zone in OpenNebula.
  `OneResponse`
  `delete()`
  Deletes the zone from OpenNebula.
  `static OneResponse`
  `delete(Client client, int id)`
  Deletes a zone from OpenNebula.
  `OneResponse`
  `enable(boolean enable)`
  Enable or disable this Zone
  `static OneResponse`
  `enable(Client client, int id, boolean enable)`
  Enable or disable the given Zone
  `OneResponse`
  `info()`
  Loads the xml representation of the zone.
  `static OneResponse`
  `info(Client client, int id)`
  Retrieves the information of the given zone.
  `static OneResponse`
  `info(Client client, int id, boolean decrypt)`
  Retrieves the information of the given Zone.
  `OneResponse`
  `rename(String name)`
  Renames this Zone
  `static OneResponse`
  `rename(Client client, int id, String name)`
  Renames this Zone
  `OneResponse`
  `update(String new_template)`
  Replaces the template contents.
  `OneResponse`
  `update(String new_template, boolean append)`
  Replaces the template contents.
  `static OneResponse`
  `update(Client client, int id, String new_template, boolean append)`
  Replaces the 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

  - ### Zone

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

  - ### Zone

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

- ## Method Details

  - ### allocate

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

  - ### info

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

  - ### enable

    public static OneResponse enable(Client client, int id, boolean enable)
    Enable or disable the given Zone
    Parameters:
      `client` - XML-RPC Client.
      `id` - The zone id.
      `enable` - True for enabling, false for disabling
    Returns:
      A encapsulated response.

  - ### update

    public static OneResponse update(Client client, int id, String new_template, boolean append)
    Replaces the template contents.
    Parameters:
      `client` - XML-RPC Client.
      `id` - The zone id of the target zone 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 zone id.

  - ### rename

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

  - ### info

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

  - ### delete

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

  - ### enable

    public OneResponse enable(boolean enable)
    Enable or disable this Zone
    Parameters:
      `enable` - True for enabling, false for disabling
    Returns:
      A encapsulated response.

  - ### rename

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

  - ### update

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

  - ### update

    public OneResponse update(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 zone id.