use of org.apache.cloudstack.api.response.BackupResponse in project cloudstack by apache.
the class ListBackupsCmd method setupResponseBackupList.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
protected void setupResponseBackupList(final List<Backup> backups, final Integer count) {
final List<BackupResponse> responses = new ArrayList<>();
for (Backup backup : backups) {
if (backup == null) {
continue;
}
BackupResponse backupResponse = _responseGenerator.createBackupResponse(backup);
responses.add(backupResponse);
}
final ListResponse<BackupResponse> response = new ListResponse<>();
response.setResponses(responses, count);
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of org.apache.cloudstack.api.response.BackupResponse in project cloudstack by apache.
the class BackupDaoImpl method newBackupResponse.
@Override
public BackupResponse newBackupResponse(Backup backup) {
VMInstanceVO vm = vmInstanceDao.findByIdIncludingRemoved(backup.getVmId());
AccountVO account = accountDao.findByIdIncludingRemoved(vm.getAccountId());
DomainVO domain = domainDao.findByIdIncludingRemoved(vm.getDomainId());
DataCenterVO zone = dataCenterDao.findByIdIncludingRemoved(vm.getDataCenterId());
BackupOffering offering = backupOfferingDao.findByIdIncludingRemoved(vm.getBackupOfferingId());
BackupResponse response = new BackupResponse();
response.setId(backup.getUuid());
response.setVmId(vm.getUuid());
response.setVmName(vm.getHostName());
response.setExternalId(backup.getExternalId());
response.setType(backup.getType());
response.setDate(backup.getDate());
response.setSize(backup.getSize());
response.setProtectedSize(backup.getProtectedSize());
response.setStatus(backup.getStatus());
response.setVolumes(new Gson().toJson(vm.getBackupVolumeList().toArray(), Backup.VolumeInfo[].class));
response.setBackupOfferingId(offering.getUuid());
response.setBackupOffering(offering.getName());
response.setAccountId(account.getUuid());
response.setAccount(account.getAccountName());
response.setDomainId(domain.getUuid());
response.setDomain(domain.getName());
response.setZoneId(zone.getUuid());
response.setZone(zone.getName());
response.setObjectName("backup");
return response;
}
Aggregations