use of org.apache.cloudstack.api.response.DomainRouterResponse in project cloudstack by apache.
the class QueryManagerImpl method searchForRouters.
@Override
public ListResponse<DomainRouterResponse> searchForRouters(ListRoutersCmd cmd) {
Pair<List<DomainRouterJoinVO>, Integer> result = searchForRoutersInternal(cmd, cmd.getId(), cmd.getRouterName(), cmd.getState(), cmd.getZoneId(), cmd.getPodId(), cmd.getClusterId(), cmd.getHostId(), cmd.getKeyword(), cmd.getNetworkId(), cmd.getVpcId(), cmd.getForVpc(), cmd.getRole(), cmd.getVersion(), cmd.isHealthCheckFailed());
ListResponse<DomainRouterResponse> response = new ListResponse<DomainRouterResponse>();
List<DomainRouterResponse> routerResponses = ViewResponseHelper.createDomainRouterResponse(result.first().toArray(new DomainRouterJoinVO[result.first().size()]));
if (VirtualNetworkApplianceManager.RouterHealthChecksEnabled.value()) {
for (DomainRouterResponse res : routerResponses) {
DomainRouterVO resRouter = _routerDao.findByUuid(res.getId());
res.setHealthChecksFailed(routerHealthCheckResultDao.hasFailingChecks(resRouter.getId()));
if (cmd.shouldFetchHealthCheckResults()) {
res.setHealthCheckResults(responseGenerator.createHealthCheckResponse(resRouter, new ArrayList<>(routerHealthCheckResultDao.getHealthCheckResults(resRouter.getId()))));
}
}
}
response.setResponses(routerResponses, result.second());
return response;
}
use of org.apache.cloudstack.api.response.DomainRouterResponse in project cloudstack by apache.
the class QueryManagerImpl method searchForInternalLbVms.
@Override
public ListResponse<DomainRouterResponse> searchForInternalLbVms(ListInternalLBVMsCmd cmd) {
Pair<List<DomainRouterJoinVO>, Integer> result = searchForRoutersInternal(cmd, cmd.getId(), cmd.getRouterName(), cmd.getState(), cmd.getZoneId(), cmd.getPodId(), null, cmd.getHostId(), cmd.getKeyword(), cmd.getNetworkId(), cmd.getVpcId(), cmd.getForVpc(), cmd.getRole(), null, null);
ListResponse<DomainRouterResponse> response = new ListResponse<DomainRouterResponse>();
List<DomainRouterResponse> routerResponses = ViewResponseHelper.createDomainRouterResponse(result.first().toArray(new DomainRouterJoinVO[result.first().size()]));
if (VirtualNetworkApplianceManager.RouterHealthChecksEnabled.value()) {
for (DomainRouterResponse res : routerResponses) {
DomainRouterVO resRouter = _routerDao.findByUuid(res.getId());
res.setHealthChecksFailed(routerHealthCheckResultDao.hasFailingChecks(resRouter.getId()));
if (cmd.shouldFetchHealthCheckResults()) {
res.setHealthCheckResults(responseGenerator.createHealthCheckResponse(resRouter, new ArrayList<>(routerHealthCheckResultDao.getHealthCheckResults(resRouter.getId()))));
}
}
}
response.setResponses(routerResponses, result.second());
return response;
}
Aggregations