Skip to content

Commit

Permalink
Amend PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MatejNedic committed Oct 3, 2024
1 parent 7493a2a commit e9edd35
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
1 change: 0 additions & 1 deletion docs/src/main/asciidoc/s3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ To use S3 Access Grants out of the box with `S3Client` and `S3Template` introduc
<dependency>
<groupId>software.amazon.s3.accessgrants</groupId>
<artifactId>aws-s3-accessgrants-java-plugin</artifactId>
<optional>true</optional>
</dependency>
----

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ S3ClientBuilder s3ClientBuilder(AwsClientBuilderConfigurer awsClientBuilderConfi

if (ClassUtils.isPresent("software.amazon.awssdk.s3accessgrants.plugin.S3AccessGrantsPlugin", null)) {
S3AccessGrantsPlugin s3AccessGrantsPlugin = S3AccessGrantsPlugin.builder()
.enableFallback(properties.getEnableFallback()).build();
.enableFallback(properties.getPlugin().getEnableFallback()).build();
builder.addPlugin(s3AccessGrantsPlugin);
}
Optional.ofNullable(this.properties.getCrossRegionEnabled()).ifPresent(builder::crossRegionAccessEnabled);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.awspring.cloud.autoconfigure.s3.properties;

public class S3PluginProperties {

/**
* If set to false if Access Grants does not find/return permissions, S3Client won't try to determine if policies
* grant access If set to true fallback policies S3/IAM will be evaluated.
*/
private boolean enableFallback;

public boolean getEnableFallback() {
return enableFallback;
}

public void setEnableFallback(boolean enableFallback) {
this.enableFallback = enableFallback;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,8 @@ public class S3Properties extends AwsClientProperties {
@NestedConfigurationProperty
private S3CrtClientProperties crt;

/**
* If set to false if Access Grants does not find/return permissions, S3Client won't try to determine if policies
* grant access If set to true fallback policies S3/IAM will be evaluated.
*/
private boolean enableFallback;
@NestedConfigurationProperty
private S3PluginProperties plugin = new S3PluginProperties();

@Nullable
public Boolean getAccelerateModeEnabled() {
Expand Down Expand Up @@ -182,11 +179,11 @@ public S3Configuration toS3Configuration() {
return config.build();
}

public boolean getEnableFallback() {
return enableFallback;
public S3PluginProperties getPlugin() {
return plugin;
}

public void setEnableFallback(boolean enableFallback) {
this.enableFallback = enableFallback;
public void setPlugin(S3PluginProperties plugin) {
this.plugin = plugin;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class S3AutoConfigurationTests {
.withClassLoader(new FilteredClassLoader(S3AccessGrantsPlugin.class));

@Test
void testThatS3AccessGrantIdentityProviderIsSet() {
void setsS3AccessGrantIdentityProvider() {
contextRunner.run(context -> {
S3ClientBuilder builder = context.getBean(S3ClientBuilder.class);
ConfiguredAwsClient client = new ConfiguredAwsClient(builder.build());
Expand All @@ -87,7 +87,7 @@ void testThatS3AccessGrantIdentityProviderIsSet() {
}

@Test
void testThatS3AccessGrantIdentityProviderIsNotSet() {
void doesNotSetS3AccessGrantIdentityProvider() {
contextRunnerWithoutGrant.run(context -> {
S3ClientBuilder builder = context.getBean(S3ClientBuilder.class);
ConfiguredAwsClient client = new ConfiguredAwsClient(builder.build());
Expand Down

0 comments on commit e9edd35

Please sign in to comment.