diff options
author | Ola Aunrønning <olaa@verizonmedia.com> | 2021-09-16 15:39:20 +0200 |
---|---|---|
committer | Ola Aunrønning <olaa@verizonmedia.com> | 2021-09-16 15:39:20 +0200 |
commit | 61ee68c3c63d18cf6d201f07dcc574031252aa82 (patch) | |
tree | 4042b915c3338b8999d2fa461b378247bd9a6f22 | |
parent | 511170c43b976486e43433f4b796e33e98d3519c (diff) |
Ignore dashboardId parameter. Remove unused functions
3 files changed, 6 insertions, 36 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 554d3e5b7fa..6933c9b18f5 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,16 +10,8 @@ public interface HorizonClient { HorizonResponse getUser(); - HorizonResponse getDashboard(String dashboardId); - - HorizonResponse getFavorite(String userId); + HorizonResponse getDashboard(); HorizonResponse getTopFolders(); - HorizonResponse getRecent(String userId); - - HorizonResponse getClipboard(String dashboardId); - - HorizonResponse getMetaData(byte[] query); - } 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 13a8c2ec079..f98082ea6aa 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,12 +17,7 @@ public class MockHorizonClient implements HorizonClient { } @Override - public HorizonResponse getDashboard(String dashboardId) { - return HorizonResponse.empty(); - } - - @Override - public HorizonResponse getFavorite(String userId) { + public HorizonResponse getDashboard() { return HorizonResponse.empty(); } @@ -31,18 +26,4 @@ public class MockHorizonClient implements HorizonClient { return HorizonResponse.empty(); } - @Override - public HorizonResponse getRecent(String userId) { - return HorizonResponse.empty(); - } - - @Override - public HorizonResponse getClipboard(String dashboardId) { - return HorizonResponse.empty(); - } - - @Override - public HorizonResponse getMetaData(byte[] query) { - 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 c116aa43c0d..6619b2ff5c6 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 @@ -87,16 +87,13 @@ 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(path.get("id"))); - if (path.matches("/horizon/v1/config/dashboard/favorite")) return new JsonInputStreamResponse(client.getFavorite(request.getProperty("user"))); - if (path.matches("/horizon/v1/config/dashboard/recent")) return new JsonInputStreamResponse(client.getRecent(request.getProperty("user"))); + if (path.matches("/horizon/v1/config/dashboard/file/{id}")) return new JsonInputStreamResponse(client.getDashboard()); return ErrorResponse.notFoundError("Nothing at " + path); } private HttpResponse post(HttpRequest request, Set<TenantName> authorizedTenants, boolean operator) { Path path = new Path(request.getUri()); - if (path.matches("/horizon/v1/tsdb/api/query/graph")) return tsdbQuery(request, authorizedTenants, operator, true); - if (path.matches("/horizon/v1/meta/search/timeseries")) return tsdbQuery(request, authorizedTenants, operator, false); + if (path.matches("/horizon/v1/tsdb/api/query/graph")) return tsdbQuery(request, authorizedTenants, operator); return ErrorResponse.notFoundError("Nothing at " + path); } @@ -106,10 +103,10 @@ public class HorizonApiHandler extends LoggingRequestHandler { return ErrorResponse.notFoundError("Nothing at " + path); } - private HttpResponse tsdbQuery(HttpRequest request, Set<TenantName> authorizedTenants, boolean operator, boolean isMetricQuery) { + private HttpResponse tsdbQuery(HttpRequest request, Set<TenantName> authorizedTenants, boolean operator) { try { byte[] data = TsdbQueryRewriter.rewrite(request.getData().readAllBytes(), authorizedTenants, operator, systemName); - return new JsonInputStreamResponse(isMetricQuery ? client.getMetrics(data) : client.getMetaData(data)); + return new JsonInputStreamResponse(client.getMetrics(data)); } catch (TsdbQueryRewriter.UnauthorizedException e) { return ErrorResponse.forbidden("Access denied"); } catch (IOException e) { |