aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/HorizonClient.java2
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/MockHorizonClient.java2
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/horizon/HorizonApiHandler.java11
3 files changed, 12 insertions, 3 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/HorizonClient.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/HorizonClient.java
index 07489c931b6..3dd102222c7 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/HorizonClient.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/HorizonClient.java
@@ -10,7 +10,7 @@ public interface HorizonClient {
HorizonResponse getUser();
- HorizonResponse getDashboard();
+ HorizonResponse getDashboard(int dashboardId);
HorizonResponse getTopFolders();
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/MockHorizonClient.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/MockHorizonClient.java
index 79c53734efb..06966b6e47c 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/MockHorizonClient.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/MockHorizonClient.java
@@ -17,7 +17,7 @@ public class MockHorizonClient implements HorizonClient {
}
@Override
- public HorizonResponse getDashboard() {
+ public HorizonResponse getDashboard(int dashboardId) {
return HorizonResponse.empty();
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/horizon/HorizonApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/horizon/HorizonApiHandler.java
index 7601129c12f..70e55034887 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/horizon/HorizonApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/horizon/HorizonApiHandler.java
@@ -82,7 +82,7 @@ public class HorizonApiHandler extends LoggingRequestHandler {
private HttpResponse get(HttpRequest request) {
Path path = new Path(request.getUri());
if (path.matches("/horizon/v1/config/dashboard/topFolders")) return new JsonInputStreamResponse(client.getTopFolders());
- if (path.matches("/horizon/v1/config/dashboard/file/{id}")) return new JsonInputStreamResponse(client.getDashboard());
+ if (path.matches("/horizon/v1/config/dashboard/file/{id}")) return getDashboard(path.get("id"));
return ErrorResponse.notFoundError("Nothing at " + path);
}
@@ -121,6 +121,15 @@ public class HorizonApiHandler extends LoggingRequestHandler {
}
}
+ private HttpResponse getDashboard(String id) {
+ try {
+ int dashboardId = Integer.parseInt(id);
+ return new JsonInputStreamResponse(client.getDashboard(dashboardId));
+ } catch (NumberFormatException e) {
+ return ErrorResponse.badRequest("Dashboard ID must be integer, was " + id);
+ }
+ }
+
private static Set<Role> getRoles(HttpRequest request) {
return Optional.ofNullable(request.getJDiscRequest().context().get(SecurityContext.ATTRIBUTE_NAME))
.filter(SecurityContext.class::isInstance)