public BaragonResponse enqueueReloadServiceConfigs(String serviceId, boolean noValidate) { String requestId = String.format("%s-%s-%s", serviceId, System.currentTimeMillis(), "RELOAD"); Optional<BaragonService> maybeService = stateDatastore.getService(serviceId); if (maybeService.isPresent()) { try { return requestManager.enqueueRequest( buildReloadRequest(maybeService.get(), requestId, noValidate)); } catch (Exception e) { return BaragonResponse.failure(requestId, e.getMessage()); } } else { return BaragonResponse.serviceNotFound(requestId, serviceId); } }
public Optional<BaragonServiceState> getService(String serviceId) { final Optional<BaragonService> maybeServiceInfo = stateDatastore.getService(serviceId); if (!maybeServiceInfo.isPresent()) { return Optional.absent(); } try { return Optional.of( new BaragonServiceState( maybeServiceInfo.get(), stateDatastore.getUpstreamsMap(serviceId).values())); } catch (Exception e) { throw Throwables.propagate(e); } }