You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/10/26 17:30:18 UTC

[GitHub] [beam] aromanenko-dev commented on a change in pull request #15788: [BEAM-8958] Use AWS credentials provider with BasicKinesisProvider (AWS sdk v2)

aromanenko-dev commented on a change in pull request #15788:
URL: https://github.com/apache/beam/pull/15788#discussion_r736737458



##########
File path: sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/kinesis/KinesisIO.java
##########
@@ -53,7 +56,7 @@
  * p.apply(KinesisIO.read()
  *     .withStreamName("streamName")
  *     .withInitialPositionInStream(InitialPositionInStream.LATEST)
- *     .withAWSClientsProvider("AWS_KEY", _"AWS_SECRET", STREAM_REGION)
+ *     .withAWSClientsProvider(DefaultCredentialsProvider.create(), STREAM_REGION)

Review comment:
       I'd suggest to keep an example with a key/secret as it was and just to add another one with a custom AWS credentials provider. 

##########
File path: sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/kinesis/KinesisIO.java
##########
@@ -338,8 +341,33 @@ public Read withAWSClientsProvider(String awsAccessKey, String awsSecretKey, Reg
      */
     public Read withAWSClientsProvider(
         String awsAccessKey, String awsSecretKey, Region region, String serviceEndpoint) {
+      AwsCredentialsProvider awsCredentialsProvider =
+          StaticCredentialsProvider.create(AwsBasicCredentials.create(awsAccessKey, awsSecretKey));
+      return withAWSClientsProvider(awsCredentialsProvider, region, serviceEndpoint);
+    }
+
+    /**
+     * Specify {@link AwsCredentialsProvider} and region to be used to read from Kinesis. If you
+     * need more sophisticated credential protocol, then you should look at {@link
+     * Read#withAWSClientsProvider(AWSClientsProvider)}.
+     */
+    public Read withAWSClientsProvider(

Review comment:
       Please, add the unit test for all new public methods.




-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org