feat(storage): update compose sample to support deleteSourceObjects option#13493
feat(storage): update compose sample to support deleteSourceObjects option#13493nidhiii-27 wants to merge 1 commit into
Conversation
…ption Update composeObject snippet to support deleteSourceObjects option. Add corresponding system integration tests. [Generated-by: AI]
There was a problem hiding this comment.
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.
| .setDeleteSourceObjects(deleteSourceObjects) | ||
| .build(); | ||
|
|
||
| Blob compositeObject = storage.compose(composeRequest); | ||
|
|
There was a problem hiding this comment.
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);
}
Update composeObject snippet to support deleteSourceObjects option.
Add corresponding system integration tests.
[Generated-by: AI]