diff options
author | Bjørn Christian Seime <bjorncs@oath.com> | 2017-09-12 09:57:19 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@oath.com> | 2017-09-12 09:57:19 +0200 |
commit | 6affbf8a332b328034185b514720c2cf71ae88c6 (patch) | |
tree | e3b990cee56a31ac5fe51930998b9667688e30cb | |
parent | 8b5994123459a7b4033944f965dd16d4b942ffdd (diff) |
Remove ZMS/Athens client without principal
6 files changed, 4 insertions, 41 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/Athens.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/Athens.java index c1f72fa4370..0635fb850b7 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/Athens.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/Athens.java @@ -17,7 +17,6 @@ public interface Athens { AthensPrincipal principalFrom(UserId userId); NTokenValidator validator(); NToken nTokenFrom(String rawToken); - UnauthorizedZmsClient unauthorizedZmsClient(); ZmsClientFactory zmsClientFactory(); AthensDomain screwdriverDomain(); diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/UnauthorizedZmsClient.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/UnauthorizedZmsClient.java deleted file mode 100644 index d1996bdbd45..00000000000 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/UnauthorizedZmsClient.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.hosted.controller.api.integration.athens; - -import com.yahoo.vespa.hosted.controller.api.identifiers.AthensDomain; - -import java.util.List; - -/** - * @author gv - */ -public class UnauthorizedZmsClient { - - private final ZmsClient client; - - public UnauthorizedZmsClient(ZmsClientFactory zmsClientFactory) { - client = zmsClientFactory.createClientWithoutPrincipal(); - } - - public List<AthensDomain> getDomainList(String prefix) { - return client.getDomainList(prefix); - } - -} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/ZmsClientFactory.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/ZmsClientFactory.java index 24a2d67ebf6..e00f3ce2f64 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/ZmsClientFactory.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/ZmsClientFactory.java @@ -8,6 +8,4 @@ public interface ZmsClientFactory { ZmsClient createClientWithServicePrincipal(); ZmsClient createClientWithAuthorizedServiceToken(NToken authorizedServiceToken); - - ZmsClient createClientWithoutPrincipal(); } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/mock/AthensMock.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/mock/AthensMock.java index a993c6e3da3..8bed95bfcd4 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/mock/AthensMock.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/mock/AthensMock.java @@ -11,7 +11,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.athens.AthensPrincipal; import com.yahoo.vespa.hosted.controller.api.integration.athens.InvalidTokenException; import com.yahoo.vespa.hosted.controller.api.integration.athens.NToken; import com.yahoo.vespa.hosted.controller.api.integration.athens.NTokenValidator; -import com.yahoo.vespa.hosted.controller.api.integration.athens.UnauthorizedZmsClient; import com.yahoo.vespa.hosted.controller.api.integration.athens.ZmsClientFactory; /** @@ -23,12 +22,10 @@ public class AthensMock extends AbstractComponent implements Athens { private static final AthensDomain screwdriverDomain = new AthensDomain("screwdriver-domain"); private final ZmsClientFactory zmsClientFactory; - private final UnauthorizedZmsClient unauthorizedZmsClient; private final NTokenValidator nTokenValidator; public AthensMock(AthensDbMock athensDb, NTokenValidator nTokenValidator) { this.zmsClientFactory = new ZmsClientFactoryMock(athensDb); - this.unauthorizedZmsClient = new UnauthorizedZmsClient(zmsClientFactory); this.nTokenValidator = nTokenValidator; } @@ -67,11 +64,6 @@ public class AthensMock extends AbstractComponent implements Athens { } @Override - public UnauthorizedZmsClient unauthorizedZmsClient() { - return unauthorizedZmsClient; - } - - @Override public ZmsClientFactory zmsClientFactory() { return zmsClientFactory; } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/mock/ZmsClientFactoryMock.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/mock/ZmsClientFactoryMock.java index 73d971a27fe..8bc8b29fb4c 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/mock/ZmsClientFactoryMock.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/athens/mock/ZmsClientFactoryMock.java @@ -42,12 +42,6 @@ public class ZmsClientFactoryMock extends AbstractComponent implements ZmsClient return new ZmsClientMock(athens); } - @Override - public ZmsClient createClientWithoutPrincipal() { - log("createClientWithoutPrincipal()"); - return new ZmsClientMock(athens); - } - private static void log(String format, Object... args) { log.log(Level.INFO, String.format(format, args)); } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java index dcb54f13e4b..68912ac55ef 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java @@ -15,6 +15,7 @@ import com.yahoo.vespa.hosted.controller.api.identifiers.Property; import com.yahoo.vespa.hosted.controller.api.identifiers.PropertyId; import com.yahoo.vespa.hosted.controller.api.integration.MetricsService; import com.yahoo.vespa.hosted.controller.api.integration.athens.Athens; +import com.yahoo.vespa.hosted.controller.api.integration.athens.ZmsClient; import com.yahoo.vespa.hosted.controller.api.integration.chef.Chef; import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServerClient; import com.yahoo.vespa.hosted.controller.api.integration.cost.ApplicationCost; @@ -85,6 +86,7 @@ public class Controller extends AbstractComponent { private final MetricsService metricsService; private final Chef chefClient; private final Athens athens; + private final ZmsClient zmsClient; /** * Creates a controller @@ -140,6 +142,7 @@ public class Controller extends AbstractComponent { this.chefClient = chefClient; this.clock = clock; this.athens = athens; + this.zmsClient = athens.zmsClientFactory().createClientWithServicePrincipal(); applicationController = new ApplicationController(this, db, curator, rotationRepository, athens.zmsClientFactory(), nameService, configServerClient, routingGenerator, clock); @@ -154,7 +157,7 @@ public class Controller extends AbstractComponent { public ApplicationController applications() { return applicationController; } public List<AthensDomain> getDomainList(String prefix) { - return athens.unauthorizedZmsClient().getDomainList(prefix); + return zmsClient.getDomainList(prefix); } public Athens athens() { |