Quantcast
Channel: VMware Communities : All Content - vRealize Automation Tools
Viewing all articles
Browse latest Browse all 9859

How to get the cost of CPU, memory, storage using vRO

$
0
0

Hi,

I have couple of XaaS blueprints and I want to display the cost of provisioning similar to the ASD's blueprint. I was able to get the blueprint's cost by day and total cost, but I could not find any vRO classes to get the cost of each component such as CPU/memory/storage. The reason for that is I want to update on the fly the daily cost and total cost when the user change the number of CPU, memory...

Here is my code to get the daily and total cost:

// Input: vCACCAFE:CatalogItem

var host = vCACCAFEEntitiesFinder.getHostForEntity(catalogItem);

 

var items = vCACCAFEEntitiesFinder.findCatalogResources(host, catalogItem.name);

       System.log('Number items: ' + items.length);

for each (var i in items) {

    System.log("Id: " + i.id);   

    System.log("Name: " + i.name);

 

    var resource = vCACCAFEEntitiesFinder.getCatalogResource(host, i.id);

    var resourceType = resource.getResourceTypeRef().getLabel();

    System.log("resource type: " + resourceType);

    System.log("resource Data: " + resource.getResourceData());

    System.log("resource lease: " + resource.getLeaseForDisplay().getAmount());

    var cost = resource.getCosts().getLeaseRate().getCost();

    System.log("resource cost: " + cost.amount + cost.currencyCode);

    var totalCost = resource.getTotalCost();

    System.log("resource total cost: " + totalCost.amount);

}

 

Does anybody know which vCACCAFE class I should use to get those info?

Thanks,

  - Huy


Viewing all articles
Browse latest Browse all 9859

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>