-
Notifications
You must be signed in to change notification settings - Fork 910
Expose endpointOverride through ServiceClientConfiguration #3900
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"category": "AWS SDK for Java v2", | ||
"contributor": "", | ||
"type": "feature", | ||
"description": "Exposes endpointOverride in SdkClient through ServiceClientConfiguration" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package software.amazon.awssdk.services.json; | ||
|
||
import java.net.URI; | ||
import software.amazon.awssdk.annotations.Generated; | ||
import software.amazon.awssdk.annotations.SdkInternalApi; | ||
import software.amazon.awssdk.auth.token.credentials.SdkTokenProvider; | ||
|
@@ -28,12 +29,17 @@ public DefaultJsonAsyncClientBuilder tokenProvider(SdkTokenProvider tokenProvide | |
} | ||
|
||
@Override | ||
protected final JsonAsyncClient buildClient() { | ||
protected JsonAsyncClient buildClient() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why remove final? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. intellij suggested to remove it i wasn't sure, added it back |
||
SdkClientConfiguration clientConfiguration = super.asyncClientConfiguration(); | ||
this.validateClientOptions(clientConfiguration); | ||
URI endpointOverride = null; | ||
if (clientConfiguration.option(SdkClientOption.ENDPOINT_OVERRIDDEN) != null | ||
&& clientConfiguration.option(SdkClientOption.ENDPOINT_OVERRIDDEN)) { | ||
endpointOverride = clientConfiguration.option(SdkClientOption.ENDPOINT); | ||
} | ||
JsonServiceClientConfiguration serviceClientConfiguration = JsonServiceClientConfiguration.builder() | ||
.overrideConfiguration(overrideConfiguration()).region(clientConfiguration.option(AwsClientOption.AWS_REGION)) | ||
.build(); | ||
.endpointOverride(endpointOverride).build(); | ||
return new DefaultJsonAsyncClient(serviceClientConfiguration, clientConfiguration); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
|
||
package software.amazon.awssdk.awscore; | ||
|
||
import java.net.URI; | ||
import java.util.Objects; | ||
import software.amazon.awssdk.annotations.SdkPublicApi; | ||
import software.amazon.awssdk.core.SdkServiceClientConfiguration; | ||
|
@@ -81,6 +82,7 @@ public interface Builder extends SdkServiceClientConfiguration.Builder { | |
protected abstract static class BuilderImpl implements Builder { | ||
protected ClientOverrideConfiguration overrideConfiguration; | ||
protected Region region; | ||
protected URI endpointOverride; | ||
|
||
protected BuilderImpl() { | ||
} | ||
|
@@ -90,19 +92,6 @@ protected BuilderImpl(AwsServiceClientConfiguration awsServiceClientConfiguratio | |
this.region = awsServiceClientConfiguration.region(); | ||
} | ||
|
||
|
||
@Override | ||
public Builder overrideConfiguration(ClientOverrideConfiguration clientOverrideConfiguration) { | ||
this.overrideConfiguration = clientOverrideConfiguration; | ||
return this; | ||
} | ||
Comment on lines
-93
to
-98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we have this on the interface? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added in Builder interface |
||
|
||
@Override | ||
public Builder region(Region region) { | ||
this.region = region; | ||
return this; | ||
} | ||
|
||
@Override | ||
public final ClientOverrideConfiguration overrideConfiguration() { | ||
return overrideConfiguration; | ||
|
@@ -112,6 +101,11 @@ public final ClientOverrideConfiguration overrideConfiguration() { | |
public final Region region() { | ||
return region; | ||
} | ||
|
||
@Override | ||
public final URI endpointOverride() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we have a setter on the interface to override the return type? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added overridden setters for endpointOverride and overrideConfiguration |
||
return endpointOverride; | ||
} | ||
} | ||
|
||
} |
Uh oh!
There was an error while loading. Please reload this page.
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.
Nit:
Boolean.TRUE.equals(clientConfiguration.option($T.ENDPOINT_OVERRIDDEN))
?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.
updated