JooHyukKim commented on code in PR #21004:
URL: https://github.com/apache/pulsar/pull/21004#discussion_r1295644612


##########
pulsar-io/kinesis/src/main/java/org/apache/pulsar/io/kinesis/KinesisSourceConfig.java:
##########
@@ -122,24 +123,27 @@ public class KinesisSourceConfig extends 
BaseKinesisConfig implements Serializab
     )
     private String dynamoEndpoint = "";
 
-    @FieldDoc(
-        required = false,
-        defaultValue = "",
-        help = "Cloudwatch end-point url. It can be found at 
https://docs.aws.amazon.com/general/latest/gr/rande.html";
-    )
-    private String cloudwatchEndpoint = "";
-
     @FieldDoc(
         required = false,
         defaultValue = "true",
         help = "When true, uses Kinesis enhanced fan-out, when false, uses 
polling"
     )
     private boolean useEnhancedFanOut = true;
 
-
-    public static KinesisSourceConfig load(String yamlFile) throws IOException 
{
-        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
-        return mapper.readValue(new File(yamlFile), KinesisSourceConfig.class);
+    public static KinesisSourceConfig load(Map<String, Object> config, 
SourceContext sourceContext) {
+        KinesisSourceConfig kinesisSourceConfig = 
IOConfigUtils.loadWithSecrets(config,
+                KinesisSourceConfig.class, sourceContext);
+        checkArgument(isNotBlank(kinesisSourceConfig.getAwsRegion())
+                        || (isNotBlank(kinesisSourceConfig.getAwsEndpoint())
+                            && 
isNotBlank(kinesisSourceConfig.getCloudwatchEndpoint())
+                            && 
isNotBlank(kinesisSourceConfig.getDynamoEndpoint())),
+                "Either the awsEndpoint, cloudwatchEndpoint, dynamoEndpoint or 
awsRegion must be set");

Review Comment:
   The current error message can be more consistent with the actual validation 
logic maybe like.....
   
   ```suggestion
                 "Either \"awsRegion\" must be set OR all of [ \"awsEndpoint\", 
\"cloudwatchEndpoint\", and \"dynamoEndpoint\" ] must be set.");
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to