Trying to get more comfortable with query services and playing around with one of the samples.
1. This does not work. It will not add the VM to my vms array (Vcloud:vm) because it cannot convert the object (ch.dunes.model.type.ConvertorException: Unable to convert object, no sdk type defined for class : com.vmware.vmo.plugin.vcloud.model.schema.objects.QueryResultAdminVMRecord@1a4d4480). What do I need to do?
var vms = new Array();
for each (vapp in vapps) {
var queryService = vapp.getHost().getQueryService();
var expression = new VclExpression(VclQueryVMField.CONTAINER, vapp.getReference().href, VclExpressionType.EQUALS);
var filter = new VclFilter(expression);
var params = new VclQueryParams();
params.setFilter(filter);
var resultSet = queryService.queryRecords(VclQueryRecordType.ADMINVM, params);
while (resultSet != null) {
var records = resultSet.getRecords(new VclQueryResultAdminVMRecord());
for (i = 0; i < records.length; i++) {
if (records[i].status == "POWERED_ON") {
vms.push(records[i]);
}
}
resultSet = resultSet.getNextPage();
}
}
2. How can I get all vapps in a vdc or an organization with QS? In the API Explorer I have seen that vcloud:vdc does not contain any getQueryService()....