This repository was archived by the owner on Aug 31, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
src/main/scala/com/audienceproject/spark/dynamodb/connector Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -75,13 +75,19 @@ private[dynamodb] trait DynamoConnector {
75
75
**/
76
76
private def getCredentials (chosenRegion : String , roleArn : Option [String ]) = {
77
77
roleArn.map(arn => {
78
- val stsEndpoint = Option (System .getProperty(" aws.sts.endpoint" )).getOrElse(" https://sts.amazonaws.com" )
79
- val stsClient = AWSSecurityTokenServiceClientBuilder
80
- .standard()
81
- .withCredentials(new DefaultAWSCredentialsProviderChain )
82
- .withRegion(chosenRegion)
83
- .withEndpointConfiguration(new EndpointConfiguration (stsEndpoint, chosenRegion))
84
- .build()
78
+ val stsClient = Option (System .getProperty(" aws.sts.endpoint" )).map(endpoint => {
79
+ AWSSecurityTokenServiceClientBuilder
80
+ .standard()
81
+ .withCredentials(new DefaultAWSCredentialsProviderChain )
82
+ .withEndpointConfiguration(new EndpointConfiguration (endpoint, chosenRegion))
83
+ .build()
84
+ }).getOrElse(
85
+ AWSSecurityTokenServiceClientBuilder
86
+ .standard()
87
+ .withCredentials(new DefaultAWSCredentialsProviderChain )
88
+ .withRegion(chosenRegion)
89
+ .build()
90
+ )
85
91
val assumeRoleResult = stsClient.assumeRole(
86
92
new AssumeRoleRequest ()
87
93
.withRoleSessionName(" DynamoDBAssumed" )
You can’t perform that action at this time.
0 commit comments