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


##########
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())),

Review Comment:
   Thanks for your suggestion. I create an `isNotBlankEndpoint` variable. This 
makes it easier to read a little.



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