public <T> List<T> listCall(CloudStackCommand cmd, String apiKey, String secretKey,
String responseName, String responseObjName, Type collectionType) throws Exception {
assert(responseName != null);
JsonAccessor json = execute(cmd, apiKey, secretKey);
if(responseObjName != null)
try {
return (new Gson()).fromJson(json.eval(responseName + "." + responseObjName), collectionType);
} catch(Exception e) {
// this happens because responseObjName won't exist if there are no objects in the list.
logger.debug("CloudSatck API response doesn't contain responseObjName:" + responseObjName +
" because response is empty");
return null;
}
return (new Gson()).fromJson(json.eval(responseName), collectionType);
}