Phone sales support +39 0575 05077
  Phone technical support +39 0575 0508
 

4.1.13 Restoring a Cloud Server

Using Aruba's WsEndUser SetEnqueueServerRestore method you can queue an operation (Job) to restore an archived virtual server, actually returning it to the group of active servers.

Parameters
ServerRestore
Type: ServerRestore
ServerRestore type value that represents the unique identifier for the virtual server and the number of CPUs and the amount of RAM to restore the virtual server.

Let's look at the example of a method that restores an archived virtual server.
//IWsEndUser.SetEnqueueServerRestore Method (c# .NET)
private void RestoreVirtualServer(WsEndUserClient client, int serverId)
{
    try
    {
        //sets the object to be passed on to the method, by setting the ServerId
        //and by specifying the number of CPUs and the Gb of RAM
        ServerRestore server = new ServerRestore() { 
            ServerId = serverId, 
            CPUQuantity = 2, 
            RAMQuantity = 4 
        };

        //calls the SetEnqueueServerRestore method,
        //getting a WsResult object       
        WsResult result = client.SetEnqueueServerRestore(server);

        //if the call fails, the exception is relaunched
        //with the indication of the type of error
        if (!result.Success)
            throw new ApplicationException(result.ResultMessage);
    }
    catch (Exception ex)
    {
        //relaunches the generic error
        throw new ApplicationException(ex.Message);
    }
}
//IWsEndUser.setEnqueueServerRestore Method (JAVA)
private void RestoreVirtualServer(IWsEndUser client, int serverId)
{
    try
    {
        //sets the object to be passed on to the method, by setting the ServerId
        //and by specifying the number of CPUs and the Gb of RAM
        ServerRestore server = new ServerRestore();
        server.setServerId(serverId);
        server.setCPUQuantity(2);
        server.setRAMQuantity(4);
 
        //calls the setEnqueueServerRestore method,
        //getting a WsResult object
        WsResult result = client.setEnqueueServerRestore(server);

        //if the call fails, the exception is relaunched
        //with the indication of the type of error
        if (!result.isSuccess())
        {
            throw new Exception(result.getResultMessage());
        }
    }
    catch (Exception ex)
    {
        //prints the error
        System.out.println(ex);
    }
}

Version
API: v2.8 URL: https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl
See also

API: v2.8 URL: https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl