-
-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S3 Integration based on AWS SDK v2 #275
Conversation
Makefile
Outdated
@@ -4,7 +4,7 @@ format: | |||
mvnd spring-javaformat:apply | |||
|
|||
build: | |||
mvnd spring-javaformat:apply verify | |||
mvnd spring-javaformat:apply verify spring-javaformat:apply |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we need this again in the same command line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First we format, then in verify phase code generation runs which can generate unformatted code, so that we need to format again.
Alternative would be to generate code in generated-sources
but then, if generated file changes for whatever reason (like SDK update) its easy to miss it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Figured out a better way - class is now generated into a separate module - spring-cloud-aws-s3-cross-region
which is not a subject of spring-formatting or checkstyle (as its not easy to generate class that matches these conventions).
@@ -59,9 +59,11 @@ | |||
<module>spring-cloud-aws-parameter-store</module> | |||
<module>spring-cloud-aws-secrets-manager</module> | |||
<module>spring-cloud-aws-ses</module> | |||
<module>spring-cloud-aws-s3-parent</module> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the purpose of s3-parent
module? should be only s3
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we would. I've added parent only to wrap actual s3
module and another module for code generation. If we could add code generation to s3
module, without polluting s3
jar with classes responsible for code generation we could get rid of parent, but i haven't figured out how to do it. Suggestions welcome!
@Bean | ||
@ConditionalOnMissingBean | ||
S3ClientBuilder s3ClientBuilder(AwsCredentialsProvider credentialsProvider, AwsRegionProvider regionProvider) { | ||
Region region = StringUtils.hasLength(this.properties.getRegion()) ? Region.of(this.properties.getRegion()) | ||
: regionProvider.getRegion(); | ||
S3ClientBuilder builder = S3Client.builder().credentialsProvider(credentialsProvider).region(region) | ||
.overrideConfiguration(SpringCloudClientConfiguration.clientOverrideConfiguration()) | ||
.serviceConfiguration(s3ServiceConfiguration()); | ||
Optional.ofNullable(this.properties.getEndpoint()).ifPresent(builder::endpointOverride); | ||
return builder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in order to keep consistency with other modules should we move it to the s3Client
? I think in the future we can add customizer for all clients. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With s3ClientBuilder
as a bean, we give an easy way to configure how clients are created in CrossRegionS3Client
.
Users still can provide their own s3Client
and then builder bean is not used. This means that from the bean override point of view, we are consistent with other integrations.
...-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/s3/S3AutoConfiguration.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
public Boolean getPathStyleAccessEnabled() { | ||
return pathStyleAccessEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return pathStyleAccessEnabled; | |
return this.pathStyleAccessEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a convention we used neither in 2.x nor 3.x. We can discuss (at this point i don't see value) but if so we would enforce it in checkstyle.
} | ||
|
||
public Boolean getChecksumValidationEnabled() { | ||
return checksumValidationEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return checksumValidationEnabled; | |
return this.checksumValidationEnabled; |
} | ||
|
||
public Boolean getChunkedEncodingEnabled() { | ||
return chunkedEncodingEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return chunkedEncodingEnabled; | |
return this.chunkedEncodingEnabled; |
} | ||
|
||
public Boolean getDualstackEnabled() { | ||
return dualstackEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return dualstackEnabled; | |
return this.dualstackEnabled; |
} | ||
|
||
public Boolean getUseArnRegionEnabled() { | ||
return useArnRegionEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return useArnRegionEnabled; | |
return this.useArnRegionEnabled; |
S3Resource
and integration withResourceLoader
ResourcePatternResolver
(perhaps we should skip it)Fixes issues:
In subsequent PR:
S3Template
with common operations including delete (Support for deleting of resources spring-attic/spring-cloud-aws#629)Use Java 1.6+ MimeTypesFiletypeMap for SimpleStorageResource content type derivation #131
Add ability for SimpleStorageResource.getURL() to account for custom repositories not hosted in AWS #166