Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
We currently have scenarios where the client needs to interact directly with the storage provider without routing the file content through the application.
For document flows, we need to:
- Generate a pre-signed URL for uploading or downloading a document.
- Retrieve the stored object's metadata, such as size, content type, name, ETag, and other information provided by the storage provider.
- Avoid routing potentially large files through the backend just for upload or download operations.
The existing Storage methods work well when the application needs to consume the object content directly, but they do not fully cover scenarios where we only want to delegate the transfer to the storage provider or retrieve information about the object.
Describe the solution you'd like
I would like to evaluate the possibility of adding support for these operations in the Storage abstraction.
Conceptually, something similar to:
/// <summary>
/// Retrieves metadata (statistical information) for a blob asynchronously.
/// </summary>
/// <param name="args">
/// The arguments required to get the blob metadata, including container and blob names.
/// </param>
/// <param name="cancellationToken">
/// The cancellation token to observe while waiting for the task to complete.
/// </param>
/// <returns>
/// A task that represents the asynchronous operation to retrieve the metadata of the blob.
/// </returns>
Task<StatResponse> GetStatAsync(
BlobProviderStatArgs args,
CancellationToken cancellationToken = default
);
/// <summary>
/// Generates a pre-signed URL for the given blob provider and arguments.
/// </summary>
/// <param name="args">
/// The arguments required to generate the pre-signed URL.
/// </param>
/// <param name="ct">
/// The cancellation token.
/// </param>
/// <returns>
/// A Task object representing the asynchronous operation.
/// The task result is a string that represents the pre-signed URL.
/// </returns>
Task<string> PreSignedUrlAsync(
BlobProviderPreSignedUrlArgs args,
CancellationToken ct = default
);
The contracts above are only an initial proposal.
Ideally, PreSignedUrlAsync(...) could support different operations, such as upload and download, through its arguments, while GetStatAsync(...) would provide access to the blob metadata directly from the provider.
If this approach makes sense and there is no existing implementation or RFC covering it, I can start the implementation and open a PR following the design guidance from the ABP team.
Additional context
The main use case is a document flow where the backend creates a document reference and the frontend uploads the file directly to the storage provider using a pre-signed URL.
After the upload, the backend needs to retrieve the object metadata to validate the uploaded document and later generate another pre-signed URL for download.
It would also be helpful to understand the recommended design for these capabilities:
- Should these operations belong to the main Storage abstraction or to a provider-specific capability/interface?
- How should providers that do not support a specific pre-signed URL operation be handled?
- Should metadata responses use a provider-independent ABP model instead of exposing a provider-specific type such as
StatResponse?
- Are there existing ABP patterns for expiration, HTTP method, content type, file size, object key restrictions, or other security concerns related to pre-signed URLs?
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
We currently have scenarios where the client needs to interact directly with the storage provider without routing the file content through the application.
For document flows, we need to:
The existing Storage methods work well when the application needs to consume the object content directly, but they do not fully cover scenarios where we only want to delegate the transfer to the storage provider or retrieve information about the object.
Describe the solution you'd like
I would like to evaluate the possibility of adding support for these operations in the Storage abstraction.
Conceptually, something similar to:
The contracts above are only an initial proposal.
Ideally,
PreSignedUrlAsync(...)could support different operations, such as upload and download, through its arguments, whileGetStatAsync(...)would provide access to the blob metadata directly from the provider.If this approach makes sense and there is no existing implementation or RFC covering it, I can start the implementation and open a PR following the design guidance from the ABP team.
Additional context
The main use case is a document flow where the backend creates a document reference and the frontend uploads the file directly to the storage provider using a pre-signed URL.
After the upload, the backend needs to retrieve the object metadata to validate the uploaded document and later generate another pre-signed URL for download.
It would also be helpful to understand the recommended design for these capabilities:
StatResponse?