CAMEL-23342: camel-azure-storage-blob - add listBlobVersions container operation#23554
Merged
Conversation
…r operation Add a new container-level producer operation that returns one BlobItem per version of every blob in the container, allowing the full version history of a blob to be inspected for auditing and compliance scenarios. Requires versioning to be enabled on the storage account. The operation reuses the same ListBlobsOptions plumbing as listBlobs (so prefix, regex and maxResultsPerPage all still apply) and forces BlobListDetails.setRetrieveVersions(true) before issuing the request. Each returned BlobItem carries its own versionId and isCurrentVersion flag, populated by the Azure SDK. This complements CAMEL-23330, which added the read-path BLOB_VERSION_ID header for targeting a specific version on getBlob / downloadBlobToFile / downloadLink, by providing a way to discover the versions in the first place. - BlobOperationsDefinition: new listBlobVersions enum value (container-level) - BlobContainerOperations: new listBlobVersions(Exchange) reusing the listBlob options/regex filter and forcing retrieveVersions=true - BlobProducer: switch case wired to the new operation - Unit tests verifying retrieveVersions is set on the request and that the regex filter still narrows the result - Documentation update with example and upgrade guide entry Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
davsclaus
approved these changes
May 27, 2026
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
Contributor
|
🧪 CI tested the following changed modules:
All tested modules (9 modules)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
CAMEL-23330 added the read-path
CamelAzureStorageBlobVersionIdheader sogetBlob,downloadBlobToFileanddownloadLinkcan target a specific version of a blob whenversioning is enabled on the storage account. There was, however, no operation to
list the versions of a blob — needed for auditing and compliance scenarios where
the full version history must be inspectable. The Azure SDK supports this via
BlobContainerClient.listBlobs()withBlobListDetails.setRetrieveVersions(true),but the Camel component did not expose it.
What this changes
Adds a new container-level producer operation
listBlobVersionsthat:ListBlobsOptionsplumbing aslistBlobs(so the existingprefix,regexandmaxResultsPerPageoptions/headers all still apply).BlobListDetails.setRetrieveVersions(true)before issuing the request,preserving any other
BlobListDetailsflags the caller already set via theCamelAzureStorageBlobListDetailsheader.List<BlobItem>where each item carries its ownversionIdandisCurrentVersionflag, populated by the Azure SDK.Implemented as a separate operation (rather than a flag on
listBlobs) becausethe result shape differs from
listBlobs(one row per version vs. one row perblob), which matches how the rest of the API treats shape-changing variants
(
findBlobsByTags,createBlobSnapshot, etc.).Files touched
BlobOperationsDefinition— newlistBlobVersionsenum value (container-level).BlobContainerOperations— newlistBlobVersions(Exchange).BlobProducer— switch case wired to the new operation.BlobContainerOperationsTest— two new mock-based tests (basic + regex), withan
ArgumentCaptorto assertretrieveVersions=trueactually reaches the request.azure-storage-blob-component.adoc— operation table row + example block.camel-4x-upgrade-guide-4_21.adoc— new-feature note for 4.21.azure-storage-blob.jsoncatalog metadata and component metadata(picked up by a full reactor build from root, as required by the CI regen guard).
Compatibility
Additive only:
BlobOperationsDefinitionis an enum — adding a value is backward-compatible.BlobContainerOperations.listBlobVersionsis a new public method on a classthat is part of the component's public API surface.
Test plan
mvn test -Dtest=BlobContainerOperationsTest(6/6,including the two new tests).
mvn -DskipTests installincomponents/camel-azure/camel-azure-storage-blob.mvn clean install -DskipTests(regen artifacts committed in the same commit).
included; the existing
BlobContainerOperationsITexercises the livelistBlobspath. Happy to add an IT in a follow-up if reviewers prefer.Related
Claude Code on behalf of Andrea Cosentino