I am trying to get a list of all vAppTemplateNames from my VCD host using the query service.
I have over 280 vApp Templates in VCD that are visible in the VCD plugin inventory in VCO. When I query VCD via the query service I only get back 82 records. My code is below.
Any reason the query service would return a subset and not full result set? Could it be a permissions issue, even though the plugin has all the vAppTemplates in the inventory? Is there something simple I am missing.
Input: vdc, type = vCloud:vdc
- var vcdHost = vdc.getHost();
- var queryService = vcdHost.getQueryService();
- var expression = new VclExpression(VclQueryVAppTemplateField.NAME, "*", VclExpressionType.EQUALS);
- var filter = new VclFilter(expression);
- var params = new VclQueryParams();
- params.setFilter(filter);
- var resultSet = queryService.queryRecords(VclQueryRecordType.VAPPTEMPLATE, params);
- var vAppTemplateNames = new Array();
- System.log("Total Result: "+ resultSet.getTotal());
- while (resultSet != null) {
- var records = resultSet.getRecords(new VclQueryResultVAppTemplateRecord());
- for each (var record in records) {
- vAppTemplateNames.push(record.name);
- System.log("TemplateName: "+ record.name);
- }
- resultSet = resultSet.getNextPage();
- }
- return vAppTemplateNames.sort();
slahy