Skip to content

feat(Storage): update StorageObject::exists to use HEAD request instead of GET#5

Open
salilg-eng wants to merge 11 commits into
mainfrom
feat/storage-object-exists
Open

feat(Storage): update StorageObject::exists to use HEAD request instead of GET#5
salilg-eng wants to merge 11 commits into
mainfrom
feat/storage-object-exists

Conversation

@salilg-eng
Copy link
Copy Markdown
Owner

Fixes / Addresses

Addresses b/437200793

Behavior Change & Motivation

Previously, StorageObject::exists() invoked getObject() (making an HTTP GET request) to verify if an object existed. Following a server-side enhancement to Google Cloud Storage Audit Logs, failed GET requests against non-existent objects started emitting severity ERROR log messages rather than INFO.

Because checking whether an object exists is intended for workflows where an object may not be present, it should not generate false-alarm error severity records in Cloud Audit Logs or trigger unnecessary payload data downloads.

Technical Implementation

  • Introduced headObject() definition in ConnectionInterface and implemented it in Rest.
  • Updated StorageObject::exists() to use headObject() (HTTP HEAD) instead of getObject() (HTTP GET).
  • Updated corresponding snippet and unit test expectations.

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 a headObject method to the ConnectionInterface and its Rest implementation to perform HEAD requests, allowing StorageObject::exists() to check for object existence more efficiently. The reviewer recommended adding @return array to the docblocks of the new headObject method in both the interface and the implementation to improve documentation and support static analysis.

Comment thread Storage/src/Connection/ConnectionInterface.php
Comment thread Storage/src/Connection/Rest.php
@salilg-eng salilg-eng marked this pull request as ready for review May 18, 2026 13:39
@salilg-eng salilg-eng force-pushed the feat/storage-object-exists branch from 4d28423 to 85080be Compare May 19, 2026 06:35
@salilg-eng salilg-eng self-assigned this May 19, 2026

