-
Notifications
You must be signed in to change notification settings - Fork 945
S3CrossRegion Sync and Async Clients Redirect implementation #4089
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
joviegas
merged 13 commits into
cross_region_bucket_access/project_branch
from
joviegas/cross_region_decorator_sync_implementation
Jun 21, 2023
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3ab5cbf
S3CrossRegionSyncClient Redirect implementation
joviegas 233b93e
Added implementation for Async client Decorator
joviegas ec30955
Updated older Cross region test cases
joviegas 02db0d9
rebased from Lattest project branch
joviegas 72c74fa
Added paramterized test
joviegas 9cc4bdf
Async Exception checged to completableException
joviegas 95f389d
Updated test cases and changes the Exception handling when HeadBucket…
joviegas a712820
Handled Anna-karin's comments
joviegas d1096c3
Removed async execution of HeadBucket and attached it to the completa…
joviegas d086ece
Handled Zoe's comments
joviegas 12b080a
Handled Anna-karin's comment and also rebased from project branch
joviegas f99d959
Added test case when Redirected after the Region is cached
joviegas d13ce08
Changed region constant to Region Type in Tests
joviegas 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
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
50 changes: 50 additions & 0 deletions
50
...azon/awssdk/services/s3/internal/crossregion/endpointprovider/BucketEndpointProvider.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,50 @@ | ||
/* | ||
* 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.services.s3.internal.crossregion.endpointprovider; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
import java.util.function.Supplier; | ||
import software.amazon.awssdk.annotations.SdkInternalApi; | ||
import software.amazon.awssdk.endpoints.Endpoint; | ||
import software.amazon.awssdk.regions.Region; | ||
import software.amazon.awssdk.services.s3.endpoints.S3EndpointParams; | ||
import software.amazon.awssdk.services.s3.endpoints.S3EndpointProvider; | ||
|
||
/** | ||
* Decorator S3EndpointProvider which updates the region with the one that is supplied during its instantiation. | ||
*/ | ||
@SdkInternalApi | ||
public class BucketEndpointProvider implements S3EndpointProvider { | ||
private final S3EndpointProvider delegateEndPointProvider; | ||
private final Supplier<Region> regionSupplier; | ||
|
||
private BucketEndpointProvider(S3EndpointProvider delegateEndPointProvider, Supplier<Region> regionSupplier) { | ||
this.delegateEndPointProvider = delegateEndPointProvider; | ||
this.regionSupplier = regionSupplier; | ||
} | ||
|
||
public static BucketEndpointProvider create(S3EndpointProvider delegateEndPointProvider, Supplier<Region> regionSupplier) { | ||
return new BucketEndpointProvider(delegateEndPointProvider, regionSupplier); | ||
} | ||
|
||
@Override | ||
public CompletableFuture<Endpoint> resolveEndpoint(S3EndpointParams endpointParams) { | ||
Region crossRegion = regionSupplier.get(); | ||
return delegateEndPointProvider.resolveEndpoint( | ||
crossRegion != null ? endpointParams.toBuilder().region(crossRegion).build() : endpointParams); | ||
cenedhryn marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
} | ||
} | ||
|
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.
Uh oh!
There was an error while loading. Please reload this page.