use of com.yahoo.vespa.hosted.controller.restapi.StringResponse in project vespa by vespa-engine.
the class ApplicationApiHandler method deactivate.
private HttpResponse deactivate(String tenantName, String applicationName, String instanceName, String environment, String region, HttpRequest request) {
Application application = controller.applications().require(ApplicationId.from(tenantName, applicationName, instanceName));
ZoneId zone = ZoneId.from(environment, region);
Deployment deployment = application.deployments().get(zone);
if (deployment == null) {
// Attempt to deactivate application even if the deployment is not known by the controller
controller.applications().deactivate(application, zone);
} else {
controller.applications().deactivate(application, deployment, false);
}
// TODO: Change to return JSON
return new StringResponse("Deactivated " + path(TenantResource.API_PATH, tenantName, ApplicationResource.API_PATH, applicationName, EnvironmentResource.API_PATH, environment, "region", region, "instance", instanceName));
}
use of com.yahoo.vespa.hosted.controller.restapi.StringResponse in project vespa by vespa-engine.
the class ApplicationApiHandler method restart.
/**
* Schedule restart of deployment, or specific host in a deployment
*/
private HttpResponse restart(String tenantName, String applicationName, String instanceName, String environment, String region, HttpRequest request) {
DeploymentId deploymentId = new DeploymentId(ApplicationId.from(tenantName, applicationName, instanceName), ZoneId.from(environment, region));
// TODO: Propagate all filters
Optional<Hostname> hostname = Optional.ofNullable(request.getProperty("hostname")).map(Hostname::new);
controller.applications().restart(deploymentId, hostname);
// TODO: Change to return JSON
return new StringResponse("Requested restart of " + path(TenantResource.API_PATH, tenantName, ApplicationResource.API_PATH, applicationName, EnvironmentResource.API_PATH, environment, "region", region, "instance", instanceName));
}
Aggregations