Class AwsRestHighLevelClientFactory
- java.lang.Object
-
- com.amazonaws.athena.connectors.elasticsearch.AwsRestHighLevelClientFactory
-
public class AwsRestHighLevelClientFactory extends Object
This class creates a REST client injected with an endpoint and credentials.
-
-
Constructor Summary
Constructors Constructor Description AwsRestHighLevelClientFactory(boolean useAwsCredentials)
Constructs a new client factory (using a builder) that will create clients injected with credentials.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AwsRestHighLevelClient
getOrCreateClient(String endpoint)
Attempts to get a REST client from the client cache synchronously using the endpoint as a key.
-
-
-
Constructor Detail
-
AwsRestHighLevelClientFactory
public AwsRestHighLevelClientFactory(boolean useAwsCredentials)
Constructs a new client factory (using a builder) that will create clients injected with credentials.- Parameters:
useAwsCredentials
- if true the factory create clients injected with AWC credentials. If false, it will create clients injected with username/password credentials.
-
-
Method Detail
-
getOrCreateClient
public AwsRestHighLevelClient getOrCreateClient(String endpoint)
Attempts to get a REST client from the client cache synchronously using the endpoint as a key. If the client does not exist in the cache, createClient() is called to create a new client. The newly created client is then inserted into the cache and stored for later use.- Parameters:
endpoint
- is the Elasticsearch instance endpoint.- Returns:
- an Elasticsearch REST client.
-
-