Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 293210

Re: Query vCloud Object from vCO

$
0
0

Glad you found the solution by yourself.

 

Here is a better version of what I have posted yesterday:

 

 

var queryService = vcdHost.getQueryService();
 
var expression = new VclExpression(VclQueryVAppTemplateField.NAME, vAppTemplateName, VclExpressionType.EQUALS);
var filter = new VclFilter(expression);
var params = new VclQueryParams();
params.setFilter(filter);
 
var vAppTemplates = new Array();
var resultSet = queryService.queryRecords(VclQueryRecordType.VAPPTEMPLATE, params);
 
while (resultSet != null{
    var records = resultSet.getRecords(new VclQueryResultVAppTemplateRecord());
    //System.log(records.length + " records found");
    for each (var record in records) {
        if (record.vdcName == vdcName) {
            var vAppTemplateRef = new VclReference();
            vAppTemplateRef.href = record.href;
            vAppTemplateRef.name = record.name;
            vAppTemplateRef.type = record.type;
            vAppTemplates.push(vcdHost.getEntityByReference(VclEntityType.VAPP_TEMPLATE, vAppTemplateRef));
            }
        }
    resultSet = resultSet.getNextPage();
}
 
return vAppTemplates;

 

 

Here I am only returning the vAppTemplate records having a particular VDC name instead of returning all vAppTemplates with a given name and using a separate action to iterate through all their VDCs.


Viewing all articles
Browse latest Browse all 293210

Trending Articles



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