feat(storage): add sample for hierarchical namespace recursive delete - #4434
feat(storage): add sample for hierarchical namespace recursive delete#4434nidhiii-27 wants to merge 7 commits into
Conversation
Adds a Node.js code sample demonstrating hierarchical namespace recursive folder delete. Fixes: b/530059535 [Generated-by: AI]
Add helpful log statements.
…ests Re-enable recursive delete folder integration tests and resolve GCS billing project limitations. [Generated-by: AI]
Remove skip comment for 'should delete a folder recursively' integration test. [Generated-by: AI]
…folder sample [Generated-by: AI]
There was a problem hiding this comment.
Code Review
This pull request introduces a new sample script deleteFolderRecursive.js to recursively delete folders, updates renameFolder.js to strip billing project headers, bumps the @google-cloud/storage-control dependency, and updates system tests to explicitly pass the project ID to the Storage client. It also enables the folder renaming test and adds a test for recursive deletion. Regarding the feedback, there is an issue in deleteFolderRecursive.js where a failed operation is incorrectly logged as successful; the code should check for op.error and throw an error if the operation fails.
| ); | ||
| op = latestOp; | ||
| } | ||
| console.log(`Deleted folder: ${folderName}.`); |
There was a problem hiding this comment.
If the recursive delete operation fails, op.done will be true but op.error will be populated. Currently, the code will incorrectly log that the folder was successfully deleted even if the operation failed. We should check for op.error and throw an error if it exists.
if (op.error) {
throw new Error(op.error.message);
}
console.log("Deleted folder: " + folderName + ".");…iew comments [Generated-by: AI]
[Generated-by: AI]
Draft PR for hierarchical namespace recursive delete folder sample.
[Generated-by: AI]