-
Notifications
You must be signed in to change notification settings - Fork 1k
Add support for service-specific endpoint overrides without code changes. #5562
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d298fca
Made protected API changes in support of service-specific endpoint ov…
millems 7860e1f
Updates to the way SDK clients are built, to support the new client e…
millems f77631c
Moved non-client users of DefaultServiceEndpointBuilder over to AwsCl…
millems d0bcb01
Miscellaneous changes required to move the SDK over from the old SdkC…
millems 668f544
Codegen test file changes.
millems 3ce4f5d
Changelog entry.
millems d7e38fa
Merge branch 'master' into millem/endpoint-url-part-3
millems 2a3cce2
Fix checkstyle issue.
millems d5bd8b0
Merge branch 'master' into millem/endpoint-url-part-3
millems 1bacaf6
Update .changes/next-release/feature-AWSSDKforJavav2-eea40a4.json
millems 651291b
WIP
millems bd5a56b
Updated environment variables and profile properties to match the oth…
millems c00a92c
Addressed comments.
millems 04a8a50
Updated test to use new profile property and environment variables.
millems 2890871
Merge branch 'master' into millem/endpoint-url-part-3
millems File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
461 changes: 461 additions & 0 deletions
461
...core/src/main/java/software/amazon/awssdk/awscore/endpoint/AwsClientEndpointProvider.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
core/sdk-core/src/main/java/software/amazon/awssdk/core/ClientEndpointProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| /* | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"). | ||
| * You may not use this file except in compliance with the License. | ||
| * A copy of the License is located at | ||
| * | ||
| * http://aws.amazon.com/apache2.0 | ||
| * | ||
| * or in the "license" file accompanying this file. This file is distributed | ||
| * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
| * express or implied. See the License for the specific language governing | ||
| * permissions and limitations under the License. | ||
| */ | ||
|
|
||
| package software.amazon.awssdk.core; | ||
|
|
||
| import java.net.URI; | ||
| import software.amazon.awssdk.annotations.SdkProtectedApi; | ||
| import software.amazon.awssdk.core.internal.StaticClientEndpointProvider; | ||
| import software.amazon.awssdk.endpoints.EndpointProvider; | ||
|
|
||
| /** | ||
| * Client endpoint providers are responsible for resolving client-level endpoints. {@link EndpointProvider}s are | ||
| * ultimately responsible for resolving the endpoint used for a request. | ||
| * <p> | ||
| * {@link EndpointProvider}s may choose to honor or completely ignore the client-level endpoint. Default endpoint | ||
| * providers will ignore the client-level endpoint, unless {@link #isEndpointOverridden()} is true. | ||
| */ | ||
| @SdkProtectedApi | ||
| public interface ClientEndpointProvider { | ||
| /** | ||
| * Create a client endpoint provider that uses the provided URI and returns true from {@link #isEndpointOverridden()}. | ||
| */ | ||
| static ClientEndpointProvider forEndpointOverride(URI uri) { | ||
| return new StaticClientEndpointProvider(uri, true); | ||
| } | ||
|
|
||
| /** | ||
| * Create a client endpoint provider that uses the provided static URI and override settings. | ||
| */ | ||
| static ClientEndpointProvider create(URI uri, boolean isEndpointOverridden) { | ||
| return new StaticClientEndpointProvider(uri, isEndpointOverridden); | ||
| } | ||
|
|
||
| /** | ||
| * Retrieve the client endpoint from this provider. | ||
| */ | ||
| URI clientEndpoint(); | ||
|
|
||
| /** | ||
| * Returns true if this endpoint was specified as an override by the customer, or false if it was determined | ||
| * automatically by the SDK. | ||
| */ | ||
| boolean isEndpointOverridden(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Took me a second to figure out what this meant! Just curious what happens if we do encounter this ordering issue with the other overload?
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.
Spotbugs complains about the dependency. I didn't test what happens if we ignore spotbugs. I suspect it could be a weird "no class def found" because of the cyclic static initialization dependency?