Search in sources :

Example 1 with SnapshotScheduleResponse

use of com.cloud.api.response.SnapshotScheduleResponse in project CloudStack-archive by CloudStack-extras.

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 = new SnapshotScheduleResponse();
        snapSchedResponse.setId(snapshotSchedule.getId());
        snapSchedResponse.setVolumeId(snapshotSchedule.getVolumeId());
        snapSchedResponse.setSnapshotPolicyId(snapshotSchedule.getPolicyId());
        snapSchedResponse.setScheduled(snapshotSchedule.getScheduledTimestamp());
        snapSchedResponse.setObjectName("snapshot");
        snapshotScheduleResponses.add(snapSchedResponse);
    }
    response.setResponses(snapshotScheduleResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) SnapshotScheduleResponse(com.cloud.api.response.SnapshotScheduleResponse) ArrayList(java.util.ArrayList) SnapshotSchedule(com.cloud.storage.snapshot.SnapshotSchedule)

Aggregations

ListResponse (com.cloud.api.response.ListResponse)1 SnapshotScheduleResponse (com.cloud.api.response.SnapshotScheduleResponse)1 SnapshotSchedule (com.cloud.storage.snapshot.SnapshotSchedule)1 ArrayList (java.util.ArrayList)1