Skip to content

feat(storage): add Cloud Storage bucket IP filtering samples#2221

Open
salilg-eng wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
salilg-eng:feat/bucket-ip-filter
Open

feat(storage): add Cloud Storage bucket IP filtering samples#2221
salilg-eng wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
salilg-eng:feat/bucket-ip-filter

Conversation

@salilg-eng

Copy link
Copy Markdown
Contributor

This PR add PHP code samples demonstrating how to manage IP filtering for Cloud Storage buckets.

What's included:

  • Snippets for getting, enabling, disabling, listing, and deleting bucket IP filtering rules.
  • A full lifecycle integration test (IpFilterTest.php) to cover the new snippets.

Note on enable_ip_filtering.php:
I set the mode to Disabled by default in the snippet (with an accompanying comment). If we actually set it to Enabled during the automated tests, we risk locking the test runner out of the bucket and causing permission failures during the cleanup phase. Users can easily flip it to Enabled when adapting the code for their own use.

@salilg-eng salilg-eng requested review from a team as code owners June 22, 2026 13:46
@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Jun 22, 2026
@snippet-bot

snippet-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 5 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label Bot added the samples Issues that are directly related to samples. label Jun 22, 2026

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

Copy link
Copy Markdown

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 new PHP code samples for managing Cloud Storage bucket IP filtering rules, including enabling, disabling, retrieving, deleting, and listing IP filtering configurations, along with a lifecycle integration test. The feedback suggests improving the usability of the enable_ip_filtering sample by making the filter mode an optional parameter (defaulting to 'Enabled') and passing 'Disabled' explicitly in tests to prevent runner lockout. Additionally, it is recommended to specify the 'full' projection when listing buckets to ensure the ipFilter metadata is reliably returned.

Comment thread storage/src/enable_ip_filtering.php Outdated
Comment thread storage/test/storageTest.php
Comment thread storage/src/list_buckets_ip_filtering.php Outdated
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. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant