Repository navigation
fix(storage): resolve HttpStorageOptions default host from the configured universe domain - #15235
nidhiii-27 wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for resolving and validating the Google Cloud Universe Domain across both HTTP and gRPC storage clients. It updates StorageOptions to dynamically resolve the universe domain from either an explicit builder configuration or the GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable, while preserving manually set hosts. Additionally, it adds validation to ensure that signing credentials match the configured universe domain, and fixes canonical header generation for signed URLs. Extensive unit and integration tests are added to verify these behaviors. Feedback was provided to improve the validation of the explicitly configured universe domain by checking for blank strings (containing only whitespace) rather than just empty strings, preventing potential downstream URI parsing issues.
36fc74d to
ea928bc
Compare
ea928bc to
6c01bec
Compare
…se domain on build() HttpStorageOptions.Builder now resolves the default host from the configured universe domain each time build() is called, unless a host was set with setHost(...). Hosts set with setHost(...) are used as before. Host-resolution tests were added to StorageOptionsBuilderTest.
…ured universe domain
StorageOptions resolves the configured universe domain, the same way EndpointContext does, and HttpStorageOptions derives its default host from it. Explicit setHost() values and getUniverseDomain() are unchanged, and an explicit setHost("https://www.googleapis.com") resolves to the storage host for the configured universe domain. StorageOptionsTest adds host-resolution cases.
6c01bec to
fa26520
Compare
…domain-env # Conflicts: # java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/HttpStorageOptions.java # java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageOptions.java
HttpStorageOptions.Builder.build() resolves the storage host before constructing HttpStorageOptions when no custom host is set, and re-resolves only when an explicit host equals the ServiceOptions default host. Custom hosts and explicit universe domain resolution remain unchanged. StorageOptionsTest adds a toBuilder() universe-domain assertion, and the StorageOptions.usesDefaultHost() Javadoc links getResolvedUniverseDomain(). [Generated-by: AI]
…domain-env # Conflicts: # java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageClientMetrics.java # java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageOptionsTest.java
…rviceOptions
StorageOptions rejects an empty universe domain with IllegalArgumentException("The universe domain cannot be empty"), as ServiceOptions.resolveUniverseDomain() does, and HttpStorageOptions.Builder.build() and GrpcStorageOptions.Builder.build() apply this check when options are built. StorageOptions.resolveUniverseDomain() returns the same resolved universe domain used for the default host. Unset and non-empty universe domains and explicit custom hosts are unchanged; StorageOptionsTest covers the empty-value check.
[Generated-by: AI]
StorageOptions resolves the configured universe domain and validates it the same way ServiceOptions.resolveUniverseDomain() does; HttpStorageOptions and GrpcStorageOptions derive their default storage host from it, and StorageImpl and StorageClientMetrics use the same resolved universe domain. Explicit setHost() values and getUniverseDomain() are unchanged, and an explicit setHost("https://www.googleapis.com") resolves to the storage host for the configured universe domain. StorageOptionsTest covers default host resolution, empty-value validation, and V4 signed URL hosts.