Search in sources :

Example 1 with SnapshotScheduleResponse

use of org.apache.cloudstack.api.response.SnapshotScheduleResponse in project cloudstack by apache.

the class ApiResponseHelper method createSnapshotScheduleResponse.

@Override
public SnapshotScheduleResponse createSnapshotScheduleResponse(SnapshotSchedule snapshotSchedule) {
    SnapshotScheduleResponse response = new SnapshotScheduleResponse();
    response.setId(snapshotSchedule.getUuid());
    if (snapshotSchedule.getVolumeId() != null) {
        Volume vol = ApiDBUtils.findVolumeById(snapshotSchedule.getVolumeId());
        if (vol != null) {
            response.setVolumeId(vol.getUuid());
        }
    }
    if (snapshotSchedule.getPolicyId() != null) {
        SnapshotPolicy policy = ApiDBUtils.findSnapshotPolicyById(snapshotSchedule.getPolicyId());
        if (policy != null) {
            response.setSnapshotPolicyId(policy.getUuid());
        }
    }
    response.setScheduled(snapshotSchedule.getScheduledTimestamp());
    response.setObjectName("snapshot");
    return response;
}
Also used : SnapshotPolicy(com.cloud.storage.snapshot.SnapshotPolicy) Volume(com.cloud.storage.Volume) SnapshotScheduleResponse(org.apache.cloudstack.api.response.SnapshotScheduleResponse)

Example 2 with SnapshotScheduleResponse

use of org.apache.cloudstack.api.response.SnapshotScheduleResponse in project cloudstack by apache.

the class ListRecurringSnapshotScheduleCmd method execute.

@Override
public void execute() {
    List<? extends SnapshotSchedule> snapshotSchedules = _snapshotService.findRecurringSnapshotSchedule(this);
    ListResponse<SnapshotScheduleResponse> response = new ListResponse<SnapshotScheduleResponse>();
    List<SnapshotScheduleResponse> snapshotScheduleResponses = new ArrayList<SnapshotScheduleResponse>();
    for (SnapshotSchedule snapshotSchedule : snapshotSchedules) {
        SnapshotScheduleResponse snapSchedResponse = _responseGenerator.createSnapshotScheduleResponse(snapshotSchedule);
        snapshotScheduleResponses.add(snapSchedResponse);
    }
    response.setResponses(snapshotScheduleResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(org.apache.cloudstack.api.response.ListResponse) SnapshotScheduleResponse(org.apache.cloudstack.api.response.SnapshotScheduleResponse) ArrayList(java.util.ArrayList) SnapshotSchedule(com.cloud.storage.snapshot.SnapshotSchedule)

Aggregations

SnapshotScheduleResponse (org.apache.cloudstack.api.response.SnapshotScheduleResponse)2 Volume (com.cloud.storage.Volume)1 SnapshotPolicy (com.cloud.storage.snapshot.SnapshotPolicy)1 SnapshotSchedule (com.cloud.storage.snapshot.SnapshotSchedule)1 ArrayList (java.util.ArrayList)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1