Computing > 11 - Private Cloud > Purchase private cloud

11.3 Purchase private cloud

By the method setEnqueuePurchasePrivateCloud you can puchase a private cloud. The method require to specify the name of private cloud, a description, the username and password, a telephone number, an email and the resources quantity

Parametres
purchasePrivateCloud
Type: PurchasePrivateCloud
Hold all the attributes for the creation of a Private Cloud

 
/// IWsEndUser.SetEnqueuePurchasePrivateCloud Method (c# .NET)
public static string SetEnqueuePurchasePrivateCloud(WsEndUserClient client,
    PurchasePrivateCloud purchasePrivateCloud)
{
    //specify the account login details 
    client.ClientCredentials.UserName.UserName = "ARU-0000";
    client.ClientCredentials.UserName.Password = "0123456789";

    StringBuilder stringBuilder = new StringBuilder();

    try
    {
	// call method setEnqueuePurchasePrivateCloud 
	// obtaining a WsResultOfint item
	WsResultOfPurchasedPrivateCloud result = 
               client.SetEnqueuePurchasePrivateCloud(purchasePrivateCloud);

	//if the call is Success print value
	if (result.Success)
	{
	    // get Value returned from server
	    stringBuilder.Append(" Operation ends successfully. Result Code : ");
	    stringBuilder.Append(result.ResultCode);
	}
	else
	{
	    throw new ApplicationException(result.ResultMessage);
	}
    }
    catch (Exception ex)
    {
	// re-run the error
	throw new ApplicationException(ex.Message);
    }

    return stringBuilder.ToString();
}
//IWsEndUser.setEnqueuePurchasePrivateCloud Method (JAVA)
private static void setEnqueuePurchasePrivateCloud(IWsEndUser client,
      PurchasePrivateCloud purchasePrivateCloud)
{
     //specify the account login details 
    ((BindingProvider) client).getRequestContext()
	.put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");
    ((BindingProvider) client).getRequestContext()
	.put(BindingProvider.PASSWORD_PROPERTY, "0123456789");
    
    try
    {

        // call method setEnqueuePurchasePrivateCloud 
        // obtaining a WsResult item
        WsResult result = 
              client.setEnqueuePurchasePrivateCloud(purchasePrivateCloud);

        //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)
    {
        //print the error 
        System.out.println(ex);
    }
}
Version
API: v2.8 URL:https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl