Skip to content

Commit bcad563

Browse files
fix: disable universe-domain validation (#13246)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 693215877 Source-Link: googleapis/googleapis@bb6b53e Source-Link: googleapis/googleapis-gen@db8b5a9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNoZWxsLy5Pd2xCb3QueWFtbCIsImgiOiJkYjhiNWE5MzQ4NGFkNDQwNTViMmJhY2M0YzdjZjg3ZTk3MGZlMGVkIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNwZWVjaC8uT3dsQm90LnlhbWwiLCJoIjoiZGI4YjVhOTM0ODRhZDQ0MDU1YjJiYWNjNGM3Y2Y4N2U5NzBmZTBlZCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXN0b3JhZ2UtY29udHJvbC8uT3dsQm90LnlhbWwiLCJoIjoiZGI4YjVhOTM0ODRhZDQ0MDU1YjJiYWNjNGM3Y2Y4N2U5NzBmZTBlZCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXN0b3JhZ2UtdHJhbnNmZXIvLk93bEJvdC55YW1sIiwiaCI6ImRiOGI1YTkzNDg0YWQ0NDA1NWIyYmFjYzRjN2NmODdlOTcwZmUwZWQifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXN0b3JhZ2VpbnNpZ2h0cy8uT3dsQm90LnlhbWwiLCJoIjoiZGI4YjVhOTM0ODRhZDQ0MDU1YjJiYWNjNGM3Y2Y4N2U5NzBmZTBlZCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXN1cHBvcnQvLk93bEJvdC55YW1sIiwiaCI6ImRiOGI1YTkzNDg0YWQ0NDA1NWIyYmFjYzRjN2NmODdlOTcwZmUwZWQifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkL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

File tree

236 files changed

+315
-8009
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+315
-8009
lines changed

packages/google-cloud-shell/google/cloud/shell/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.10.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-shell/google/cloud/shell_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.10.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-shell/google/cloud/shell_v1/services/cloud_shell_service/client.py

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -467,36 +467,6 @@ def _get_universe_domain(
467467
raise ValueError("Universe Domain cannot be an empty string.")
468468
return universe_domain
469469

470-
@staticmethod
471-
def _compare_universes(
472-
client_universe: str, credentials: ga_credentials.Credentials
473-
) -> bool:
474-
"""Returns True iff the universe domains used by the client and credentials match.
475-
476-
Args:
477-
client_universe (str): The universe domain configured via the client options.
478-
credentials (ga_credentials.Credentials): The credentials being used in the client.
479-
480-
Returns:
481-
bool: True iff client_universe matches the universe in credentials.
482-
483-
Raises:
484-
ValueError: when client_universe does not match the universe in credentials.
485-
"""
486-
487-
default_universe = CloudShellServiceClient._DEFAULT_UNIVERSE
488-
credentials_universe = getattr(credentials, "universe_domain", default_universe)
489-
490-
if client_universe != credentials_universe:
491-
raise ValueError(
492-
"The configured universe domain "
493-
f"({client_universe}) does not match the universe domain "
494-
f"found in the credentials ({credentials_universe}). "
495-
"If you haven't configured the universe domain explicitly, "
496-
f"`{default_universe}` is the default."
497-
)
498-
return True
499-
500470
def _validate_universe_domain(self):
501471
"""Validates client's and credentials' universe domains are consistent.
502472
@@ -506,13 +476,9 @@ def _validate_universe_domain(self):
506476
Raises:
507477
ValueError: If the configured universe domain is not valid.
508478
"""
509-
self._is_universe_domain_valid = (
510-
self._is_universe_domain_valid
511-
or CloudShellServiceClient._compare_universes(
512-
self.universe_domain, self.transport._credentials
513-
)
514-
)
515-
return self._is_universe_domain_valid
479+
480+
# NOTE (b/349488459): universe validation is disabled until further notice.
481+
return True
516482

517483
@property
518484
def api_endpoint(self):

packages/google-cloud-shell/samples/generated_samples/snippet_metadata_google.cloud.shell.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-shell",
11-
"version": "1.10.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-shell/tests/unit/gapic/shell_v1/test_cloud_shell_service.py

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -337,86 +337,6 @@ def test__get_universe_domain():
337337
assert str(excinfo.value) == "Universe Domain cannot be an empty string."
338338

339339

340-
@pytest.mark.parametrize(
341-
"client_class,transport_class,transport_name",
342-
[
343-
(CloudShellServiceClient, transports.CloudShellServiceGrpcTransport, "grpc"),
344-
(CloudShellServiceClient, transports.CloudShellServiceRestTransport, "rest"),
345-
],
346-
)
347-
def test__validate_universe_domain(client_class, transport_class, transport_name):
348-
client = client_class(
349-
transport=transport_class(credentials=ga_credentials.AnonymousCredentials())
350-
)
351-
assert client._validate_universe_domain() == True
352-
353-
# Test the case when universe is already validated.
354-
assert client._validate_universe_domain() == True
355-
356-
if transport_name == "grpc":
357-
# Test the case where credentials are provided by the
358-
# `local_channel_credentials`. The default universes in both match.
359-
channel = grpc.secure_channel(
360-
"http://localhost/", grpc.local_channel_credentials()
361-
)
362-
client = client_class(transport=transport_class(channel=channel))
363-
assert client._validate_universe_domain() == True
364-
365-
# Test the case where credentials do not exist: e.g. a transport is provided
366-
# with no credentials. Validation should still succeed because there is no
367-
# mismatch with non-existent credentials.
368-
channel = grpc.secure_channel(
369-
"http://localhost/", grpc.local_channel_credentials()
370-
)
371-
transport = transport_class(channel=channel)
372-
transport._credentials = None
373-
client = client_class(transport=transport)
374-
assert client._validate_universe_domain() == True
375-
376-
# TODO: This is needed to cater for older versions of google-auth
377-
# Make this test unconditional once the minimum supported version of
378-
# google-auth becomes 2.23.0 or higher.
379-
google_auth_major, google_auth_minor = [
380-
int(part) for part in google.auth.__version__.split(".")[0:2]
381-
]
382-
if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23):
383-
credentials = ga_credentials.AnonymousCredentials()
384-
credentials._universe_domain = "foo.com"
385-
# Test the case when there is a universe mismatch from the credentials.
386-
client = client_class(transport=transport_class(credentials=credentials))
387-
with pytest.raises(ValueError) as excinfo:
388-
client._validate_universe_domain()
389-
assert (
390-
str(excinfo.value)
391-
== "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default."
392-
)
393-
394-
# Test the case when there is a universe mismatch from the client.
395-
#
396-
# TODO: Make this test unconditional once the minimum supported version of
397-
# google-api-core becomes 2.15.0 or higher.
398-
api_core_major, api_core_minor = [
399-
int(part) for part in api_core_version.__version__.split(".")[0:2]
400-
]
401-
if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15):
402-
client = client_class(
403-
client_options={"universe_domain": "bar.com"},
404-
transport=transport_class(
405-
credentials=ga_credentials.AnonymousCredentials(),
406-
),
407-
)
408-
with pytest.raises(ValueError) as excinfo:
409-
client._validate_universe_domain()
410-
assert (
411-
str(excinfo.value)
412-
== "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default."
413-
)
414-
415-
# Test that ValueError is raised if universe_domain is provided via client options and credentials is None
416-
with pytest.raises(ValueError):
417-
client._compare_universes("foo.bar", None)
418-
419-
420340
@pytest.mark.parametrize(
421341
"client_class,transport_name",
422342
[

packages/google-cloud-speech/google/cloud/speech/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.28.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-speech/google/cloud/speech_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.28.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-speech/google/cloud/speech_v1/services/adaptation/client.py

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -484,36 +484,6 @@ def _get_universe_domain(
484484
raise ValueError("Universe Domain cannot be an empty string.")
485485
return universe_domain
486486

487-
@staticmethod
488-
def _compare_universes(
489-
client_universe: str, credentials: ga_credentials.Credentials
490-
) -> bool:
491-
"""Returns True iff the universe domains used by the client and credentials match.
492-
493-
Args:
494-
client_universe (str): The universe domain configured via the client options.
495-
credentials (ga_credentials.Credentials): The credentials being used in the client.
496-
497-
Returns:
498-
bool: True iff client_universe matches the universe in credentials.
499-
500-
Raises:
501-
ValueError: when client_universe does not match the universe in credentials.
502-
"""
503-
504-
default_universe = AdaptationClient._DEFAULT_UNIVERSE
505-
credentials_universe = getattr(credentials, "universe_domain", default_universe)
506-
507-
if client_universe != credentials_universe:
508-
raise ValueError(
509-
"The configured universe domain "
510-
f"({client_universe}) does not match the universe domain "
511-
f"found in the credentials ({credentials_universe}). "
512-
"If you haven't configured the universe domain explicitly, "
513-
f"`{default_universe}` is the default."
514-
)
515-
return True
516-
517487
def _validate_universe_domain(self):
518488
"""Validates client's and credentials' universe domains are consistent.
519489
@@ -523,13 +493,9 @@ def _validate_universe_domain(self):
523493
Raises:
524494
ValueError: If the configured universe domain is not valid.
525495
"""
526-
self._is_universe_domain_valid = (
527-
self._is_universe_domain_valid
528-
or AdaptationClient._compare_universes(
529-
self.universe_domain, self.transport._credentials
530-
)
531-
)
532-
return self._is_universe_domain_valid
496+
497+
# NOTE (b/349488459): universe validation is disabled until further notice.
498+
return True
533499

534500
@property
535501
def api_endpoint(self):

packages/google-cloud-speech/google/cloud/speech_v1/services/speech/client.py

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -488,36 +488,6 @@ def _get_universe_domain(
488488
raise ValueError("Universe Domain cannot be an empty string.")
489489
return universe_domain
490490

491-
@staticmethod
492-
def _compare_universes(
493-
client_universe: str, credentials: ga_credentials.Credentials
494-
) -> bool:
495-
"""Returns True iff the universe domains used by the client and credentials match.
496-
497-
Args:
498-
client_universe (str): The universe domain configured via the client options.
499-
credentials (ga_credentials.Credentials): The credentials being used in the client.
500-
501-
Returns:
502-
bool: True iff client_universe matches the universe in credentials.
503-
504-
Raises:
505-
ValueError: when client_universe does not match the universe in credentials.
506-
"""
507-
508-
default_universe = SpeechClient._DEFAULT_UNIVERSE
509-
credentials_universe = getattr(credentials, "universe_domain", default_universe)
510-
511-
if client_universe != credentials_universe:
512-
raise ValueError(
513-
"The configured universe domain "
514-
f"({client_universe}) does not match the universe domain "
515-
f"found in the credentials ({credentials_universe}). "
516-
"If you haven't configured the universe domain explicitly, "
517-
f"`{default_universe}` is the default."
518-
)
519-
return True
520-
521491
def _validate_universe_domain(self):
522492
"""Validates client's and credentials' universe domains are consistent.
523493
@@ -527,13 +497,9 @@ def _validate_universe_domain(self):
527497
Raises:
528498
ValueError: If the configured universe domain is not valid.
529499
"""
530-
self._is_universe_domain_valid = (
531-
self._is_universe_domain_valid
532-
or SpeechClient._compare_universes(
533-
self.universe_domain, self.transport._credentials
534-
)
535-
)
536-
return self._is_universe_domain_valid
500+
501+
# NOTE (b/349488459): universe validation is disabled until further notice.
502+
return True
537503

538504
@property
539505
def api_endpoint(self):

packages/google-cloud-speech/google/cloud/speech_v1p1beta1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.28.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-speech/google/cloud/speech_v1p1beta1/services/adaptation/client.py

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -484,36 +484,6 @@ def _get_universe_domain(
484484
raise ValueError("Universe Domain cannot be an empty string.")
485485
return universe_domain
486486

487-
@staticmethod
488-
def _compare_universes(
489-
client_universe: str, credentials: ga_credentials.Credentials
490-
) -> bool:
491-
"""Returns True iff the universe domains used by the client and credentials match.
492-
493-
Args:
494-
client_universe (str): The universe domain configured via the client options.
495-
credentials (ga_credentials.Credentials): The credentials being used in the client.
496-
497-
Returns:
498-
bool: True iff client_universe matches the universe in credentials.
499-
500-
Raises:
501-
ValueError: when client_universe does not match the universe in credentials.
502-
"""
503-
504-
default_universe = AdaptationClient._DEFAULT_UNIVERSE
505-
credentials_universe = getattr(credentials, "universe_domain", default_universe)
506-
507-
if client_universe != credentials_universe:
508-
raise ValueError(
509-
"The configured universe domain "
510-
f"({client_universe}) does not match the universe domain "
511-
f"found in the credentials ({credentials_universe}). "
512-
"If you haven't configured the universe domain explicitly, "
513-
f"`{default_universe}` is the default."
514-
)
515-
return True
516-
517487
def _validate_universe_domain(self):
518488
"""Validates client's and credentials' universe domains are consistent.
519489
@@ -523,13 +493,9 @@ def _validate_universe_domain(self):
523493
Raises:
524494
ValueError: If the configured universe domain is not valid.
525495
"""
526-
self._is_universe_domain_valid = (
527-
self._is_universe_domain_valid
528-
or AdaptationClient._compare_universes(
529-
self.universe_domain, self.transport._credentials
530-
)
531-
)
532-
return self._is_universe_domain_valid
496+
497+
# NOTE (b/349488459): universe validation is disabled until further notice.
498+
return True
533499

534500
@property
535501
def api_endpoint(self):

packages/google-cloud-speech/google/cloud/speech_v1p1beta1/services/speech/client.py

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -488,36 +488,6 @@ def _get_universe_domain(
488488
raise ValueError("Universe Domain cannot be an empty string.")
489489
return universe_domain
490490

491-
@staticmethod
492-
def _compare_universes(
493-
client_universe: str, credentials: ga_credentials.Credentials
494-
) -> bool:
495-
"""Returns True iff the universe domains used by the client and credentials match.
496-
497-
Args:
498-
client_universe (str): The universe domain configured via the client options.
499-
credentials (ga_credentials.Credentials): The credentials being used in the client.
500-
501-
Returns:
502-
bool: True iff client_universe matches the universe in credentials.
503-
504-
Raises:
505-
ValueError: when client_universe does not match the universe in credentials.
506-
"""
507-
508-
default_universe = SpeechClient._DEFAULT_UNIVERSE
509-
credentials_universe = getattr(credentials, "universe_domain", default_universe)
510-
511-
if client_universe != credentials_universe:
512-
raise ValueError(
513-
"The configured universe domain "
514-
f"({client_universe}) does not match the universe domain "
515-
f"found in the credentials ({credentials_universe}). "
516-
"If you haven't configured the universe domain explicitly, "
517-
f"`{default_universe}` is the default."
518-
)
519-
return True
520-
521491
def _validate_universe_domain(self):
522492
"""Validates client's and credentials' universe domains are consistent.
523493
@@ -527,13 +497,9 @@ def _validate_universe_domain(self):
527497
Raises:
528498
ValueError: If the configured universe domain is not valid.
529499
"""
530-
self._is_universe_domain_valid = (
531-
self._is_universe_domain_valid
532-
or SpeechClient._compare_universes(
533-
self.universe_domain, self.transport._credentials
534-
)
535-
)
536-
return self._is_universe_domain_valid
500+
501+
# NOTE (b/349488459): universe validation is disabled until further notice.
502+
return True
537503

538504
@property
539505
def api_endpoint(self):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy