Repository navigation
feat(storage): add bucket IP filtering samples and tests - #14594
nidhiii-27 wants to merge 4 commits into
Conversation
Add Python code samples and tests demonstrating Cloud Storage Bucket IP filtering. Fixes: b/544985518 [Generated-by: AI]
There was a problem hiding this comment.
Code Review
This pull request introduces Python code snippets and tests demonstrating Google Cloud Storage bucket IP filtering features, including creating, enabling, disabling, retrieving, listing, and deleting IP filtering rules. The review feedback highlights several potential bugs and improvement opportunities: handling potential IndexError exceptions when executing the scripts from the command line without arguments, defensively checking for None values to avoid TypeError exceptions on list operations, and refactoring direct self-assignments to prevent linter warnings or accidental code removal that would break the SDK's change registration.
Address review feedback regarding self-assignment, defensive None checks, and CLI arg handling. [Generated-by: AI]
|
Here is the summary of changes. You are about to add 6 region tags.
This comment is generated by snippet-bot.
|
|
why all the kokoro tests are failing ? |
The kokoro configs have been disabled hence these tests do not run at all. |
shradhakatyal
left a comment
There was a problem hiding this comment.
Blocking dependency issue (storage/samples/snippets/requirements.txt):
storage/samples/snippets/requirements.txt currently pins google-cloud-storage==3.1.0, which predates google.cloud.storage.ip_filter (added in 3.3.0). Please bump google-cloud-storage to >=3.3.0 (e.g., 3.14.1) so nox tests do not fail with ModuleNotFoundError.
[Generated-by: AI]
shradhakatyal
left a comment
There was a problem hiding this comment.
Thank you for addressing the previous inline feedback. Please resolve the remaining dependency version issue in requirements.txt and the inline comments below.
Blocking dependency issue (storage/samples/snippets/requirements.txt):
storage/samples/snippets/requirements.txt currently pins google-cloud-storage==3.1.0. The google.cloud.storage.ip_filter module was added in version 3.3.0. Without updating this dependency, nox test sessions will fail with ModuleNotFoundError.
…a pattern - Simplify enable_ip_filtering to take bucket_name only, verify ip_filter exists, set mode to Enabled, reassign, patch, print confirmation, and return bucket. - Simplify get_ip_filtering to display mode and print serialized ip_filter dictionary. - Streamline delete_ip_filtering_rules logic by eliminating unnecessary modification flags. - Remove projection="full" in list_buckets_ip_filtering and handle potential None mode. - Pin google-cloud-storage==3.14.1 in requirements.txt. - Update bucket_ip_filter_test.py to match simplified signatures, add None check on public_network_source, and handle IP filter network constraints. [Generated-by: AI]
Add Python code samples and tests demonstrating Cloud Storage Bucket IP filtering.
Fixes: b/544985518
[Generated-by: AI]