Search in sources :

Example 1 with GraphicsConsole

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());
}
Also used : GraphicsDevice(org.ovirt.engine.core.common.businessentities.GraphicsDevice) WebApplicationException(javax.ws.rs.WebApplicationException) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) GraphicsConsole(org.ovirt.engine.api.model.GraphicsConsole)

Example 2 with GraphicsConsole

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());
}
Also used : GraphicsDevice(org.ovirt.engine.core.common.businessentities.GraphicsDevice) WebApplicationException(javax.ws.rs.WebApplicationException) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) GraphicsConsole(org.ovirt.engine.api.model.GraphicsConsole)

Example 3 with GraphicsConsole

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());
}
Also used : GraphicsDevice(org.ovirt.engine.core.common.businessentities.GraphicsDevice) WebApplicationException(javax.ws.rs.WebApplicationException) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) GraphicsConsole(org.ovirt.engine.api.model.GraphicsConsole)

Example 4 with GraphicsConsole

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;
}
Also used : GraphicsType(org.ovirt.engine.api.model.GraphicsType) GraphicsConsole(org.ovirt.engine.api.model.GraphicsConsole)

Aggregations

GraphicsConsole (org.ovirt.engine.api.model.GraphicsConsole)4 WebApplicationException (javax.ws.rs.WebApplicationException)3 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)3 GraphicsDevice (org.ovirt.engine.core.common.businessentities.GraphicsDevice)3 GraphicsType (org.ovirt.engine.api.model.GraphicsType)1