[
https://issues.apache.org/jira/browse/BEAM-10335?focusedWorklogId=454069&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-454069
]
ASF GitHub Bot logged work on BEAM-10335:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 02/Jul/20 16:22
Start Date: 02/Jul/20 16:22
Worklog Time Spent: 10m
Work Description: 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]
Issue Time Tracking
-------------------
Worklog Id: (was: 454069)
Time Spent: 40m (was: 0.5h)
> Add STS Assume role credentials provider to AwsModule
> -----------------------------------------------------
>
> Key: BEAM-10335
> URL: https://issues.apache.org/jira/browse/BEAM-10335
> Project: Beam
> Issue Type: Improvement
> Components: io-java-aws
> Affects Versions: 2.22.0
> Reporter: Julius Almeida
> Assignee: Julius Almeida
> Priority: P2
> Labels: starter
> Time Spent: 40m
> Remaining Estimate: 0h
>
> In order to perform multi account s3 write, we need to assume role.
> Current implementation of AwsModule has no options to serialize & deserialize
> credentials provided by STSAssumeRoleSessionCredentialsProvider.
> Need to add support for STSAssumeRoleSessionCredentialsProvider in AwsModule.
> AwsModule.class :
> [https://github.com/apache/beam/blob/master/sdks/java/io/amazon-web-services/src/main/java/org/apache/beam/sdk/io/aws/options/AwsModule.java]
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)