use of com.yahoo.vespa.hosted.controller.NotExistsException in project vespa by vespa-engine.
the class ApplicationApiHandler method deployment.
private HttpResponse deployment(String tenantName, String applicationName, String instanceName, String environment, String region, HttpRequest request) {
ApplicationId id = ApplicationId.from(tenantName, applicationName, instanceName);
Application application = controller.applications().get(id).orElseThrow(() -> new NotExistsException(id + " not found"));
DeploymentId deploymentId = new DeploymentId(application.id(), ZoneId.from(environment, region));
Deployment deployment = application.deployments().get(deploymentId.zoneId());
if (deployment == null)
throw new NotExistsException(application + " is not deployed in " + deploymentId.zoneId());
Slime slime = new Slime();
toSlime(slime.setObject(), deploymentId, deployment, request);
return new SlimeJsonResponse(slime);
}
use of com.yahoo.vespa.hosted.controller.NotExistsException in project vespa by vespa-engine.
the class ApplicationApiHandler method rotationStatus.
private HttpResponse rotationStatus(String tenantName, String applicationName, String instanceName, String environment, String region) {
ApplicationId applicationId = ApplicationId.from(tenantName, applicationName, instanceName);
Application application = controller.applications().require(applicationId);
if (!application.rotation().isPresent()) {
throw new NotExistsException("global rotation does not exist for '" + environment + "." + region + "'");
}
Slime slime = new Slime();
Cursor response = slime.setObject();
Map<String, RotationStatus> rotationHealthStatus = controller.getHealthStatus(application.rotation().get().dnsName());
for (String rotationEndpoint : rotationHealthStatus.keySet()) {
if (rotationEndpoint.contains(toDns(environment)) && rotationEndpoint.contains(toDns(region))) {
Cursor bcpStatusObject = response.setObject("bcpStatus");
bcpStatusObject.setString("rotationStatus", rotationHealthStatus.getOrDefault(rotationEndpoint, RotationStatus.UNKNOWN).name());
}
}
return new SlimeJsonResponse(slime);
}
use of com.yahoo.vespa.hosted.controller.NotExistsException in project vespa by vespa-engine.
the class ApplicationApiHandler method application.
private HttpResponse application(String tenantName, String applicationName, HttpRequest request) {
ApplicationId applicationId = ApplicationId.from(tenantName, applicationName, "default");
Application application = controller.applications().get(applicationId).orElseThrow(() -> new NotExistsException(applicationId + " not found"));
Slime slime = new Slime();
toSlime(slime.setObject(), application, request);
return new SlimeJsonResponse(slime);
}
Aggregations