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;
}
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);
}
Aggregations