Search in sources :

Example 1 with RollingMaintenanceHostUpdatedResponse

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;
}
Also used : RollingMaintenanceResponse(org.apache.cloudstack.api.response.RollingMaintenanceResponse) ArrayList(java.util.ArrayList) RollingMaintenanceHostSkippedResponse(org.apache.cloudstack.api.response.RollingMaintenanceHostSkippedResponse) RollingMaintenanceManager(com.cloud.resource.RollingMaintenanceManager) RollingMaintenanceHostUpdatedResponse(org.apache.cloudstack.api.response.RollingMaintenanceHostUpdatedResponse)

Aggregations

RollingMaintenanceManager (com.cloud.resource.RollingMaintenanceManager)1 ArrayList (java.util.ArrayList)1 RollingMaintenanceHostSkippedResponse (org.apache.cloudstack.api.response.RollingMaintenanceHostSkippedResponse)1 RollingMaintenanceHostUpdatedResponse (org.apache.cloudstack.api.response.RollingMaintenanceHostUpdatedResponse)1 RollingMaintenanceResponse (org.apache.cloudstack.api.response.RollingMaintenanceResponse)1