Skip to content

Commit 4a447cc

Browse files
zoewanggL-Applin
authored andcommitted
Update crossRegionEnabled to take Boolean instead of boolean in the C… (#4187)
* Update crossRegionEnabled to take Boolean instead of boolean in the CRT based S3 client and update javadoc for copy operation in the S3TransferManager * Add japicmp exclusion for the change temporarily
1 parent 947f4ed commit 4a447cc

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

pom.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,7 @@
622622
<!-- Service modules that are heavily customized should be included -->
623623
<includeModule>s3</includeModule>
624624
<includeModule>s3-control</includeModule>
625-
<!-- remove SQS temporarily TODO: re-enable -->
626-
<!-- <includeModule>sqs</includeModule>-->
625+
<includeModule>sqs</includeModule>
627626
<includeModule>rds</includeModule>
628627
<includeModule>apigateway</includeModule>
629628
<includeModule>polly</includeModule>
@@ -632,9 +631,9 @@
632631
<exclude>*.internal.*</exclude>
633632
<exclude>software.amazon.awssdk.thirdparty.*</exclude>
634633
<exclude>software.amazon.awssdk.regions.*</exclude>
635-
<exclude>software.amazon.awssdk.core.signer.NoOpSigner</exclude>
636-
<exclude>software.amazon.awssdk.auth.credentials.ProfileCredentialsProviderFactory</exclude>
637634
<exclude>software.amazon.awssdk.utils.async.InputStreamSubscriber</exclude>
635+
<!-- exclude S3CrtAsyncClientBuilder temporarily TODO: re-enable -->
636+
<exclude>software.amazon.awssdk.services.s3.S3CrtAsyncClientBuilder</exclude>
638637
</excludes>
639638

640639
<ignoreMissingOldVersion>true</ignoreMissingOldVersion>

services-custom/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/S3TransferManager.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ default DirectoryDownload downloadDirectory(Consumer<DownloadDirectoryRequest.Bu
611611
}
612612

613613
/**
614-
* Creates a copy of an object that is already stored in S3 in the same region.
614+
* Creates a copy of an object that is already stored in S3.
615615
* <p>
616616
* Depending on the underlying S3Client, {@link S3TransferManager} may intelligently use plain {@link CopyObjectRequest}s
617617
* for smaller objects, and multiple parallel {@link UploadPartCopyRequest}s for larger objects. If multipart copy is
@@ -625,10 +625,22 @@ default DirectoryDownload downloadDirectory(Consumer<DownloadDirectoryRequest.Bu
625625
* the way the {@link CopyObjectRequest} API behaves. When copying an object, S3 performs the byte copying on your behalf
626626
* while keeping the connection alive. The progress of the copy is not known until it fully completes and S3 sends a response
627627
* describing the outcome.
628+
*
629+
* <p>
630+
* If you are copying an object to a bucket in a different region, you need to enable cross region access
631+
* on the {@link S3AsyncClient}.
632+
*
628633
* <p>
629634
* <b>Usage Example:</b>
630635
* {@snippet :
631-
* S3TransferManager transferManager = S3TransferManager.create();
636+
* S3AsyncClient s3AsyncClient =
637+
* S3AsyncClient.crtBuilder()
638+
* // enable cross-region access, only required if you are making cross-region copy
639+
* .crossRegionAccessEnabled(true)
640+
* .build();
641+
* S3TransferManager transferManager = S3TransferManager.builder()
642+
* .s3Client(s3AsyncClient)
643+
* .build();
632644
* CopyObjectRequest copyObjectRequest = CopyObjectRequest.builder()
633645
* .sourceBucket("source_bucket")
634646
* .sourceKey("source_key")
@@ -647,6 +659,7 @@ default DirectoryDownload downloadDirectory(Consumer<DownloadDirectoryRequest.Bu
647659
* @param copyRequest the copy request, containing a {@link CopyObjectRequest}
648660
* @return A {@link Copy} that can be used to track the ongoing transfer
649661
* @see #copy(Consumer)
662+
* @see S3AsyncClient#copyObject(CopyObjectRequest)
650663
*/
651664
default Copy copy(CopyRequest copyRequest) {
652665
throw new UnsupportedOperationException();

services/s3/src/main/java/software/amazon/awssdk/services/s3/S3CrtAsyncClientBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ default S3CrtAsyncClientBuilder retryConfiguration(Consumer<S3CrtRetryConfigurat
232232
* @param crossRegionAccessEnabled Whether cross region bucket access should be enabled.
233233
* @return The builder object for method chaining.
234234
*/
235-
S3CrtAsyncClientBuilder crossRegionAccessEnabled(boolean crossRegionAccessEnabled);
235+
S3CrtAsyncClientBuilder crossRegionAccessEnabled(Boolean crossRegionAccessEnabled);
236236

237237
@Override
238238
S3AsyncClient build();

services/s3/src/main/java/software/amazon/awssdk/services/s3/internal/crt/DefaultS3CrtAsyncClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public S3CrtAsyncClientBuilder retryConfiguration(S3CrtRetryConfiguration retryC
271271
}
272272

273273
@Override
274-
public S3CrtAsyncClientBuilder crossRegionAccessEnabled(boolean crossRegionAccessEnabled) {
274+
public S3CrtAsyncClientBuilder crossRegionAccessEnabled(Boolean crossRegionAccessEnabled) {
275275
this.crossRegionAccessEnabled = crossRegionAccessEnabled;
276276
return this;
277277
}

0 commit comments

Comments
 (0)