Skip to content

CAMEL-23342: camel-azure-storage-blob - add listBlobVersions container operation#23554

Merged
oscerd merged 1 commit into
apache:mainfrom
oscerd:fix/CAMEL-23342
May 27, 2026
Merged

CAMEL-23342: camel-azure-storage-blob - add listBlobVersions container operation#23554
oscerd merged 1 commit into
apache:mainfrom
oscerd:fix/CAMEL-23342

Conversation

@oscerd
Copy link
Copy Markdown
Contributor

@oscerd oscerd commented May 27, 2026

Motivation

CAMEL-23330 added the read-path CamelAzureStorageBlobVersionId header so getBlob,
downloadBlobToFile and downloadLink can target a specific version of a blob when
versioning 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() with BlobListDetails.setRetrieveVersions(true),
but the Camel component did not expose it.

What this changes

Adds a new container-level producer operation listBlobVersions that:

  • Reuses the same ListBlobsOptions plumbing as listBlobs (so the existing
    prefix, regex and maxResultsPerPage options/headers all still apply).
  • Forces BlobListDetails.setRetrieveVersions(true) before issuing the request,
    preserving any other BlobListDetails flags the caller already set via the
    CamelAzureStorageBlobListDetails header.
  • Returns a List<BlobItem> where each item carries its own versionId and
    isCurrentVersion flag, populated by the Azure SDK.

Implemented as a separate operation (rather than a flag on listBlobs) because
the result shape differs from listBlobs (one row per version vs. one row per
blob), which matches how the rest of the API treats shape-changing variants
(findBlobsByTags, createBlobSnapshot, etc.).

Files touched

  • BlobOperationsDefinition — new listBlobVersions enum value (container-level).
  • BlobContainerOperations — new listBlobVersions(Exchange).
  • BlobProducer — switch case wired to the new operation.
  • BlobContainerOperationsTest — two new mock-based tests (basic + regex), with
    an ArgumentCaptor to assert retrieveVersions=true actually 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.
  • Regenerated: azure-storage-blob.json catalog metadata and component metadata
    (picked up by a full reactor build from root, as required by the CI regen guard).

Compatibility

Additive only:

  • BlobOperationsDefinition is an enum — adding a value is backward-compatible.
  • BlobContainerOperations.listBlobVersions is a new public method on a class
    that is part of the component's public API surface.
  • No existing operation behaviour changes.

Test plan

  • Unit tests pass: mvn test -Dtest=BlobContainerOperationsTest (6/6,
    including the two new tests).
  • Module build clean: mvn -DskipTests install in
    components/camel-azure/camel-azure-storage-blob.
  • Full reactor build from root clean: mvn clean install -DskipTests
    (regen artifacts committed in the same commit).
  • Integration tests against a versioning-enabled storage account are not
    included; the existing BlobContainerOperationsIT exercises the live
    listBlobs path. Happy to add an IT in a follow-up if reviewers prefer.

Related


Claude Code on behalf of Andrea Cosentino

…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>
@oscerd oscerd requested review from davsclaus and gzurowski May 27, 2026 09:54
@github-actions
Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions
Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • catalog/camel-catalog
  • components/camel-azure/camel-azure-storage-blob
  • docs
All tested modules (9 modules)
  • Camel :: Azure :: Storage Blob
  • Camel :: Catalog :: Camel Catalog
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Launcher :: Container
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

@oscerd oscerd merged commit e04ba48 into apache:main May 27, 2026
7 checks passed
@oscerd oscerd deleted the fix/CAMEL-23342 branch May 27, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants