Search in sources :

Example 21 with SlimeJsonResponse

use of com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse in project vespa by vespa-engine.

the class ZoneApiHandler method environment.

private HttpResponse environment(HttpRequest request, Environment environment) {
    List<ZoneId> zones = zoneRegistry.zones().all().in(environment).ids();
    Slime slime = new Slime();
    Cursor root = slime.setArray();
    zones.forEach(zone -> {
        Cursor object = root.addObject();
        object.setString("name", zone.region().value());
        object.setString("url", request.getUri().resolve("/zone/v2/environment/").resolve(environment.value() + "/").resolve("region/").resolve(zone.region().value()).toString());
    });
    return new SlimeJsonResponse(slime);
}
Also used : SlimeJsonResponse(com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse) ZoneId(com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId) Slime(com.yahoo.slime.Slime) Cursor(com.yahoo.slime.Cursor)

Example 22 with SlimeJsonResponse

use of com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse in project vespa by vespa-engine.

the class ZoneApiHandler method defaultRegion.

private HttpResponse defaultRegion(HttpRequest request, Environment environment) {
    RegionName region = zoneRegistry.getDefaultRegion(environment).orElseThrow(() -> new IllegalArgumentException("No default region for environment: " + environment));
    Slime slime = new Slime();
    Cursor root = slime.setObject();
    root.setString("name", region.value());
    root.setString("url", request.getUri().resolve("/zone/v2/environment/").resolve(environment.value() + "/").resolve("region/").resolve(region.value()).toString());
    return new SlimeJsonResponse(slime);
}
Also used : SlimeJsonResponse(com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse) RegionName(com.yahoo.config.provision.RegionName) Slime(com.yahoo.slime.Slime) Cursor(com.yahoo.slime.Cursor)

Example 23 with SlimeJsonResponse

use of com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse in project vespa by vespa-engine.

the class ZoneApiHandler method root.

private HttpResponse root(HttpRequest request) {
    Slime slime = new Slime();
    Cursor root = slime.setObject();
    Cursor uris = root.setArray("uris");
    ZoneList zoneList = zoneRegistry.zones().controllerManaged();
    zoneList.ids().forEach(zoneId -> uris.addString(request.getUri().resolve("/zone/v2/").resolve(zoneId.environment().value() + "/").resolve(zoneId.region().value()).toString()));
    Cursor zones = root.setArray("zones");
    zoneList.ids().forEach(zoneId -> {
        Cursor object = zones.addObject();
        object.setString("environment", zoneId.environment().value());
        object.setString("region", zoneId.region().value());
    });
    return new SlimeJsonResponse(slime);
}
Also used : SlimeJsonResponse(com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse) Slime(com.yahoo.slime.Slime) Cursor(com.yahoo.slime.Cursor) ZoneList(com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneList)

Aggregations

SlimeJsonResponse (com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse)23 Slime (com.yahoo.slime.Slime)22 Cursor (com.yahoo.slime.Cursor)17 ApplicationId (com.yahoo.config.provision.ApplicationId)7 Application (com.yahoo.vespa.hosted.controller.Application)7 NotExistsException (com.yahoo.vespa.hosted.controller.NotExistsException)4 Tenant (com.yahoo.vespa.hosted.controller.api.Tenant)3 DeploymentId (com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId)3 ZoneId (com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId)3 Environment (com.yahoo.config.provision.Environment)2 RegionName (com.yahoo.config.provision.RegionName)2 TenantName (com.yahoo.config.provision.TenantName)2 Inspector (com.yahoo.slime.Inspector)2 AthenzDomain (com.yahoo.vespa.athenz.api.AthenzDomain)2 ActivateResult (com.yahoo.vespa.hosted.controller.api.ActivateResult)2 DeployOptions (com.yahoo.vespa.hosted.controller.api.application.v4.model.DeployOptions)2 EndpointStatus (com.yahoo.vespa.hosted.controller.api.application.v4.model.EndpointStatus)2 ApplicationPackage (com.yahoo.vespa.hosted.controller.application.ApplicationPackage)2 Deployment (com.yahoo.vespa.hosted.controller.application.Deployment)2 VespaVersion (com.yahoo.vespa.hosted.controller.versions.VespaVersion)2