Skip to content

Commit

Permalink
fix: fix ValueError in test__validate_universe_domain (#929)
Browse files Browse the repository at this point in the history
* feat: Allow users to explicitly configure universe domain

chore: Update gapic-generator-python to v1.14.0
PiperOrigin-RevId: 603108274

Source-Link: googleapis/googleapis@3d83e36

Source-Link: googleapis/googleapis-gen@baf5e9b
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYmFmNWU5YmJiMTRhNzY4YjJiNGM5ZWFlOWZlYjc4ZjE4ZjE3NTdmYSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix: Resolve AttributeError 'Credentials' object has no attribute 'universe_domain'

fix: Add google-auth as a direct dependency

fix: Add staticmethod decorator to methods added in v1.14.0

chore: Update gapic-generator-python to v1.14.1
PiperOrigin-RevId: 603728206

Source-Link: googleapis/googleapis@9063da8

Source-Link: googleapis/googleapis-gen@891c67d
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODkxYzY3ZDBhODU1YjA4MDg1ZWIzMDFkYWJiMTQwNjRlZjRiMmM2ZCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix: fix `ValueError` in `test__validate_universe_domain`

PiperOrigin-RevId: 604699565

Source-Link: googleapis/googleapis@cd3eabf

Source-Link: googleapis/googleapis-gen@01f69ba
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDFmNjliYTdhMTNkNTllNmY0NWUyNDMzNTliOTFhNmU4OTYyMjFmOCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Feb 7, 2024
1 parent 3393f8c commit aa76a5a
Show file tree
Hide file tree
Showing 21 changed files with 2,626 additions and 239 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
from google.oauth2 import service_account # type: ignore

try:
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault]
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.AsyncRetry, object] # type: ignore
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore

from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
Expand All @@ -67,8 +67,12 @@ class BigtableInstanceAdminAsyncClient:

_client: BigtableInstanceAdminClient

# Copy defaults from the synchronous client for use here.
# Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
DEFAULT_ENDPOINT = BigtableInstanceAdminClient.DEFAULT_ENDPOINT
DEFAULT_MTLS_ENDPOINT = BigtableInstanceAdminClient.DEFAULT_MTLS_ENDPOINT
_DEFAULT_ENDPOINT_TEMPLATE = BigtableInstanceAdminClient._DEFAULT_ENDPOINT_TEMPLATE
_DEFAULT_UNIVERSE = BigtableInstanceAdminClient._DEFAULT_UNIVERSE

app_profile_path = staticmethod(BigtableInstanceAdminClient.app_profile_path)
parse_app_profile_path = staticmethod(
Expand Down Expand Up @@ -193,6 +197,25 @@ def transport(self) -> BigtableInstanceAdminTransport:
"""
return self._client.transport

@property
def api_endpoint(self):
"""Return the API endpoint used by the client instance.
Returns:
str: The API endpoint used by the client instance.
"""
return self._client._api_endpoint

@property
def universe_domain(self) -> str:
"""Return the universe domain used by the client instance.
Returns:
str: The universe domain used
by the client instance.
"""
return self._client._universe_domain

get_transport_class = functools.partial(
type(BigtableInstanceAdminClient).get_transport_class,
type(BigtableInstanceAdminClient),
Expand All @@ -206,7 +229,7 @@ def __init__(
client_options: Optional[ClientOptions] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiates the bigtable instance admin client.
"""Instantiates the bigtable instance admin async client.
Args:
credentials (Optional[google.auth.credentials.Credentials]): The
Expand All @@ -217,23 +240,38 @@ def __init__(
transport (Union[str, ~.BigtableInstanceAdminTransport]): The
transport to use. If set to None, a transport is chosen
automatically.
client_options (ClientOptions): Custom options for the client. It
won't take effect if a ``transport`` instance is provided.
(1) The ``api_endpoint`` property can be used to override the
default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
environment variable can also be used to override the endpoint:
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
Custom options for the client.
1. The ``api_endpoint`` property can be used to override the
default endpoint provided by the client when ``transport`` is
not explicitly provided. Only if this property is not set and
``transport`` was not explicitly provided, the endpoint is
determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
variable, which have one of the following values:
"always" (always use the default mTLS endpoint), "never" (always
use the default regular endpoint) and "auto" (auto switch to the
default mTLS endpoint if client certificate is present, this is
the default value). However, the ``api_endpoint`` property takes
precedence if provided.
(2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
use the default regular endpoint) and "auto" (auto-switch to the
default mTLS endpoint if client certificate is present; this is
the default value).
2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
is "true", then the ``client_cert_source`` property can be used
to provide client certificate for mutual TLS transport. If
to provide a client certificate for mTLS transport. If
not provided, the default SSL client certificate will be used if
present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
set, no client certificate will be used.
3. The ``universe_domain`` property can be used to override the
default "googleapis.com" universe. Note that ``api_endpoint``
property still takes precedence; and ``universe_domain`` is
currently not supported for mTLS.
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
The client info used to send a user-agent string along with
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you're developing
your own client library.
Raises:
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
creation failed for any reason.
Expand Down Expand Up @@ -360,6 +398,9 @@ async def create_instance(
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -460,6 +501,9 @@ async def get_instance(
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -549,6 +593,9 @@ async def list_instances(
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -623,6 +670,9 @@ async def update_instance(
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -731,6 +781,9 @@ async def partial_update_instance(
),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -812,6 +865,9 @@ async def delete_instance(
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
await rpc(
request,
Expand Down Expand Up @@ -920,6 +976,9 @@ async def create_cluster(
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -1019,6 +1078,9 @@ async def get_cluster(
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -1110,6 +1172,9 @@ async def list_clusters(
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -1184,6 +1249,9 @@ async def update_cluster(
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -1299,6 +1367,9 @@ async def partial_update_cluster(
),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -1380,6 +1451,9 @@ async def delete_cluster(
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
await rpc(
request,
Expand Down Expand Up @@ -1479,6 +1553,9 @@ async def create_app_profile(
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -1569,6 +1646,9 @@ async def get_app_profile(
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -1664,6 +1744,9 @@ async def list_app_profiles(
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -1776,6 +1859,9 @@ async def update_app_profile(
),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -1857,6 +1943,9 @@ async def delete_app_profile(
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
await rpc(
request,
Expand Down Expand Up @@ -1973,6 +2062,9 @@ async def get_iam_policy(
gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -2081,6 +2173,9 @@ async def set_iam_policy(
gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -2180,6 +2275,9 @@ async def test_iam_permissions(
gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -2273,6 +2371,9 @@ async def list_hot_tablets(
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
Expand Down
Loading

0 comments on commit aa76a5a

Please sign in to comment.