Skip to content

feat(storage): update compose sample to support deleteSourceObjects option#13493

Draft
nidhiii-27 wants to merge 1 commit into
mainfrom
feat/java-compose-delete-sources
Draft

feat(storage): update compose sample to support deleteSourceObjects option#13493
nidhiii-27 wants to merge 1 commit into
mainfrom
feat/java-compose-delete-sources

Conversation

@nidhiii-27

Copy link
Copy Markdown
Contributor

Update composeObject snippet to support deleteSourceObjects option.
Add corresponding system integration tests.

[Generated-by: AI]

…ption

Update composeObject snippet to support deleteSourceObjects option.
Add corresponding system integration tests.

[Generated-by: AI]
@nidhiii-27 nidhiii-27 added ai-generated storage-sample-architect Generated by storage-sample-architect skill labels Jun 16, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a deleteSourceObjects parameter to the ComposeObject sample and updates the integration tests to verify this behavior. However, a critical issue was identified: the ComposeRequest.Builder does not support a setDeleteSourceObjects method, and the underlying API does not support deleting source objects during composition. The reviewer recommends explicitly deleting the source objects using storage.delete(...) after the compose operation succeeds.

Comment on lines +74 to 78
.setDeleteSourceObjects(deleteSourceObjects)
.build();

Blob compositeObject = storage.compose(composeRequest);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

The ComposeRequest.Builder class in the Google Cloud Storage Java SDK does not have a setDeleteSourceObjects method, and the Cloud Storage Compose API does not support deleting source objects as part of the compose request. To achieve this behavior, you must explicitly delete the source objects using storage.delete(...) after the compose operation succeeds.

            .build();

    Blob compositeObject = storage.compose(composeRequest);

    if (deleteSourceObjects) {
      storage.delete(bucketName, firstObjectName);
      storage.delete(bucketName, secondObjectName);
    }

@nidhiii-27 nidhiii-27 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 16, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated storage-sample-architect Generated by storage-sample-architect skill

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants