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

4.1.02 Editing the RAM

Using Aruba's WsEndUser SetEnqueueServerUpdate method you can change the resources of a virtual server, specifying the characteristics of the resources that have changed.

Parameters
server
Type: ServerUpdate
UpdateServer class object which represents the structure of the server to be edited.
The UpdateServer class contains all the useful information to complete the task of updating the virtual server, and all the related resources.

Let's look at the example of a method that performs an update operation of the RAM

//IWsEndUser.SetEnqueueServerUpdate Method (c# .NET)
private static void UpdateServerRAM(WsEndUserClient client, int serverId)
{
    try
    {
        //creates a new object called serverToUpdate,
        //ServerUpdate class 
        ServerUpdate serverToUpdate = new ServerUpdate()
        {
            //the new amount of RAM  
            RAMQuantity = 8,
            //indicates the virtual server on which to apply the update 
            ServerId = serverId
        };

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

        //if the call fails; it relaunches the error indicating the message
        if (!result.Success)
            throw new ApplicationException(result.ResultMessage);
    }
    catch (Exception ex)
    {
        //relaunches the generic error 
        throw new ApplicationException(ex.Message);
    }
}
//IWsEndUser.setEnqueueServerUpdate Method (JAVA)
private static void UpdateServerRAM(IWsEndUser client, int serverId, int ramQuantityGb)
{
    try
    {
        //creates a new object called serverToUpdate, ServerUpdate class 
        ServerUpdate serverToUpdate = new ServerUpdate();
        //the new amount of RAM
        serverToUpdate.setRAMQuantity(ramQuantityGb);
        
        //indicates the virtual server on which to apply the update
        serverToUpdate.setServerId(serverId);      
 
        //calls the setEnqueueServerUpdate method,
        //getting a WsResult object 
        WsResult result = client.setEnqueueServerUpdate(serverToUpdate);

        //if the call fails; it relaunches the error indicating the message
        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