DRILL-8428: ElasticSearch Config Missing Getters (#2797)
diff --git a/contrib/storage-elasticsearch/src/main/java/org/apache/drill/exec/store/elasticsearch/ElasticsearchStorageConfig.java b/contrib/storage-elasticsearch/src/main/java/org/apache/drill/exec/store/elasticsearch/ElasticsearchStorageConfig.java
index 01e9ca8..8244505 100644
--- a/contrib/storage-elasticsearch/src/main/java/org/apache/drill/exec/store/elasticsearch/ElasticsearchStorageConfig.java
+++ b/contrib/storage-elasticsearch/src/main/java/org/apache/drill/exec/store/elasticsearch/ElasticsearchStorageConfig.java
@@ -19,6 +19,8 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -39,6 +41,7 @@
import java.util.Optional;
@JsonTypeName(ElasticsearchStorageConfig.NAME)
+@JsonInclude(Include.NON_EMPTY)
public class ElasticsearchStorageConfig extends StoragePluginConfig {
public static final String NAME = "elastic";
@@ -65,18 +68,18 @@
@JsonCreator
public ElasticsearchStorageConfig(
- @JsonProperty(HOSTS) List<String> hosts,
+ @JsonProperty("hosts") List<String> hosts,
@JsonProperty(USERNAME) String username,
@JsonProperty(PASSWORD) String password,
- @JsonProperty(PATH_PREFIX) String pathPrefix,
+ @JsonProperty("pathPrefix") String pathPrefix,
@JsonProperty("authMode") String authMode,
- @JsonProperty("disableSSLVerification") Boolean disableSSLVerification,
+ @JsonProperty("disableSSLVerification") boolean disableSSLVerification,
@JsonProperty(CREDENTIALS_PROVIDER) CredentialsProvider credentialsProvider) {
super(CredentialProviderUtils.getCredentialsProvider(username, password, credentialsProvider),
credentialsProvider == null, AuthMode.parseOrDefault(authMode, AuthMode.SHARED_USER));
this.hosts = hosts;
this.pathPrefix = pathPrefix;
- this.disableSSLVerification = disableSSLVerification == null ? false : disableSSLVerification;
+ this.disableSSLVerification = disableSSLVerification;
}
private ElasticsearchStorageConfig(ElasticsearchStorageConfig that, CredentialsProvider credentialsProvider) {
@@ -91,6 +94,21 @@
return new ElasticsearchStorageConfig(this, credentialsProvider);
}
+ @JsonProperty("hosts")
+ public List<String> getHosts() {
+ return hosts;
+ }
+
+ @JsonProperty("pathPrefix")
+ public String getPathPrefix() {
+ return pathPrefix;
+ }
+
+ @JsonProperty("disableSSLVerification")
+ public boolean getDisableSSLVerification() {
+ return disableSSLVerification;
+ }
+
private static CredentialsProvider getCredentialsProvider(CredentialsProvider credentialsProvider) {
return credentialsProvider != null ? credentialsProvider : PlainCredentialsProvider.EMPTY_CREDENTIALS_PROVIDER;
}
@@ -123,6 +141,7 @@
builder.put(PATH_PREFIX, pathPrefix != null ? pathPrefix : EMPTY_STRING);
builder.put(USERNAME, credentials.getOrDefault(USERNAME, EMPTY_STRING));
builder.put(PASSWORD, credentials.getOrDefault(PASSWORD, EMPTY_STRING));
+ builder.put(DISABLE_SSL_VERIFICATION, Boolean.valueOf(disableSSLVerification).toString());
credentials.remove(USERNAME);
credentials.remove(PASSWORD);