Vdc (OpenNebula Cloud API)
Description: declaration: package: org.opennebula.client.vdc, class: Vdc

Package org.opennebula.client.vdc

# Class Vdc

java.lang.Object
org.opennebula.client.PoolElement
org.opennebula.client.vdc.Vdc

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `OneResponse`
  `addCluster(int zoneId, int clusterId)`
  Adds a cluster to this VDC
  `static OneResponse`
  `addCluster(Client client, int id, int zoneId, int clusterId)`
  Adds a cluster to this VDC
  `OneResponse`
  `addDatastore(int zoneId, int datastoreId)`
  Adds a datastore to this VDC
  `static OneResponse`
  `addDatastore(Client client, int id, int zoneId, int datastoreId)`
  Adds a datastore to this VDC
  `OneResponse`
  `addGroup(int groupId)`
  Adds a group to this VDC
  `static OneResponse`
  `addGroup(Client client, int id, int groupId)`
  Adds a group to this VDC
  `OneResponse`
  `addHost(int zoneId, int hostId)`
  Adds a host to this VDC
  `static OneResponse`
  `addHost(Client client, int id, int zoneId, int hostId)`
  Adds a host to this VDC
  `OneResponse`
  `addVnet(int zoneId, int vnetId)`
  Adds a vnet to this VDC
  `static OneResponse`
  `addVnet(Client client, int id, int zoneId, int vnetId)`
  Adds a vnet to this VDC
  `static OneResponse`
  `allocate(Client client, String description)`
  Allocates a new vdc in OpenNebula
  `OneResponse`
  `delCluster(int zoneId, int clusterId)`
  Deletes a cluster from this VDC
  `static OneResponse`
  `delCluster(Client client, int id, int zoneId, int clusterId)`
  Deletes a cluster from this VDC
  `OneResponse`
  `delDatastore(int zoneId, int datastoreId)`
  Deletes a datastore from this VDC
  `static OneResponse`
  `delDatastore(Client client, int id, int zoneId, int datastoreId)`
  Deletes a datastore from this VDC
  `OneResponse`
  `delete()`
  Deletes the vdc from OpenNebula.
  `static OneResponse`
  `delete(Client client, int id)`
  Deletes a vdc from OpenNebula.
  `OneResponse`
  `delGroup(int groupId)`
  Deletes a group from this VDC
  `static OneResponse`
  `delGroup(Client client, int id, int groupId)`
  Deletes a group from this VDC
  `OneResponse`
  `delHost(int zoneId, int hostId)`
  Deletes a host from this VDC
  `static OneResponse`
  `delHost(Client client, int id, int zoneId, int hostId)`
  Deletes a host from this VDC
  `OneResponse`
  `delVnet(int zoneId, int vnetId)`
  Deletes a vnet from this VDC
  `static OneResponse`
  `delVnet(Client client, int id, int zoneId, int vnetId)`
  Deletes a vnet from this VDC
  `OneResponse`
  `info()`
  Loads the xml representation of the vdc.
  `static OneResponse`
  `info(Client client, int id)`
  Retrieves the information of the given vdc.
  `static OneResponse`
  `info(Client client, int id, boolean decrypt)`
  Retrieves the information of the given VDC.
  `OneResponse`
  `rename(String name)`
  Renames this Vdc
  `static OneResponse`
  `rename(Client client, int id, String name)`
  Renames this vdc
  `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

  - ### Vdc

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

  - ### Vdc

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

- ## Method Details

  - ### allocate

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

  - ### info

    public static OneResponse info(Client client, int id)
    Retrieves the information of the given vdc.
    Parameters:
      `client` - XML-RPC Client.
      `id` - The vdc 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 VDC.
    Parameters:
      `client` - XML-RPC Client.
      `id` - The VDC id for the VDC 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 vdc from OpenNebula.
    Parameters:
      `client` - XML-RPC Client.
      `id` - The vdc id.
    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 vdc id of the target vdc 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 vdc id.

  - ### rename

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

  - ### addGroup

    public static OneResponse addGroup(Client client, int id, int groupId)
    Adds a group to this VDC
    Parameters:
      `client` - XML-RPC Client.
      `id` - The vdc id of the target vdc
      `groupId` - The group to add
    Returns:
      If an error occurs the error message contains the reason.

  - ### delGroup

    public static OneResponse delGroup(Client client, int id, int groupId)
    Deletes a group from this VDC
    Parameters:
      `client` - XML-RPC Client.
      `id` - The vdc id of the target vdc
      `groupId` - The group to delete
    Returns:
      If an error occurs the error message contains the reason.

  - ### addCluster

    public static OneResponse addCluster(Client client, int id, int zoneId, int clusterId)
    Adds a cluster to this VDC
    Parameters:
      `client` - XML-RPC Client.
      `id` - The vdc id of the target vdc
      `zoneId` - The cluster's zone
      `clusterId` - The cluster to add
    Returns:
      If an error occurs the error message contains the reason.

  - ### delCluster

    public static OneResponse delCluster(Client client, int id, int zoneId, int clusterId)
    Deletes a cluster from this VDC
    Parameters:
      `client` - XML-RPC Client.
      `id` - The vdc id of the target vdc
      `zoneId` - The cluster's zone
      `clusterId` - The cluster to delete
    Returns:
      If an error occurs the error message contains the reason.

  - ### addHost

    public static OneResponse addHost(Client client, int id, int zoneId, int hostId)
    Adds a host to this VDC
    Parameters:
      `client` - XML-RPC Client.
      `id` - The vdc id of the target vdc
      `zoneId` - The host's zone
      `hostId` - The host to add
    Returns:
      If an error occurs the error message contains the reason.

  - ### delHost

    public static OneResponse delHost(Client client, int id, int zoneId, int hostId)
    Deletes a host from this VDC
    Parameters:
      `client` - XML-RPC Client.
      `id` - The vdc id of the target vdc
      `zoneId` - The host's zone
      `hostId` - The host to delete
    Returns:
      If an error occurs the error message contains the reason.

  - ### addVnet

    public static OneResponse addVnet(Client client, int id, int zoneId, int vnetId)
    Adds a vnet to this VDC
    Parameters:
      `client` - XML-RPC Client.
      `id` - The vdc id of the target vdc
      `zoneId` - The vnet's zone
      `vnetId` - The vnet to add
    Returns:
      If an error occurs the error message contains the reason.

  - ### delVnet

    public static OneResponse delVnet(Client client, int id, int zoneId, int vnetId)
    Deletes a vnet from this VDC
    Parameters:
      `client` - XML-RPC Client.
      `id` - The vdc id of the target vdc
      `zoneId` - The vnet's zone
      `vnetId` - The vnet to delete
    Returns:
      If an error occurs the error message contains the reason.

  - ### addDatastore

    public static OneResponse addDatastore(Client client, int id, int zoneId, int datastoreId)
    Adds a datastore to this VDC
    Parameters:
      `client` - XML-RPC Client.
      `id` - The vdc id of the target vdc
      `zoneId` - The datastore's zone
      `datastoreId` - The datastore to add
    Returns:
      If an error occurs the error message contains the reason.

  - ### delDatastore

    public static OneResponse delDatastore(Client client, int id, int zoneId, int datastoreId)
    Deletes a datastore from this VDC
    Parameters:
      `client` - XML-RPC Client.
      `id` - The vdc id of the target vdc
      `zoneId` - The datastore's zone
      `datastoreId` - The datastore to delete
    Returns:
      If an error occurs the error message contains the reason.

  - ### info

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

  - ### delete

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

  - ### update

    public OneResponse update(String new_template)
    Replaces the template contents.
    Parameters:
      `new_template` - New template contents
    Returns:
      If successful the message contains the vdc 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 vdc id.

  - ### rename

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

  - ### addGroup

    public OneResponse addGroup(int groupId)
    Adds a group to this VDC
    Parameters:
      `groupId` - The group to add
    Returns:
      If an error occurs the error message contains the reason.

  - ### delGroup

    public OneResponse delGroup(int groupId)
    Deletes a group from this VDC
    Parameters:
      `groupId` - The group to delete
    Returns:
      If an error occurs the error message contains the reason.

  - ### addCluster

    public OneResponse addCluster(int zoneId, int clusterId)
    Adds a cluster to this VDC
    Parameters:
      `zoneId` - The cluster's zone
      `clusterId` - The cluster to add
    Returns:
      If an error occurs the error message contains the reason.

  - ### delCluster

    public OneResponse delCluster(int zoneId, int clusterId)
    Deletes a cluster from this VDC
    Parameters:
      `zoneId` - The cluster's zone
      `clusterId` - The cluster to delete
    Returns:
      If an error occurs the error message contains the reason.

  - ### addHost

    public OneResponse addHost(int zoneId, int hostId)
    Adds a host to this VDC
    Parameters:
      `zoneId` - The host's zone
      `hostId` - The host to add
    Returns:
      If an error occurs the error message contains the reason.

  - ### delHost

    public OneResponse delHost(int zoneId, int hostId)
    Deletes a host from this VDC
    Parameters:
      `zoneId` - The host's zone
      `hostId` - The host to delete
    Returns:
      If an error occurs the error message contains the reason.

  - ### addVnet

    public OneResponse addVnet(int zoneId, int vnetId)
    Adds a vnet to this VDC
    Parameters:
      `zoneId` - The vnet's zone
      `vnetId` - The vnet to add
    Returns:
      If an error occurs the error message contains the reason.

  - ### delVnet

    public OneResponse delVnet(int zoneId, int vnetId)
    Deletes a vnet from this VDC
    Parameters:
      `zoneId` - The vnet's zone
      `vnetId` - The vnet to delete
    Returns:
      If an error occurs the error message contains the reason.

  - ### addDatastore

    public OneResponse addDatastore(int zoneId, int datastoreId)
    Adds a datastore to this VDC
    Parameters:
      `zoneId` - The datastore's zone
      `datastoreId` - The datastore to add
    Returns:
      If an error occurs the error message contains the reason.

  - ### delDatastore

    public OneResponse delDatastore(int zoneId, int datastoreId)
    Deletes a datastore from this VDC
    Parameters:
      `zoneId` - The datastore's zone
      `datastoreId` - The datastore to delete
    Returns:
      If an error occurs the error message contains the reason.