use of com.yahoo.vespa.orchestrator.restapi.wire.HostStateChangeDenialReason in project vespa by vespa-engine.
the class HostResource method webExceptionWithDenialReason.
private static WebApplicationException webExceptionWithDenialReason(String operationDescription, HostName hostName, HostStateChangeDeniedException e) {
HostStateChangeDenialReason hostStateChangeDenialReason = new HostStateChangeDenialReason(e.getConstraintName(), operationDescription + " failed: " + e.getMessage());
UpdateHostResponse response = new UpdateHostResponse(hostName.s(), hostStateChangeDenialReason);
return new WebApplicationException(hostStateChangeDenialReason.toString(), e, Response.status(Response.Status.CONFLICT).entity(response).type(MediaType.APPLICATION_JSON_TYPE).build());
}
use of com.yahoo.vespa.orchestrator.restapi.wire.HostStateChangeDenialReason in project vespa by vespa-engine.
the class OrchestratorImplTest method testSuspendCallWithFailureReason.
@Test(expected = OrchestratorException.class)
public void testSuspendCallWithFailureReason() {
when(configServerApi.put(OrchestratorImpl.ORCHESTRATOR_PATH_PREFIX_HOST_API + "/" + hostName + "/suspended", Optional.empty(), UpdateHostResponse.class)).thenReturn(new UpdateHostResponse(hostName, new HostStateChangeDenialReason("hostname", "fail")));
orchestrator.suspend(hostName);
}
use of com.yahoo.vespa.orchestrator.restapi.wire.HostStateChangeDenialReason in project vespa by vespa-engine.
the class OrchestratorImplTest method testResumeCallWithFailureReason.
@Test(expected = OrchestratorException.class)
public void testResumeCallWithFailureReason() {
when(configServerApi.delete(OrchestratorImpl.ORCHESTRATOR_PATH_PREFIX_HOST_API + "/" + hostName + "/suspended", UpdateHostResponse.class)).thenReturn(new UpdateHostResponse(hostName, new HostStateChangeDenialReason("hostname", "fail")));
orchestrator.resume(hostName);
}
Aggregations