use of org.ovirt.engine.api.model.GraphicsConsole in project ovirt-engine by oVirt.
the class BackendInstanceTypeGraphicsConsolesResource method add.
@Override
public Response add(GraphicsConsole console) {
GraphicsDevice device = getMapper(GraphicsConsole.class, GraphicsDevice.class).map(console, null);
device.setVmId(guid);
ActionReturnValue res = doCreateEntity(ActionType.AddGraphicsAndVideoDevices, createAddGraphicsDeviceParams(device));
if (res != null && res.getSucceeded()) {
return BackendGraphicsConsoleHelper.find(console, this::list);
}
throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build());
}
use of org.ovirt.engine.api.model.GraphicsConsole in project ovirt-engine by oVirt.
the class BackendVmGraphicsConsolesResource method add.
@Override
public Response add(GraphicsConsole console) {
GraphicsDevice device = getMapper(GraphicsConsole.class, GraphicsDevice.class).map(console, null);
device.setVmId(guid);
ActionReturnValue res = doCreateEntity(ActionType.AddGraphicsAndVideoDevices, createAddGraphicsDeviceParams(device));
if (res != null && res.getSucceeded()) {
return BackendGraphicsConsoleHelper.find(console, this::list);
}
throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build());
}
use of org.ovirt.engine.api.model.GraphicsConsole in project ovirt-engine by oVirt.
the class BackendTemplateGraphicsConsolesResource method add.
@Override
public Response add(GraphicsConsole console) {
GraphicsDevice device = getMapper(GraphicsConsole.class, GraphicsDevice.class).map(console, null);
device.setVmId(guid);
ActionReturnValue res = doCreateEntity(ActionType.AddGraphicsAndVideoDevices, createAddGraphicsDeviceParams(device));
if (res != null && res.getSucceeded()) {
return BackendGraphicsConsoleHelper.find(console, this::list);
}
throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build());
}
use of org.ovirt.engine.api.model.GraphicsConsole in project ovirt-engine by oVirt.
the class VmMapper method map.
@Mapping(from = Map.Entry.class, to = GraphicsConsole.class)
public static GraphicsConsole map(Map.Entry<org.ovirt.engine.core.common.businessentities.GraphicsType, GraphicsInfo> graphicsInfo, GraphicsConsole template) {
GraphicsConsole model = template != null ? template : new GraphicsConsole();
GraphicsType graphicsType = map(graphicsInfo.getKey(), null);
if (graphicsType != null) {
model.setId(HexUtils.string2hex(graphicsType.value()));
model.setProtocol(graphicsType);
}
if (graphicsInfo.getValue() != null) {
model.setPort(graphicsInfo.getValue().getPort());
model.setTlsPort(graphicsInfo.getValue().getTlsPort());
model.setAddress(graphicsInfo.getValue().getIp());
}
return model;
}
Aggregations