Skip to content

Add PresignedFileDownload return type for presigned URL downloads#7004

Open
jencymaryjoseph wants to merge 1 commit into
feature/master/pre-signed-url-getobjectfrom
jencyjos/pre-signed-url-getobject/presigned-file-download
Open

Add PresignedFileDownload return type for presigned URL downloads#7004
jencymaryjoseph wants to merge 1 commit into
feature/master/pre-signed-url-getobjectfrom
jencyjos/pre-signed-url-getobject/presigned-file-download

Conversation

@jencymaryjoseph
Copy link
Copy Markdown
Contributor

@jencymaryjoseph jencymaryjoseph commented May 29, 2026

Motivation and Context

downloadFileWithPresignedUrl() previously returned FileDownload, which exposes pause(). Pause is not supported for presigned URL downloads. Calling pause() threw UnsupportedOperationException at runtime - a bad customer experience. This PR introduces PresignedFileDownload, a new return type that provides compile-time safety by not exposing pause().

Modifications

  • Added PresignedFileDownload interface (extends ObjectTransfer — has completionFuture() and progress(), no pause())
  • Added DefaultPresignedFileDownload internal implementation
  • Changed S3TransferManager.downloadFileWithPresignedUrl() return type from FileDownload to PresignedFileDownload
  • Updated DelegatingS3TransferManager and GenericS3TransferManager accordingly
  • Removed runtime UnsupportedOperationException from GenericS3TransferManager

Testing

  • Updated existing unit and integration tests to use PresignedFileDownload return type
  • All existing presigned URL download tests pass (progress tracking, multipart, error cases)

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@jencymaryjoseph jencymaryjoseph requested a review from a team as a code owner May 29, 2026 22:02
@jencymaryjoseph jencymaryjoseph force-pushed the jencyjos/pre-signed-url-getobject/presigned-file-download branch from 9a4fa5f to dd0a645 Compare May 29, 2026 22:25
* A download transfer of a single object from S3 using a presigned URL.
*
* <p>Unlike {@link FileDownload}, this type does not support pause/resume because presigned URLs
* have a limited lifetime and cannot be reliably resumed after expiration.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the expiry time only limitation for not implementing this for pause/resume?

import software.amazon.awssdk.utils.Validate;

@SdkInternalApi
public final class DefaultPresignedFileDownload implements PresignedFileDownload {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add equals and hashcode methods and also add test with EqualsVerifier something like DefaultDownloadTest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants