Skip to content

Commit 448d850

Browse files
chore: Update gapic-generator-python to v1.20.2 (#1026)
1 parent 91a27df commit 448d850

File tree

21 files changed

+23449
-17023
lines changed

21 files changed

+23449
-17023
lines changed

packages/google-cloud-bigtable/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/client.py

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

589-
@staticmethod
590-
def _compare_universes(
591-
client_universe: str, credentials: ga_credentials.Credentials
592-
) -> bool:
593-
"""Returns True iff the universe domains used by the client and credentials match.
594-
595-
Args:
596-
client_universe (str): The universe domain configured via the client options.
597-
credentials (ga_credentials.Credentials): The credentials being used in the client.
598-
599-
Returns:
600-
bool: True iff client_universe matches the universe in credentials.
601-
602-
Raises:
603-
ValueError: when client_universe does not match the universe in credentials.
604-
"""
605-
606-
default_universe = BigtableInstanceAdminClient._DEFAULT_UNIVERSE
607-
credentials_universe = getattr(credentials, "universe_domain", default_universe)
608-
609-
if client_universe != credentials_universe:
610-
raise ValueError(
611-
"The configured universe domain "
612-
f"({client_universe}) does not match the universe domain "
613-
f"found in the credentials ({credentials_universe}). "
614-
"If you haven't configured the universe domain explicitly, "
615-
f"`{default_universe}` is the default."
616-
)
617-
return True
618-
619589
def _validate_universe_domain(self):
620590
"""Validates client's and credentials' universe domains are consistent.
621591
@@ -625,13 +595,9 @@ def _validate_universe_domain(self):
625595
Raises:
626596
ValueError: If the configured universe domain is not valid.
627597
"""
628-
self._is_universe_domain_valid = (
629-
self._is_universe_domain_valid
630-
or BigtableInstanceAdminClient._compare_universes(
631-
self.universe_domain, self.transport._credentials
632-
)
633-
)
634-
return self._is_universe_domain_valid
598+
599+
# NOTE (b/349488459): universe validation is disabled until further notice.
600+
return True
635601

636602
@property
637603
def api_endpoint(self):
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
transport inheritance structure
3+
_______________________________
4+
5+
`BigtableInstanceAdminTransport` is the ABC for all transports.
6+
- public child `BigtableInstanceAdminGrpcTransport` for sync gRPC transport (defined in `grpc.py`).
7+
- public child `BigtableInstanceAdminGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`).
8+
- private child `_BaseBigtableInstanceAdminRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`).
9+
- public child `BigtableInstanceAdminRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`).

packages/google-cloud-bigtable/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc_asyncio.py

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16+
import inspect
1617
import warnings
1718
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
1819

@@ -237,6 +238,9 @@ def __init__(
237238
)
238239

239240
# Wrap messages. This must be done after self._grpc_channel exists
241+
self._wrap_with_kind = (
242+
"kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
243+
)
240244
self._prep_wrapped_messages(client_info)
241245

