Search in sources :

Example 1 with SetVmTicketParameters

use of org.ovirt.engine.core.common.action.SetVmTicketParameters in project ovirt-engine by oVirt.

the class ConfigureConsoleOptionsQuery method generateTicket.

private String generateTicket() {
    SetVmTicketParameters parameters = new SetVmTicketParameters(getParameters().getOptions().getVmId(), null, ConsoleOptions.TICKET_VALIDITY_SECONDS, getParameters().getOptions().getGraphicsType());
    // we need these two params because SetVmTicket needs to know current user
    parameters.setSessionId(getEngineContext().getSessionId());
    parameters.setParametersCurrentUser(getUser());
    ActionReturnValue result = backend.runAction(ActionType.SetVmTicket, parameters);
    if (!result.getSucceeded()) {
        throw new TicketGenerationException(result);
    }
    return result.getActionReturnValue();
}
Also used : SetVmTicketParameters(org.ovirt.engine.core.common.action.SetVmTicketParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue)

Example 2 with SetVmTicketParameters

use of org.ovirt.engine.core.common.action.SetVmTicketParameters in project ovirt-engine by oVirt.

the class BackendGraphicsConsoleHelper method setTicket.

public static Response setTicket(BackendResource resource, Action action, Guid vmId, org.ovirt.engine.core.common.businessentities.GraphicsType graphicsType) {
    final Response response = resource.performAction(ActionType.SetVmTicket, new SetVmTicketParameters(vmId, getTicketValue(action), getTicketExpiry(action), graphicsType), action);
    final Action actionResponse = (Action) response.getEntity();
    if (CreationStatus.FAILED.value().equals(actionResponse.getStatus())) {
        actionResponse.getTicket().setValue(null);
        actionResponse.getTicket().setExpiry(null);
    }
    return response;
}
Also used : Response(javax.ws.rs.core.Response) SetVmTicketParameters(org.ovirt.engine.core.common.action.SetVmTicketParameters) Action(org.ovirt.engine.api.model.Action)

Aggregations

SetVmTicketParameters (org.ovirt.engine.core.common.action.SetVmTicketParameters)2 Response (javax.ws.rs.core.Response)1 Action (org.ovirt.engine.api.model.Action)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1