Skip to content

Commit

Permalink
chore: Update gapic-generator-python to v1.20.2 (#1026)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcf-owl-bot[bot] authored Nov 7, 2024
1 parent 2bca8fb commit 74f37a0
Show file tree
Hide file tree
Showing 21 changed files with 23,449 additions and 17,023 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -586,36 +586,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 = BigtableInstanceAdminClient._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 @@ -625,13 +595,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 BigtableInstanceAdminClient._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
@@ -0,0 +1,9 @@

transport inheritance structure
_______________________________

`BigtableInstanceAdminTransport` is the ABC for all transports.
- public child `BigtableInstanceAdminGrpcTransport` for sync gRPC transport (defined in `grpc.py`).
- public child `BigtableInstanceAdminGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`).
- private child `_BaseBigtableInstanceAdminRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`).
- public child `BigtableInstanceAdminRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`).
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import inspect
import warnings
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union

Expand Down Expand Up @@ -237,6 +238,9 @@ def __init__(
)

# Wrap messages. This must be done after self._grpc_channel exists
self._wrap_with_kind = (
"kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
)
self._prep_wrapped_messages(client_info)

@property
Expand Down Expand Up @@ -898,12 +902,12 @@ def list_hot_tablets(
def _prep_wrapped_messages(self, client_info):
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
self._wrapped_methods = {
self.create_instance: gapic_v1.method_async.wrap_method(
self.create_instance: self._wrap_method(
self.create_instance,
default_timeout=300.0,
client_info=client_info,
),
self.get_instance: gapic_v1.method_async.wrap_method(
self.get_instance: self._wrap_method(
self.get_instance,
default_retry=retries.AsyncRetry(
initial=1.0,
Expand All @@ -918,7 +922,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.list_instances: gapic_v1.method_async.wrap_method(
self.list_instances: self._wrap_method(
self.list_instances,
default_retry=retries.AsyncRetry(
initial=1.0,
Expand All @@ -933,7 +937,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.update_instance: gapic_v1.method_async.wrap_method(
self.update_instance: self._wrap_method(
self.update_instance,
default_retry=retries.AsyncRetry(
initial=1.0,
Expand All @@ -948,7 +952,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.partial_update_instance: gapic_v1.method_async.wrap_method(
self.partial_update_instance: self._wrap_method(
self.partial_update_instance,
default_retry=retries.AsyncRetry(
initial=1.0,
Expand All @@ -963,17 +967,17 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.delete_instance: gapic_v1.method_async.wrap_method(
self.delete_instance: self._wrap_method(
self.delete_instance,
default_timeout=60.0,
client_info=client_info,
),
self.create_cluster: gapic_v1.method_async.wrap_method(
self.create_cluster: self._wrap_method(
self.create_cluster,
default_timeout=60.0,
client_info=client_info,
),
self.get_cluster: gapic_v1.method_async.wrap_method(
self.get_cluster: self._wrap_method(
self.get_cluster,
default_retry=retries.AsyncRetry(
initial=1.0,
Expand All @@ -988,7 +992,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.list_clusters: gapic_v1.method_async.wrap_method(
self.list_clusters: self._wrap_method(
self.list_clusters,
default_retry=retries.AsyncRetry(
initial=1.0,
Expand All @@ -1003,7 +1007,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.update_cluster: gapic_v1.method_async.wrap_method(
self.update_cluster: self._wrap_method(
self.update_cluster,
default_retry=retries.AsyncRetry(
initial=1.0,
Expand All @@ -1018,22 +1022,22 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.partial_update_cluster: gapic_v1.method_async.wrap_method(
self.partial_update_cluster: self._wrap_method(
self.partial_update_cluster,
default_timeout=None,
client_info=client_info,
),
self.delete_cluster: gapic_v1.method_async.wrap_method(
self.delete_cluster: self._wrap_method(
self.delete_cluster,
default_timeout=60.0,
client_info=client_info,
),
self.create_app_profile: gapic_v1.method_async.wrap_method(
self.create_app_profile: self._wrap_method(
self.create_app_profile,
default_timeout=60.0,
client_info=client_info,
),
self.get_app_profile: gapic_v1.method_async.wrap_method(
self.get_app_profile: self._wrap_method(
self.get_app_profile,
default_retry=retries.AsyncRetry(
initial=1.0,
Expand All @@ -1048,7 +1052,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.list_app_profiles: gapic_v1.method_async.wrap_method(
self.list_app_profiles: self._wrap_method(
self.list_app_profiles,
default_retry=retries.AsyncRetry(
initial=1.0,
Expand All @@ -1063,7 +1067,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.update_app_profile: gapic_v1.method_async.wrap_method(
self.update_app_profile: self._wrap_method(
self.update_app_profile,
default_retry=retries.AsyncRetry(
initial=1.0,
Expand All @@ -1078,12 +1082,12 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.delete_app_profile: gapic_v1.method_async.wrap_method(
self.delete_app_profile: self._wrap_method(
self.delete_app_profile,
default_timeout=60.0,
client_info=client_info,
),
self.get_iam_policy: gapic_v1.method_async.wrap_method(
self.get_iam_policy: self._wrap_method(
self.get_iam_policy,
default_retry=retries.AsyncRetry(
initial=1.0,
Expand All @@ -1098,12 +1102,12 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.set_iam_policy: gapic_v1.method_async.wrap_method(
self.set_iam_policy: self._wrap_method(
self.set_iam_policy,
default_timeout=60.0,
client_info=client_info,
),
self.test_iam_permissions: gapic_v1.method_async.wrap_method(
self.test_iam_permissions: self._wrap_method(
self.test_iam_permissions,
default_retry=retries.AsyncRetry(
initial=1.0,
Expand All @@ -1118,7 +1122,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.list_hot_tablets: gapic_v1.method_async.wrap_method(
self.list_hot_tablets: self._wrap_method(
self.list_hot_tablets,
default_retry=retries.AsyncRetry(
initial=1.0,
Expand All @@ -1135,8 +1139,17 @@ def _prep_wrapped_messages(self, client_info):
),
}

def _wrap_method(self, func, *args, **kwargs):
if self._wrap_with_kind: # pragma: NO COVER
kwargs["kind"] = self.kind
return gapic_v1.method_async.wrap_method(func, *args, **kwargs)

def close(self):
return self.grpc_channel.close()

@property
def kind(self) -> str:
return "grpc_asyncio"


__all__ = ("BigtableInstanceAdminGrpcAsyncIOTransport",)
Loading

0 comments on commit 74f37a0

Please sign in to comment.