From 2ed2d82a0cbab74d8c78e1418804e4524e76678a 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 (cherry picked from commit 050c95db0da3f78e200da3ad2123faacf1a673b3) --- .../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 96af1540..d4d33e97 100644 --- a/src/main/java/org/opensearch/commons/rest/SecureRestClientBuilder.java +++ b/src/main/java/org/opensearch/commons/rest/SecureRestClientBuilder.java @@ -132,6 +132,15 @@ public SecureRestClientBuilder(Settings settings, Path configPath) { hosts.add(new HttpHost(host, port, httpSSLEnabled ? ConfigConstants.HTTPS : ConfigConstants.HTTP)); } + 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