-
-
Notifications
You must be signed in to change notification settings - Fork 304
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
apply path-style-access-enabled config to CRT client #872
apply path-style-access-enabled config to CRT client #872
Conversation
contextRunner.withPropertyValues().run(context -> { | ||
S3AsyncClient client = context.getBean(S3AsyncClient.class); | ||
S3AsyncClient delegate = (S3AsyncClient) ReflectionTestUtils.getField(client, "delegate"); | ||
SdkClientConfiguration clientConfiguration = (SdkClientConfiguration) ReflectionTestUtils.getField(delegate, "clientConfiguration"); |
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.
If anybody can think of a way to accomplish this without the double reflection field access, I would love to do this more eloquently!
7820662
to
baec512
Compare
@@ -66,6 +66,7 @@ S3AsyncClient s3AsyncClient(AwsCredentialsProvider credentialsProvider) { | |||
.region(this.awsClientBuilderConfigurer.resolveRegion(this.properties)); | |||
Optional.ofNullable(this.awsProperties.getEndpoint()).ifPresent(builder::endpointOverride); | |||
Optional.ofNullable(this.properties.getEndpoint()).ifPresent(builder::endpointOverride); | |||
Optional.ofNullable(this.properties.getPathStyleAccessEnabled()).ifPresent(builder::forcePathStyle); |
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.
Is is actually the same? "forcePathStyle" and "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.
There is a lot of code like this in the SDK codebase that heavily implies they are the same. I am definitely willing to be proven wrong but I couldn't find any other mapping for the option that does the same thing across the the SDK.
private AttributeMap createClientContextParams() {
AttributeMap.Builder params = AttributeMap.builder();
params.put(S3ClientContextParams.USE_ARN_REGION, s3Configuration.useArnRegionEnabled());
params.put(S3ClientContextParams.DISABLE_MULTI_REGION_ACCESS_POINTS,
!s3Configuration.multiRegionEnabled());
params.put(S3ClientContextParams.FORCE_PATH_STYLE, s3Configuration.pathStyleAccessEnabled());
params.put(S3ClientContextParams.ACCELERATE, s3Configuration.accelerateModeEnabled());
return params.build();
}
Co-authored-by: Maciej Walkowiak <walkowiak.maciej@yahoo.com>
Co-authored-by: Maciej Walkowiak <walkowiak.maciej@yahoo.com>
📢 Type of change
📜 Description
Apply the
path-style-access-enabled
S3 config property in theS3CrtAsyncClientAutoConfiguration
💡 Motivation and Context
The standard S3 configuration allows you to configure "path style access" via property config. AWS has added this to the CRT client configuration as of version
2.20.42
per this thread. It would be great to have this option available in the auto configuration for the CRT client.💚 How did you test it?
Reflection-driven unit test and empirical localhost testing.
📝 Checklist
🔮 Next steps