IWsEndUserGetVirtualDatacenterCost Method |
Namespace: Aruba.Cloud.WsEndUser
[OperationContractAttribute] WsResult<VirtualDatacenterCost> GetVirtualDatacenterCost()
private String GetDataCenterCost() { StringBuilder sb = new StringBuilder(); try { WsResultOfVirtualDatacenterCost result = client.GetVirtualDatacenterCost(); if (result.Success) { ServerCost serverCosts = result.Value.ServerCost.Where(p => p.ServerId == 825).Single(); if (serverCosts != null) { sb.AppendLine("Resources hourly cost for ServerId " + serverCosts.ServerId); sb.AppendLine("- RAM: " + serverCosts.OSTemplateCost.TotalHourlyCost); sb.AppendLine("- OS Template: " + serverCosts.OSTemplateCost.TotalHourlyCost); sb.AppendLine("- Disks: " + serverCosts.VirtualDiskCost.TotalHourlyCost); sb.AppendLine("- CPU: " + serverCosts.CpuCost.TotalHourlyCost); sb.AppendLine("-------------------------------"); sb.AppendLine("TOTAL (per hour): " + serverCosts.TotalHourlyCost); } } else { throw new ApplicationException(String.Format( "An error has occurred while invoking GetDataCenterCost(). This is the inner exception: {0}", result.ResultMessage)); } } catch (Exception ex) { throw new ApplicationException(String.Format("An error has occurred while getting datacenter cost. {0}", ex.Message)); } return sb.ToString(); }