generated from micronaut-projects/micronaut-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
type: improvementA minor improvement to an existing featureA minor improvement to an existing feature
Description
Feature description
currently it is only possible to use Metadata on UploadRequest and cannot add tags. In Azure Blob Storage index tags can by used to search blobs, so in many cases Micronaut implementation is useless if one need add tags for search functionality.
With Azure SDK it can be made like:
val blob = blobClient.getBlobClient(path);
BlobHttpHeaders headers = new BlobHttpHeaders().setContentType("........................");
BlobParallelUploadOptions options = new BlobParallelUploadOptions(BinaryData.fromStream(source))
.setHeaders(headers)
.setTags(Map.of("issued", DateTimeFormatter.ofPattern("yyyy-MM-dd").format(attributes.issueDate())));
val r = blob.uploadWithResponse(options, null, null);I tryed this:
UploadRequest request = UploadRequest
.fromPath(Path.of("..................pdf")
, "blob/path");
val res = objectStorage.upload(request, options -> {
options.setTags(Map.of("type", "FS", "issued", "2024-12-01"));
});but it not works, probably because of this (tags are not copied):
private BlockBlobSimpleUploadOptions toBlockBlobSimpleUploadOptions(@NonNull BlobParallelUploadOptions options, @NonNull InputStream inputStream, @NonNull long length) {
BlockBlobSimpleUploadOptions simpleUploadOptions = new BlockBlobSimpleUploadOptions(new BufferedInputStream(inputStream), length);
simpleUploadOptions.setMetadata(options.getMetadata());
simpleUploadOptions.setHeaders(options.getHeaders());
return simpleUploadOptions;
}from AzureBlobStorageOperations
BTW using client.deleteIfExists() is in my opinion bad practice:
- by default
uploadWithResponseoverrides existing blob, according to javadoc: "Creates a new blob, or updates the content of an existing blob" - how it will works with version-level immutability support containers?
Metadata
Metadata
Assignees
Labels
type: improvementA minor improvement to an existing featureA minor improvement to an existing feature