use of com.cloud.api.response.DomainRouterResponse in project cosmic by MissionCriticalCloud.
the class ViewResponseHelper method createDomainRouterResponse.
public static List<DomainRouterResponse> createDomainRouterResponse(final DomainRouterJoinVO... routers) {
final Account caller = CallContext.current().getCallingAccount();
final Hashtable<Long, DomainRouterResponse> vrDataList = new Hashtable<>();
// Initialise the vrdatalist with the input data
for (final DomainRouterJoinVO vr : routers) {
DomainRouterResponse vrData = vrDataList.get(vr.getId());
if (vrData == null) {
// first time encountering this vm
vrData = ApiDBUtils.newDomainRouterResponse(vr, caller);
} else {
// update nics for 1 to many mapping fields
vrData = ApiDBUtils.fillRouterDetails(vrData, vr);
}
vrDataList.put(vr.getId(), vrData);
}
return new ArrayList<>(vrDataList.values());
}
use of com.cloud.api.response.DomainRouterResponse in project cosmic by MissionCriticalCloud.
the class DestroyRouterCmd method execute.
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
final CallContext ctx = CallContext.current();
ctx.setEventDetails("Router Id: " + getId());
final VirtualRouter result = _routerService.destroyRouter(getId(), ctx.getCallingAccount(), ctx.getCallingUserId());
if (result != null) {
final DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy router");
}
}
use of com.cloud.api.response.DomainRouterResponse in project cosmic by MissionCriticalCloud.
the class RebootRouterCmd method execute.
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
CallContext.current().setEventDetails("Router Id: " + getId());
final VirtualRouter result = _routerService.rebootRouter(getId(), true);
if (result != null) {
final DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
response.setResponseName("router");
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot router");
}
}
Aggregations