Skip to content

Commit b479ff8

Browse files
fix: disable universe-domain validation (#13242)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 693215877 Source-Link: googleapis/googleapis@bb6b53e Source-Link: googleapis/googleapis-gen@db8b5a9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFkcy1tYXJrZXRpbmdwbGF0Zm9ybS1hZG1pbi8uT3dsQm90LnlhbWwiLCJoIjoiZGI4YjVhOTM0ODRhZDQ0MDU1YjJiYWNjNGM3Y2Y4N2U5NzBmZTBlZCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFydGlmYWN0LXJlZ2lzdHJ5Ly5Pd2xCb3QueWFtbCIsImgiOiJkYjhiNWE5MzQ4NGFkNDQwNTViMmJhY2M0YzdjZjg3ZTk3MGZlMGVkIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJ1aWxkLy5Pd2xCb3QueWFtbCIsImgiOiJkYjhiNWE5MzQ4NGFkNDQwNTViMmJhY2M0YzdjZjg3ZTk3MGZlMGVkIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWNvbXB1dGUvLk93bEJvdC55YW1sIiwiaCI6ImRiOGI1YTkzNDg0YWQ0NDA1NWIyYmFjYzRjN2NmODdlOTcwZmUwZWQifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWNvbnRhaW5lci8uT3dsQm90LnlhbWwiLCJoIjoiZGI4YjVhOTM0ODRhZDQ0MDU1YjJiYWNjNGM3Y2Y4N2U5NzBmZTBlZCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWNvbnRhaW5lcmFuYWx5c2lzLy5Pd2xCb3QueWFtbCIsImgiOiJkYjhiNWE5MzQ4NGFkNDQwNTViMmJhY2M0YzdjZjg3ZTk3MGZlMGVkIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ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@users.noreply.github.com> Co-authored-by: Victor Chudnovsky <[email protected]>
1 parent 170e8f2 commit b479ff8

File tree

618 files changed

+78298
-71134
lines changed

Some content is hidden

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

618 files changed

+78298
-71134
lines changed

packages/google-ads-marketingplatform-admin/google/ads/marketingplatform_admin/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__ = "0.1.1" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-ads-marketingplatform-admin/google/ads/marketingplatform_admin_v1alpha/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__ = "0.1.1" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-ads-marketingplatform-admin/google/ads/marketingplatform_admin_v1alpha/services/marketingplatform_admin_service/client.py

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

520-
@staticmethod
521-
def _compare_universes(
522-
client_universe: str, credentials: ga_credentials.Credentials
523-
) -> bool:
524-
"""Returns True iff the universe domains used by the client and credentials match.
525-
526-
Args:
527-
client_universe (str): The universe domain configured via the client options.
528-
credentials (ga_credentials.Credentials): The credentials being used in the client.
529-
530-
Returns:
531-
bool: True iff client_universe matches the universe in credentials.
532-
533-
Raises:
534-
ValueError: when client_universe does not match the universe in credentials.
535-
"""
536-
537-
default_universe = MarketingplatformAdminServiceClient._DEFAULT_UNIVERSE
538-
credentials_universe = getattr(credentials, "universe_domain", default_universe)
539-
540-
if client_universe != credentials_universe:
541-
raise ValueError(
542-
"The configured universe domain "
543-
f"({client_universe}) does not match the universe domain "
544-
f"found in the credentials ({credentials_universe}). "
545-
"If you haven't configured the universe domain explicitly, "
546-
f"`{default_universe}` is the default."
547-
)
548-
return True
549-
550520
def _validate_universe_domain(self):
551521
"""Validates client's and credentials' universe domains are consistent.
552522
@@ -556,13 +526,9 @@ def _validate_universe_domain(self):
556526
Raises:
557527
ValueError: If the configured universe domain is not valid.
558528
"""
559-
self._is_universe_domain_valid = (
560-
self._is_universe_domain_valid
561-
or MarketingplatformAdminServiceClient._compare_universes(
562-
self.universe_domain, self.transport._credentials
563-
)
564-
)
565-
return self._is_universe_domain_valid
529+
530+
# NOTE (b/349488459): universe validation is disabled until further notice.
531+
return True
566532

567533
@property
568534
def api_endpoint(self):

packages/google-ads-marketingplatform-admin/samples/generated_samples/snippet_metadata_google.marketingplatform.admin.v1alpha.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-ads-marketingplatform-admin",
11-
"version": "0.1.1"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-ads-marketingplatform-admin/tests/unit/gapic/marketingplatform_admin_v1alpha/test_marketingplatform_admin_service.py

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -350,94 +350,6 @@ def test__get_universe_domain():
350350
assert str(excinfo.value) == "Universe Domain cannot be an empty string."
351351

352352

353-
@pytest.mark.parametrize(
354-
"client_class,transport_class,transport_name",
355-
[
356-
(
357-
MarketingplatformAdminServiceClient,
358-
transports.MarketingplatformAdminServiceGrpcTransport,
359-
"grpc",
360-
),
361-
(
362-
MarketingplatformAdminServiceClient,
363-
transports.MarketingplatformAdminServiceRestTransport,
364-
"rest",
365-
),
366-
],
367-
)
368-
def test__validate_universe_domain(client_class, transport_class, transport_name):
369-
client = client_class(
370-
transport=transport_class(credentials=ga_credentials.AnonymousCredentials())
371-
)
372-
assert client._validate_universe_domain() == True
373-
374-
# Test the case when universe is already validated.
375-
assert client._validate_universe_domain() == True
376-
377-
if transport_name == "grpc":
378-
# Test the case where credentials are provided by the
379-
# `local_channel_credentials`. The default universes in both match.
380-
channel = grpc.secure_channel(
381-
"http://localhost/", grpc.local_channel_credentials()
382-
)
383-
client = client_class(transport=transport_class(channel=channel))
384-
assert client._validate_universe_domain() == True
385-
386-
# Test the case where credentials do not exist: e.g. a transport is provided
387-
# with no credentials. Validation should still succeed because there is no
388-
# mismatch with non-existent credentials.
389-
channel = grpc.secure_channel(
390-
"http://localhost/", grpc.local_channel_credentials()
391-
)
392-
transport = transport_class(channel=channel)
393-
transport._credentials = None
394-
client = client_class(transport=transport)
395-
assert client._validate_universe_domain() == True
396-
397-
# TODO: This is needed to cater for older versions of google-auth
398-
# Make this test unconditional once the minimum supported version of
399-
# google-auth becomes 2.23.0 or higher.
400-
google_auth_major, google_auth_minor = [
401-
int(part) for part in google.auth.__version__.split(".")[0:2]
402-
]
403-
if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23):
404-
credentials = ga_credentials.AnonymousCredentials()
405-
credentials._universe_domain = "foo.com"
406-
# Test the case when there is a universe mismatch from the credentials.
407-
client = client_class(transport=transport_class(credentials=credentials))
408-
with pytest.raises(ValueError) as excinfo:
409-
client._validate_universe_domain()
410-
assert (
411-
str(excinfo.value)
412-
== "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."
413-
)
414-
415-
# Test the case when there is a universe mismatch from the client.
416-
#
417-
# TODO: Make this test unconditional once the minimum supported version of
418-
# google-api-core becomes 2.15.0 or higher.
419-
api_core_major, api_core_minor = [
420-
int(part) for part in api_core_version.__version__.split(".")[0:2]
421-
]
422-
if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15):
423-
client = client_class(
424-
client_options={"universe_domain": "bar.com"},
425-
transport=transport_class(
426-
credentials=ga_credentials.AnonymousCredentials(),
427-
),
428-
)
429-
with pytest.raises(ValueError) as excinfo:
430-
client._validate_universe_domain()
431-
assert (
432-
str(excinfo.value)
433-
== "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."
434-
)
435-
436-
# Test that ValueError is raised if universe_domain is provided via client options and credentials is None
437-
with pytest.raises(ValueError):
438-
client._compare_universes("foo.bar", None)
439-
440-
441353
@pytest.mark.parametrize(
442354
"client_class,transport_name",
443355
[

packages/google-cloud-artifact-registry/google/cloud/artifactregistry/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.13.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-artifact-registry/google/cloud/artifactregistry_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.13.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-artifact-registry/google/cloud/artifactregistry_v1/services/artifact_registry/client.py

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

857-
@staticmethod
858-
def _compare_universes(
859-
client_universe: str, credentials: ga_credentials.Credentials
860-
) -> bool:
861-
"""Returns True iff the universe domains used by the client and credentials match.
862-
863-
Args:
864-
client_universe (str): The universe domain configured via the client options.
865-
credentials (ga_credentials.Credentials): The credentials being used in the client.
866-
867-
Returns:
868-
bool: True iff client_universe matches the universe in credentials.
869-
870-
Raises:
871-
ValueError: when client_universe does not match the universe in credentials.
872-
"""
873-
874-
default_universe = ArtifactRegistryClient._DEFAULT_UNIVERSE
875-
credentials_universe = getattr(credentials, "universe_domain", default_universe)
876-
877-
if client_universe != credentials_universe:
878-
raise ValueError(
879-
"The configured universe domain "
880-
f"({client_universe}) does not match the universe domain "
881-
f"found in the credentials ({credentials_universe}). "
882-
"If you haven't configured the universe domain explicitly, "
883-
f"`{default_universe}` is the default."
884-
)
885-
return True
886-
887857
def _validate_universe_domain(self):
888858
"""Validates client's and credentials' universe domains are consistent.
889859
@@ -893,13 +863,9 @@ def _validate_universe_domain(self):
893863
Raises:
894864
ValueError: If the configured universe domain is not valid.
895865
"""
896-
self._is_universe_domain_valid = (
897-
self._is_universe_domain_valid
898-
or ArtifactRegistryClient._compare_universes(
899-
self.universe_domain, self.transport._credentials
900-
)
901-
)
902-
return self._is_universe_domain_valid
866+
867+
# NOTE (b/349488459): universe validation is disabled until further notice.
868+
return True
903869

904870
@property
905871
def api_endpoint(self):

packages/google-cloud-artifact-registry/google/cloud/artifactregistry_v1beta2/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.13.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-artifact-registry/google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py

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

634-
@staticmethod
635-
def _compare_universes(
636-
client_universe: str, credentials: ga_credentials.Credentials
637-
) -> bool:
638-
"""Returns True iff the universe domains used by the client and credentials match.
639-
640-
Args:
641-
client_universe (str): The universe domain configured via the client options.
642-
credentials (ga_credentials.Credentials): The credentials being used in the client.
643-
644-
Returns:
645-
bool: True iff client_universe matches the universe in credentials.
646-
647-
Raises:
648-
ValueError: when client_universe does not match the universe in credentials.
649-
"""
650-
651-
default_universe = ArtifactRegistryClient._DEFAULT_UNIVERSE
652-
credentials_universe = getattr(credentials, "universe_domain", default_universe)
653-
654-
if client_universe != credentials_universe:
655-
raise ValueError(
656-
"The configured universe domain "
657-
f"({client_universe}) does not match the universe domain "
658-
f"found in the credentials ({credentials_universe}). "
659-
"If you haven't configured the universe domain explicitly, "
660-
f"`{default_universe}` is the default."
661-
)
662-
return True
663-
664634
def _validate_universe_domain(self):
665635
"""Validates client's and credentials' universe domains are consistent.
666636
@@ -670,13 +640,9 @@ def _validate_universe_domain(self):
670640
Raises:
671641
ValueError: If the configured universe domain is not valid.
672642
"""
673-
self._is_universe_domain_valid = (
674-
self._is_universe_domain_valid
675-
or ArtifactRegistryClient._compare_universes(
676-
self.universe_domain, self.transport._credentials
677-
)
678-
)
679-
return self._is_universe_domain_valid
643+
644+
# NOTE (b/349488459): universe validation is disabled until further notice.
645+
return True
680646

681647
@property
682648
def api_endpoint(self):

0 commit comments

Comments
 (0)