use of org.ovirt.engine.api.v3.types.V3VMs in project ovirt-engine by oVirt.
the class V3VmsOutAdapter method adapt.
@Override
public V3VMs adapt(Vms from) {
V3VMs to = new V3VMs();
if (from.isSetActions()) {
to.setActions(adaptOut(from.getActions()));
}
if (from.isSetActive()) {
to.setActive(from.getActive());
}
if (from.isSetSize()) {
to.setSize(from.getSize());
}
if (from.isSetTotal()) {
to.setTotal(from.getTotal());
}
to.getVMs().addAll(adaptOut(from.getVms()));
return to;
}
use of org.ovirt.engine.api.v3.types.V3VMs in project ovirt-engine by oVirt.
the class V3NicOutAdapter method adapt.
@Override
public V3NIC adapt(Nic from) {
V3NIC to = new V3NIC();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptOut(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptOut(from.getActions()));
}
if (from.isSetBootProtocol()) {
to.setBootProtocol(from.getBootProtocol().value());
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetInstanceType()) {
to.setInstanceType(adaptOut(from.getInstanceType()));
}
if (from.isSetInterface()) {
to.setInterface(from.getInterface().value());
}
if (from.isSetLinked()) {
to.setLinked(from.isLinked());
}
if (from.isSetMac()) {
to.setMac(adaptOut(from.getMac()));
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetNetwork()) {
to.setNetwork(adaptOut(from.getNetwork()));
}
if (from.isSetOnBoot()) {
to.setOnBoot(from.isOnBoot());
}
if (from.isSetPlugged()) {
to.setPlugged(from.isPlugged());
// In V3 the "active" property used to be a synonym of "plugged":
to.setActive(from.isPlugged());
}
if (from.isSetReportedDevices()) {
to.setReportedDevices(new V3ReportedDevices());
to.getReportedDevices().getReportedDevices().addAll(adaptOut(from.getReportedDevices().getReportedDevices()));
}
if (from.isSetStatistics()) {
to.setStatistics(new V3Statistics());
to.getStatistics().getStatistics().addAll(adaptOut(from.getStatistics().getStatistics()));
}
if (from.isSetTemplate()) {
to.setTemplate(adaptOut(from.getTemplate()));
}
if (from.isSetVm()) {
to.setVm(adaptOut(from.getVm()));
}
if (from.isSetVms()) {
to.setVms(new V3VMs());
to.getVms().getVMs().addAll(adaptOut(from.getVms().getVms()));
}
if (from.isSetVnicProfile()) {
to.setVnicProfile(adaptOut(from.getVnicProfile()));
// In V4 the "network" and "port_mirroring" properties of the NIC have been removed, but in V3 they must
// be populated:
setNetworkAndPortMirroring(from, to);
}
return to;
}
use of org.ovirt.engine.api.v3.types.V3VMs in project ovirt-engine by oVirt.
the class V3FloppyOutAdapter method adapt.
@Override
public V3Floppy adapt(Floppy from) {
V3Floppy to = new V3Floppy();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptOut(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptOut(from.getActions()));
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetFile()) {
to.setFile(adaptOut(from.getFile()));
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetInstanceType()) {
to.setInstanceType(adaptOut(from.getInstanceType()));
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetTemplate()) {
to.setTemplate(adaptOut(from.getTemplate()));
}
if (from.isSetVm()) {
to.setVm(adaptOut(from.getVm()));
}
if (from.isSetVms()) {
to.setVms(new V3VMs());
to.getVms().getVMs().addAll(adaptOut(from.getVms().getVms()));
}
return to;
}
use of org.ovirt.engine.api.v3.types.V3VMs in project ovirt-engine by oVirt.
the class V3QuotaOutAdapter method adapt.
@Override
public V3Quota adapt(Quota from) {
V3Quota to = new V3Quota();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptOut(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptOut(from.getActions()));
}
if (from.isSetClusterHardLimitPct()) {
to.setClusterHardLimitPct(from.getClusterHardLimitPct());
}
if (from.isSetClusterSoftLimitPct()) {
to.setClusterSoftLimitPct(from.getClusterSoftLimitPct());
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetDataCenter()) {
to.setDataCenter(adaptOut(from.getDataCenter()));
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetDisks()) {
to.setDisks(new V3Disks());
to.getDisks().getDisks().addAll(adaptOut(from.getDisks().getDisks()));
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetStorageHardLimitPct()) {
to.setStorageHardLimitPct(from.getStorageHardLimitPct());
}
if (from.isSetStorageSoftLimitPct()) {
to.setStorageSoftLimitPct(from.getStorageSoftLimitPct());
}
if (from.isSetUsers()) {
to.setUsers(new V3Users());
to.getUsers().getUsers().addAll(adaptOut(from.getUsers().getUsers()));
}
if (from.isSetVms()) {
to.setVms(new V3VMs());
to.getVms().getVMs().addAll(adaptOut(from.getVms().getVms()));
}
return to;
}
use of org.ovirt.engine.api.v3.types.V3VMs in project ovirt-engine by oVirt.
the class V3VmsServer method list.
@GET
public V3VMs list(@Context HttpHeaders headers, @Context UriInfo ui) {
// Transform the data:
V3VMs vms = adaptList(getDelegate()::list);
// Add the link to the disks collection:
vms.getVMs().forEach(V3VmHelper::addDisksLink);
// Add the requested inline details:
Set<String> details = DetailHelper.getDetails(headers, ui);
if (details != null && !details.isEmpty()) {
vms.getVMs().forEach(vm -> {
V3VmServer server = getVmResource(vm.getId());
V3VmHelper.addInlineDetails(vm, server, details);
});
}
// Add the guest IP address:
vms.getVMs().forEach(V3VmHelper::addGuestIp);
return vms;
}
Aggregations