IWsEndUserSetEnqueuePurchaseSharedStorage Method |
Namespace: Aruba.Cloud.WsEndUser
[OperationContractAttribute] WsResult SetEnqueuePurchaseSharedStorage( EnqueuePurchaseSharedStorageRequest operationRequest )
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(); }