use of com.yahoo.vespa.orchestrator.restapi.wire.HostService in project vespa by vespa-engine.
the class HostResource method getHost.
@Override
public GetHostResponse getHost(String hostNameString) {
HostName hostName = new HostName(hostNameString);
try {
Host host = orchestrator.getHost(hostName);
URI applicationUri = uriInfo.getBaseUriBuilder().path(InstanceResource.class).path(host.getApplicationInstanceReference().asString()).build();
List<HostService> hostServices = host.getServiceInstances().stream().map(serviceInstance -> new HostService(serviceInstance.getServiceCluster().clusterId().s(), serviceInstance.getServiceCluster().serviceType().s(), serviceInstance.configId().s(), serviceInstance.serviceStatus().name())).collect(Collectors.toList());
return new GetHostResponse(host.getHostName().s(), host.getHostStatus().name(), applicationUri.toString(), hostServices);
} catch (HostNameNotFoundException e) {
log.log(LogLevel.INFO, "Host not found: " + hostName);
throw new NotFoundException(e);
}
}
Aggregations