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



##########
File path: sdks/java/io/amazon-web-services/build.gradle
##########
@@ -18,8 +18,14 @@ import groovy.json.JsonOutput
  * limitations under the License.
  */
 
-plugins { id 'org.apache.beam.module' }
-applyJavaNature(automaticModuleName: 'org.apache.beam.sdk.io.aws')
+plugins {
+  id 'org.apache.beam.module'
+}
+
+applyJavaNature(
+        automaticModuleName: 'org.apache.beam.sdk.io.aws',
+        shadowClosure: {}

Review comment:
       Please, remove it. It should be a user's responsibility to create or not 
shadow jar, not Beam.

##########
File path: 
sdks/java/io/amazon-web-services/src/main/java/org/apache/beam/sdk/io/aws/options/AwsModule.java
##########
@@ -203,7 +211,27 @@ public void serializeWithType(
         } catch (NoSuchFieldException | IllegalAccessException e) {
           throw new IOException("failed to access private field with 
reflection", e);
         }
+      } else if (credentialsProvider
+          .getClass()
+          .equals(STSAssumeRoleSessionCredentialsProvider.class)) {
+        try {
+          STSAssumeRoleSessionCredentialsProvider specificProvider =
+              (STSAssumeRoleSessionCredentialsProvider) credentialsProvider;
+
+          Field fieldRole =
+              
STSAssumeRoleSessionCredentialsProvider.class.getDeclaredField("roleArn");
+          fieldRole.setAccessible(true);
+          String roleArn = (String) fieldRole.get(specificProvider);
+          jsonGenerator.writeStringField(ROLE_ARN, roleArn);
 
+          Field fieldSession =
+              
STSAssumeRoleSessionCredentialsProvider.class.getDeclaredField("roleSessionName");

Review comment:
       Use `ROLE_SESSION_NAME` constant here.

##########
File path: 
sdks/java/io/amazon-web-services/src/main/java/org/apache/beam/sdk/io/aws/options/AwsModule.java
##########
@@ -203,7 +211,27 @@ public void serializeWithType(
         } catch (NoSuchFieldException | IllegalAccessException e) {
           throw new IOException("failed to access private field with 
reflection", e);
         }
+      } else if (credentialsProvider
+          .getClass()
+          .equals(STSAssumeRoleSessionCredentialsProvider.class)) {
+        try {
+          STSAssumeRoleSessionCredentialsProvider specificProvider =
+              (STSAssumeRoleSessionCredentialsProvider) credentialsProvider;
+
+          Field fieldRole =
+              
STSAssumeRoleSessionCredentialsProvider.class.getDeclaredField("roleArn");

Review comment:
       Use `ROLE_ARN` constant here.

##########
File path: 
sdks/java/io/amazon-web-services/src/test/java/org/apache/beam/sdk/io/aws/options/AwsModuleTest.java
##########
@@ -117,6 +118,29 @@ public void 
testClasspathPropertiesFileCredentialsProviderSerializationDeseriali
     assertEquals(credentialsFilePath, deserializedCredentialsFilePath);
   }
 
+  @Test
+  public void testSTSCredentialsProviderWrapperSerializationDeserialization() 
throws Exception {

Review comment:
       nit: word `Wrapper` is unnecessary in the test name.

##########
File path: 
sdks/java/io/amazon-web-services/src/test/java/org/apache/beam/sdk/io/aws/options/AwsModuleTest.java
##########
@@ -17,9 +17,9 @@
  */
 package org.apache.beam.sdk.io.aws.options;
 
+import static org.hamcrest.MatcherAssert.assertThat;

Review comment:
       Please, leave `org.junit.Assert.assertThat` as it was before.




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


Reply via email to