$args['restRetryFunction'] = $this->restRetryFunction ?? $this->getRestRetryFunction(
'objects',
'get',
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

here get or head?

gcf-owl-bot Bot and others added 7 commits May 26, 2026 16:52
…equest access to `DataAssets` with in a `DataProduct` (googleapis#9209)

* feat(dataplex): Add `RequestDataProductAccess` method to request access to `DataAssets` with in a `DataProduct`
feat(dataplex): Add `ApprovalWorkflowService` to manage `ChangeRequest` resource
feat(dataplex): Add `ModifyEntry` method to `CatalogService`
feat(dataplex): Add `UnstructuredDataOptions` message
feat(dataplex): Add `Mode` enum in `DataProfileSpec` message
feat(dataplex): Add `CancelDataScanJob` method to `DataScanService`
feat(dataplex): Add `DataQualityRuleTemplate` message
docs: A comment for message `Aspect` is changed
docs: A comment for field `view` in message `.google.cloud.dataplex.v1.GetEntryRequest` is changed
docs: A comment for field `view` in message `.google.cloud.dataplex.v1.LookupEntryRequest` is changed
docs: A comment for field `resources` in message `.google.cloud.dataplex.v1.LookupContextRequest` is changed
docs: A comment for field `options` in message `.google.cloud.dataplex.v1.LookupContextRequest` is changed
docs: A comment for field `context` in message `.google.cloud.dataplex.v1.LookupContextResponse` is changed
docs: A comment for field `data_scan_id` in message `.google.cloud.dataplex.v1.CreateDataScanRequest` is changed
docs: A comment for message `DataScan` is changed
docs: A comment for field `resource` in message `.google.cloud.dataplex.v1.DataSource` is changed

PiperOrigin-RevId: 920743950

Source-Link: googleapis/googleapis@1742af7

Source-Link: https://github.com/googleapis/googleapis-gen/commit/cd4cc02e97b2d1329b993d2d405342ce8af35810
Copy-Tag: eyJwIjoiRGF0YXBsZXgvLk93bEJvdC55YW1sIiwiaCI6ImNkNGNjMDJlOTdiMmQxMzI5Yjk5M2QyZDQwNTM0MmNlOGFmMzU4MTAifQ==

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
…ce Finding APIs (googleapis#9217)

* feat: add support for GCS Storage Control Intelligence Finding APIs

Stages public GAPIC client libraries in Java, Go, Python, Node.js, and Ruby for
the GCS Storage Control Intelligence Finding service.

This includes the addition of the following RPC methods for retrieving and
summarizing telemetry findings (such as security, performance, or cost-related
insights) at the project, organization, or folder level:
- `GetIntelligenceFinding`
- `ListIntelligenceFindings`
- `SummarizeIntelligenceFindings`
- `GetIntelligenceFindingRevision`
- `ListIntelligenceFindingRevisions`

PiperOrigin-RevId: 922200845

Source-Link: googleapis/googleapis@6d5b853

Source-Link: https://github.com/googleapis/googleapis-gen/commit/94bb285e999d02a8946954f3559e20d8febaad4c
Copy-Tag: eyJwIjoiU3RvcmFnZUNvbnRyb2wvLk93bEJvdC55YW1sIiwiaCI6Ijk0YmIyODVlOTk5ZDAyYTg5NDY5NTRmMzU1OWUyMGQ4ZmViYWFkNGMifQ==

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
…essage `.google.cloud.sql.v1.PointInTimeRestoreContext` (googleapis#9216)

* feat: A new field `target_instance_settings` is added to message `.google.cloud.sql.v1.PointInTimeRestoreContext`
feat: A new field `target_instance_clear_settings_field_names` is added to message `.google.cloud.sql.v1.PointInTimeRestoreContext`
feat: A new field `region` is added to message `.google.cloud.sql.v1.PointInTimeRestoreContext`
feat: A new value `PROJECT_ABUSE` is added to enum `SqlSuspensionReason`
feat: A new field `psc_auto_dns_enabled` is added to message `.google.cloud.sql.v1.PscConfig`
feat: A new field `psc_write_endpoint_dns_enabled` is added to message `.google.cloud.sql.v1.PscConfig`
feat: A new value `PRE_CHECK_MAJOR_VERSION_UPGRADE` is added to enum `SqlOperationType`
feat: A new field `accelerated_replica_mode` is added to message `.google.cloud.sql.v1.Settings`
feat: A new value `POSTGRES_19` is added to enum `SqlDatabaseVersion`
feat: A new value `SQLSERVER_2025_STANDARD` is added to enum `SqlDatabaseVersion`
feat: A new value `SQLSERVER_2025_ENTERPRISE` is added to enum `SqlDatabaseVersion`
feat: A new value `SQLSERVER_2025_EXPRESS` is added to enum `SqlDatabaseVersion`
docs: A comment for field `project` in message `.google.cloud.sql.v1.SqlInstancesCloneRequest` is changed
docs: A comment for field `auto_iam_authn` in message `.google.cloud.sql.v1.ExecuteSqlPayload` is changed
docs: A comment for field `consumer_project` in message `.google.cloud.sql.v1.PscAutoConnectionConfig` is changed
docs: A comment for message `PerformanceCaptureConfig` is changed
docs: A comment for field `enabled` in message `.google.cloud.sql.v1.PerformanceCaptureConfig` is changed
docs: A comment for field `probing_interval_seconds` in message `.google.cloud.sql.v1.PerformanceCaptureConfig` is changed
docs: A comment for field `probe_threshold` in message `.google.cloud.sql.v1.PerformanceCaptureConfig` is changed
docs: A comment for field `running_threads_threshold` in message `.google.cloud.sql.v1.PerformanceCaptureConfig` is changed
docs: A comment for field `seconds_behind_source_threshold` in message `.google.cloud.sql.v1.PerformanceCaptureConfig` is changed
docs: A comment for field `transaction_duration_threshold` in message `.google.cloud.sql.v1.PerformanceCaptureConfig` is changed

PiperOrigin-RevId: 921857990

Source-Link: googleapis/googleapis@06fde45

Source-Link: https://github.com/googleapis/googleapis-gen/commit/6c6337a7d993487d86994b440bd4cfbcf16fc079
Copy-Tag: eyJwIjoiU3FsQWRtaW4vLk93bEJvdC55YW1sIiwiaCI6IjZjNjMzN2E3ZDk5MzQ4N2Q4Njk5NGI0NDBiZDRjZmJjZjE2ZmMwNzkifQ==

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
…me and requested_not_before_time fields to PrivateCA v1 API (googleapis#9215)

* feat: add allow_requester_specified_not_before_time and requested_not_before_time fields to PrivateCA v1 API
docs: update comments for backdate_duration field in CaPool
docs: update comments for parent field in ListCertificatesRequest

PiperOrigin-RevId: 921762720

Source-Link: googleapis/googleapis@ec2e510

Source-Link: https://github.com/googleapis/googleapis-gen/commit/b8da48e8a8aaabd7f6fc39ed2f5cfd1804c7e255
Copy-Tag: eyJwIjoiU2VjdXJpdHlQcml2YXRlQ2EvLk93bEJvdC55YW1sIiwiaCI6ImI4ZGE0OGU4YThhYWFiZDdmNmZjMzllZDJmNWNmZDE4MDRjN2UyNTUifQ==

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
…y Migration API (googleapis#9204)

* feat: add support for assessment tasks in BigQuery Migration API
feat: add suggestion config to translation tasks
docs: update comments for various fields in MigrationWorkflow, MigrationTask, and MigrationSubtask
docs: Add comment that field `create_time` in message `.google.cloud.bigquery.migration.v2.MigrationWorkflow` is output only
docs: Add comment that field `last_update_time` in message `.google.cloud.bigquery.migration.v2.MigrationWorkflow` is output only
docs: Fixed typo in comment for enum value `PAUSED` in enum `State` is changed
docs: Link to relevant documentation in comment for field `type` in message `.google.cloud.bigquery.migration.v2.MigrationTask` is changed
docs: Add comment that field `create_time` in message `.google.cloud.bigquery.migration.v2.MigrationTask` is output only
docs: Add comment that field `last_update_time` in message `.google.cloud.bigquery.migration.v2.MigrationTask` is output only
docs: Add comment that field `resource_error_count` in message `.google.cloud.bigquery.migration.v2.MigrationTask` is output only
docs: Add comment that field `metrics` in message `.google.cloud.bigquery.migration.v2.MigrationTask` is output only
docs: Add comment that field `total_processing_error_count` in message `.google.cloud.bigquery.migration.v2.MigrationTask` is output only
docs: Add comment that field `total_resource_error_count` in message `.google.cloud.bigquery.migration.v2.MigrationTask` is output only
docs: Add comment that field `resource_error_count` in message `.google.cloud.bigquery.migration.v2.MigrationSubtask` is output only
docs: Add comment that field `create_time` in message `.google.cloud.bigquery.migration.v2.MigrationSubtask` is output only
docs: Add comment that field `last_update_time` in message `.google.cloud.bigquery.migration.v2.MigrationSubtask` is output only
docs: Add comment for field `metrics` in message `.google.cloud.bigquery.migration.v2.MigrationSubtask` is output only

PiperOrigin-RevId: 918496010

Source-Link: googleapis/googleapis@43731d5

Source-Link: https://github.com/googleapis/googleapis-gen/commit/1a8cf1fa69363ffbfca334d355c8a453d6eb5665
Copy-Tag: eyJwIjoiQmlnUXVlcnlNaWdyYXRpb24vLk93bEJvdC55YW1sIiwiaCI6IjFhOGNmMWZhNjkzNjNmZmJmY2EzMzRkMzU1YzhhNDUzZDZlYjU2NjUifQ==

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
…ad of GET

Optimizes exists() check on GCS objects using lighter HEAD requests and resolves GCS retry conformance test failures.
Adds : array return type hint to ConnectionInterface and Rest connection client implementations, and fixes GCS retry conformance test TypeError crash by correctly returning GCS response headers array.
@salilg-eng salilg-eng force-pushed the feat/storage-object-exists branch from 8627de5 to 488e1da Compare May 29, 2026 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants