use of com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse in project vespa by vespa-engine.
the class ApplicationApiHandler method getGlobalRotationOverride.
private HttpResponse getGlobalRotationOverride(String tenantName, String applicationName, String instanceName, String environment, String region) {
DeploymentId deploymentId = new DeploymentId(ApplicationId.from(tenantName, applicationName, instanceName), ZoneId.from(environment, region));
Slime slime = new Slime();
Cursor c1 = slime.setObject().setArray("globalrotationoverride");
try {
Map<String, EndpointStatus> rotations = controller.applications().getGlobalRotationStatus(deploymentId);
for (String rotation : rotations.keySet()) {
EndpointStatus currentStatus = rotations.get(rotation);
c1.addString(rotation);
Cursor c2 = c1.addObject();
c2.setString("status", currentStatus.getStatus().name());
c2.setString("reason", currentStatus.getReason() == null ? "" : currentStatus.getReason());
c2.setString("agent", currentStatus.getAgent() == null ? "" : currentStatus.getAgent());
c2.setLong("timestamp", currentStatus.getEpoch());
}
} catch (IOException e) {
return ErrorResponse.internalServerError("Unable to get rotation status: " + e.getMessage());
}
return new SlimeJsonResponse(slime);
}
use of com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse in project vespa by vespa-engine.
the class ApplicationApiHandler method athenzDomains.
private HttpResponse athenzDomains(HttpRequest request) {
Slime slime = new Slime();
Cursor response = slime.setObject();
Cursor array = response.setArray("data");
for (AthenzDomain athenzDomain : controller.getDomainList(request.getProperty("prefix"))) {
array.addString(athenzDomain.getName());
}
return new SlimeJsonResponse(slime);
}
use of com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse in project vespa by vespa-engine.
the class ApplicationApiHandler method tenant.
private HttpResponse tenant(Tenant tenant, HttpRequest request, boolean listApplications) {
Slime slime = new Slime();
toSlime(slime.setObject(), tenant, request, listApplications);
return new SlimeJsonResponse(slime);
}
use of com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse in project vespa by vespa-engine.
the class ApplicationApiHandler method properties.
private HttpResponse properties() {
Slime slime = new Slime();
Cursor response = slime.setObject();
Cursor array = response.setArray("properties");
for (Map.Entry<PropertyId, Property> entry : controller.fetchPropertyList().entrySet()) {
Cursor propertyObject = array.addObject();
propertyObject.setString("propertyid", entry.getKey().id());
propertyObject.setString("property", entry.getValue().id());
}
return new SlimeJsonResponse(slime);
}
use of com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse 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