Click or drag to resize

IWsEndUserGetVirtualDatacenterCost Method

Get price's details of account virtual datacenter's components. By call to GetVirtualDataCenterCost method it's possible know price's details for each virtual datacenter's component

Namespace:  Aruba.Cloud.WsEndUser
Assembly:  Aruba.Cloud.WsEndUser (in Aruba.Cloud.WsEndUser.dll) Version: (
WsResult<VirtualDatacenterCost> GetVirtualDatacenterCost()

Return Value

Type: WsResultVirtualDatacenterCost
WsResultOfVirtualDatacenterCost contain data center information of authenticated user. For more information consult WsResult class and VirtualDatacenterCost class.
private String GetDataCenterCost()
  StringBuilder sb = new StringBuilder();

    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("TOTAL (per hour): " + serverCosts.TotalHourlyCost);
      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();
See Also