use of org.apache.cloudstack.api.response.RouterHealthCheckResultsListResponse in project cloudstack by apache.
the class GetRouterHealthCheckResultsCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InvalidParameterValueException, ServerApiException {
CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getRouterId()));
VirtualRouter router = _routerService.findRouter(getRouterId());
if (router == null || router.getRole() != VirtualRouter.Role.VIRTUAL_ROUTER) {
throw new InvalidParameterValueException("Can't find router by routerId");
}
try {
List<RouterHealthCheckResultResponse> healthChecks = _queryService.listRouterHealthChecks(this);
RouterHealthCheckResultsListResponse routerResponse = new RouterHealthCheckResultsListResponse();
routerResponse.setRouterId(router.getUuid());
routerResponse.setHealthChecks(healthChecks);
routerResponse.setObjectName("routerhealthchecks");
routerResponse.setResponseName(getCommandName());
setResponseObject(routerResponse);
} catch (CloudRuntimeException ex) {
ex.printStackTrace();
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to get health check results due to: " + ex.getLocalizedMessage());
}
}
Aggregations