use of com.emc.storageos.model.vdc.VirtualDataCenterRestRep in project coprhd-controller by CoprHD.
the class VirtualDataCenters method itemDetails.
public static void itemDetails(String id) {
VirtualDataCenterRestRep vdc = VirtualDataCenterUtils.get(id);
if (vdc == null) {
error(MessagesUtils.get(UNKNOWN, id));
}
Tasks<VirtualDataCenterRestRep> vdcTasks = VirtualDataCenterUtils.getTasks(uri(id));
Task<VirtualDataCenterRestRep> latestTask = null;
if (vdcTasks != null) {
latestTask = vdcTasks.latestFinishedTask();
}
render(vdc, latestTask);
}
use of com.emc.storageos.model.vdc.VirtualDataCenterRestRep in project coprhd-controller by CoprHD.
the class VirtualDataCenters method save.
@FlashException(keep = true, referrer = { "create", "edit" })
@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void save(VirtualDataCenterForm vdc) {
vdc.validate("vdc");
if (Validation.hasErrors()) {
Common.handleError();
}
if (vdc.isNew()) {
VirtualDataCenterAddParam vdcToAdd = new VirtualDataCenterAddParam();
vdcToAdd.setName(vdc.name);
vdcToAdd.setApiEndpoint(vdc.apiEndpoint);
vdcToAdd.setDescription(vdc.description);
vdcToAdd.setSecretKey(vdc.secretKey);
try {
vdcToAdd.setCertificateChain(FileUtils.readFileToString(vdc.certChain));
} catch (Exception e) {
flash.error(MessagesUtils.get("vdc.certChain.invalid.error"));
Common.handleError();
}
Task<VirtualDataCenterRestRep> task = VirtualDataCenterUtils.create(vdcToAdd);
flash.put("inProgressTask", task.getTaskResource().getId());
} else {
VirtualDataCenterRestRep currentVDC = VirtualDataCenterUtils.get(vdc.id);
if (currentVDC != null) {
VirtualDataCenterModifyParam vdcToUpdate = new VirtualDataCenterModifyParam();
vdcToUpdate.setName(vdc.name);
vdcToUpdate.setDescription(vdc.description);
Task<VirtualDataCenterRestRep> task = VirtualDataCenterUtils.update(uri(vdc.id), vdcToUpdate);
flash.put("inProgressTask", task.getTaskResource().getId());
}
}
Cache.delete(Common.VDCS);
if (StringUtils.isNotBlank(vdc.referrerUrl)) {
redirect(vdc.referrerUrl);
} else {
list();
}
}
use of com.emc.storageos.model.vdc.VirtualDataCenterRestRep in project coprhd-controller by CoprHD.
the class VirtualDataCenterMapper method map.
public static VirtualDataCenterRestRep map(VirtualDataCenter from) {
if (from == null) {
return null;
}
VirtualDataCenterRestRep to = new VirtualDataCenterRestRep();
mapDataObjectFields(from, to);
to.setDescription(from.getDescription());
to.setApiEndpoint(from.getApiEndpoint());
to.setStatus(from.getConnectionStatus().name());
to.setLocal(from.getLocal());
to.setShortId(from.getShortId());
to.setGeoCommandEndpoint(from.getGeoCommandEndpoint());
to.setGeoDataEndpoint(from.getGeoDataEndpoint());
to.setLastSeenTimeInMillis(from.getLastSeenTimeInMillis());
return to;
}
Aggregations