Skip to content

feat(storage): Add delete object source field in ComposeObject API#16094

Open
v-pratap wants to merge 3 commits into
googleapis:mainfrom
v-pratap:delete-object-source
Open

feat(storage): Add delete object source field in ComposeObject API#16094
v-pratap wants to merge 3 commits into
googleapis:mainfrom
v-pratap:delete-object-source

Conversation

@v-pratap
Copy link
Copy Markdown
Contributor

No description provided.

@v-pratap v-pratap requested review from a team as code owners May 13, 2026 08:32
@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label May 13, 2026
Copy link
Copy Markdown

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

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 the DeleteSourceObjects option for ComposeObject requests, implementing support in both gRPC and REST paths. It also includes integration tests to verify the behavior when the option is enabled or disabled. Feedback was provided to simplify the option retrieval logic using value_or(false) for better readability and to add a docstring to the new public-facing DeleteSourceObjects parameter.

Comment on lines +382 to +384
if (HasOption<DeleteSourceObjects>() && GetOption<DeleteSourceObjects>().value()) {
compose_object_payload_json["deleteSourceObjects"] = true;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For consistency with other parts of the codebase and to improve readability, you can use value_or(false) instead of checking HasOption and then calling value(). This simplifies the logic while maintaining the same behavior and aligns with the preference for defensive code.

  if (GetOption<DeleteSourceObjects>().value_or(false)) {
    compose_object_payload_json["deleteSourceObjects"] = true;
  }
References
  1. Prefer defensive code, such as explicit ok() checks, even if they seem redundant based on the current implementation of a framework, as the framework's contract may change in the future.

Comment on lines +608 to +614
struct DeleteSourceObjects
: public internal::WellKnownParameter<DeleteSourceObjects, bool> {
using WellKnownParameter<DeleteSourceObjects, bool>::WellKnownParameter;
static char const* well_known_parameter_name() {
return "deleteSourceObjects";
}
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

New public-facing parameters should include a docstring explaining their purpose, consistent with other parameters in this file. This helps users understand the functionality when using the library.

/**
 * If true, the source objects are deleted after a successful compose.
 */
struct DeleteSourceObjects
    : public internal::WellKnownParameter<DeleteSourceObjects, bool> {
  using WellKnownParameter<DeleteSourceObjects, bool>::WellKnownParameter;
  static char const* well_known_parameter_name() {
    return "deleteSourceObjects";
  }
};

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.70%. Comparing base (55df15b) to head (b5077ac).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16094   +/-   ##
=======================================
  Coverage   92.70%   92.70%           
=======================================
  Files        2353     2353           
  Lines      218352   218412   +60     
=======================================
+ Hits       202418   202479   +61     
+ Misses      15934    15933    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant