Skip to content

feat: abstract pre-signed upload request creation#742

Open
alvarosanchez wants to merge 9 commits into3.0.xfrom
CLI-65-github-issue-631-abstract-the-creation-of-pre-signed-upload-requests
Open

feat: abstract pre-signed upload request creation#742
alvarosanchez wants to merge 9 commits into3.0.xfrom
CLI-65-github-issue-631-abstract-the-creation-of-pre-signed-upload-requests

Conversation

@alvarosanchez
Copy link
Copy Markdown
Member

Summary

  • add a portable presigned upload request API in object-storage-core
  • implement provider-backed signed PUT request generation for AWS, GCP, and Azure
  • document the new pre-signed upload flow and add controller-facing doc examples

Why

Micronaut Object Storage already abstracts direct upload/download operations, but it did not expose a first-class way to generate time-limited client upload requests. Some providers require signed headers in addition to the URL, so the API needs to return the full request shape instead of only a link.

Closes #631.

Validation

  • ./gradlew --no-daemon :micronaut-doc-examples:micronaut-example-java:compileJava :micronaut-doc-examples:micronaut-example-groovy:compileGroovy :micronaut-doc-examples:micronaut-example-kotlin:compileKotlin :micronaut-object-storage-core:test --tests 'io.micronaut.objectstorage.ObjectStorageOperationsPresignedUploadFallbackSpec' :micronaut-object-storage-aws:test --tests 'io.micronaut.objectstorage.aws.AwsS3PresignedUploadSpec' :micronaut-object-storage-gcp:test --tests 'io.micronaut.objectstorage.googlecloud.GoogleCloudStoragePresignedUploadSpec' :micronaut-object-storage-azure:test --tests 'io.micronaut.objectstorage.azure.AzureBlobStoragePresignedUploadSpec' japiCmp docs

Copilot AI review requested due to automatic review settings April 2, 2026 11:51
@alvarosanchez alvarosanchez added the type: improvement A minor improvement to an existing feature label Apr 2, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new portable API in object-storage-core for generating time-limited, client-replayable pre-signed upload HTTP requests, with provider-specific implementations for AWS S3, Google Cloud Storage, and Azure Blob Storage, plus corresponding documentation and doc-example controllers.

Changes:

  • Adds CreatePresignedUploadRequest + PresignedUpload types and a default ObjectStorageOperations#createPresignedUpload(...) API returning Optional.
  • Implements provider-backed signed PUT request generation for AWS, GCP, and Azure, with new provider-specific tests.
  • Adds a dedicated “Pre-Signed Uploads” documentation section and Java/Groovy/Kotlin controller examples.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/main/docs/guide/toc.yml Adds the new “Pre-Signed Uploads” section to the guide navigation.
src/main/docs/guide/quickStart.adoc Links quick start readers to the new pre-signed uploads section.
src/main/docs/guide/preSignedUploads.adoc Documents the new pre-signed upload flow and provides a controller example snippet.
object-storage-core/src/main/java/io/micronaut/objectstorage/ObjectStorageOperations.java Adds the portable createPresignedUpload default method returning Optional.
object-storage-core/src/main/java/io/micronaut/objectstorage/request/CreatePresignedUploadRequest.java Defines request parameters for creating a pre-signed upload (key, expiry, optional headers/metadata).
object-storage-core/src/main/java/io/micronaut/objectstorage/response/PresignedUpload.java Defines the portable “full request shape” response (URI/method/headers/expiration).
object-storage-core/src/test/groovy/io/micronaut/objectstorage/ObjectStorageOperationsPresignedUploadFallbackSpec.groovy Verifies the default interface method behavior (providers not overriding return empty).
object-storage-aws/src/main/java/io/micronaut/objectstorage/aws/AwsS3Operations.java Implements AWS S3 pre-signed PUT creation via S3Presigner.
object-storage-aws/src/test/groovy/io/micronaut/objectstorage/aws/AwsS3PresignedUploadSpec.groovy Adds AWS presigned upload unit tests.
object-storage-gcp/src/main/java/io/micronaut/objectstorage/googlecloud/GoogleCloudStorageOperations.java Implements GCS signed PUT generation via Storage#signUrl(...) with portable headers.
object-storage-gcp/src/test/groovy/io/micronaut/objectstorage/googlecloud/GoogleCloudStoragePresignedUploadSpec.groovy Adds GCP presigned upload unit tests.
object-storage-azure/src/main/java/io/micronaut/objectstorage/azure/AzureBlobStorageOperations.java Adds Azure SAS-based signed upload generation and returns portable headers.
object-storage-azure/src/test/groovy/io/micronaut/objectstorage/azure/AzureBlobStoragePresignedUploadSpec.groovy Adds Azure presigned upload unit tests.
object-storage-azure/src/test/groovy/io/micronaut/objectstorage/azure/AzureBlobStoragePaginationSpec.groovy Updates test subclass constructor call due to Azure operations constructor signature change.
doc-examples/example-java/src/main/java/example/PresignedUploadController.java Adds Java doc-example controller for returning a presigned upload payload.
doc-examples/example-groovy/src/main/groovy/example/PresignedUploadController.groovy Adds Groovy doc-example controller for returning a presigned upload payload.
doc-examples/example-kotlin/src/main/kotlin/example/PresignedUploadController.kt Adds Kotlin doc-example controller for returning a presigned upload payload.

@alvarosanchez
Copy link
Copy Markdown
Member Author

Addressed the remaining review follow-ups on this branch:

  • reject blank CreatePresignedUploadRequest.contentType values
  • return Optional.empty() for Azure presigning when shared-key credentials are unavailable
  • align the guide contract text with the runtime behavior

Verification:

  • ./gradlew --no-daemon :micronaut-object-storage-core:test --tests 'io.micronaut.objectstorage.request.CreatePresignedUploadRequestSpec' --tests 'io.micronaut.objectstorage.ObjectStorageOperationsPresignedUploadFallbackSpec'\n- ./gradlew --no-daemon :micronaut-object-storage-azure:test --tests 'io.micronaut.objectstorage.azure.AzureBlobStoragePresignedUploadSpec'\n- ./gradlew --no-daemon japiCmp docs

alvarosanchez and others added 8 commits April 4, 2026 01:10
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
@alvarosanchez alvarosanchez force-pushed the CLI-65-github-issue-631-abstract-the-creation-of-pre-signed-upload-requests branch from 9a1bd69 to f282a47 Compare April 4, 2026 01:13
Co-Authored-By: Paperclip <noreply@paperclip.ing>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 4, 2026

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

Labels

type: improvement A minor improvement to an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Abstract the creation of pre-signed upload requests

2 participants