Skip to content

Commit

Permalink
chore: [Many APIs] Update gapic-generator-python to v1.20.2 (#13235)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 691540410

Source-Link:
googleapis/googleapis@b43cfb1

Source-Link:
googleapis/googleapis-gen@40fd27b
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWF1dG9tbC8uT3dsQm90LnlhbWwiLCJoIjoiNDBmZDI3YjA4YWJiMmU4YjhhODRiNTc5NDFlMTIyNjk3MWYzN2E5NyJ9
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJhY2t1cGRyLy5Pd2xCb3QueWFtbCIsImgiOiI0MGZkMjdiMDhhYmIyZThiOGE4NGI1Nzk0MWUxMjI2OTcxZjM3YTk3In0=
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJhcmUtbWV0YWwtc29sdXRpb24vLk93bEJvdC55YW1sIiwiaCI6IjQwZmQyN2IwOGFiYjJlOGI4YTg0YjU3OTQxZTEyMjY5NzFmMzdhOTcifQ==
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJhdGNoLy5Pd2xCb3QueWFtbCIsImgiOiI0MGZkMjdiMDhhYmIyZThiOGE4NGI1Nzk0MWUxMjI2OTcxZjM3YTk3In0=
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJleW9uZGNvcnAtYXBwY29ubmVjdGlvbnMvLk93bEJvdC55YW1sIiwiaCI6IjQwZmQyN2IwOGFiYjJlOGI4YTg0YjU3OTQxZTEyMjY5NzFmMzdhOTcifQ==
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJleW9uZGNvcnAtYXBwY29ubmVjdG9ycy8uT3dsQm90LnlhbWwiLCJoIjoiNDBmZDI3YjA4YWJiMmU4YjhhODRiNTc5NDFlMTIyNjk3MWYzN2E5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ag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJpbmFyeS1hdXRob3JpemF0aW9uLy5Pd2xCb3QueWFtbCIsImgiOiI0MGZkMjdiMDhhYmIyZThiOGE4NGI1Nzk0MWUxMjI2OTcxZjM3YTk3In0=

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: ohmayr <omairnaveed@ymail.com>
  • Loading branch information
3 people authored Oct 31, 2024
1 parent 85c7512 commit 4ed4108
Show file tree
Hide file tree
Showing 142 changed files with 176 additions and 4,121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "2.14.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "2.14.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -564,36 +564,6 @@ def _get_universe_domain(
raise ValueError("Universe Domain cannot be an empty string.")
return universe_domain

@staticmethod
def _compare_universes(
client_universe: str, credentials: ga_credentials.Credentials
) -> bool:
"""Returns True iff the universe domains used by the client and credentials match.
Args:
client_universe (str): The universe domain configured via the client options.
credentials (ga_credentials.Credentials): The credentials being used in the client.
Returns:
bool: True iff client_universe matches the universe in credentials.
Raises:
ValueError: when client_universe does not match the universe in credentials.
"""

default_universe = AutoMlClient._DEFAULT_UNIVERSE
credentials_universe = getattr(credentials, "universe_domain", default_universe)

if client_universe != credentials_universe:
raise ValueError(
"The configured universe domain "
f"({client_universe}) does not match the universe domain "
f"found in the credentials ({credentials_universe}). "
"If you haven't configured the universe domain explicitly, "
f"`{default_universe}` is the default."
)
return True

def _validate_universe_domain(self):
"""Validates client's and credentials' universe domains are consistent.
Expand All @@ -603,13 +573,9 @@ def _validate_universe_domain(self):
Raises:
ValueError: If the configured universe domain is not valid.
"""
self._is_universe_domain_valid = (
self._is_universe_domain_valid
or AutoMlClient._compare_universes(
self.universe_domain, self.transport._credentials
)
)
return self._is_universe_domain_valid

# NOTE (b/349488459): universe validation is disabled until further notice.
return True

@property
def api_endpoint(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,36 +473,6 @@ def _get_universe_domain(
raise ValueError("Universe Domain cannot be an empty string.")
return universe_domain

@staticmethod
def _compare_universes(
client_universe: str, credentials: ga_credentials.Credentials
) -> bool:
"""Returns True iff the universe domains used by the client and credentials match.
Args:
client_universe (str): The universe domain configured via the client options.
credentials (ga_credentials.Credentials): The credentials being used in the client.
Returns:
bool: True iff client_universe matches the universe in credentials.
Raises:
ValueError: when client_universe does not match the universe in credentials.
"""

default_universe = PredictionServiceClient._DEFAULT_UNIVERSE
credentials_universe = getattr(credentials, "universe_domain", default_universe)

if client_universe != credentials_universe:
raise ValueError(
"The configured universe domain "
f"({client_universe}) does not match the universe domain "
f"found in the credentials ({credentials_universe}). "
"If you haven't configured the universe domain explicitly, "
f"`{default_universe}` is the default."
)
return True

def _validate_universe_domain(self):
"""Validates client's and credentials' universe domains are consistent.
Expand All @@ -512,13 +482,9 @@ def _validate_universe_domain(self):
Raises:
ValueError: If the configured universe domain is not valid.
"""
self._is_universe_domain_valid = (
self._is_universe_domain_valid
or PredictionServiceClient._compare_universes(
self.universe_domain, self.transport._credentials
)
)
return self._is_universe_domain_valid

# NOTE (b/349488459): universe validation is disabled until further notice.
return True

@property
def api_endpoint(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "2.14.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -623,36 +623,6 @@ def _get_universe_domain(
raise ValueError("Universe Domain cannot be an empty string.")
return universe_domain

@staticmethod
def _compare_universes(
client_universe: str, credentials: ga_credentials.Credentials
) -> bool:
"""Returns True iff the universe domains used by the client and credentials match.
Args:
client_universe (str): The universe domain configured via the client options.
credentials (ga_credentials.Credentials): The credentials being used in the client.
Returns:
bool: True iff client_universe matches the universe in credentials.
Raises:
ValueError: when client_universe does not match the universe in credentials.
"""

default_universe = AutoMlClient._DEFAULT_UNIVERSE
credentials_universe = getattr(credentials, "universe_domain", default_universe)

if client_universe != credentials_universe:
raise ValueError(
"The configured universe domain "
f"({client_universe}) does not match the universe domain "
f"found in the credentials ({credentials_universe}). "
"If you haven't configured the universe domain explicitly, "
f"`{default_universe}` is the default."
)
return True

def _validate_universe_domain(self):
"""Validates client's and credentials' universe domains are consistent.
Expand All @@ -662,13 +632,9 @@ def _validate_universe_domain(self):
Raises:
ValueError: If the configured universe domain is not valid.
"""
self._is_universe_domain_valid = (
self._is_universe_domain_valid
or AutoMlClient._compare_universes(
self.universe_domain, self.transport._credentials
)
)
return self._is_universe_domain_valid

# NOTE (b/349488459): universe validation is disabled until further notice.
return True

@property
def api_endpoint(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,36 +473,6 @@ def _get_universe_domain(
raise ValueError("Universe Domain cannot be an empty string.")
return universe_domain

@staticmethod
def _compare_universes(
client_universe: str, credentials: ga_credentials.Credentials
) -> bool:
"""Returns True iff the universe domains used by the client and credentials match.
Args:
client_universe (str): The universe domain configured via the client options.
credentials (ga_credentials.Credentials): The credentials being used in the client.
Returns:
bool: True iff client_universe matches the universe in credentials.
Raises:
ValueError: when client_universe does not match the universe in credentials.
"""

default_universe = PredictionServiceClient._DEFAULT_UNIVERSE
credentials_universe = getattr(credentials, "universe_domain", default_universe)

if client_universe != credentials_universe:
raise ValueError(
"The configured universe domain "
f"({client_universe}) does not match the universe domain "
f"found in the credentials ({credentials_universe}). "
"If you haven't configured the universe domain explicitly, "
f"`{default_universe}` is the default."
)
return True

def _validate_universe_domain(self):
"""Validates client's and credentials' universe domains are consistent.
Expand All @@ -512,13 +482,9 @@ def _validate_universe_domain(self):
Raises:
ValueError: If the configured universe domain is not valid.
"""
self._is_universe_domain_valid = (
self._is_universe_domain_valid
or PredictionServiceClient._compare_universes(
self.universe_domain, self.transport._credentials
)
)
return self._is_universe_domain_valid

# NOTE (b/349488459): universe validation is disabled until further notice.
return True

@property
def api_endpoint(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-automl",
"version": "2.14.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-automl",
"version": "2.14.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,86 +309,6 @@ def test__get_universe_domain():
assert str(excinfo.value) == "Universe Domain cannot be an empty string."


@pytest.mark.parametrize(
"client_class,transport_class,transport_name",
[
(AutoMlClient, transports.AutoMlGrpcTransport, "grpc"),
(AutoMlClient, transports.AutoMlRestTransport, "rest"),
],
)
def test__validate_universe_domain(client_class, transport_class, transport_name):
client = client_class(
transport=transport_class(credentials=ga_credentials.AnonymousCredentials())
)
assert client._validate_universe_domain() == True

# Test the case when universe is already validated.
assert client._validate_universe_domain() == True

if transport_name == "grpc":
# Test the case where credentials are provided by the
# `local_channel_credentials`. The default universes in both match.
channel = grpc.secure_channel(
"http://localhost/", grpc.local_channel_credentials()
)
client = client_class(transport=transport_class(channel=channel))
assert client._validate_universe_domain() == True

# Test the case where credentials do not exist: e.g. a transport is provided
# with no credentials. Validation should still succeed because there is no
# mismatch with non-existent credentials.
channel = grpc.secure_channel(
"http://localhost/", grpc.local_channel_credentials()
)
transport = transport_class(channel=channel)
transport._credentials = None
client = client_class(transport=transport)
assert client._validate_universe_domain() == True

# TODO: This is needed to cater for older versions of google-auth
# Make this test unconditional once the minimum supported version of
# google-auth becomes 2.23.0 or higher.
google_auth_major, google_auth_minor = [
int(part) for part in google.auth.__version__.split(".")[0:2]
]
if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23):
credentials = ga_credentials.AnonymousCredentials()
credentials._universe_domain = "foo.com"
# Test the case when there is a universe mismatch from the credentials.
client = client_class(transport=transport_class(credentials=credentials))
with pytest.raises(ValueError) as excinfo:
client._validate_universe_domain()
assert (
str(excinfo.value)
== "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."
)

# Test the case when there is a universe mismatch from the client.
#
# TODO: Make this test unconditional once the minimum supported version of
# google-api-core becomes 2.15.0 or higher.
api_core_major, api_core_minor = [
int(part) for part in api_core_version.__version__.split(".")[0:2]
]
if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15):
client = client_class(
client_options={"universe_domain": "bar.com"},
transport=transport_class(
credentials=ga_credentials.AnonymousCredentials(),
),
)
with pytest.raises(ValueError) as excinfo:
client._validate_universe_domain()
assert (
str(excinfo.value)
== "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."
)

# Test that ValueError is raised if universe_domain is provided via client options and credentials is None
with pytest.raises(ValueError):
client._compare_universes("foo.bar", None)


@pytest.mark.parametrize(
"client_class,transport_name",
[
Expand Down
Loading

0 comments on commit 4ed4108

Please sign in to comment.