From 947e936d0a398c0a41d9494a5d412efe9ead52f2 Mon Sep 17 00:00:00 2001 From: Martin Polden Date: Wed, 16 Dec 2020 11:49:40 +0100 Subject: Allow controller zone --- .../hosted/controller/restapi/application/ApplicationApiHandler.java | 4 ++++ .../hosted/controller/restapi/application/ApplicationApiTest.java | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java index 824a374642a..117ac9bbf4b 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java @@ -2206,6 +2206,10 @@ public class ApplicationApiHandler extends LoggingRequestHandler { private ZoneId requireZone(String environment, String region) { ZoneId zone = ZoneId.from(environment, region); + // TODO(mpolden): Find a way to not hardcode this. Some APIs allow this "virtual" zone, e.g. /logs + if (zone.environment() == Environment.prod && zone.region().value().equals("controller")) { + return zone; + } if (!controller.zoneRegistry().hasZone(zone)) { throw new IllegalArgumentException("Zone " + zone + " does not exist in this system"); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java index 27d7b6f3d7a..3d1375601ad 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java @@ -494,6 +494,11 @@ public class ApplicationApiTest extends ControllerContainerTest { .userIdentity(USER_ID), "INFO - All good"); + // GET controller logs + tester.assertResponse(request("/application/v4/tenant/tenant2/application/application1/environment/prod/region/controller/instance/default/logs?from=1233&to=3214", GET) + .userIdentity(USER_ID), + "INFO - All good"); + // Get content - root tester.assertResponse(request("/application/v4/tenant/tenant2/application/application1/instance/default/environment/dev/region/us-east-1/content/", GET).userIdentity(USER_ID), "{\"path\":\"/\"}"); -- cgit v1.2.3