242246
@property
@@ -898,12 +902,12 @@ def list_hot_tablets(
898902
def _prep_wrapped_messages(self, client_info):
899903
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
900904
self._wrapped_methods = {
901-
self.create_instance: gapic_v1.method_async.wrap_method(
905+
self.create_instance: self._wrap_method(
902906
self.create_instance,
903907
default_timeout=300.0,
904908
client_info=client_info,
905909
),
906-
self.get_instance: gapic_v1.method_async.wrap_method(
910+
self.get_instance: self._wrap_method(
907911
self.get_instance,
908912
default_retry=retries.AsyncRetry(
909913
initial=1.0,
@@ -918,7 +922,7 @@ def _prep_wrapped_messages(self, client_info):
918922
default_timeout=60.0,
919923
client_info=client_info,
920924
),
921-
self.list_instances: gapic_v1.method_async.wrap_method(
925+
self.list_instances: self._wrap_method(
922926
self.list_instances,
923927
default_retry=retries.AsyncRetry(
924928
initial=1.0,
@@ -933,7 +937,7 @@ def _prep_wrapped_messages(self, client_info):
933937
default_timeout=60.0,
934938
client_info=client_info,
935939
),
936-
self.update_instance: gapic_v1.method_async.wrap_method(
940+
self.update_instance: self._wrap_method(
937941
self.update_instance,
938942
default_retry=retries.AsyncRetry(
939943
initial=1.0,
@@ -948,7 +952,7 @@ def _prep_wrapped_messages(self, client_info):
948952
default_timeout=60.0,
949953
client_info=client_info,
950954
),
951-
self.partial_update_instance: gapic_v1.method_async.wrap_method(
955+
self.partial_update_instance: self._wrap_method(
952956
self.partial_update_instance,
953957
default_retry=retries.AsyncRetry(
954958
initial=1.0,
@@ -963,17 +967,17 @@ def _prep_wrapped_messages(self, client_info):
963967
default_timeout=60.0,
964968
client_info=client_info,
965969
),
966-
self.delete_instance: gapic_v1.method_async.wrap_method(
970+
self.delete_instance: self._wrap_method(
967971
self.delete_instance,
968972
default_timeout=60.0,
969973
client_info=client_info,
970974
),
971-
self.create_cluster: gapic_v1.method_async.wrap_method(
975+
self.create_cluster: self._wrap_method(
972976
self.create_cluster,
973977
default_timeout=60.0,
974978
client_info=client_info,
975979
),
976-
self.get_cluster: gapic_v1.method_async.wrap_method(
980+
self.get_cluster: self._wrap_method(
977981
self.get_cluster,
978982
default_retry=retries.AsyncRetry(
979983
initial=1.0,
@@ -988,7 +992,7 @@ def _prep_wrapped_messages(self, client_info):
988992
default_timeout=60.0,
989993
client_info=client_info,
990994
),
991-
self.list_clusters: gapic_v1.method_async.wrap_method(
995+
self.list_clusters: self._wrap_method(
992996
self.list_clusters,
993997
default_retry=retries.AsyncRetry(
994998
initial=1.0,
@@ -1003,7 +1007,7 @@ def _prep_wrapped_messages(self, client_info):
10031007
default_timeout=60.0,
10041008
client_info=client_info,
10051009
),
1006-
self.update_cluster: gapic_v1.method_async.wrap_method(
1010+
self.update_cluster: self._wrap_method(
10071011
self.update_cluster,
10081012
default_retry=retries.AsyncRetry(
10091013
initial=1.0,
@@ -1018,22 +1022,22 @@ def _prep_wrapped_messages(self, client_info):
10181022
default_timeout=60.0,
10191023
client_info=client_info,
10201024
),
1021-
self.partial_update_cluster: gapic_v1.method_async.wrap_method(
1025+
self.partial_update_cluster: self._wrap_method(
10221026
self.partial_update_cluster,
10231027
default_timeout=None,
10241028
client_info=client_info,
10251029
),
1026-
self.delete_cluster: gapic_v1.method_async.wrap_method(
1030+
self.delete_cluster: self._wrap_method(
10271031
self.delete_cluster,
10281032
default_timeout=60.0,
10291033
client_info=client_info,
10301034
),
1031-
self.create_app_profile: gapic_v1.method_async.wrap_method(
1035+
self.create_app_profile: self._wrap_method(
10321036
self.create_app_profile,
10331037
default_timeout=60.0,
10341038
client_info=client_info,
10351039
),
1036-
self.get_app_profile: gapic_v1.method_async.wrap_method(
1040+
self.get_app_profile: self._wrap_method(
10371041
self.get_app_profile,
10381042
default_retry=retries.AsyncRetry(
10391043
initial=1.0,
@@ -1048,7 +1052,7 @@ def _prep_wrapped_messages(self, client_info):
10481052
default_timeout=60.0,
10491053
client_info=client_info,
10501054
),
1051-
self.list_app_profiles: gapic_v1.method_async.wrap_method(
1055+
self.list_app_profiles: self._wrap_method(
10521056
self.list_app_profiles,
10531057
default_retry=retries.AsyncRetry(
10541058
initial=1.0,
@@ -1063,7 +1067,7 @@ def _prep_wrapped_messages(self, client_info):
10631067
default_timeout=60.0,
10641068
client_info=client_info,
10651069
),
1066-
self.update_app_profile: gapic_v1.method_async.wrap_method(
1070+
self.update_app_profile: self._wrap_method(
10671071
self.update_app_profile,
10681072
default_retry=retries.AsyncRetry(
10691073
initial=1.0,
@@ -1078,12 +1082,12 @@ def _prep_wrapped_messages(self, client_info):
10781082
default_timeout=60.0,
10791083
client_info=client_info,
10801084
),
1081-
self.delete_app_profile: gapic_v1.method_async.wrap_method(
1085+
self.delete_app_profile: self._wrap_method(
10821086
self.delete_app_profile,
10831087
default_timeout=60.0,
10841088
client_info=client_info,
10851089
),
1086-
self.get_iam_policy: gapic_v1.method_async.wrap_method(
1090+
self.get_iam_policy: self._wrap_method(
10871091
self.get_iam_policy,
10881092
default_retry=retries.AsyncRetry(
10891093
initial=1.0,
@@ -1098,12 +1102,12 @@ def _prep_wrapped_messages(self, client_info):
10981102
default_timeout=60.0,
10991103
client_info=client_info,
11001104
),
1101-
self.set_iam_policy: gapic_v1.method_async.wrap_method(
1105+
self.set_iam_policy: self._wrap_method(
11021106
self.set_iam_policy,
11031107
default_timeout=60.0,
11041108
client_info=client_info,
11051109
),
1106-
self.test_iam_permissions: gapic_v1.method_async.wrap_method(
1110+
self.test_iam_permissions: self._wrap_method(
11071111
self.test_iam_permissions,
11081112
default_retry=retries.AsyncRetry(
11091113
initial=1.0,
@@ -1118,7 +1122,7 @@ def _prep_wrapped_messages(self, client_info):
11181122
default_timeout=60.0,
11191123
client_info=client_info,
11201124
),
1121-
self.list_hot_tablets: gapic_v1.method_async.wrap_method(
1125+
self.list_hot_tablets: self._wrap_method(
11221126
self.list_hot_tablets,
11231127
default_retry=retries.AsyncRetry(
11241128
initial=1.0,
@@ -1135,8 +1139,17 @@ def _prep_wrapped_messages(self, client_info):
11351139
),
11361140
}
11371141

1142+
def _wrap_method(self, func, *args, **kwargs):
1143+
if self._wrap_with_kind: # pragma: NO COVER
1144+
kwargs["kind"] = self.kind
1145+
return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
1146+
11381147
def close(self):
11391148
return self.grpc_channel.close()
11401149

1150+
@property
1151+
def kind(self) -> str:
1152+
return "grpc_asyncio"
1153+
11411154

11421155
__all__ = ("BigtableInstanceAdminGrpcAsyncIOTransport",)

0 commit comments

Comments
 (0)