vCO Workflow Script to Get Organisational Virtual Data Centers Resource Allocation, Limits and Usage

The following script gets Organisational Virtual Data Centers Resource Allocation, Limits and Usage

 

var objVclQueryService;
objVclQueryService = objVclHost.getQueryService();

var objVclExpression;
objVclExpression = new VclExpression(VclQueryAdminVdcField.NAME, "*", VclExpressionType.EQUALS);

var objVclFilter;
objVclFilter = new VclFilter(objVclExpression);

var objVclQueryParams;
objVclQueryParams = new VclQueryParams();
objVclQueryParams.setFilter(objVclFilter);

var objVclAbstractRecordResultSet;
objVclAbstractRecordResultSet = objVclQueryService.queryRecords(VclQueryRecordType.ADMINORGVDC, objVclQueryParams);

if (objVclAbstractRecordResultSet == null) 
{
throw "No matching Org vDC found.";
}
else
{
var arrRecords;
arrRecords = objVclAbstractRecordResultSet.getRecords(new VclQueryResultAdminVdcRecord());

for each (var objRecord in arrRecords) 
{
System.log("===========================================================================");
System.log("orgVdc = " + objRecord.name);
System.log("===========================================================================");
System.log("cpuAllocationMhz = " + objRecord.cpuAllocationMhz);
System.log("cpuLimitMhz = " + objRecord.cpuLimitMhz);
System.log("cpuUsedMhz = " + objRecord.cpuUsedMhz);
System.log("===========================================================================");
System.log("memoryAllocationMB = " + objRecord.memoryAllocationMB);
System.log("memoryLimitMB = " + objRecord.memoryLimitMB);
System.log("memoryUsedMB = " + objRecord.memoryUsedMB);
System.log("===========================================================================");
System.log("storageAllocationMB = " + objRecord.storageAllocationMB);
System.log("storageLimitMB = " + objRecord.storageLimitMB);
System.log("storageUsedMB = " + objRecord.storageUsedMB);
System.log("===========================================================================");
}
}

Leave a Reply