Search in sources :

Example 11 with DomainRouterResponse

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;
}
Also used : ListResponse(org.apache.cloudstack.api.response.ListResponse) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) DomainRouterResponse(org.apache.cloudstack.api.response.DomainRouterResponse) DomainRouterVO(com.cloud.vm.DomainRouterVO) DomainRouterJoinVO(com.cloud.api.query.vo.DomainRouterJoinVO)

Example 12 with DomainRouterResponse

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;
}
Also used : ListResponse(org.apache.cloudstack.api.response.ListResponse) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) DomainRouterResponse(org.apache.cloudstack.api.response.DomainRouterResponse) DomainRouterVO(com.cloud.vm.DomainRouterVO) DomainRouterJoinVO(com.cloud.api.query.vo.DomainRouterJoinVO)

Aggregations

DomainRouterResponse (org.apache.cloudstack.api.response.DomainRouterResponse)12 VirtualRouter (com.cloud.network.router.VirtualRouter)8 ServerApiException (org.apache.cloudstack.api.ServerApiException)8 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)5 DomainRouterJoinVO (com.cloud.api.query.vo.DomainRouterJoinVO)3 ArrayList (java.util.ArrayList)3 DomainRouterVO (com.cloud.vm.DomainRouterVO)2 List (java.util.List)2 ListResponse (org.apache.cloudstack.api.response.ListResponse)2 HostPodVO (com.cloud.dc.HostPodVO)1 TrafficType (com.cloud.network.Networks.TrafficType)1 VMTemplateVO (com.cloud.storage.VMTemplateVO)1 Account (com.cloud.user.Account)1 Hashtable (java.util.Hashtable)1 NicResponse (org.apache.cloudstack.api.response.NicResponse)1 CallContext (org.apache.cloudstack.context.CallContext)1