Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,14 @@
</description>
</property>

<property>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets actually cut this. Adding default values here increases the size of the configuration when marshalling, which happens a lot these days.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

<name>fs.s3a.assumed.role.external.id</name>
<value />
<description>
External id for assumed role, it's an optional configuration.
</description>
</property>

<property>
<name>fs.s3a.assumed.role.policy</name>
<value/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ private Constants() {
public static final String ASSUMED_ROLE_ARN =
"fs.s3a.assumed.role.arn";

/**
* external id for assume role request: {@value}.
*/
public static final String ASSUMED_ROLE_EXTERNAL_ID = "fs.s3a.assumed.role.external.id";

/**
* Session name for the assumed role, must be valid characters according
* to the AWS APIs: {@value}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,18 @@ public AssumedRoleCredentialProvider(@Nullable URI fsUri, Configuration conf)
duration = conf.getTimeDuration(ASSUMED_ROLE_SESSION_DURATION,
ASSUMED_ROLE_SESSION_DURATION_DEFAULT, TimeUnit.SECONDS);
String policy = conf.getTrimmed(ASSUMED_ROLE_POLICY, "");
String externalId = conf.getTrimmed(ASSUMED_ROLE_EXTERNAL_ID, "");

LOG.debug("{}", this);

AssumeRoleRequest.Builder requestBuilder =
AssumeRoleRequest.builder().roleArn(arn).roleSessionName(sessionName)
.durationSeconds((int) duration);

if (StringUtils.isNotEmpty(externalId)) {
requestBuilder.externalId(externalId);
}

if (StringUtils.isNotEmpty(policy)) {
LOG.debug("Scope down policy {}", policy);
requestBuilder.policy(policy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ Here are the full set of configuration options.
</description>
</property>

<property>
<name>fs.s3a.assumed.role.external.id</name>
<value />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you an a valid example

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean? Put an example value here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think putting an example here is meaningless, because external id is just a string set by the user, it can by any value. No unified format.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so make that clear, e.g

<value>arbitrary value</value

<description>
External id for assumed role, it's an optional configuration.
</description>
Comment thread
steveloughran marked this conversation as resolved.
</property>

<property>
<name>fs.s3a.assumed.role.policy</name>
<value/>
Expand Down