Click or drag to resize

IWsEndUserSetEnqueuePurchaseSharedStorage Method

By the method SetEnqueuePurchaseSharedStorage you can puchase a network storage. The method require to specify the name of storage, the protocol, the IP if you want and the size of storage also if you specify the ISCSI protocol you must specify the IQN of your machine

Namespace:  Aruba.Cloud.WsEndUser
Assembly:  Aruba.Cloud.WsEndUser (in Aruba.Cloud.WsEndUser.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
[OperationContractAttribute]
WsResult SetEnqueuePurchaseSharedStorage(
	EnqueuePurchaseSharedStorageRequest operationRequest
)

Parameters

operationRequest
Type: Aruba.Cloud.Provisioning.Entities.SharedStorageEnqueuePurchaseSharedStorageRequest

Return Value

Type: WsResult
Examples
        public static string SetEnqueuePurchaseSharedStorage(WsEndUserClient client,
    int quantity, String storageName, 
    SharedStorageProtocolType protocolType, String[] IQNValues= null)
{
    //specify the account login details 
    client.ClientCredentials.UserName.UserName = "ARU-0000";
    client.ClientCredentials.UserName.Password = "0123456789";

    StringBuilder stringBuilder = new StringBuilder();

    try
    {
        // create the object EnqueuePurchaseSharedStorageRequest  for the request 
        // with data to process
        EnqueuePurchaseSharedStorageRequest request = 
            new EnqueuePurchaseSharedStorageRequest();

        request.Quantity = quantity;
        request.SharedStorageName = storageName;
        request.SharedStorageProtocolType = protocolType;

        if (protocolType == SharedStorageProtocolType.ISCSI)
        {
            // IQN values are mandatory ...
            if (IQNValues == null || IQNValues.Length==0)
            {
                throw new ApplicationException(
                    @"For ISCSI SharedStorageProtocolType IQNs values 
                      are mandatory.");
            }

            // create the IQNvalues to assign to the storage
            request.SharedStorageIQNs = new SharedStorageIQN[IQNValues.Length];

            for (int i=0; i< IQNValues.Length; i++)
            {
                SharedStorageIQN iqn = new SharedStorageIQN();
                iqn.Value =  IQNValues[i];
                iqn.Status = SharedStorageStatus.Active;
                request.SharedStorageIQNs[i] = iqn; 
            }
        }

        // call method SetEnqueuePurchaseSharedStorage, 
        // obtaining a WsResult item               
        WsResult result = client.SetEnqueuePurchaseSharedStorage(request);

        //if the call is Success print history values
        if (result.Success)
        {
            // get Value returned from server
            stringBuilder.Append(" Operation 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();
}
See Also