Skip to content

Commit

Permalink
kept the old RegionAndEndpointConfiguration configure method for bina…
Browse files Browse the repository at this point in the history
…ry compatibility (#277)
  • Loading branch information
musketyr authored Jan 13, 2025
1 parent 7ae234b commit d3d0dae
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public interface RegionAndEndpointConfiguration {

String getAsyncClient();

@Deprecated
default <C, B extends AwsClientBuilder<B, C>> B configure(B builder, AwsRegionProvider awsRegionProvider) {
return configure(builder, awsRegionProvider, null, Optional.empty());
}

default <C, B extends AwsClientBuilder<B, C>> B configure(B builder, AwsRegionProvider awsRegionProvider, ClientBuilderProvider builderProvider, Optional<SdkAsyncHttpClient> httpClient) {
builder.region(Optional.ofNullable(getRegion()).map(Region::of).orElseGet(awsRegionProvider::getRegion));

Expand All @@ -51,11 +56,11 @@ default <C, B extends AwsClientBuilder<B, C>> B configure(B builder, AwsRegionPr
}
}

if (getClient() != null && builder instanceof SdkSyncClientBuilder<?, ?> clientBuilder) {
if (builderProvider != null && getClient() != null && builder instanceof SdkSyncClientBuilder<?, ?> clientBuilder) {
builderProvider.findHttpClientBuilder(getClient()).ifPresent(clientBuilder::httpClientBuilder);
}

if (getAsyncClient() != null && builder instanceof AwsAsyncClientBuilder<?, ?> clientBuilder) {
if (builderProvider != null && getAsyncClient() != null && builder instanceof AwsAsyncClientBuilder<?, ?> clientBuilder) {
builderProvider.findAsyncHttpClientBuilder(getClient()).ifPresent(clientBuilder::httpClientBuilder);
} else if (httpClient.isPresent() && builder instanceof AwsAsyncClientBuilder<?, ?> clientBuilder) {
clientBuilder.httpClient(httpClient.get());
Expand Down

0 comments on commit d3d0dae

Please sign in to comment.