Skip to content

Add PresignedFileDownload return type for presigned URL downloads#7004

Merged
jencymaryjoseph merged 2 commits into
feature/master/pre-signed-url-getobjectfrom
jencyjos/pre-signed-url-getobject/presigned-file-download
Jun 1, 2026
Merged

Add PresignedFileDownload return type for presigned URL downloads#7004
jencymaryjoseph merged 2 commits into
feature/master/pre-signed-url-getobjectfrom
jencyjos/pre-signed-url-getobject/presigned-file-download

Conversation

@jencymaryjoseph

@jencymaryjoseph jencymaryjoseph commented May 29, 2026

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Expiry is the main concern, and v1 didn't support pause/resume for presigned URLs either — so we decided to keep the same behavior. I'll update the Javadoc to not state the reason.

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

@jencymaryjoseph jencymaryjoseph requested a review from joviegas June 1, 2026 16:24
@jencymaryjoseph jencymaryjoseph merged commit e126cb2 into feature/master/pre-signed-url-getobject Jun 1, 2026
4 checks passed
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants