Storage > 2 - Account Management > Change Tariff Plan

2.4 Change Tariff Plan

By the method SetCloudStorageAccountPricingType you can specify the method of payment for the resources of an account CloudStorage, choosing between a prepaid tariff plan or a type to consumption.

Parameters
cloudStorageAccountId
Type: int
Int type item which contain the account id.
 
cloudStoracePricingTypeId
Type: int
Int type item which contain the tariff plan id.
 
Returns
The method returns a WsResult item with information on the result of the call to the method.
 
//WsCloudStorage.SetCloudStorageAccountPricingType Method (c# .NET)
private static void SetCloudStorageAccountPricingType(WsCloudStorageClient client, 
    int cloudStorageAccountId, int cloudStoracePricingTypeId)
{
    //specify the account login details 
    client.ClientCredentials.UserName.UserName = "ARU-0000";
    client.ClientCredentials.UserName.Password = "1234567890";

    try
    {
        //call method SetCloudStorageAccountPricingType, 
        //obtaining a WsResult item
        WsResult result = 
            client.SetCloudStorageAccountPricingType(cloudStorageAccountId, 
                cloudStoracePricingTypeId);

        //if the call is not successful, re-run the error indicating the message
        if (!result.Success)
        {
            throw new Exception(result.ResultMessage);
        }
    }
    catch (Exception ex)
    {
        //re-run the error
        throw new Exception(ex.Message);
    }
}
//IWsCloudStorage.SetCloudStorageAccountPricingTypeMethod Method (JAVA)
private static void SetCloudStorageAccountPricingType(WsCloudStorageClient client, 
    int cloudStorageAccountId, int cloudStoracePricingTypeId)
{
    //specify the account login details     
     ((BindingProvider) wsCloudStorage).getRequestContext()
     .put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");
     ((BindingProvider) wsCloudStorage).getRequestContext()
     .put(BindingProvider.PASSWORD_PROPERTY, "1234567890");

    StringBuilder sb = new StringBuilder();
    try 
    {
        // call method SetCloudStorageAccountPricingType,
        // obtaining a WsResult item
        WsResult result = 
            client.setCloudStorageAccountPricingType(cloudStoraceAccountId, 
            overLimitBehavior);
        //if the call is not successful, re-run the error indicating the message
        if (!result.isSuccess()) 
        {
            throw new Exception(result.getResultMessage().getValue());
        }
    } 
    catch (Exception ex) 
    {
        //show result
        System.out.println(ex);
    }


By the method SetCloudStorageAccountOverLimitBehavior you can specify the behavior to adopt exceeded the limit of your pricing plan.
 
 
Parameters
cloudStoraceAccountId
Type: Int
Int type item which contain the account id.
 
overLimitBehavior
Type: OverLimitBehavior
OverLimitBehavior type item which contain the tariff plan to use.
 
Returns
The method returns a WsResult item with information on the result of the call to the method.
 
//WsCloudStorage.SetCloudStorageAccountOverLimitBehavior Method (c# .NET)
private static void SetCloudStorageAccountOverLimitBehavior(WsCloudStorageClient 
    client, int cloudStorageAccountId, OverLimitBehavior overLimitBehavior)
{
    //specify the account login details 
    client.ClientCredentials.UserName.UserName = "ARU-0000";
    client.ClientCredentials.UserName.Password = "1234567890";

    try
    {
        //call method SetCloudStorageAccountOverLimitBehavior, 
        //obtaining a WsResult item
        WsResult result = 
            client.SetCloudStorageAccountOverLimitBehavior(cloudStorageAccountId, 
            overLimitBehavior);

        //if the call is not successful, re-run the error indicating the message
        if (!result.Success)
        {
            throw new Exception(result.ResultMessage);
        }
    }
    catch (Exception ex)
    {
        //re-run the error
        throw new Exception(ex.Message);
    }
}
//IWsCloudStorage.SetCloudStorageAccountOverLimitBehavior Method Method (JAVA)
private static String SetCloudStorageAccountOverLimitBehavior(IWsCloudStorage 
    client, Integer cloudStoraceAccountId,
    OverLimitBehavior overLimitBehavior) 
{
    //specify the account login details     
     ((BindingProvider) wsCloudStorage).getRequestContext()
     .put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");
     ((BindingProvider) wsCloudStorage).getRequestContext()
     .put(BindingProvider.PASSWORD_PROPERTY, "1234567890");
    StringBuilder sb = new StringBuilder();
    try 
    {
        // call method SetCloudStorageAccountOverLimitBehavior,
        // obtaining a WsResult item
        WsResult result = 
            client.setCloudStorageAccountOverLimitBehavior(cloudStoraceAccountId, 
            overLimitBehavior);
        //if the call is not successful, re-run the error indicating the message
        if (!result.isSuccess()) 
        {
            throw new Exception(result.getResultMessage().getValue());
        }
    } 
    catch (Exception ex) 
    {
        //show result
        System.out.println(ex);
    }
Versione
API: v2.8 URL: https://api.services.cloud.it/wsCloudStorage/v2.8/WsCloudStorage.svc?wsdl