diff options
author | Valerij Fredriksen <valerijf@verizonmedia.com> | 2021-06-14 14:03:07 +0200 |
---|---|---|
committer | Valerij Fredriksen <valerijf@verizonmedia.com> | 2021-06-14 14:03:07 +0200 |
commit | 33e23de1c0df684628aeeb4a18971325713dbe57 (patch) | |
tree | 74191279e00b29a548a06c089fea7c8b884dca6b /controller-api | |
parent | 291e527fb70897742f16caa4b3c7062cc6e47708 (diff) |
Proxy Horzion HTTP response code
Diffstat (limited to 'controller-api')
3 files changed, 54 insertions, 28 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 77a36610dc7..554d3e5b7fa 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 @@ -1,27 +1,25 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.api.integration.horizon; -import java.io.InputStream; - /** * @author olaa */ public interface HorizonClient { - InputStream getMetrics(byte[] query); + HorizonResponse getMetrics(byte[] query); - InputStream getUser(); + HorizonResponse getUser(); - InputStream getDashboard(String dashboardId) ; + HorizonResponse getDashboard(String dashboardId); - InputStream getFavorite(String userId); + HorizonResponse getFavorite(String userId); - InputStream getTopFolders(); + HorizonResponse getTopFolders(); - InputStream getRecent(String userId); + HorizonResponse getRecent(String userId); - InputStream getClipboard(String dashboardId); + HorizonResponse getClipboard(String dashboardId); - InputStream getMetaData(byte[] query); + HorizonResponse getMetaData(byte[] query); } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/HorizonResponse.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/HorizonResponse.java new file mode 100644 index 00000000000..ba7540b2708 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/HorizonResponse.java @@ -0,0 +1,30 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.controller.api.integration.horizon; + +import java.io.InputStream; + +/** + * @author valerijf + */ +public class HorizonResponse { + + private final int code; + private final InputStream inputStream; + + public HorizonResponse(int code, InputStream inputStream) { + this.code = code; + this.inputStream = inputStream; + } + + public int code() { + return code; + } + + public InputStream inputStream() { + return inputStream; + } + + public static HorizonResponse empty() { + return new HorizonResponse(200, InputStream.nullInputStream()); + } +} 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 0ecad973cff..13a8c2ec079 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 @@ -1,50 +1,48 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.api.integration.horizon; -import java.io.InputStream; - /** * @author olaa */ public class MockHorizonClient implements HorizonClient { @Override - public InputStream getMetrics(byte[] query) { - return null; + public HorizonResponse getMetrics(byte[] query) { + return HorizonResponse.empty(); } @Override - public InputStream getUser() { - return null; + public HorizonResponse getUser() { + return HorizonResponse.empty(); } @Override - public InputStream getDashboard(String dashboardId) { - return null; + public HorizonResponse getDashboard(String dashboardId) { + return HorizonResponse.empty(); } @Override - public InputStream getFavorite(String userId) { - return null; + public HorizonResponse getFavorite(String userId) { + return HorizonResponse.empty(); } @Override - public InputStream getTopFolders() { - return null; + public HorizonResponse getTopFolders() { + return HorizonResponse.empty(); } @Override - public InputStream getRecent(String userId) { - return null; + public HorizonResponse getRecent(String userId) { + return HorizonResponse.empty(); } @Override - public InputStream getClipboard(String dashboardId) { - return null; + public HorizonResponse getClipboard(String dashboardId) { + return HorizonResponse.empty(); } @Override - public InputStream getMetaData(byte[] query) { - return null; + public HorizonResponse getMetaData(byte[] query) { + return HorizonResponse.empty(); } } |