use of com.yahoo.vespa.orchestrator.restapi.wire.UpdateHostResponse 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);
}
use of com.yahoo.vespa.orchestrator.restapi.wire.UpdateHostResponse in project vespa by vespa-engine.
the class OrchestratorImpl method resume.
@Override
public void resume(final String hostName) {
UpdateHostResponse response;
try {
String path = getSuspendPath(hostName);
response = configServerApi.delete(path, UpdateHostResponse.class);
} catch (HttpException.NotFoundException n) {
throw new OrchestratorNotFoundException("Failed to resume " + hostName + ", host not found");
} catch (HttpException e) {
throw new OrchestratorException("Failed to suspend " + hostName + ": " + e.toString());
} catch (Exception e) {
throw new RuntimeException("Got error on resume", e);
}
Optional.ofNullable(response.reason()).ifPresent(reason -> {
throw new OrchestratorException(reason.message());
});
}
use of com.yahoo.vespa.orchestrator.restapi.wire.UpdateHostResponse in project vespa by vespa-engine.
the class OrchestratorImpl method suspend.
@Override
public void suspend(final String hostName) {
UpdateHostResponse response;
try {
response = configServerApi.put(getSuspendPath(hostName), Optional.empty(), /* body */
UpdateHostResponse.class);
} catch (HttpException.NotFoundException n) {
throw new OrchestratorNotFoundException("Failed to suspend " + hostName + ", host not found");
} catch (HttpException e) {
throw new OrchestratorException("Failed to suspend " + hostName + ": " + e.toString());
} catch (Exception e) {
throw new RuntimeException("Got error on suspend", e);
}
Optional.ofNullable(response.reason()).ifPresent(reason -> {
throw new OrchestratorException(reason.message());
});
}
Aggregations