use of org.ovirt.engine.api.model.GraphicsType in project ovirt-engine by oVirt.
the class BackendGraphicsConsoleHelper method remove.
public static Response remove(BackendResource resource, Guid guid, String consoleId) {
List<GraphicsDevice> devices = DisplayHelper.getGraphicsDevicesForEntity(resource, guid, false);
if (devices == null) {
throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build());
}
org.ovirt.engine.core.common.businessentities.GraphicsType graphicsType = asGraphicsType(consoleId);
return devices.stream().filter(device -> device.getGraphicsType().equals(graphicsType)).findFirst().map(device -> resource.performAction(ActionType.RemoveGraphicsAndVideoDevices, new GraphicsParameters(device))).orElseThrow(() -> new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build()));
}
use of org.ovirt.engine.api.model.GraphicsType in project ovirt-engine by oVirt.
the class BackendVmGraphicsConsoleResource method proxyTicket.
@Override
public Response proxyTicket(Action action) {
final String plainConsoleId = HexUtils.hex2string(consoleId);
final GraphicsType graphicsTypeModel = GraphicsType.fromValue(plainConsoleId);
final org.ovirt.engine.core.common.businessentities.GraphicsType graphicsTypeEntity = VmMapper.map(graphicsTypeModel, null);
final String ticketValue = getTicket(graphicsTypeEntity);
if (!action.isSetProxyTicket()) {
action.setProxyTicket(new ProxyTicket());
}
action.getProxyTicket().setValue(ticketValue);
return Response.ok().entity(action).build();
}
use of org.ovirt.engine.api.model.GraphicsType 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;
}
use of org.ovirt.engine.api.model.GraphicsType in project ovirt-engine by oVirt.
the class BackendGraphicsConsoleHelper method asGraphicsType.
public static org.ovirt.engine.core.common.businessentities.GraphicsType asGraphicsType(String consoleId) {
String consoleString = HexUtils.hex2string(consoleId);
GraphicsType type = GraphicsType.fromValue(consoleString);
return VmMapper.map(type, null);
}
Aggregations