Skip to content

feat(storage): support delete source objects on compose#14349

Open
nidhiii-27 wants to merge 2 commits into
mainfrom
compose-delete-sources
Open

feat(storage): support delete source objects on compose#14349
nidhiii-27 wants to merge 2 commits into
mainfrom
compose-delete-sources

Conversation

@nidhiii-27

Copy link
Copy Markdown
Contributor

Updates compose file sample to support deleting source objects optionally. Fixes b/441557254

Add deleteSourceObjects parameter to compose sample.
Updated test to assert both delete behavior scenarios.

[Generated-by: AI]

@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 adds support for the "delete_source_objects" parameter in the "compose_file" snippet, enabling the deletion of source objects after composition, and includes unit tests to verify both the default and deletion behaviors. The reviewer suggested refactoring the conditional print statements in "storage_compose_file.py" to use a conditional suffix string, which reduces code duplication and improves maintainability.

Comment on lines 60 to 71
if delete_source_objects:
print(
"New composite object {} in the bucket {} was created by combining {} and {}. Source objects were deleted.".format(
destination_blob_name, bucket_name, first_blob_name, second_blob_name
)
)
else:
print(
"New composite object {} in the bucket {} was created by combining {} and {}".format(
destination_blob_name, bucket_name, first_blob_name, second_blob_name
)
)

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.

medium

The print statements for when delete_source_objects is True vs False are highly duplicated. We can simplify this by using a conditional suffix string, which reduces duplication and improves maintainability.

    suffix = " Source objects were deleted." if delete_source_objects else ""
    print(
        "New composite object {} in the bucket {} was created by combining {} and {}.{}".format(
            destination_blob_name, bucket_name, first_blob_name, second_blob_name, suffix
        )
    )

- Reordered imports in snippets_test.py to satisfy flake8.
- Refactored storage_compose_file.py print statements to avoid duplication.

[Generated-by: AI]
@nidhiii-27 nidhiii-27 marked this pull request as ready for review June 24, 2026 06:47
@nidhiii-27 nidhiii-27 requested review from a team as code owners June 24, 2026 06:47
@product-auto-label product-auto-label Bot added api: storage Issues related to the Cloud Storage API. samples Issues that are directly related to samples. labels Jun 24, 2026
@nidhiii-27

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated api: storage Issues related to the Cloud Storage API. samples Issues that are directly related to samples. storage-sample-architect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant