From 71ba66efdd6cb007f6cf11ccb6998d03f044bc71 Mon Sep 17 00:00:00 2001 From: Abhijeet V <31417623+abvaidya@users.noreply.github.com> Date: Thu, 16 May 2024 07:59:47 -0700 Subject: [PATCH] update interface to use both enterprise and cloud hostname resolvers Signed-off-by: Abhijeet V <31417623+abvaidya@users.noreply.github.com> --- .../msd/repository/StaticWorkloadDataRepository.java | 5 +++-- .../repository/StaticWorkloadDataRepositoryFactory.java | 7 +++++-- .../msd/validator/NoOpStaticWorkloadValidatorTest.java | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libs/java/server_common/src/main/java/com/yahoo/athenz/common/server/msd/repository/StaticWorkloadDataRepository.java b/libs/java/server_common/src/main/java/com/yahoo/athenz/common/server/msd/repository/StaticWorkloadDataRepository.java index 4ea1adfab8c..8891fc3485f 100644 --- a/libs/java/server_common/src/main/java/com/yahoo/athenz/common/server/msd/repository/StaticWorkloadDataRepository.java +++ b/libs/java/server_common/src/main/java/com/yahoo/athenz/common/server/msd/repository/StaticWorkloadDataRepository.java @@ -30,10 +30,11 @@ public interface StaticWorkloadDataRepository { /** * Initializes the repository object * @param privateKeyStore used to fetch necessary secrets to initialize the repository - * @param hostnameResolver used to resolve hostnames to ip addresses + * @param enterpriseHostnameResolver used to resolve hostnames to ip addresses for enterprise services + * @param cloudHostnameResolver used to resolve hostnames to ip addresses for cloud services * @param msdStore used to fetch workload data from underlying storage */ - void initialize(PrivateKeyStore privateKeyStore, HostnameResolver hostnameResolver, MsdStore msdStore); + void initialize(PrivateKeyStore privateKeyStore, HostnameResolver enterpriseHostnameResolver, HostnameResolver cloudHostnameResolver, MsdStore msdStore); /** * Returns static workload data from the corresponding repository diff --git a/libs/java/server_common/src/main/java/com/yahoo/athenz/common/server/msd/repository/StaticWorkloadDataRepositoryFactory.java b/libs/java/server_common/src/main/java/com/yahoo/athenz/common/server/msd/repository/StaticWorkloadDataRepositoryFactory.java index 4b06d726897..617c02486d8 100644 --- a/libs/java/server_common/src/main/java/com/yahoo/athenz/common/server/msd/repository/StaticWorkloadDataRepositoryFactory.java +++ b/libs/java/server_common/src/main/java/com/yahoo/athenz/common/server/msd/repository/StaticWorkloadDataRepositoryFactory.java @@ -30,11 +30,14 @@ public interface StaticWorkloadDataRepositoryFactory { /** * Creates the Repository objects * @param privateKeyStore used to fetch necessary secrets to initialize the repository - * @param hostnameResolver used to resolve hostnames to ip addresses + * @param enterpriseHostnameResolver used to resolve hostnames to ip addresses for enterprise services + * @param cloudHostnameResolver used to resolve hostnames to ip addresses for cloud services * @param msdStore used to fetch workload data from underlying storage * @param type type of static workload to get appropriate repository from the factory implementation * @return static workload data repository object */ - StaticWorkloadDataRepository create(final PrivateKeyStore privateKeyStore, final HostnameResolver hostnameResolver, final MsdStore msdStore, + StaticWorkloadDataRepository create(final PrivateKeyStore privateKeyStore, final HostnameResolver enterpriseHostnameResolver, + final HostnameResolver cloudHostnameResolver, + final MsdStore msdStore, final StaticWorkloadType type); } diff --git a/libs/java/server_common/src/test/java/com/yahoo/athenz/common/server/msd/validator/NoOpStaticWorkloadValidatorTest.java b/libs/java/server_common/src/test/java/com/yahoo/athenz/common/server/msd/validator/NoOpStaticWorkloadValidatorTest.java index 2818c8f1048..0c503d01f64 100644 --- a/libs/java/server_common/src/test/java/com/yahoo/athenz/common/server/msd/validator/NoOpStaticWorkloadValidatorTest.java +++ b/libs/java/server_common/src/test/java/com/yahoo/athenz/common/server/msd/validator/NoOpStaticWorkloadValidatorTest.java @@ -33,7 +33,7 @@ public void testNoOpValidator() { StaticWorkloadDataRepository repository = new StaticWorkloadDataRepository<>() { @Override - public void initialize(PrivateKeyStore privateKeyStore, HostnameResolver hostnameResolver, MsdStore msdStore) { + public void initialize(PrivateKeyStore privateKeyStore, HostnameResolver enterpriseHostnameResolver, HostnameResolver cloudHostnameResolver, MsdStore msdStore) { }