From 050c95db0da3f78e200da3ad2123faacf1a673b3 Mon Sep 17 00:00:00 2001 From: bowenlan-amzn Date: Fri, 18 Nov 2022 16:39:42 -0800 Subject: [PATCH] Add a super admin client builder w/ hosts params (#322) Signed-off-by: bowenlan-amzn Signed-off-by: bowenlan-amzn --- .../opensearch/commons/rest/SecureRestClientBuilder.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/org/opensearch/commons/rest/SecureRestClientBuilder.java b/src/main/java/org/opensearch/commons/rest/SecureRestClientBuilder.java index 1c1ef498..aefa7e5f 100644 --- a/src/main/java/org/opensearch/commons/rest/SecureRestClientBuilder.java +++ b/src/main/java/org/opensearch/commons/rest/SecureRestClientBuilder.java @@ -138,6 +138,15 @@ public SecureRestClientBuilder(Settings settings, Path configPath) { hosts.add(new HttpHost(httpSSLEnabled ? ConfigConstants.HTTPS : ConfigConstants.HTTP, host, port)); } + public SecureRestClientBuilder(Settings settings, Path configPath, HttpHost[] httpHosts) { + this.httpSSLEnabled = settings.getAsBoolean(ConfigConstants.OPENSEARCH_SECURITY_SSL_HTTP_ENABLED, false); + this.settings = settings; + this.configPath = configPath; + this.user = null; + this.passwd = null; + hosts.addAll(Arrays.asList(httpHosts)); + } + /** * Creates a low-level Rest client. * @return