use of org.apache.cloudstack.api.response.RollingMaintenanceHostUpdatedResponse in project cloudstack by apache.
the class ApiResponseHelper method createRollingMaintenanceResponse.
@Override
public RollingMaintenanceResponse createRollingMaintenanceResponse(Boolean success, String details, List<RollingMaintenanceManager.HostUpdated> hostsUpdated, List<RollingMaintenanceManager.HostSkipped> hostsSkipped) {
RollingMaintenanceResponse response = new RollingMaintenanceResponse(success, details);
List<RollingMaintenanceHostUpdatedResponse> updated = new ArrayList<>();
for (RollingMaintenanceManager.HostUpdated h : hostsUpdated) {
RollingMaintenanceHostUpdatedResponse r = new RollingMaintenanceHostUpdatedResponse();
r.setHostId(h.getHost().getUuid());
r.setHostName(h.getHost().getName());
r.setStartDate(getDateStringInternal(h.getStart()));
r.setEndDate(getDateStringInternal(h.getEnd()));
r.setOutput(h.getOutputMsg());
updated.add(r);
}
List<RollingMaintenanceHostSkippedResponse> skipped = new ArrayList<>();
for (RollingMaintenanceManager.HostSkipped h : hostsSkipped) {
RollingMaintenanceHostSkippedResponse r = new RollingMaintenanceHostSkippedResponse();
r.setHostId(h.getHost().getUuid());
r.setHostName(h.getHost().getName());
r.setReason(h.getReason());
skipped.add(r);
}
response.setUpdatedHosts(updated);
response.setSkippedHosts(skipped);
response.setObjectName("rollingmaintenance");
return response;
}
Aggregations