KarmaGYZ commented on a change in pull request #11822:
URL: https://github.com/apache/flink/pull/11822#discussion_r411364910
##########
File path:
flink-connectors/flink-connector-elasticsearch-base/src/main/java/org/apache/flink/table/descriptors/ElasticsearchValidator.java
##########
@@ -76,12 +78,18 @@ public void validate(DescriptorProperties properties) {
properties.validateValue(CONNECTOR_TYPE,
CONNECTOR_TYPE_VALUE_ELASTICSEARCH, false);
validateVersion(properties);
validateHosts(properties);
+ validateAuth(properties);
validateGeneralProperties(properties);
validateFailureHandler(properties);
validateBulkFlush(properties);
validateConnectionProperties(properties);
}
+ private void validateAuth(DescriptorProperties properties) {
+ properties.validateString(CONNECTOR_USERNAME, true);
+ properties.validateString(CONNECTOR_PASSWORD, true);
Review comment:
I think it makes sense to set the minLen of the user name to 1. Besides,
if the properties contain `CONNECTOR_USERNAME`, it seems the
`CONNECTOR_PASSWORD` is not optional.
##########
File path:
flink-connectors/flink-connector-elasticsearch6/src/main/java/org/apache/flink/streaming/connectors/elasticsearch6/Elasticsearch6UpsertTableSink.java
##########
@@ -189,6 +207,67 @@ protected ElasticsearchUpsertTableSinkBase copy(
// Helper classes
//
--------------------------------------------------------------------------------------------
+ /**
+ * This class implements {@link RestClientFactory}, used for es with
authentication.
+ */
+ static class AuthRestClientFactory implements RestClientFactory {
Review comment:
Does it make sense to add userName and password as two optional fields
to the `DefaultRestClientFactory` instead of introducing this class?
##########
File path:
flink-connectors/flink-connector-elasticsearch7/src/main/java/org/apache/flink/streaming/connectors/elasticsearch7/Elasticsearch7UpsertTableSink.java
##########
@@ -211,6 +227,59 @@ protected ElasticsearchUpsertTableSinkBase copy(
// Helper classes
//
--------------------------------------------------------------------------------------------
+ /**
+ * This class implements {@link RestClientFactory}, used for es with
authentication.
+ */
+ static class AuthRestClientFactory implements RestClientFactory {
Review comment:
Same as above.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]