Skip to content

Commit e95b23a

Browse files
committed
fix(generator): update fallback signatures and type cast client_cert_source
1 parent e25bd09 commit e95b23a

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/_compat.py.j2

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,15 @@ except ImportError:
6262
return default_endpoint_template.format(UNIVERSE_DOMAIN=universe_domain)
6363

6464
def get_universe_domain(
65-
client_universe_domain: Optional[str],
66-
universe_domain_env: Optional[str],
65+
*potential_universes: Optional[str],
6766
default_universe: str,
6867
) -> str:
6968
"""Return the universe domain used by the client."""
7069
universe_domain = default_universe
71-
if client_universe_domain is not None:
72-
universe_domain = client_universe_domain
73-
elif universe_domain_env is not None:
74-
universe_domain = universe_domain_env
70+
for potential_universe in potential_universes:
71+
if potential_universe is not None:
72+
universe_domain = potential_universe
73+
break
7574
if len(universe_domain.strip()) == 0:
7675
raise ValueError("Universe Domain cannot be an empty string.")
7776
return universe_domain

packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
379379
str: The API endpoint to be used by the client.
380380
"""
381381
use_mtls = use_mtls_endpoint == "always" or (
382-
use_mtls_endpoint == "auto" and client_cert_source
382+
use_mtls_endpoint == "auto" and bool(client_cert_source)
383383
)
384384
return client_utils.get_api_endpoint(
385385
api_override,

0 commit comments

Comments
 (0)