google-cloud-bigtable 2.30.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. google/cloud/bigtable/__init__.py +25 -0
  2. google/cloud/bigtable/app_profile.py +377 -0
  3. google/cloud/bigtable/backup.py +490 -0
  4. google/cloud/bigtable/batcher.py +414 -0
  5. google/cloud/bigtable/client.py +475 -0
  6. google/cloud/bigtable/cluster.py +541 -0
  7. google/cloud/bigtable/column_family.py +362 -0
  8. google/cloud/bigtable/data/__init__.py +103 -0
  9. google/cloud/bigtable/data/_async/__init__.py +25 -0
  10. google/cloud/bigtable/data/_async/_mutate_rows.py +226 -0
  11. google/cloud/bigtable/data/_async/_read_rows.py +363 -0
  12. google/cloud/bigtable/data/_async/client.py +1522 -0
  13. google/cloud/bigtable/data/_async/mutations_batcher.py +534 -0
  14. google/cloud/bigtable/data/_cross_sync/__init__.py +20 -0
  15. google/cloud/bigtable/data/_cross_sync/_decorators.py +441 -0
  16. google/cloud/bigtable/data/_cross_sync/_mapping_meta.py +64 -0
  17. google/cloud/bigtable/data/_cross_sync/cross_sync.py +334 -0
  18. google/cloud/bigtable/data/_helpers.py +249 -0
  19. google/cloud/bigtable/data/_sync_autogen/_mutate_rows.py +182 -0
  20. google/cloud/bigtable/data/_sync_autogen/_read_rows.py +304 -0
  21. google/cloud/bigtable/data/_sync_autogen/client.py +1293 -0
  22. google/cloud/bigtable/data/_sync_autogen/mutations_batcher.py +449 -0
  23. google/cloud/bigtable/data/exceptions.py +340 -0
  24. google/cloud/bigtable/data/execute_query/__init__.py +43 -0
  25. google/cloud/bigtable/data/execute_query/_async/__init__.py +13 -0
  26. google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py +291 -0
  27. google/cloud/bigtable/data/execute_query/_byte_cursor.py +123 -0
  28. google/cloud/bigtable/data/execute_query/_checksum.py +43 -0
  29. google/cloud/bigtable/data/execute_query/_parameters_formatting.py +155 -0
  30. google/cloud/bigtable/data/execute_query/_query_result_parsing_utils.py +134 -0
  31. google/cloud/bigtable/data/execute_query/_reader.py +122 -0
  32. google/cloud/bigtable/data/execute_query/_sync_autogen/execute_query_iterator.py +239 -0
  33. google/cloud/bigtable/data/execute_query/metadata.py +399 -0
  34. google/cloud/bigtable/data/execute_query/values.py +123 -0
  35. google/cloud/bigtable/data/mutations.py +380 -0
  36. google/cloud/bigtable/data/read_modify_write_rules.py +112 -0
  37. google/cloud/bigtable/data/read_rows_query.py +536 -0
  38. google/cloud/bigtable/data/row.py +535 -0
  39. google/cloud/bigtable/data/row_filters.py +968 -0
  40. google/cloud/bigtable/encryption_info.py +64 -0
  41. google/cloud/bigtable/enums.py +223 -0
  42. google/cloud/bigtable/error.py +64 -0
  43. google/cloud/bigtable/gapic_version.py +16 -0
  44. google/cloud/bigtable/helpers.py +31 -0
  45. google/cloud/bigtable/instance.py +789 -0
  46. google/cloud/bigtable/policy.py +255 -0
  47. google/cloud/bigtable/row.py +1267 -0
  48. google/cloud/bigtable/row_data.py +380 -0
  49. google/cloud/bigtable/row_filters.py +838 -0
  50. google/cloud/bigtable/row_merger.py +250 -0
  51. google/cloud/bigtable/row_set.py +213 -0
  52. google/cloud/bigtable/table.py +1409 -0
  53. google/cloud/bigtable_admin/__init__.py +410 -0
  54. google/cloud/bigtable_admin/gapic_version.py +16 -0
  55. google/cloud/bigtable_admin/py.typed +2 -0
  56. google/cloud/bigtable_admin_v2/__init__.py +250 -0
  57. google/cloud/bigtable_admin_v2/gapic_metadata.json +962 -0
  58. google/cloud/bigtable_admin_v2/gapic_version.py +16 -0
  59. google/cloud/bigtable_admin_v2/py.typed +2 -0
  60. google/cloud/bigtable_admin_v2/services/__init__.py +15 -0
  61. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/__init__.py +22 -0
  62. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/async_client.py +3465 -0
  63. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/client.py +3944 -0
  64. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/pagers.py +681 -0
  65. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/__init__.py +40 -0
  66. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/base.py +751 -0
  67. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc.py +1249 -0
  68. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc_asyncio.py +1579 -0
  69. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/rest.py +6820 -0
  70. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/rest_base.py +1746 -0
  71. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/__init__.py +22 -0
  72. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/async_client.py +3472 -0
  73. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/client.py +3949 -0
  74. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/pagers.py +669 -0
  75. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/__init__.py +40 -0
  76. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/base.py +708 -0
  77. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/grpc.py +1257 -0
  78. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/grpc_asyncio.py +1549 -0
  79. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/rest.py +6609 -0
  80. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/rest_base.py +1714 -0
  81. google/cloud/bigtable_admin_v2/types/__init__.py +248 -0
  82. google/cloud/bigtable_admin_v2/types/bigtable_instance_admin.py +1364 -0
  83. google/cloud/bigtable_admin_v2/types/bigtable_table_admin.py +1715 -0
  84. google/cloud/bigtable_admin_v2/types/common.py +81 -0
  85. google/cloud/bigtable_admin_v2/types/instance.py +819 -0
  86. google/cloud/bigtable_admin_v2/types/table.py +1028 -0
  87. google/cloud/bigtable_admin_v2/types/types.py +776 -0
  88. google/cloud/bigtable_v2/__init__.py +136 -0
  89. google/cloud/bigtable_v2/gapic_metadata.json +193 -0
  90. google/cloud/bigtable_v2/gapic_version.py +16 -0
  91. google/cloud/bigtable_v2/py.typed +2 -0
  92. google/cloud/bigtable_v2/services/__init__.py +15 -0
  93. google/cloud/bigtable_v2/services/bigtable/__init__.py +22 -0
  94. google/cloud/bigtable_v2/services/bigtable/async_client.py +1741 -0
  95. google/cloud/bigtable_v2/services/bigtable/client.py +2194 -0
  96. google/cloud/bigtable_v2/services/bigtable/transports/__init__.py +38 -0
  97. google/cloud/bigtable_v2/services/bigtable/transports/base.py +343 -0
  98. google/cloud/bigtable_v2/services/bigtable/transports/grpc.py +660 -0
  99. google/cloud/bigtable_v2/services/bigtable/transports/grpc_asyncio.py +762 -0
  100. google/cloud/bigtable_v2/services/bigtable/transports/rest.py +2489 -0
  101. google/cloud/bigtable_v2/services/bigtable/transports/rest_base.py +711 -0
  102. google/cloud/bigtable_v2/types/__init__.py +138 -0
  103. google/cloud/bigtable_v2/types/bigtable.py +1531 -0
  104. google/cloud/bigtable_v2/types/data.py +1612 -0
  105. google/cloud/bigtable_v2/types/feature_flags.py +119 -0
  106. google/cloud/bigtable_v2/types/request_stats.py +171 -0
  107. google/cloud/bigtable_v2/types/response_params.py +64 -0
  108. google/cloud/bigtable_v2/types/types.py +579 -0
  109. google_cloud_bigtable-2.30.0.data/scripts/fixup_bigtable_admin_v2_keywords.py +233 -0
  110. google_cloud_bigtable-2.30.0.data/scripts/fixup_bigtable_v2_keywords.py +186 -0
  111. google_cloud_bigtable-2.30.0.dist-info/LICENSE +202 -0
  112. google_cloud_bigtable-2.30.0.dist-info/METADATA +154 -0
  113. google_cloud_bigtable-2.30.0.dist-info/RECORD +115 -0
  114. google_cloud_bigtable-2.30.0.dist-info/WHEEL +5 -0
  115. google_cloud_bigtable-2.30.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,3944 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2024 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from collections import OrderedDict
17
+ from http import HTTPStatus
18
+ import json
19
+ import logging as std_logging
20
+ import os
21
+ import re
22
+ from typing import (
23
+ Dict,
24
+ Callable,
25
+ Mapping,
26
+ MutableMapping,
27
+ MutableSequence,
28
+ Optional,
29
+ Sequence,
30
+ Tuple,
31
+ Type,
32
+ Union,
33
+ cast,
34
+ )
35
+ import warnings
36
+
37
+ from google.cloud.bigtable_admin_v2 import gapic_version as package_version
38
+
39
+ from google.api_core import client_options as client_options_lib
40
+ from google.api_core import exceptions as core_exceptions
41
+ from google.api_core import gapic_v1
42
+ from google.api_core import retry as retries
43
+ from google.auth import credentials as ga_credentials # type: ignore
44
+ from google.auth.transport import mtls # type: ignore
45
+ from google.auth.transport.grpc import SslCredentials # type: ignore
46
+ from google.auth.exceptions import MutualTLSChannelError # type: ignore
47
+ from google.oauth2 import service_account # type: ignore
48
+
49
+ try:
50
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
51
+ except AttributeError: # pragma: NO COVER
52
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
53
+
54
+ try:
55
+ from google.api_core import client_logging # type: ignore
56
+
57
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
58
+ except ImportError: # pragma: NO COVER
59
+ CLIENT_LOGGING_SUPPORTED = False
60
+
61
+ _LOGGER = std_logging.getLogger(__name__)
62
+
63
+ from google.api_core import operation # type: ignore
64
+ from google.api_core import operation_async # type: ignore
65
+ from google.cloud.bigtable_admin_v2.services.bigtable_instance_admin import pagers
66
+ from google.cloud.bigtable_admin_v2.types import bigtable_instance_admin
67
+ from google.cloud.bigtable_admin_v2.types import common
68
+ from google.cloud.bigtable_admin_v2.types import instance
69
+ from google.cloud.bigtable_admin_v2.types import instance as gba_instance
70
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
71
+ from google.iam.v1 import policy_pb2 # type: ignore
72
+ from google.protobuf import field_mask_pb2 # type: ignore
73
+ from google.protobuf import timestamp_pb2 # type: ignore
74
+ from .transports.base import BigtableInstanceAdminTransport, DEFAULT_CLIENT_INFO
75
+ from .transports.grpc import BigtableInstanceAdminGrpcTransport
76
+ from .transports.grpc_asyncio import BigtableInstanceAdminGrpcAsyncIOTransport
77
+ from .transports.rest import BigtableInstanceAdminRestTransport
78
+
79
+
80
+ class BigtableInstanceAdminClientMeta(type):
81
+ """Metaclass for the BigtableInstanceAdmin client.
82
+
83
+ This provides class-level methods for building and retrieving
84
+ support objects (e.g. transport) without polluting the client instance
85
+ objects.
86
+ """
87
+
88
+ _transport_registry = (
89
+ OrderedDict()
90
+ ) # type: Dict[str, Type[BigtableInstanceAdminTransport]]
91
+ _transport_registry["grpc"] = BigtableInstanceAdminGrpcTransport
92
+ _transport_registry["grpc_asyncio"] = BigtableInstanceAdminGrpcAsyncIOTransport
93
+ _transport_registry["rest"] = BigtableInstanceAdminRestTransport
94
+
95
+ def get_transport_class(
96
+ cls,
97
+ label: Optional[str] = None,
98
+ ) -> Type[BigtableInstanceAdminTransport]:
99
+ """Returns an appropriate transport class.
100
+
101
+ Args:
102
+ label: The name of the desired transport. If none is
103
+ provided, then the first transport in the registry is used.
104
+
105
+ Returns:
106
+ The transport class to use.
107
+ """
108
+ # If a specific transport is requested, return that one.
109
+ if label:
110
+ return cls._transport_registry[label]
111
+
112
+ # No transport is requested; return the default (that is, the first one
113
+ # in the dictionary).
114
+ return next(iter(cls._transport_registry.values()))
115
+
116
+
117
+ class BigtableInstanceAdminClient(metaclass=BigtableInstanceAdminClientMeta):
118
+ """Service for creating, configuring, and deleting Cloud
119
+ Bigtable Instances and Clusters. Provides access to the Instance
120
+ and Cluster schemas only, not the tables' metadata or data
121
+ stored in those tables.
122
+ """
123
+
124
+ @staticmethod
125
+ def _get_default_mtls_endpoint(api_endpoint):
126
+ """Converts api endpoint to mTLS endpoint.
127
+
128
+ Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
129
+ "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively.
130
+ Args:
131
+ api_endpoint (Optional[str]): the api endpoint to convert.
132
+ Returns:
133
+ str: converted mTLS api endpoint.
134
+ """
135
+ if not api_endpoint:
136
+ return api_endpoint
137
+
138
+ mtls_endpoint_re = re.compile(
139
+ r"(?P<name>[^.]+)(?P<mtls>\.mtls)?(?P<sandbox>\.sandbox)?(?P<googledomain>\.googleapis\.com)?"
140
+ )
141
+
142
+ m = mtls_endpoint_re.match(api_endpoint)
143
+ name, mtls, sandbox, googledomain = m.groups()
144
+ if mtls or not googledomain:
145
+ return api_endpoint
146
+
147
+ if sandbox:
148
+ return api_endpoint.replace(
149
+ "sandbox.googleapis.com", "mtls.sandbox.googleapis.com"
150
+ )
151
+
152
+ return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com")
153
+
154
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
155
+ DEFAULT_ENDPOINT = "bigtableadmin.googleapis.com"
156
+ DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore
157
+ DEFAULT_ENDPOINT
158
+ )
159
+
160
+ _DEFAULT_ENDPOINT_TEMPLATE = "bigtableadmin.{UNIVERSE_DOMAIN}"
161
+ _DEFAULT_UNIVERSE = "googleapis.com"
162
+
163
+ @classmethod
164
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
165
+ """Creates an instance of this client using the provided credentials
166
+ info.
167
+
168
+ Args:
169
+ info (dict): The service account private key info.
170
+ args: Additional arguments to pass to the constructor.
171
+ kwargs: Additional arguments to pass to the constructor.
172
+
173
+ Returns:
174
+ BigtableInstanceAdminClient: The constructed client.
175
+ """
176
+ credentials = service_account.Credentials.from_service_account_info(info)
177
+ kwargs["credentials"] = credentials
178
+ return cls(*args, **kwargs)
179
+
180
+ @classmethod
181
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
182
+ """Creates an instance of this client using the provided credentials
183
+ file.
184
+
185
+ Args:
186
+ filename (str): The path to the service account private key json
187
+ file.
188
+ args: Additional arguments to pass to the constructor.
189
+ kwargs: Additional arguments to pass to the constructor.
190
+
191
+ Returns:
192
+ BigtableInstanceAdminClient: The constructed client.
193
+ """
194
+ credentials = service_account.Credentials.from_service_account_file(filename)
195
+ kwargs["credentials"] = credentials
196
+ return cls(*args, **kwargs)
197
+
198
+ from_service_account_json = from_service_account_file
199
+
200
+ @property
201
+ def transport(self) -> BigtableInstanceAdminTransport:
202
+ """Returns the transport used by the client instance.
203
+
204
+ Returns:
205
+ BigtableInstanceAdminTransport: The transport used by the client
206
+ instance.
207
+ """
208
+ return self._transport
209
+
210
+ @staticmethod
211
+ def app_profile_path(
212
+ project: str,
213
+ instance: str,
214
+ app_profile: str,
215
+ ) -> str:
216
+ """Returns a fully-qualified app_profile string."""
217
+ return (
218
+ "projects/{project}/instances/{instance}/appProfiles/{app_profile}".format(
219
+ project=project,
220
+ instance=instance,
221
+ app_profile=app_profile,
222
+ )
223
+ )
224
+
225
+ @staticmethod
226
+ def parse_app_profile_path(path: str) -> Dict[str, str]:
227
+ """Parses a app_profile path into its component segments."""
228
+ m = re.match(
229
+ r"^projects/(?P<project>.+?)/instances/(?P<instance>.+?)/appProfiles/(?P<app_profile>.+?)$",
230
+ path,
231
+ )
232
+ return m.groupdict() if m else {}
233
+
234
+ @staticmethod
235
+ def cluster_path(
236
+ project: str,
237
+ instance: str,
238
+ cluster: str,
239
+ ) -> str:
240
+ """Returns a fully-qualified cluster string."""
241
+ return "projects/{project}/instances/{instance}/clusters/{cluster}".format(
242
+ project=project,
243
+ instance=instance,
244
+ cluster=cluster,
245
+ )
246
+
247
+ @staticmethod
248
+ def parse_cluster_path(path: str) -> Dict[str, str]:
249
+ """Parses a cluster path into its component segments."""
250
+ m = re.match(
251
+ r"^projects/(?P<project>.+?)/instances/(?P<instance>.+?)/clusters/(?P<cluster>.+?)$",
252
+ path,
253
+ )
254
+ return m.groupdict() if m else {}
255
+
256
+ @staticmethod
257
+ def crypto_key_path(
258
+ project: str,
259
+ location: str,
260
+ key_ring: str,
261
+ crypto_key: str,
262
+ ) -> str:
263
+ """Returns a fully-qualified crypto_key string."""
264
+ return "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}".format(
265
+ project=project,
266
+ location=location,
267
+ key_ring=key_ring,
268
+ crypto_key=crypto_key,
269
+ )
270
+
271
+ @staticmethod
272
+ def parse_crypto_key_path(path: str) -> Dict[str, str]:
273
+ """Parses a crypto_key path into its component segments."""
274
+ m = re.match(
275
+ r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/keyRings/(?P<key_ring>.+?)/cryptoKeys/(?P<crypto_key>.+?)$",
276
+ path,
277
+ )
278
+ return m.groupdict() if m else {}
279
+
280
+ @staticmethod
281
+ def hot_tablet_path(
282
+ project: str,
283
+ instance: str,
284
+ cluster: str,
285
+ hot_tablet: str,
286
+ ) -> str:
287
+ """Returns a fully-qualified hot_tablet string."""
288
+ return "projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}".format(
289
+ project=project,
290
+ instance=instance,
291
+ cluster=cluster,
292
+ hot_tablet=hot_tablet,
293
+ )
294
+
295
+ @staticmethod
296
+ def parse_hot_tablet_path(path: str) -> Dict[str, str]:
297
+ """Parses a hot_tablet path into its component segments."""
298
+ m = re.match(
299
+ r"^projects/(?P<project>.+?)/instances/(?P<instance>.+?)/clusters/(?P<cluster>.+?)/hotTablets/(?P<hot_tablet>.+?)$",
300
+ path,
301
+ )
302
+ return m.groupdict() if m else {}
303
+
304
+ @staticmethod
305
+ def instance_path(
306
+ project: str,
307
+ instance: str,
308
+ ) -> str:
309
+ """Returns a fully-qualified instance string."""
310
+ return "projects/{project}/instances/{instance}".format(
311
+ project=project,
312
+ instance=instance,
313
+ )
314
+
315
+ @staticmethod
316
+ def parse_instance_path(path: str) -> Dict[str, str]:
317
+ """Parses a instance path into its component segments."""
318
+ m = re.match(r"^projects/(?P<project>.+?)/instances/(?P<instance>.+?)$", path)
319
+ return m.groupdict() if m else {}
320
+
321
+ @staticmethod
322
+ def logical_view_path(
323
+ project: str,
324
+ instance: str,
325
+ logical_view: str,
326
+ ) -> str:
327
+ """Returns a fully-qualified logical_view string."""
328
+ return "projects/{project}/instances/{instance}/logicalViews/{logical_view}".format(
329
+ project=project,
330
+ instance=instance,
331
+ logical_view=logical_view,
332
+ )
333
+
334
+ @staticmethod
335
+ def parse_logical_view_path(path: str) -> Dict[str, str]:
336
+ """Parses a logical_view path into its component segments."""
337
+ m = re.match(
338
+ r"^projects/(?P<project>.+?)/instances/(?P<instance>.+?)/logicalViews/(?P<logical_view>.+?)$",
339
+ path,
340
+ )
341
+ return m.groupdict() if m else {}
342
+
343
+ @staticmethod
344
+ def materialized_view_path(
345
+ project: str,
346
+ instance: str,
347
+ materialized_view: str,
348
+ ) -> str:
349
+ """Returns a fully-qualified materialized_view string."""
350
+ return "projects/{project}/instances/{instance}/materializedViews/{materialized_view}".format(
351
+ project=project,
352
+ instance=instance,
353
+ materialized_view=materialized_view,
354
+ )
355
+
356
+ @staticmethod
357
+ def parse_materialized_view_path(path: str) -> Dict[str, str]:
358
+ """Parses a materialized_view path into its component segments."""
359
+ m = re.match(
360
+ r"^projects/(?P<project>.+?)/instances/(?P<instance>.+?)/materializedViews/(?P<materialized_view>.+?)$",
361
+ path,
362
+ )
363
+ return m.groupdict() if m else {}
364
+
365
+ @staticmethod
366
+ def table_path(
367
+ project: str,
368
+ instance: str,
369
+ table: str,
370
+ ) -> str:
371
+ """Returns a fully-qualified table string."""
372
+ return "projects/{project}/instances/{instance}/tables/{table}".format(
373
+ project=project,
374
+ instance=instance,
375
+ table=table,
376
+ )
377
+
378
+ @staticmethod
379
+ def parse_table_path(path: str) -> Dict[str, str]:
380
+ """Parses a table path into its component segments."""
381
+ m = re.match(
382
+ r"^projects/(?P<project>.+?)/instances/(?P<instance>.+?)/tables/(?P<table>.+?)$",
383
+ path,
384
+ )
385
+ return m.groupdict() if m else {}
386
+
387
+ @staticmethod
388
+ def common_billing_account_path(
389
+ billing_account: str,
390
+ ) -> str:
391
+ """Returns a fully-qualified billing_account string."""
392
+ return "billingAccounts/{billing_account}".format(
393
+ billing_account=billing_account,
394
+ )
395
+
396
+ @staticmethod
397
+ def parse_common_billing_account_path(path: str) -> Dict[str, str]:
398
+ """Parse a billing_account path into its component segments."""
399
+ m = re.match(r"^billingAccounts/(?P<billing_account>.+?)$", path)
400
+ return m.groupdict() if m else {}
401
+
402
+ @staticmethod
403
+ def common_folder_path(
404
+ folder: str,
405
+ ) -> str:
406
+ """Returns a fully-qualified folder string."""
407
+ return "folders/{folder}".format(
408
+ folder=folder,
409
+ )
410
+
411
+ @staticmethod
412
+ def parse_common_folder_path(path: str) -> Dict[str, str]:
413
+ """Parse a folder path into its component segments."""
414
+ m = re.match(r"^folders/(?P<folder>.+?)$", path)
415
+ return m.groupdict() if m else {}
416
+
417
+ @staticmethod
418
+ def common_organization_path(
419
+ organization: str,
420
+ ) -> str:
421
+ """Returns a fully-qualified organization string."""
422
+ return "organizations/{organization}".format(
423
+ organization=organization,
424
+ )
425
+
426
+ @staticmethod
427
+ def parse_common_organization_path(path: str) -> Dict[str, str]:
428
+ """Parse a organization path into its component segments."""
429
+ m = re.match(r"^organizations/(?P<organization>.+?)$", path)
430
+ return m.groupdict() if m else {}
431
+
432
+ @staticmethod
433
+ def common_project_path(
434
+ project: str,
435
+ ) -> str:
436
+ """Returns a fully-qualified project string."""
437
+ return "projects/{project}".format(
438
+ project=project,
439
+ )
440
+
441
+ @staticmethod
442
+ def parse_common_project_path(path: str) -> Dict[str, str]:
443
+ """Parse a project path into its component segments."""
444
+ m = re.match(r"^projects/(?P<project>.+?)$", path)
445
+ return m.groupdict() if m else {}
446
+
447
+ @staticmethod
448
+ def common_location_path(
449
+ project: str,
450
+ location: str,
451
+ ) -> str:
452
+ """Returns a fully-qualified location string."""
453
+ return "projects/{project}/locations/{location}".format(
454
+ project=project,
455
+ location=location,
456
+ )
457
+
458
+ @staticmethod
459
+ def parse_common_location_path(path: str) -> Dict[str, str]:
460
+ """Parse a location path into its component segments."""
461
+ m = re.match(r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)$", path)
462
+ return m.groupdict() if m else {}
463
+
464
+ @classmethod
465
+ def get_mtls_endpoint_and_cert_source(
466
+ cls, client_options: Optional[client_options_lib.ClientOptions] = None
467
+ ):
468
+ """Deprecated. Return the API endpoint and client cert source for mutual TLS.
469
+
470
+ The client cert source is determined in the following order:
471
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
472
+ client cert source is None.
473
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
474
+ default client cert source exists, use the default one; otherwise the client cert
475
+ source is None.
476
+
477
+ The API endpoint is determined in the following order:
478
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
479
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
480
+ default mTLS endpoint; if the environment variable is "never", use the default API
481
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
482
+ use the default API endpoint.
483
+
484
+ More details can be found at https://google.aip.dev/auth/4114.
485
+
486
+ Args:
487
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
488
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
489
+ in this method.
490
+
491
+ Returns:
492
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
493
+ client cert source to use.
494
+
495
+ Raises:
496
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
497
+ """
498
+
499
+ warnings.warn(
500
+ "get_mtls_endpoint_and_cert_source is deprecated. Use the api_endpoint property instead.",
501
+ DeprecationWarning,
502
+ )
503
+ if client_options is None:
504
+ client_options = client_options_lib.ClientOptions()
505
+ use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")
506
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto")
507
+ if use_client_cert not in ("true", "false"):
508
+ raise ValueError(
509
+ "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
510
+ )
511
+ if use_mtls_endpoint not in ("auto", "never", "always"):
512
+ raise MutualTLSChannelError(
513
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
514
+ )
515
+
516
+ # Figure out the client cert source to use.
517
+ client_cert_source = None
518
+ if use_client_cert == "true":
519
+ if client_options.client_cert_source:
520
+ client_cert_source = client_options.client_cert_source
521
+ elif mtls.has_default_client_cert_source():
522
+ client_cert_source = mtls.default_client_cert_source()
523
+
524
+ # Figure out which api endpoint to use.
525
+ if client_options.api_endpoint is not None:
526
+ api_endpoint = client_options.api_endpoint
527
+ elif use_mtls_endpoint == "always" or (
528
+ use_mtls_endpoint == "auto" and client_cert_source
529
+ ):
530
+ api_endpoint = cls.DEFAULT_MTLS_ENDPOINT
531
+ else:
532
+ api_endpoint = cls.DEFAULT_ENDPOINT
533
+
534
+ return api_endpoint, client_cert_source
535
+
536
+ @staticmethod
537
+ def _read_environment_variables():
538
+ """Returns the environment variables used by the client.
539
+
540
+ Returns:
541
+ Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE,
542
+ GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables.
543
+
544
+ Raises:
545
+ ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not
546
+ any of ["true", "false"].
547
+ google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT
548
+ is not any of ["auto", "never", "always"].
549
+ """
550
+ use_client_cert = os.getenv(
551
+ "GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
552
+ ).lower()
553
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower()
554
+ universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN")
555
+ if use_client_cert not in ("true", "false"):
556
+ raise ValueError(
557
+ "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
558
+ )
559
+ if use_mtls_endpoint not in ("auto", "never", "always"):
560
+ raise MutualTLSChannelError(
561
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
562
+ )
563
+ return use_client_cert == "true", use_mtls_endpoint, universe_domain_env
564
+
565
+ @staticmethod
566
+ def _get_client_cert_source(provided_cert_source, use_cert_flag):
567
+ """Return the client cert source to be used by the client.
568
+
569
+ Args:
570
+ provided_cert_source (bytes): The client certificate source provided.
571
+ use_cert_flag (bool): A flag indicating whether to use the client certificate.
572
+
573
+ Returns:
574
+ bytes or None: The client cert source to be used by the client.
575
+ """
576
+ client_cert_source = None
577
+ if use_cert_flag:
578
+ if provided_cert_source:
579
+ client_cert_source = provided_cert_source
580
+ elif mtls.has_default_client_cert_source():
581
+ client_cert_source = mtls.default_client_cert_source()
582
+ return client_cert_source
583
+
584
+ @staticmethod
585
+ def _get_api_endpoint(
586
+ api_override, client_cert_source, universe_domain, use_mtls_endpoint
587
+ ):
588
+ """Return the API endpoint used by the client.
589
+
590
+ Args:
591
+ api_override (str): The API endpoint override. If specified, this is always
592
+ the return value of this function and the other arguments are not used.
593
+ client_cert_source (bytes): The client certificate source used by the client.
594
+ universe_domain (str): The universe domain used by the client.
595
+ use_mtls_endpoint (str): How to use the mTLS endpoint, which depends also on the other parameters.
596
+ Possible values are "always", "auto", or "never".
597
+
598
+ Returns:
599
+ str: The API endpoint to be used by the client.
600
+ """
601
+ if api_override is not None:
602
+ api_endpoint = api_override
603
+ elif use_mtls_endpoint == "always" or (
604
+ use_mtls_endpoint == "auto" and client_cert_source
605
+ ):
606
+ _default_universe = BigtableInstanceAdminClient._DEFAULT_UNIVERSE
607
+ if universe_domain != _default_universe:
608
+ raise MutualTLSChannelError(
609
+ f"mTLS is not supported in any universe other than {_default_universe}."
610
+ )
611
+ api_endpoint = BigtableInstanceAdminClient.DEFAULT_MTLS_ENDPOINT
612
+ else:
613
+ api_endpoint = (
614
+ BigtableInstanceAdminClient._DEFAULT_ENDPOINT_TEMPLATE.format(
615
+ UNIVERSE_DOMAIN=universe_domain
616
+ )
617
+ )
618
+ return api_endpoint
619
+
620
+ @staticmethod
621
+ def _get_universe_domain(
622
+ client_universe_domain: Optional[str], universe_domain_env: Optional[str]
623
+ ) -> str:
624
+ """Return the universe domain used by the client.
625
+
626
+ Args:
627
+ client_universe_domain (Optional[str]): The universe domain configured via the client options.
628
+ universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable.
629
+
630
+ Returns:
631
+ str: The universe domain to be used by the client.
632
+
633
+ Raises:
634
+ ValueError: If the universe domain is an empty string.
635
+ """
636
+ universe_domain = BigtableInstanceAdminClient._DEFAULT_UNIVERSE
637
+ if client_universe_domain is not None:
638
+ universe_domain = client_universe_domain
639
+ elif universe_domain_env is not None:
640
+ universe_domain = universe_domain_env
641
+ if len(universe_domain.strip()) == 0:
642
+ raise ValueError("Universe Domain cannot be an empty string.")
643
+ return universe_domain
644
+
645
+ def _validate_universe_domain(self):
646
+ """Validates client's and credentials' universe domains are consistent.
647
+
648
+ Returns:
649
+ bool: True iff the configured universe domain is valid.
650
+
651
+ Raises:
652
+ ValueError: If the configured universe domain is not valid.
653
+ """
654
+
655
+ # NOTE (b/349488459): universe validation is disabled until further notice.
656
+ return True
657
+
658
+ def _add_cred_info_for_auth_errors(
659
+ self, error: core_exceptions.GoogleAPICallError
660
+ ) -> None:
661
+ """Adds credential info string to error details for 401/403/404 errors.
662
+
663
+ Args:
664
+ error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
665
+ """
666
+ if error.code not in [
667
+ HTTPStatus.UNAUTHORIZED,
668
+ HTTPStatus.FORBIDDEN,
669
+ HTTPStatus.NOT_FOUND,
670
+ ]:
671
+ return
672
+
673
+ cred = self._transport._credentials
674
+
675
+ # get_cred_info is only available in google-auth>=2.35.0
676
+ if not hasattr(cred, "get_cred_info"):
677
+ return
678
+
679
+ # ignore the type check since pypy test fails when get_cred_info
680
+ # is not available
681
+ cred_info = cred.get_cred_info() # type: ignore
682
+ if cred_info and hasattr(error._details, "append"):
683
+ error._details.append(json.dumps(cred_info))
684
+
685
+ @property
686
+ def api_endpoint(self):
687
+ """Return the API endpoint used by the client instance.
688
+
689
+ Returns:
690
+ str: The API endpoint used by the client instance.
691
+ """
692
+ return self._api_endpoint
693
+
694
+ @property
695
+ def universe_domain(self) -> str:
696
+ """Return the universe domain used by the client instance.
697
+
698
+ Returns:
699
+ str: The universe domain used by the client instance.
700
+ """
701
+ return self._universe_domain
702
+
703
+ def __init__(
704
+ self,
705
+ *,
706
+ credentials: Optional[ga_credentials.Credentials] = None,
707
+ transport: Optional[
708
+ Union[
709
+ str,
710
+ BigtableInstanceAdminTransport,
711
+ Callable[..., BigtableInstanceAdminTransport],
712
+ ]
713
+ ] = None,
714
+ client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
715
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
716
+ ) -> None:
717
+ """Instantiates the bigtable instance admin client.
718
+
719
+ Args:
720
+ credentials (Optional[google.auth.credentials.Credentials]): The
721
+ authorization credentials to attach to requests. These
722
+ credentials identify the application to the service; if none
723
+ are specified, the client will attempt to ascertain the
724
+ credentials from the environment.
725
+ transport (Optional[Union[str,BigtableInstanceAdminTransport,Callable[..., BigtableInstanceAdminTransport]]]):
726
+ The transport to use, or a Callable that constructs and returns a new transport.
727
+ If a Callable is given, it will be called with the same set of initialization
728
+ arguments as used in the BigtableInstanceAdminTransport constructor.
729
+ If set to None, a transport is chosen automatically.
730
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
731
+ Custom options for the client.
732
+
733
+ 1. The ``api_endpoint`` property can be used to override the
734
+ default endpoint provided by the client when ``transport`` is
735
+ not explicitly provided. Only if this property is not set and
736
+ ``transport`` was not explicitly provided, the endpoint is
737
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
738
+ variable, which have one of the following values:
739
+ "always" (always use the default mTLS endpoint), "never" (always
740
+ use the default regular endpoint) and "auto" (auto-switch to the
741
+ default mTLS endpoint if client certificate is present; this is
742
+ the default value).
743
+
744
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
745
+ is "true", then the ``client_cert_source`` property can be used
746
+ to provide a client certificate for mTLS transport. If
747
+ not provided, the default SSL client certificate will be used if
748
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
749
+ set, no client certificate will be used.
750
+
751
+ 3. The ``universe_domain`` property can be used to override the
752
+ default "googleapis.com" universe. Note that the ``api_endpoint``
753
+ property still takes precedence; and ``universe_domain`` is
754
+ currently not supported for mTLS.
755
+
756
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
757
+ The client info used to send a user-agent string along with
758
+ API requests. If ``None``, then default info will be used.
759
+ Generally, you only need to set this if you're developing
760
+ your own client library.
761
+
762
+ Raises:
763
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
764
+ creation failed for any reason.
765
+ """
766
+ self._client_options = client_options
767
+ if isinstance(self._client_options, dict):
768
+ self._client_options = client_options_lib.from_dict(self._client_options)
769
+ if self._client_options is None:
770
+ self._client_options = client_options_lib.ClientOptions()
771
+ self._client_options = cast(
772
+ client_options_lib.ClientOptions, self._client_options
773
+ )
774
+
775
+ universe_domain_opt = getattr(self._client_options, "universe_domain", None)
776
+
777
+ (
778
+ self._use_client_cert,
779
+ self._use_mtls_endpoint,
780
+ self._universe_domain_env,
781
+ ) = BigtableInstanceAdminClient._read_environment_variables()
782
+ self._client_cert_source = BigtableInstanceAdminClient._get_client_cert_source(
783
+ self._client_options.client_cert_source, self._use_client_cert
784
+ )
785
+ self._universe_domain = BigtableInstanceAdminClient._get_universe_domain(
786
+ universe_domain_opt, self._universe_domain_env
787
+ )
788
+ self._api_endpoint = None # updated below, depending on `transport`
789
+
790
+ # Initialize the universe domain validation.
791
+ self._is_universe_domain_valid = False
792
+
793
+ if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER
794
+ # Setup logging.
795
+ client_logging.initialize_logging()
796
+
797
+ api_key_value = getattr(self._client_options, "api_key", None)
798
+ if api_key_value and credentials:
799
+ raise ValueError(
800
+ "client_options.api_key and credentials are mutually exclusive"
801
+ )
802
+
803
+ # Save or instantiate the transport.
804
+ # Ordinarily, we provide the transport, but allowing a custom transport
805
+ # instance provides an extensibility point for unusual situations.
806
+ transport_provided = isinstance(transport, BigtableInstanceAdminTransport)
807
+ if transport_provided:
808
+ # transport is a BigtableInstanceAdminTransport instance.
809
+ if credentials or self._client_options.credentials_file or api_key_value:
810
+ raise ValueError(
811
+ "When providing a transport instance, "
812
+ "provide its credentials directly."
813
+ )
814
+ if self._client_options.scopes:
815
+ raise ValueError(
816
+ "When providing a transport instance, provide its scopes "
817
+ "directly."
818
+ )
819
+ self._transport = cast(BigtableInstanceAdminTransport, transport)
820
+ self._api_endpoint = self._transport.host
821
+
822
+ self._api_endpoint = (
823
+ self._api_endpoint
824
+ or BigtableInstanceAdminClient._get_api_endpoint(
825
+ self._client_options.api_endpoint,
826
+ self._client_cert_source,
827
+ self._universe_domain,
828
+ self._use_mtls_endpoint,
829
+ )
830
+ )
831
+
832
+ if not transport_provided:
833
+ import google.auth._default # type: ignore
834
+
835
+ if api_key_value and hasattr(
836
+ google.auth._default, "get_api_key_credentials"
837
+ ):
838
+ credentials = google.auth._default.get_api_key_credentials(
839
+ api_key_value
840
+ )
841
+
842
+ transport_init: Union[
843
+ Type[BigtableInstanceAdminTransport],
844
+ Callable[..., BigtableInstanceAdminTransport],
845
+ ] = (
846
+ BigtableInstanceAdminClient.get_transport_class(transport)
847
+ if isinstance(transport, str) or transport is None
848
+ else cast(Callable[..., BigtableInstanceAdminTransport], transport)
849
+ )
850
+ # initialize with the provided callable or the passed in class
851
+ self._transport = transport_init(
852
+ credentials=credentials,
853
+ credentials_file=self._client_options.credentials_file,
854
+ host=self._api_endpoint,
855
+ scopes=self._client_options.scopes,
856
+ client_cert_source_for_mtls=self._client_cert_source,
857
+ quota_project_id=self._client_options.quota_project_id,
858
+ client_info=client_info,
859
+ always_use_jwt_access=True,
860
+ api_audience=self._client_options.api_audience,
861
+ )
862
+
863
+ if "async" not in str(self._transport):
864
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
865
+ std_logging.DEBUG
866
+ ): # pragma: NO COVER
867
+ _LOGGER.debug(
868
+ "Created client `google.bigtable.admin_v2.BigtableInstanceAdminClient`.",
869
+ extra={
870
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
871
+ "universeDomain": getattr(
872
+ self._transport._credentials, "universe_domain", ""
873
+ ),
874
+ "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}",
875
+ "credentialsInfo": getattr(
876
+ self.transport._credentials, "get_cred_info", lambda: None
877
+ )(),
878
+ }
879
+ if hasattr(self._transport, "_credentials")
880
+ else {
881
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
882
+ "credentialsType": None,
883
+ },
884
+ )
885
+
886
+ def create_instance(
887
+ self,
888
+ request: Optional[
889
+ Union[bigtable_instance_admin.CreateInstanceRequest, dict]
890
+ ] = None,
891
+ *,
892
+ parent: Optional[str] = None,
893
+ instance_id: Optional[str] = None,
894
+ instance: Optional[gba_instance.Instance] = None,
895
+ clusters: Optional[MutableMapping[str, gba_instance.Cluster]] = None,
896
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
897
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
898
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
899
+ ) -> operation.Operation:
900
+ r"""Create an instance within a project.
901
+
902
+ Note that exactly one of Cluster.serve_nodes and
903
+ Cluster.cluster_config.cluster_autoscaling_config can be set. If
904
+ serve_nodes is set to non-zero, then the cluster is manually
905
+ scaled. If cluster_config.cluster_autoscaling_config is
906
+ non-empty, then autoscaling is enabled.
907
+
908
+ Args:
909
+ request (Union[google.cloud.bigtable_admin_v2.types.CreateInstanceRequest, dict]):
910
+ The request object. Request message for
911
+ BigtableInstanceAdmin.CreateInstance.
912
+ parent (str):
913
+ Required. The unique name of the project in which to
914
+ create the new instance. Values are of the form
915
+ ``projects/{project}``.
916
+
917
+ This corresponds to the ``parent`` field
918
+ on the ``request`` instance; if ``request`` is provided, this
919
+ should not be set.
920
+ instance_id (str):
921
+ Required. The ID to be used when referring to the new
922
+ instance within its project, e.g., just ``myinstance``
923
+ rather than ``projects/myproject/instances/myinstance``.
924
+
925
+ This corresponds to the ``instance_id`` field
926
+ on the ``request`` instance; if ``request`` is provided, this
927
+ should not be set.
928
+ instance (google.cloud.bigtable_admin_v2.types.Instance):
929
+ Required. The instance to create. Fields marked
930
+ ``OutputOnly`` must be left blank.
931
+
932
+ This corresponds to the ``instance`` field
933
+ on the ``request`` instance; if ``request`` is provided, this
934
+ should not be set.
935
+ clusters (MutableMapping[str, google.cloud.bigtable_admin_v2.types.Cluster]):
936
+ Required. The clusters to be created within the
937
+ instance, mapped by desired cluster ID, e.g., just
938
+ ``mycluster`` rather than
939
+ ``projects/myproject/instances/myinstance/clusters/mycluster``.
940
+ Fields marked ``OutputOnly`` must be left blank.
941
+
942
+ This corresponds to the ``clusters`` field
943
+ on the ``request`` instance; if ``request`` is provided, this
944
+ should not be set.
945
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
946
+ should be retried.
947
+ timeout (float): The timeout for this request.
948
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
949
+ sent along with the request as metadata. Normally, each value must be of type `str`,
950
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
951
+ be of type `bytes`.
952
+
953
+ Returns:
954
+ google.api_core.operation.Operation:
955
+ An object representing a long-running operation.
956
+
957
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Instance` A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and
958
+ the resources that serve them. All tables in an
959
+ instance are served from all
960
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
961
+ instance.
962
+
963
+ """
964
+ # Create or coerce a protobuf request object.
965
+ # - Quick check: If we got a request object, we should *not* have
966
+ # gotten any keyword arguments that map to the request.
967
+ flattened_params = [parent, instance_id, instance, clusters]
968
+ has_flattened_params = (
969
+ len([param for param in flattened_params if param is not None]) > 0
970
+ )
971
+ if request is not None and has_flattened_params:
972
+ raise ValueError(
973
+ "If the `request` argument is set, then none of "
974
+ "the individual field arguments should be set."
975
+ )
976
+
977
+ # - Use the request object if provided (there's no risk of modifying the input as
978
+ # there are no flattened fields), or create one.
979
+ if not isinstance(request, bigtable_instance_admin.CreateInstanceRequest):
980
+ request = bigtable_instance_admin.CreateInstanceRequest(request)
981
+ # If we have keyword arguments corresponding to fields on the
982
+ # request, apply these.
983
+ if parent is not None:
984
+ request.parent = parent
985
+ if instance_id is not None:
986
+ request.instance_id = instance_id
987
+ if instance is not None:
988
+ request.instance = instance
989
+ if clusters is not None:
990
+ request.clusters = clusters
991
+
992
+ # Wrap the RPC method; this adds retry and timeout information,
993
+ # and friendly error handling.
994
+ rpc = self._transport._wrapped_methods[self._transport.create_instance]
995
+
996
+ # Certain fields should be provided within the metadata header;
997
+ # add these here.
998
+ metadata = tuple(metadata) + (
999
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
1000
+ )
1001
+
1002
+ # Validate the universe domain.
1003
+ self._validate_universe_domain()
1004
+
1005
+ # Send the request.
1006
+ response = rpc(
1007
+ request,
1008
+ retry=retry,
1009
+ timeout=timeout,
1010
+ metadata=metadata,
1011
+ )
1012
+
1013
+ # Wrap the response in an operation future.
1014
+ response = operation.from_gapic(
1015
+ response,
1016
+ self._transport.operations_client,
1017
+ gba_instance.Instance,
1018
+ metadata_type=bigtable_instance_admin.CreateInstanceMetadata,
1019
+ )
1020
+
1021
+ # Done; return the response.
1022
+ return response
1023
+
1024
+ def get_instance(
1025
+ self,
1026
+ request: Optional[
1027
+ Union[bigtable_instance_admin.GetInstanceRequest, dict]
1028
+ ] = None,
1029
+ *,
1030
+ name: Optional[str] = None,
1031
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1032
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1033
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1034
+ ) -> instance.Instance:
1035
+ r"""Gets information about an instance.
1036
+
1037
+ Args:
1038
+ request (Union[google.cloud.bigtable_admin_v2.types.GetInstanceRequest, dict]):
1039
+ The request object. Request message for
1040
+ BigtableInstanceAdmin.GetInstance.
1041
+ name (str):
1042
+ Required. The unique name of the requested instance.
1043
+ Values are of the form
1044
+ ``projects/{project}/instances/{instance}``.
1045
+
1046
+ This corresponds to the ``name`` field
1047
+ on the ``request`` instance; if ``request`` is provided, this
1048
+ should not be set.
1049
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1050
+ should be retried.
1051
+ timeout (float): The timeout for this request.
1052
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1053
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1054
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1055
+ be of type `bytes`.
1056
+
1057
+ Returns:
1058
+ google.cloud.bigtable_admin_v2.types.Instance:
1059
+ A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and
1060
+ the resources that serve them. All tables in an
1061
+ instance are served from all
1062
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
1063
+ instance.
1064
+
1065
+ """
1066
+ # Create or coerce a protobuf request object.
1067
+ # - Quick check: If we got a request object, we should *not* have
1068
+ # gotten any keyword arguments that map to the request.
1069
+ flattened_params = [name]
1070
+ has_flattened_params = (
1071
+ len([param for param in flattened_params if param is not None]) > 0
1072
+ )
1073
+ if request is not None and has_flattened_params:
1074
+ raise ValueError(
1075
+ "If the `request` argument is set, then none of "
1076
+ "the individual field arguments should be set."
1077
+ )
1078
+
1079
+ # - Use the request object if provided (there's no risk of modifying the input as
1080
+ # there are no flattened fields), or create one.
1081
+ if not isinstance(request, bigtable_instance_admin.GetInstanceRequest):
1082
+ request = bigtable_instance_admin.GetInstanceRequest(request)
1083
+ # If we have keyword arguments corresponding to fields on the
1084
+ # request, apply these.
1085
+ if name is not None:
1086
+ request.name = name
1087
+
1088
+ # Wrap the RPC method; this adds retry and timeout information,
1089
+ # and friendly error handling.
1090
+ rpc = self._transport._wrapped_methods[self._transport.get_instance]
1091
+
1092
+ # Certain fields should be provided within the metadata header;
1093
+ # add these here.
1094
+ metadata = tuple(metadata) + (
1095
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1096
+ )
1097
+
1098
+ # Validate the universe domain.
1099
+ self._validate_universe_domain()
1100
+
1101
+ # Send the request.
1102
+ response = rpc(
1103
+ request,
1104
+ retry=retry,
1105
+ timeout=timeout,
1106
+ metadata=metadata,
1107
+ )
1108
+
1109
+ # Done; return the response.
1110
+ return response
1111
+
1112
+ def list_instances(
1113
+ self,
1114
+ request: Optional[
1115
+ Union[bigtable_instance_admin.ListInstancesRequest, dict]
1116
+ ] = None,
1117
+ *,
1118
+ parent: Optional[str] = None,
1119
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1120
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1121
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1122
+ ) -> bigtable_instance_admin.ListInstancesResponse:
1123
+ r"""Lists information about instances in a project.
1124
+
1125
+ Args:
1126
+ request (Union[google.cloud.bigtable_admin_v2.types.ListInstancesRequest, dict]):
1127
+ The request object. Request message for
1128
+ BigtableInstanceAdmin.ListInstances.
1129
+ parent (str):
1130
+ Required. The unique name of the project for which a
1131
+ list of instances is requested. Values are of the form
1132
+ ``projects/{project}``.
1133
+
1134
+ This corresponds to the ``parent`` field
1135
+ on the ``request`` instance; if ``request`` is provided, this
1136
+ should not be set.
1137
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1138
+ should be retried.
1139
+ timeout (float): The timeout for this request.
1140
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1141
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1142
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1143
+ be of type `bytes`.
1144
+
1145
+ Returns:
1146
+ google.cloud.bigtable_admin_v2.types.ListInstancesResponse:
1147
+ Response message for
1148
+ BigtableInstanceAdmin.ListInstances.
1149
+
1150
+ """
1151
+ # Create or coerce a protobuf request object.
1152
+ # - Quick check: If we got a request object, we should *not* have
1153
+ # gotten any keyword arguments that map to the request.
1154
+ flattened_params = [parent]
1155
+ has_flattened_params = (
1156
+ len([param for param in flattened_params if param is not None]) > 0
1157
+ )
1158
+ if request is not None and has_flattened_params:
1159
+ raise ValueError(
1160
+ "If the `request` argument is set, then none of "
1161
+ "the individual field arguments should be set."
1162
+ )
1163
+
1164
+ # - Use the request object if provided (there's no risk of modifying the input as
1165
+ # there are no flattened fields), or create one.
1166
+ if not isinstance(request, bigtable_instance_admin.ListInstancesRequest):
1167
+ request = bigtable_instance_admin.ListInstancesRequest(request)
1168
+ # If we have keyword arguments corresponding to fields on the
1169
+ # request, apply these.
1170
+ if parent is not None:
1171
+ request.parent = parent
1172
+
1173
+ # Wrap the RPC method; this adds retry and timeout information,
1174
+ # and friendly error handling.
1175
+ rpc = self._transport._wrapped_methods[self._transport.list_instances]
1176
+
1177
+ # Certain fields should be provided within the metadata header;
1178
+ # add these here.
1179
+ metadata = tuple(metadata) + (
1180
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
1181
+ )
1182
+
1183
+ # Validate the universe domain.
1184
+ self._validate_universe_domain()
1185
+
1186
+ # Send the request.
1187
+ response = rpc(
1188
+ request,
1189
+ retry=retry,
1190
+ timeout=timeout,
1191
+ metadata=metadata,
1192
+ )
1193
+
1194
+ # Done; return the response.
1195
+ return response
1196
+
1197
+ def update_instance(
1198
+ self,
1199
+ request: Optional[Union[instance.Instance, dict]] = None,
1200
+ *,
1201
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1202
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1203
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1204
+ ) -> instance.Instance:
1205
+ r"""Updates an instance within a project. This method
1206
+ updates only the display name and type for an Instance.
1207
+ To update other Instance properties, such as labels, use
1208
+ PartialUpdateInstance.
1209
+
1210
+ Args:
1211
+ request (Union[google.cloud.bigtable_admin_v2.types.Instance, dict]):
1212
+ The request object. A collection of Bigtable
1213
+ [Tables][google.bigtable.admin.v2.Table] and the
1214
+ resources that serve them. All tables in an instance are
1215
+ served from all
1216
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
1217
+ instance.
1218
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1219
+ should be retried.
1220
+ timeout (float): The timeout for this request.
1221
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1222
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1223
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1224
+ be of type `bytes`.
1225
+
1226
+ Returns:
1227
+ google.cloud.bigtable_admin_v2.types.Instance:
1228
+ A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and
1229
+ the resources that serve them. All tables in an
1230
+ instance are served from all
1231
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
1232
+ instance.
1233
+
1234
+ """
1235
+ # Create or coerce a protobuf request object.
1236
+ # - Use the request object if provided (there's no risk of modifying the input as
1237
+ # there are no flattened fields), or create one.
1238
+ if not isinstance(request, instance.Instance):
1239
+ request = instance.Instance(request)
1240
+
1241
+ # Wrap the RPC method; this adds retry and timeout information,
1242
+ # and friendly error handling.
1243
+ rpc = self._transport._wrapped_methods[self._transport.update_instance]
1244
+
1245
+ # Certain fields should be provided within the metadata header;
1246
+ # add these here.
1247
+ metadata = tuple(metadata) + (
1248
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1249
+ )
1250
+
1251
+ # Validate the universe domain.
1252
+ self._validate_universe_domain()
1253
+
1254
+ # Send the request.
1255
+ response = rpc(
1256
+ request,
1257
+ retry=retry,
1258
+ timeout=timeout,
1259
+ metadata=metadata,
1260
+ )
1261
+
1262
+ # Done; return the response.
1263
+ return response
1264
+
1265
+ def partial_update_instance(
1266
+ self,
1267
+ request: Optional[
1268
+ Union[bigtable_instance_admin.PartialUpdateInstanceRequest, dict]
1269
+ ] = None,
1270
+ *,
1271
+ instance: Optional[gba_instance.Instance] = None,
1272
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
1273
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1274
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1275
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1276
+ ) -> operation.Operation:
1277
+ r"""Partially updates an instance within a project. This
1278
+ method can modify all fields of an Instance and is the
1279
+ preferred way to update an Instance.
1280
+
1281
+ Args:
1282
+ request (Union[google.cloud.bigtable_admin_v2.types.PartialUpdateInstanceRequest, dict]):
1283
+ The request object. Request message for
1284
+ BigtableInstanceAdmin.PartialUpdateInstance.
1285
+ instance (google.cloud.bigtable_admin_v2.types.Instance):
1286
+ Required. The Instance which will
1287
+ (partially) replace the current value.
1288
+
1289
+ This corresponds to the ``instance`` field
1290
+ on the ``request`` instance; if ``request`` is provided, this
1291
+ should not be set.
1292
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
1293
+ Required. The subset of Instance
1294
+ fields which should be replaced. Must be
1295
+ explicitly set.
1296
+
1297
+ This corresponds to the ``update_mask`` field
1298
+ on the ``request`` instance; if ``request`` is provided, this
1299
+ should not be set.
1300
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1301
+ should be retried.
1302
+ timeout (float): The timeout for this request.
1303
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1304
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1305
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1306
+ be of type `bytes`.
1307
+
1308
+ Returns:
1309
+ google.api_core.operation.Operation:
1310
+ An object representing a long-running operation.
1311
+
1312
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Instance` A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and
1313
+ the resources that serve them. All tables in an
1314
+ instance are served from all
1315
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
1316
+ instance.
1317
+
1318
+ """
1319
+ # Create or coerce a protobuf request object.
1320
+ # - Quick check: If we got a request object, we should *not* have
1321
+ # gotten any keyword arguments that map to the request.
1322
+ flattened_params = [instance, update_mask]
1323
+ has_flattened_params = (
1324
+ len([param for param in flattened_params if param is not None]) > 0
1325
+ )
1326
+ if request is not None and has_flattened_params:
1327
+ raise ValueError(
1328
+ "If the `request` argument is set, then none of "
1329
+ "the individual field arguments should be set."
1330
+ )
1331
+
1332
+ # - Use the request object if provided (there's no risk of modifying the input as
1333
+ # there are no flattened fields), or create one.
1334
+ if not isinstance(
1335
+ request, bigtable_instance_admin.PartialUpdateInstanceRequest
1336
+ ):
1337
+ request = bigtable_instance_admin.PartialUpdateInstanceRequest(request)
1338
+ # If we have keyword arguments corresponding to fields on the
1339
+ # request, apply these.
1340
+ if instance is not None:
1341
+ request.instance = instance
1342
+ if update_mask is not None:
1343
+ request.update_mask = update_mask
1344
+
1345
+ # Wrap the RPC method; this adds retry and timeout information,
1346
+ # and friendly error handling.
1347
+ rpc = self._transport._wrapped_methods[self._transport.partial_update_instance]
1348
+
1349
+ # Certain fields should be provided within the metadata header;
1350
+ # add these here.
1351
+ metadata = tuple(metadata) + (
1352
+ gapic_v1.routing_header.to_grpc_metadata(
1353
+ (("instance.name", request.instance.name),)
1354
+ ),
1355
+ )
1356
+
1357
+ # Validate the universe domain.
1358
+ self._validate_universe_domain()
1359
+
1360
+ # Send the request.
1361
+ response = rpc(
1362
+ request,
1363
+ retry=retry,
1364
+ timeout=timeout,
1365
+ metadata=metadata,
1366
+ )
1367
+
1368
+ # Wrap the response in an operation future.
1369
+ response = operation.from_gapic(
1370
+ response,
1371
+ self._transport.operations_client,
1372
+ gba_instance.Instance,
1373
+ metadata_type=bigtable_instance_admin.UpdateInstanceMetadata,
1374
+ )
1375
+
1376
+ # Done; return the response.
1377
+ return response
1378
+
1379
+ def delete_instance(
1380
+ self,
1381
+ request: Optional[
1382
+ Union[bigtable_instance_admin.DeleteInstanceRequest, dict]
1383
+ ] = None,
1384
+ *,
1385
+ name: Optional[str] = None,
1386
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1387
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1388
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1389
+ ) -> None:
1390
+ r"""Delete an instance from a project.
1391
+
1392
+ Args:
1393
+ request (Union[google.cloud.bigtable_admin_v2.types.DeleteInstanceRequest, dict]):
1394
+ The request object. Request message for
1395
+ BigtableInstanceAdmin.DeleteInstance.
1396
+ name (str):
1397
+ Required. The unique name of the instance to be deleted.
1398
+ Values are of the form
1399
+ ``projects/{project}/instances/{instance}``.
1400
+
1401
+ This corresponds to the ``name`` field
1402
+ on the ``request`` instance; if ``request`` is provided, this
1403
+ should not be set.
1404
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1405
+ should be retried.
1406
+ timeout (float): The timeout for this request.
1407
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1408
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1409
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1410
+ be of type `bytes`.
1411
+ """
1412
+ # Create or coerce a protobuf request object.
1413
+ # - Quick check: If we got a request object, we should *not* have
1414
+ # gotten any keyword arguments that map to the request.
1415
+ flattened_params = [name]
1416
+ has_flattened_params = (
1417
+ len([param for param in flattened_params if param is not None]) > 0
1418
+ )
1419
+ if request is not None and has_flattened_params:
1420
+ raise ValueError(
1421
+ "If the `request` argument is set, then none of "
1422
+ "the individual field arguments should be set."
1423
+ )
1424
+
1425
+ # - Use the request object if provided (there's no risk of modifying the input as
1426
+ # there are no flattened fields), or create one.
1427
+ if not isinstance(request, bigtable_instance_admin.DeleteInstanceRequest):
1428
+ request = bigtable_instance_admin.DeleteInstanceRequest(request)
1429
+ # If we have keyword arguments corresponding to fields on the
1430
+ # request, apply these.
1431
+ if name is not None:
1432
+ request.name = name
1433
+
1434
+ # Wrap the RPC method; this adds retry and timeout information,
1435
+ # and friendly error handling.
1436
+ rpc = self._transport._wrapped_methods[self._transport.delete_instance]
1437
+
1438
+ # Certain fields should be provided within the metadata header;
1439
+ # add these here.
1440
+ metadata = tuple(metadata) + (
1441
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1442
+ )
1443
+
1444
+ # Validate the universe domain.
1445
+ self._validate_universe_domain()
1446
+
1447
+ # Send the request.
1448
+ rpc(
1449
+ request,
1450
+ retry=retry,
1451
+ timeout=timeout,
1452
+ metadata=metadata,
1453
+ )
1454
+
1455
+ def create_cluster(
1456
+ self,
1457
+ request: Optional[
1458
+ Union[bigtable_instance_admin.CreateClusterRequest, dict]
1459
+ ] = None,
1460
+ *,
1461
+ parent: Optional[str] = None,
1462
+ cluster_id: Optional[str] = None,
1463
+ cluster: Optional[instance.Cluster] = None,
1464
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1465
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1466
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1467
+ ) -> operation.Operation:
1468
+ r"""Creates a cluster within an instance.
1469
+
1470
+ Note that exactly one of Cluster.serve_nodes and
1471
+ Cluster.cluster_config.cluster_autoscaling_config can be set. If
1472
+ serve_nodes is set to non-zero, then the cluster is manually
1473
+ scaled. If cluster_config.cluster_autoscaling_config is
1474
+ non-empty, then autoscaling is enabled.
1475
+
1476
+ Args:
1477
+ request (Union[google.cloud.bigtable_admin_v2.types.CreateClusterRequest, dict]):
1478
+ The request object. Request message for
1479
+ BigtableInstanceAdmin.CreateCluster.
1480
+ parent (str):
1481
+ Required. The unique name of the instance in which to
1482
+ create the new cluster. Values are of the form
1483
+ ``projects/{project}/instances/{instance}``.
1484
+
1485
+ This corresponds to the ``parent`` field
1486
+ on the ``request`` instance; if ``request`` is provided, this
1487
+ should not be set.
1488
+ cluster_id (str):
1489
+ Required. The ID to be used when referring to the new
1490
+ cluster within its instance, e.g., just ``mycluster``
1491
+ rather than
1492
+ ``projects/myproject/instances/myinstance/clusters/mycluster``.
1493
+
1494
+ This corresponds to the ``cluster_id`` field
1495
+ on the ``request`` instance; if ``request`` is provided, this
1496
+ should not be set.
1497
+ cluster (google.cloud.bigtable_admin_v2.types.Cluster):
1498
+ Required. The cluster to be created. Fields marked
1499
+ ``OutputOnly`` must be left blank.
1500
+
1501
+ This corresponds to the ``cluster`` field
1502
+ on the ``request`` instance; if ``request`` is provided, this
1503
+ should not be set.
1504
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1505
+ should be retried.
1506
+ timeout (float): The timeout for this request.
1507
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1508
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1509
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1510
+ be of type `bytes`.
1511
+
1512
+ Returns:
1513
+ google.api_core.operation.Operation:
1514
+ An object representing a long-running operation.
1515
+
1516
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Cluster` A resizable group of nodes in a particular cloud location, capable
1517
+ of serving all
1518
+ [Tables][google.bigtable.admin.v2.Table] in the
1519
+ parent [Instance][google.bigtable.admin.v2.Instance].
1520
+
1521
+ """
1522
+ # Create or coerce a protobuf request object.
1523
+ # - Quick check: If we got a request object, we should *not* have
1524
+ # gotten any keyword arguments that map to the request.
1525
+ flattened_params = [parent, cluster_id, cluster]
1526
+ has_flattened_params = (
1527
+ len([param for param in flattened_params if param is not None]) > 0
1528
+ )
1529
+ if request is not None and has_flattened_params:
1530
+ raise ValueError(
1531
+ "If the `request` argument is set, then none of "
1532
+ "the individual field arguments should be set."
1533
+ )
1534
+
1535
+ # - Use the request object if provided (there's no risk of modifying the input as
1536
+ # there are no flattened fields), or create one.
1537
+ if not isinstance(request, bigtable_instance_admin.CreateClusterRequest):
1538
+ request = bigtable_instance_admin.CreateClusterRequest(request)
1539
+ # If we have keyword arguments corresponding to fields on the
1540
+ # request, apply these.
1541
+ if parent is not None:
1542
+ request.parent = parent
1543
+ if cluster_id is not None:
1544
+ request.cluster_id = cluster_id
1545
+ if cluster is not None:
1546
+ request.cluster = cluster
1547
+
1548
+ # Wrap the RPC method; this adds retry and timeout information,
1549
+ # and friendly error handling.
1550
+ rpc = self._transport._wrapped_methods[self._transport.create_cluster]
1551
+
1552
+ # Certain fields should be provided within the metadata header;
1553
+ # add these here.
1554
+ metadata = tuple(metadata) + (
1555
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
1556
+ )
1557
+
1558
+ # Validate the universe domain.
1559
+ self._validate_universe_domain()
1560
+
1561
+ # Send the request.
1562
+ response = rpc(
1563
+ request,
1564
+ retry=retry,
1565
+ timeout=timeout,
1566
+ metadata=metadata,
1567
+ )
1568
+
1569
+ # Wrap the response in an operation future.
1570
+ response = operation.from_gapic(
1571
+ response,
1572
+ self._transport.operations_client,
1573
+ instance.Cluster,
1574
+ metadata_type=bigtable_instance_admin.CreateClusterMetadata,
1575
+ )
1576
+
1577
+ # Done; return the response.
1578
+ return response
1579
+
1580
+ def get_cluster(
1581
+ self,
1582
+ request: Optional[
1583
+ Union[bigtable_instance_admin.GetClusterRequest, dict]
1584
+ ] = None,
1585
+ *,
1586
+ name: Optional[str] = None,
1587
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1588
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1589
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1590
+ ) -> instance.Cluster:
1591
+ r"""Gets information about a cluster.
1592
+
1593
+ Args:
1594
+ request (Union[google.cloud.bigtable_admin_v2.types.GetClusterRequest, dict]):
1595
+ The request object. Request message for
1596
+ BigtableInstanceAdmin.GetCluster.
1597
+ name (str):
1598
+ Required. The unique name of the requested cluster.
1599
+ Values are of the form
1600
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
1601
+
1602
+ This corresponds to the ``name`` field
1603
+ on the ``request`` instance; if ``request`` is provided, this
1604
+ should not be set.
1605
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1606
+ should be retried.
1607
+ timeout (float): The timeout for this request.
1608
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1609
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1610
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1611
+ be of type `bytes`.
1612
+
1613
+ Returns:
1614
+ google.cloud.bigtable_admin_v2.types.Cluster:
1615
+ A resizable group of nodes in a particular cloud location, capable
1616
+ of serving all
1617
+ [Tables][google.bigtable.admin.v2.Table] in the
1618
+ parent [Instance][google.bigtable.admin.v2.Instance].
1619
+
1620
+ """
1621
+ # Create or coerce a protobuf request object.
1622
+ # - Quick check: If we got a request object, we should *not* have
1623
+ # gotten any keyword arguments that map to the request.
1624
+ flattened_params = [name]
1625
+ has_flattened_params = (
1626
+ len([param for param in flattened_params if param is not None]) > 0
1627
+ )
1628
+ if request is not None and has_flattened_params:
1629
+ raise ValueError(
1630
+ "If the `request` argument is set, then none of "
1631
+ "the individual field arguments should be set."
1632
+ )
1633
+
1634
+ # - Use the request object if provided (there's no risk of modifying the input as
1635
+ # there are no flattened fields), or create one.
1636
+ if not isinstance(request, bigtable_instance_admin.GetClusterRequest):
1637
+ request = bigtable_instance_admin.GetClusterRequest(request)
1638
+ # If we have keyword arguments corresponding to fields on the
1639
+ # request, apply these.
1640
+ if name is not None:
1641
+ request.name = name
1642
+
1643
+ # Wrap the RPC method; this adds retry and timeout information,
1644
+ # and friendly error handling.
1645
+ rpc = self._transport._wrapped_methods[self._transport.get_cluster]
1646
+
1647
+ # Certain fields should be provided within the metadata header;
1648
+ # add these here.
1649
+ metadata = tuple(metadata) + (
1650
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1651
+ )
1652
+
1653
+ # Validate the universe domain.
1654
+ self._validate_universe_domain()
1655
+
1656
+ # Send the request.
1657
+ response = rpc(
1658
+ request,
1659
+ retry=retry,
1660
+ timeout=timeout,
1661
+ metadata=metadata,
1662
+ )
1663
+
1664
+ # Done; return the response.
1665
+ return response
1666
+
1667
+ def list_clusters(
1668
+ self,
1669
+ request: Optional[
1670
+ Union[bigtable_instance_admin.ListClustersRequest, dict]
1671
+ ] = None,
1672
+ *,
1673
+ parent: Optional[str] = None,
1674
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1675
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1676
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1677
+ ) -> bigtable_instance_admin.ListClustersResponse:
1678
+ r"""Lists information about clusters in an instance.
1679
+
1680
+ Args:
1681
+ request (Union[google.cloud.bigtable_admin_v2.types.ListClustersRequest, dict]):
1682
+ The request object. Request message for
1683
+ BigtableInstanceAdmin.ListClusters.
1684
+ parent (str):
1685
+ Required. The unique name of the instance for which a
1686
+ list of clusters is requested. Values are of the form
1687
+ ``projects/{project}/instances/{instance}``. Use
1688
+ ``{instance} = '-'`` to list Clusters for all Instances
1689
+ in a project, e.g., ``projects/myproject/instances/-``.
1690
+
1691
+ This corresponds to the ``parent`` field
1692
+ on the ``request`` instance; if ``request`` is provided, this
1693
+ should not be set.
1694
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1695
+ should be retried.
1696
+ timeout (float): The timeout for this request.
1697
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1698
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1699
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1700
+ be of type `bytes`.
1701
+
1702
+ Returns:
1703
+ google.cloud.bigtable_admin_v2.types.ListClustersResponse:
1704
+ Response message for
1705
+ BigtableInstanceAdmin.ListClusters.
1706
+
1707
+ """
1708
+ # Create or coerce a protobuf request object.
1709
+ # - Quick check: If we got a request object, we should *not* have
1710
+ # gotten any keyword arguments that map to the request.
1711
+ flattened_params = [parent]
1712
+ has_flattened_params = (
1713
+ len([param for param in flattened_params if param is not None]) > 0
1714
+ )
1715
+ if request is not None and has_flattened_params:
1716
+ raise ValueError(
1717
+ "If the `request` argument is set, then none of "
1718
+ "the individual field arguments should be set."
1719
+ )
1720
+
1721
+ # - Use the request object if provided (there's no risk of modifying the input as
1722
+ # there are no flattened fields), or create one.
1723
+ if not isinstance(request, bigtable_instance_admin.ListClustersRequest):
1724
+ request = bigtable_instance_admin.ListClustersRequest(request)
1725
+ # If we have keyword arguments corresponding to fields on the
1726
+ # request, apply these.
1727
+ if parent is not None:
1728
+ request.parent = parent
1729
+
1730
+ # Wrap the RPC method; this adds retry and timeout information,
1731
+ # and friendly error handling.
1732
+ rpc = self._transport._wrapped_methods[self._transport.list_clusters]
1733
+
1734
+ # Certain fields should be provided within the metadata header;
1735
+ # add these here.
1736
+ metadata = tuple(metadata) + (
1737
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
1738
+ )
1739
+
1740
+ # Validate the universe domain.
1741
+ self._validate_universe_domain()
1742
+
1743
+ # Send the request.
1744
+ response = rpc(
1745
+ request,
1746
+ retry=retry,
1747
+ timeout=timeout,
1748
+ metadata=metadata,
1749
+ )
1750
+
1751
+ # Done; return the response.
1752
+ return response
1753
+
1754
+ def update_cluster(
1755
+ self,
1756
+ request: Optional[Union[instance.Cluster, dict]] = None,
1757
+ *,
1758
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1759
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1760
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1761
+ ) -> operation.Operation:
1762
+ r"""Updates a cluster within an instance.
1763
+
1764
+ Note that UpdateCluster does not support updating
1765
+ cluster_config.cluster_autoscaling_config. In order to update
1766
+ it, you must use PartialUpdateCluster.
1767
+
1768
+ Args:
1769
+ request (Union[google.cloud.bigtable_admin_v2.types.Cluster, dict]):
1770
+ The request object. A resizable group of nodes in a particular cloud
1771
+ location, capable of serving all
1772
+ [Tables][google.bigtable.admin.v2.Table] in the parent
1773
+ [Instance][google.bigtable.admin.v2.Instance].
1774
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1775
+ should be retried.
1776
+ timeout (float): The timeout for this request.
1777
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1778
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1779
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1780
+ be of type `bytes`.
1781
+
1782
+ Returns:
1783
+ google.api_core.operation.Operation:
1784
+ An object representing a long-running operation.
1785
+
1786
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Cluster` A resizable group of nodes in a particular cloud location, capable
1787
+ of serving all
1788
+ [Tables][google.bigtable.admin.v2.Table] in the
1789
+ parent [Instance][google.bigtable.admin.v2.Instance].
1790
+
1791
+ """
1792
+ # Create or coerce a protobuf request object.
1793
+ # - Use the request object if provided (there's no risk of modifying the input as
1794
+ # there are no flattened fields), or create one.
1795
+ if not isinstance(request, instance.Cluster):
1796
+ request = instance.Cluster(request)
1797
+
1798
+ # Wrap the RPC method; this adds retry and timeout information,
1799
+ # and friendly error handling.
1800
+ rpc = self._transport._wrapped_methods[self._transport.update_cluster]
1801
+
1802
+ # Certain fields should be provided within the metadata header;
1803
+ # add these here.
1804
+ metadata = tuple(metadata) + (
1805
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1806
+ )
1807
+
1808
+ # Validate the universe domain.
1809
+ self._validate_universe_domain()
1810
+
1811
+ # Send the request.
1812
+ response = rpc(
1813
+ request,
1814
+ retry=retry,
1815
+ timeout=timeout,
1816
+ metadata=metadata,
1817
+ )
1818
+
1819
+ # Wrap the response in an operation future.
1820
+ response = operation.from_gapic(
1821
+ response,
1822
+ self._transport.operations_client,
1823
+ instance.Cluster,
1824
+ metadata_type=bigtable_instance_admin.UpdateClusterMetadata,
1825
+ )
1826
+
1827
+ # Done; return the response.
1828
+ return response
1829
+
1830
+ def partial_update_cluster(
1831
+ self,
1832
+ request: Optional[
1833
+ Union[bigtable_instance_admin.PartialUpdateClusterRequest, dict]
1834
+ ] = None,
1835
+ *,
1836
+ cluster: Optional[instance.Cluster] = None,
1837
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
1838
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1839
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1840
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1841
+ ) -> operation.Operation:
1842
+ r"""Partially updates a cluster within a project. This method is the
1843
+ preferred way to update a Cluster.
1844
+
1845
+ To enable and update autoscaling, set
1846
+ cluster_config.cluster_autoscaling_config. When autoscaling is
1847
+ enabled, serve_nodes is treated as an OUTPUT_ONLY field, meaning
1848
+ that updates to it are ignored. Note that an update cannot
1849
+ simultaneously set serve_nodes to non-zero and
1850
+ cluster_config.cluster_autoscaling_config to non-empty, and also
1851
+ specify both in the update_mask.
1852
+
1853
+ To disable autoscaling, clear
1854
+ cluster_config.cluster_autoscaling_config, and explicitly set a
1855
+ serve_node count via the update_mask.
1856
+
1857
+ Args:
1858
+ request (Union[google.cloud.bigtable_admin_v2.types.PartialUpdateClusterRequest, dict]):
1859
+ The request object. Request message for
1860
+ BigtableInstanceAdmin.PartialUpdateCluster.
1861
+ cluster (google.cloud.bigtable_admin_v2.types.Cluster):
1862
+ Required. The Cluster which contains the partial updates
1863
+ to be applied, subject to the update_mask.
1864
+
1865
+ This corresponds to the ``cluster`` field
1866
+ on the ``request`` instance; if ``request`` is provided, this
1867
+ should not be set.
1868
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
1869
+ Required. The subset of Cluster
1870
+ fields which should be replaced.
1871
+
1872
+ This corresponds to the ``update_mask`` field
1873
+ on the ``request`` instance; if ``request`` is provided, this
1874
+ should not be set.
1875
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1876
+ should be retried.
1877
+ timeout (float): The timeout for this request.
1878
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1879
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1880
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1881
+ be of type `bytes`.
1882
+
1883
+ Returns:
1884
+ google.api_core.operation.Operation:
1885
+ An object representing a long-running operation.
1886
+
1887
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Cluster` A resizable group of nodes in a particular cloud location, capable
1888
+ of serving all
1889
+ [Tables][google.bigtable.admin.v2.Table] in the
1890
+ parent [Instance][google.bigtable.admin.v2.Instance].
1891
+
1892
+ """
1893
+ # Create or coerce a protobuf request object.
1894
+ # - Quick check: If we got a request object, we should *not* have
1895
+ # gotten any keyword arguments that map to the request.
1896
+ flattened_params = [cluster, update_mask]
1897
+ has_flattened_params = (
1898
+ len([param for param in flattened_params if param is not None]) > 0
1899
+ )
1900
+ if request is not None and has_flattened_params:
1901
+ raise ValueError(
1902
+ "If the `request` argument is set, then none of "
1903
+ "the individual field arguments should be set."
1904
+ )
1905
+
1906
+ # - Use the request object if provided (there's no risk of modifying the input as
1907
+ # there are no flattened fields), or create one.
1908
+ if not isinstance(request, bigtable_instance_admin.PartialUpdateClusterRequest):
1909
+ request = bigtable_instance_admin.PartialUpdateClusterRequest(request)
1910
+ # If we have keyword arguments corresponding to fields on the
1911
+ # request, apply these.
1912
+ if cluster is not None:
1913
+ request.cluster = cluster
1914
+ if update_mask is not None:
1915
+ request.update_mask = update_mask
1916
+
1917
+ # Wrap the RPC method; this adds retry and timeout information,
1918
+ # and friendly error handling.
1919
+ rpc = self._transport._wrapped_methods[self._transport.partial_update_cluster]
1920
+
1921
+ # Certain fields should be provided within the metadata header;
1922
+ # add these here.
1923
+ metadata = tuple(metadata) + (
1924
+ gapic_v1.routing_header.to_grpc_metadata(
1925
+ (("cluster.name", request.cluster.name),)
1926
+ ),
1927
+ )
1928
+
1929
+ # Validate the universe domain.
1930
+ self._validate_universe_domain()
1931
+
1932
+ # Send the request.
1933
+ response = rpc(
1934
+ request,
1935
+ retry=retry,
1936
+ timeout=timeout,
1937
+ metadata=metadata,
1938
+ )
1939
+
1940
+ # Wrap the response in an operation future.
1941
+ response = operation.from_gapic(
1942
+ response,
1943
+ self._transport.operations_client,
1944
+ instance.Cluster,
1945
+ metadata_type=bigtable_instance_admin.PartialUpdateClusterMetadata,
1946
+ )
1947
+
1948
+ # Done; return the response.
1949
+ return response
1950
+
1951
+ def delete_cluster(
1952
+ self,
1953
+ request: Optional[
1954
+ Union[bigtable_instance_admin.DeleteClusterRequest, dict]
1955
+ ] = None,
1956
+ *,
1957
+ name: Optional[str] = None,
1958
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1959
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1960
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1961
+ ) -> None:
1962
+ r"""Deletes a cluster from an instance.
1963
+
1964
+ Args:
1965
+ request (Union[google.cloud.bigtable_admin_v2.types.DeleteClusterRequest, dict]):
1966
+ The request object. Request message for
1967
+ BigtableInstanceAdmin.DeleteCluster.
1968
+ name (str):
1969
+ Required. The unique name of the cluster to be deleted.
1970
+ Values are of the form
1971
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
1972
+
1973
+ This corresponds to the ``name`` field
1974
+ on the ``request`` instance; if ``request`` is provided, this
1975
+ should not be set.
1976
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1977
+ should be retried.
1978
+ timeout (float): The timeout for this request.
1979
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1980
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1981
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1982
+ be of type `bytes`.
1983
+ """
1984
+ # Create or coerce a protobuf request object.
1985
+ # - Quick check: If we got a request object, we should *not* have
1986
+ # gotten any keyword arguments that map to the request.
1987
+ flattened_params = [name]
1988
+ has_flattened_params = (
1989
+ len([param for param in flattened_params if param is not None]) > 0
1990
+ )
1991
+ if request is not None and has_flattened_params:
1992
+ raise ValueError(
1993
+ "If the `request` argument is set, then none of "
1994
+ "the individual field arguments should be set."
1995
+ )
1996
+
1997
+ # - Use the request object if provided (there's no risk of modifying the input as
1998
+ # there are no flattened fields), or create one.
1999
+ if not isinstance(request, bigtable_instance_admin.DeleteClusterRequest):
2000
+ request = bigtable_instance_admin.DeleteClusterRequest(request)
2001
+ # If we have keyword arguments corresponding to fields on the
2002
+ # request, apply these.
2003
+ if name is not None:
2004
+ request.name = name
2005
+
2006
+ # Wrap the RPC method; this adds retry and timeout information,
2007
+ # and friendly error handling.
2008
+ rpc = self._transport._wrapped_methods[self._transport.delete_cluster]
2009
+
2010
+ # Certain fields should be provided within the metadata header;
2011
+ # add these here.
2012
+ metadata = tuple(metadata) + (
2013
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
2014
+ )
2015
+
2016
+ # Validate the universe domain.
2017
+ self._validate_universe_domain()
2018
+
2019
+ # Send the request.
2020
+ rpc(
2021
+ request,
2022
+ retry=retry,
2023
+ timeout=timeout,
2024
+ metadata=metadata,
2025
+ )
2026
+
2027
+ def create_app_profile(
2028
+ self,
2029
+ request: Optional[
2030
+ Union[bigtable_instance_admin.CreateAppProfileRequest, dict]
2031
+ ] = None,
2032
+ *,
2033
+ parent: Optional[str] = None,
2034
+ app_profile_id: Optional[str] = None,
2035
+ app_profile: Optional[instance.AppProfile] = None,
2036
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2037
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2038
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2039
+ ) -> instance.AppProfile:
2040
+ r"""Creates an app profile within an instance.
2041
+
2042
+ Args:
2043
+ request (Union[google.cloud.bigtable_admin_v2.types.CreateAppProfileRequest, dict]):
2044
+ The request object. Request message for
2045
+ BigtableInstanceAdmin.CreateAppProfile.
2046
+ parent (str):
2047
+ Required. The unique name of the instance in which to
2048
+ create the new app profile. Values are of the form
2049
+ ``projects/{project}/instances/{instance}``.
2050
+
2051
+ This corresponds to the ``parent`` field
2052
+ on the ``request`` instance; if ``request`` is provided, this
2053
+ should not be set.
2054
+ app_profile_id (str):
2055
+ Required. The ID to be used when referring to the new
2056
+ app profile within its instance, e.g., just
2057
+ ``myprofile`` rather than
2058
+ ``projects/myproject/instances/myinstance/appProfiles/myprofile``.
2059
+
2060
+ This corresponds to the ``app_profile_id`` field
2061
+ on the ``request`` instance; if ``request`` is provided, this
2062
+ should not be set.
2063
+ app_profile (google.cloud.bigtable_admin_v2.types.AppProfile):
2064
+ Required. The app profile to be created. Fields marked
2065
+ ``OutputOnly`` will be ignored.
2066
+
2067
+ This corresponds to the ``app_profile`` field
2068
+ on the ``request`` instance; if ``request`` is provided, this
2069
+ should not be set.
2070
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2071
+ should be retried.
2072
+ timeout (float): The timeout for this request.
2073
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2074
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2075
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2076
+ be of type `bytes`.
2077
+
2078
+ Returns:
2079
+ google.cloud.bigtable_admin_v2.types.AppProfile:
2080
+ A configuration object describing how
2081
+ Cloud Bigtable should treat traffic from
2082
+ a particular end user application.
2083
+
2084
+ """
2085
+ # Create or coerce a protobuf request object.
2086
+ # - Quick check: If we got a request object, we should *not* have
2087
+ # gotten any keyword arguments that map to the request.
2088
+ flattened_params = [parent, app_profile_id, app_profile]
2089
+ has_flattened_params = (
2090
+ len([param for param in flattened_params if param is not None]) > 0
2091
+ )
2092
+ if request is not None and has_flattened_params:
2093
+ raise ValueError(
2094
+ "If the `request` argument is set, then none of "
2095
+ "the individual field arguments should be set."
2096
+ )
2097
+
2098
+ # - Use the request object if provided (there's no risk of modifying the input as
2099
+ # there are no flattened fields), or create one.
2100
+ if not isinstance(request, bigtable_instance_admin.CreateAppProfileRequest):
2101
+ request = bigtable_instance_admin.CreateAppProfileRequest(request)
2102
+ # If we have keyword arguments corresponding to fields on the
2103
+ # request, apply these.
2104
+ if parent is not None:
2105
+ request.parent = parent
2106
+ if app_profile_id is not None:
2107
+ request.app_profile_id = app_profile_id
2108
+ if app_profile is not None:
2109
+ request.app_profile = app_profile
2110
+
2111
+ # Wrap the RPC method; this adds retry and timeout information,
2112
+ # and friendly error handling.
2113
+ rpc = self._transport._wrapped_methods[self._transport.create_app_profile]
2114
+
2115
+ # Certain fields should be provided within the metadata header;
2116
+ # add these here.
2117
+ metadata = tuple(metadata) + (
2118
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
2119
+ )
2120
+
2121
+ # Validate the universe domain.
2122
+ self._validate_universe_domain()
2123
+
2124
+ # Send the request.
2125
+ response = rpc(
2126
+ request,
2127
+ retry=retry,
2128
+ timeout=timeout,
2129
+ metadata=metadata,
2130
+ )
2131
+
2132
+ # Done; return the response.
2133
+ return response
2134
+
2135
+ def get_app_profile(
2136
+ self,
2137
+ request: Optional[
2138
+ Union[bigtable_instance_admin.GetAppProfileRequest, dict]
2139
+ ] = None,
2140
+ *,
2141
+ name: Optional[str] = None,
2142
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2143
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2144
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2145
+ ) -> instance.AppProfile:
2146
+ r"""Gets information about an app profile.
2147
+
2148
+ Args:
2149
+ request (Union[google.cloud.bigtable_admin_v2.types.GetAppProfileRequest, dict]):
2150
+ The request object. Request message for
2151
+ BigtableInstanceAdmin.GetAppProfile.
2152
+ name (str):
2153
+ Required. The unique name of the requested app profile.
2154
+ Values are of the form
2155
+ ``projects/{project}/instances/{instance}/appProfiles/{app_profile}``.
2156
+
2157
+ This corresponds to the ``name`` field
2158
+ on the ``request`` instance; if ``request`` is provided, this
2159
+ should not be set.
2160
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2161
+ should be retried.
2162
+ timeout (float): The timeout for this request.
2163
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2164
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2165
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2166
+ be of type `bytes`.
2167
+
2168
+ Returns:
2169
+ google.cloud.bigtable_admin_v2.types.AppProfile:
2170
+ A configuration object describing how
2171
+ Cloud Bigtable should treat traffic from
2172
+ a particular end user application.
2173
+
2174
+ """
2175
+ # Create or coerce a protobuf request object.
2176
+ # - Quick check: If we got a request object, we should *not* have
2177
+ # gotten any keyword arguments that map to the request.
2178
+ flattened_params = [name]
2179
+ has_flattened_params = (
2180
+ len([param for param in flattened_params if param is not None]) > 0
2181
+ )
2182
+ if request is not None and has_flattened_params:
2183
+ raise ValueError(
2184
+ "If the `request` argument is set, then none of "
2185
+ "the individual field arguments should be set."
2186
+ )
2187
+
2188
+ # - Use the request object if provided (there's no risk of modifying the input as
2189
+ # there are no flattened fields), or create one.
2190
+ if not isinstance(request, bigtable_instance_admin.GetAppProfileRequest):
2191
+ request = bigtable_instance_admin.GetAppProfileRequest(request)
2192
+ # If we have keyword arguments corresponding to fields on the
2193
+ # request, apply these.
2194
+ if name is not None:
2195
+ request.name = name
2196
+
2197
+ # Wrap the RPC method; this adds retry and timeout information,
2198
+ # and friendly error handling.
2199
+ rpc = self._transport._wrapped_methods[self._transport.get_app_profile]
2200
+
2201
+ # Certain fields should be provided within the metadata header;
2202
+ # add these here.
2203
+ metadata = tuple(metadata) + (
2204
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
2205
+ )
2206
+
2207
+ # Validate the universe domain.
2208
+ self._validate_universe_domain()
2209
+
2210
+ # Send the request.
2211
+ response = rpc(
2212
+ request,
2213
+ retry=retry,
2214
+ timeout=timeout,
2215
+ metadata=metadata,
2216
+ )
2217
+
2218
+ # Done; return the response.
2219
+ return response
2220
+
2221
+ def list_app_profiles(
2222
+ self,
2223
+ request: Optional[
2224
+ Union[bigtable_instance_admin.ListAppProfilesRequest, dict]
2225
+ ] = None,
2226
+ *,
2227
+ parent: Optional[str] = None,
2228
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2229
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2230
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2231
+ ) -> pagers.ListAppProfilesPager:
2232
+ r"""Lists information about app profiles in an instance.
2233
+
2234
+ Args:
2235
+ request (Union[google.cloud.bigtable_admin_v2.types.ListAppProfilesRequest, dict]):
2236
+ The request object. Request message for
2237
+ BigtableInstanceAdmin.ListAppProfiles.
2238
+ parent (str):
2239
+ Required. The unique name of the instance for which a
2240
+ list of app profiles is requested. Values are of the
2241
+ form ``projects/{project}/instances/{instance}``. Use
2242
+ ``{instance} = '-'`` to list AppProfiles for all
2243
+ Instances in a project, e.g.,
2244
+ ``projects/myproject/instances/-``.
2245
+
2246
+ This corresponds to the ``parent`` field
2247
+ on the ``request`` instance; if ``request`` is provided, this
2248
+ should not be set.
2249
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2250
+ should be retried.
2251
+ timeout (float): The timeout for this request.
2252
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2253
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2254
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2255
+ be of type `bytes`.
2256
+
2257
+ Returns:
2258
+ google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.pagers.ListAppProfilesPager:
2259
+ Response message for
2260
+ BigtableInstanceAdmin.ListAppProfiles.
2261
+ Iterating over this object will yield
2262
+ results and resolve additional pages
2263
+ automatically.
2264
+
2265
+ """
2266
+ # Create or coerce a protobuf request object.
2267
+ # - Quick check: If we got a request object, we should *not* have
2268
+ # gotten any keyword arguments that map to the request.
2269
+ flattened_params = [parent]
2270
+ has_flattened_params = (
2271
+ len([param for param in flattened_params if param is not None]) > 0
2272
+ )
2273
+ if request is not None and has_flattened_params:
2274
+ raise ValueError(
2275
+ "If the `request` argument is set, then none of "
2276
+ "the individual field arguments should be set."
2277
+ )
2278
+
2279
+ # - Use the request object if provided (there's no risk of modifying the input as
2280
+ # there are no flattened fields), or create one.
2281
+ if not isinstance(request, bigtable_instance_admin.ListAppProfilesRequest):
2282
+ request = bigtable_instance_admin.ListAppProfilesRequest(request)
2283
+ # If we have keyword arguments corresponding to fields on the
2284
+ # request, apply these.
2285
+ if parent is not None:
2286
+ request.parent = parent
2287
+
2288
+ # Wrap the RPC method; this adds retry and timeout information,
2289
+ # and friendly error handling.
2290
+ rpc = self._transport._wrapped_methods[self._transport.list_app_profiles]
2291
+
2292
+ # Certain fields should be provided within the metadata header;
2293
+ # add these here.
2294
+ metadata = tuple(metadata) + (
2295
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
2296
+ )
2297
+
2298
+ # Validate the universe domain.
2299
+ self._validate_universe_domain()
2300
+
2301
+ # Send the request.
2302
+ response = rpc(
2303
+ request,
2304
+ retry=retry,
2305
+ timeout=timeout,
2306
+ metadata=metadata,
2307
+ )
2308
+
2309
+ # This method is paged; wrap the response in a pager, which provides
2310
+ # an `__iter__` convenience method.
2311
+ response = pagers.ListAppProfilesPager(
2312
+ method=rpc,
2313
+ request=request,
2314
+ response=response,
2315
+ retry=retry,
2316
+ timeout=timeout,
2317
+ metadata=metadata,
2318
+ )
2319
+
2320
+ # Done; return the response.
2321
+ return response
2322
+
2323
+ def update_app_profile(
2324
+ self,
2325
+ request: Optional[
2326
+ Union[bigtable_instance_admin.UpdateAppProfileRequest, dict]
2327
+ ] = None,
2328
+ *,
2329
+ app_profile: Optional[instance.AppProfile] = None,
2330
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
2331
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2332
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2333
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2334
+ ) -> operation.Operation:
2335
+ r"""Updates an app profile within an instance.
2336
+
2337
+ Args:
2338
+ request (Union[google.cloud.bigtable_admin_v2.types.UpdateAppProfileRequest, dict]):
2339
+ The request object. Request message for
2340
+ BigtableInstanceAdmin.UpdateAppProfile.
2341
+ app_profile (google.cloud.bigtable_admin_v2.types.AppProfile):
2342
+ Required. The app profile which will
2343
+ (partially) replace the current value.
2344
+
2345
+ This corresponds to the ``app_profile`` field
2346
+ on the ``request`` instance; if ``request`` is provided, this
2347
+ should not be set.
2348
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
2349
+ Required. The subset of app profile
2350
+ fields which should be replaced. If
2351
+ unset, all fields will be replaced.
2352
+
2353
+ This corresponds to the ``update_mask`` field
2354
+ on the ``request`` instance; if ``request`` is provided, this
2355
+ should not be set.
2356
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2357
+ should be retried.
2358
+ timeout (float): The timeout for this request.
2359
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2360
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2361
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2362
+ be of type `bytes`.
2363
+
2364
+ Returns:
2365
+ google.api_core.operation.Operation:
2366
+ An object representing a long-running operation.
2367
+
2368
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.AppProfile` A configuration object describing how Cloud Bigtable should treat traffic
2369
+ from a particular end user application.
2370
+
2371
+ """
2372
+ # Create or coerce a protobuf request object.
2373
+ # - Quick check: If we got a request object, we should *not* have
2374
+ # gotten any keyword arguments that map to the request.
2375
+ flattened_params = [app_profile, update_mask]
2376
+ has_flattened_params = (
2377
+ len([param for param in flattened_params if param is not None]) > 0
2378
+ )
2379
+ if request is not None and has_flattened_params:
2380
+ raise ValueError(
2381
+ "If the `request` argument is set, then none of "
2382
+ "the individual field arguments should be set."
2383
+ )
2384
+
2385
+ # - Use the request object if provided (there's no risk of modifying the input as
2386
+ # there are no flattened fields), or create one.
2387
+ if not isinstance(request, bigtable_instance_admin.UpdateAppProfileRequest):
2388
+ request = bigtable_instance_admin.UpdateAppProfileRequest(request)
2389
+ # If we have keyword arguments corresponding to fields on the
2390
+ # request, apply these.
2391
+ if app_profile is not None:
2392
+ request.app_profile = app_profile
2393
+ if update_mask is not None:
2394
+ request.update_mask = update_mask
2395
+
2396
+ # Wrap the RPC method; this adds retry and timeout information,
2397
+ # and friendly error handling.
2398
+ rpc = self._transport._wrapped_methods[self._transport.update_app_profile]
2399
+
2400
+ # Certain fields should be provided within the metadata header;
2401
+ # add these here.
2402
+ metadata = tuple(metadata) + (
2403
+ gapic_v1.routing_header.to_grpc_metadata(
2404
+ (("app_profile.name", request.app_profile.name),)
2405
+ ),
2406
+ )
2407
+
2408
+ # Validate the universe domain.
2409
+ self._validate_universe_domain()
2410
+
2411
+ # Send the request.
2412
+ response = rpc(
2413
+ request,
2414
+ retry=retry,
2415
+ timeout=timeout,
2416
+ metadata=metadata,
2417
+ )
2418
+
2419
+ # Wrap the response in an operation future.
2420
+ response = operation.from_gapic(
2421
+ response,
2422
+ self._transport.operations_client,
2423
+ instance.AppProfile,
2424
+ metadata_type=bigtable_instance_admin.UpdateAppProfileMetadata,
2425
+ )
2426
+
2427
+ # Done; return the response.
2428
+ return response
2429
+
2430
+ def delete_app_profile(
2431
+ self,
2432
+ request: Optional[
2433
+ Union[bigtable_instance_admin.DeleteAppProfileRequest, dict]
2434
+ ] = None,
2435
+ *,
2436
+ name: Optional[str] = None,
2437
+ ignore_warnings: Optional[bool] = None,
2438
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2439
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2440
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2441
+ ) -> None:
2442
+ r"""Deletes an app profile from an instance.
2443
+
2444
+ Args:
2445
+ request (Union[google.cloud.bigtable_admin_v2.types.DeleteAppProfileRequest, dict]):
2446
+ The request object. Request message for
2447
+ BigtableInstanceAdmin.DeleteAppProfile.
2448
+ name (str):
2449
+ Required. The unique name of the app profile to be
2450
+ deleted. Values are of the form
2451
+ ``projects/{project}/instances/{instance}/appProfiles/{app_profile}``.
2452
+
2453
+ This corresponds to the ``name`` field
2454
+ on the ``request`` instance; if ``request`` is provided, this
2455
+ should not be set.
2456
+ ignore_warnings (bool):
2457
+ Required. If true, ignore safety
2458
+ checks when deleting the app profile.
2459
+
2460
+ This corresponds to the ``ignore_warnings`` field
2461
+ on the ``request`` instance; if ``request`` is provided, this
2462
+ should not be set.
2463
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2464
+ should be retried.
2465
+ timeout (float): The timeout for this request.
2466
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2467
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2468
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2469
+ be of type `bytes`.
2470
+ """
2471
+ # Create or coerce a protobuf request object.
2472
+ # - Quick check: If we got a request object, we should *not* have
2473
+ # gotten any keyword arguments that map to the request.
2474
+ flattened_params = [name, ignore_warnings]
2475
+ has_flattened_params = (
2476
+ len([param for param in flattened_params if param is not None]) > 0
2477
+ )
2478
+ if request is not None and has_flattened_params:
2479
+ raise ValueError(
2480
+ "If the `request` argument is set, then none of "
2481
+ "the individual field arguments should be set."
2482
+ )
2483
+
2484
+ # - Use the request object if provided (there's no risk of modifying the input as
2485
+ # there are no flattened fields), or create one.
2486
+ if not isinstance(request, bigtable_instance_admin.DeleteAppProfileRequest):
2487
+ request = bigtable_instance_admin.DeleteAppProfileRequest(request)
2488
+ # If we have keyword arguments corresponding to fields on the
2489
+ # request, apply these.
2490
+ if name is not None:
2491
+ request.name = name
2492
+ if ignore_warnings is not None:
2493
+ request.ignore_warnings = ignore_warnings
2494
+
2495
+ # Wrap the RPC method; this adds retry and timeout information,
2496
+ # and friendly error handling.
2497
+ rpc = self._transport._wrapped_methods[self._transport.delete_app_profile]
2498
+
2499
+ # Certain fields should be provided within the metadata header;
2500
+ # add these here.
2501
+ metadata = tuple(metadata) + (
2502
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
2503
+ )
2504
+
2505
+ # Validate the universe domain.
2506
+ self._validate_universe_domain()
2507
+
2508
+ # Send the request.
2509
+ rpc(
2510
+ request,
2511
+ retry=retry,
2512
+ timeout=timeout,
2513
+ metadata=metadata,
2514
+ )
2515
+
2516
+ def get_iam_policy(
2517
+ self,
2518
+ request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None,
2519
+ *,
2520
+ resource: Optional[str] = None,
2521
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2522
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2523
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2524
+ ) -> policy_pb2.Policy:
2525
+ r"""Gets the access control policy for an instance
2526
+ resource. Returns an empty policy if an instance exists
2527
+ but does not have a policy set.
2528
+
2529
+ Args:
2530
+ request (Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]):
2531
+ The request object. Request message for ``GetIamPolicy`` method.
2532
+ resource (str):
2533
+ REQUIRED: The resource for which the
2534
+ policy is being requested. See the
2535
+ operation documentation for the
2536
+ appropriate value for this field.
2537
+
2538
+ This corresponds to the ``resource`` field
2539
+ on the ``request`` instance; if ``request`` is provided, this
2540
+ should not be set.
2541
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2542
+ should be retried.
2543
+ timeout (float): The timeout for this request.
2544
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2545
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2546
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2547
+ be of type `bytes`.
2548
+
2549
+ Returns:
2550
+ google.iam.v1.policy_pb2.Policy:
2551
+ An Identity and Access Management (IAM) policy, which specifies access
2552
+ controls for Google Cloud resources.
2553
+
2554
+ A Policy is a collection of bindings. A binding binds
2555
+ one or more members, or principals, to a single role.
2556
+ Principals can be user accounts, service accounts,
2557
+ Google groups, and domains (such as G Suite). A role
2558
+ is a named list of permissions; each role can be an
2559
+ IAM predefined role or a user-created custom role.
2560
+
2561
+ For some types of Google Cloud resources, a binding
2562
+ can also specify a condition, which is a logical
2563
+ expression that allows access to a resource only if
2564
+ the expression evaluates to true. A condition can add
2565
+ constraints based on attributes of the request, the
2566
+ resource, or both. To learn which resources support
2567
+ conditions in their IAM policies, see the [IAM
2568
+ documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies).
2569
+
2570
+ **JSON example:**
2571
+
2572
+ :literal:`\` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }`\ \`
2573
+
2574
+ **YAML example:**
2575
+
2576
+ :literal:`\` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3`\ \`
2577
+
2578
+ For a description of IAM and its features, see the
2579
+ [IAM
2580
+ documentation](\ https://cloud.google.com/iam/docs/).
2581
+
2582
+ """
2583
+ # Create or coerce a protobuf request object.
2584
+ # - Quick check: If we got a request object, we should *not* have
2585
+ # gotten any keyword arguments that map to the request.
2586
+ flattened_params = [resource]
2587
+ has_flattened_params = (
2588
+ len([param for param in flattened_params if param is not None]) > 0
2589
+ )
2590
+ if request is not None and has_flattened_params:
2591
+ raise ValueError(
2592
+ "If the `request` argument is set, then none of "
2593
+ "the individual field arguments should be set."
2594
+ )
2595
+
2596
+ if isinstance(request, dict):
2597
+ # - The request isn't a proto-plus wrapped type,
2598
+ # so it must be constructed via keyword expansion.
2599
+ request = iam_policy_pb2.GetIamPolicyRequest(**request)
2600
+ elif not request:
2601
+ # Null request, just make one.
2602
+ request = iam_policy_pb2.GetIamPolicyRequest()
2603
+ if resource is not None:
2604
+ request.resource = resource
2605
+
2606
+ # Wrap the RPC method; this adds retry and timeout information,
2607
+ # and friendly error handling.
2608
+ rpc = self._transport._wrapped_methods[self._transport.get_iam_policy]
2609
+
2610
+ # Certain fields should be provided within the metadata header;
2611
+ # add these here.
2612
+ metadata = tuple(metadata) + (
2613
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
2614
+ )
2615
+
2616
+ # Validate the universe domain.
2617
+ self._validate_universe_domain()
2618
+
2619
+ # Send the request.
2620
+ response = rpc(
2621
+ request,
2622
+ retry=retry,
2623
+ timeout=timeout,
2624
+ metadata=metadata,
2625
+ )
2626
+
2627
+ # Done; return the response.
2628
+ return response
2629
+
2630
+ def set_iam_policy(
2631
+ self,
2632
+ request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None,
2633
+ *,
2634
+ resource: Optional[str] = None,
2635
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2636
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2637
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2638
+ ) -> policy_pb2.Policy:
2639
+ r"""Sets the access control policy on an instance
2640
+ resource. Replaces any existing policy.
2641
+
2642
+ Args:
2643
+ request (Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]):
2644
+ The request object. Request message for ``SetIamPolicy`` method.
2645
+ resource (str):
2646
+ REQUIRED: The resource for which the
2647
+ policy is being specified. See the
2648
+ operation documentation for the
2649
+ appropriate value for this field.
2650
+
2651
+ This corresponds to the ``resource`` field
2652
+ on the ``request`` instance; if ``request`` is provided, this
2653
+ should not be set.
2654
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2655
+ should be retried.
2656
+ timeout (float): The timeout for this request.
2657
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2658
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2659
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2660
+ be of type `bytes`.
2661
+
2662
+ Returns:
2663
+ google.iam.v1.policy_pb2.Policy:
2664
+ An Identity and Access Management (IAM) policy, which specifies access
2665
+ controls for Google Cloud resources.
2666
+
2667
+ A Policy is a collection of bindings. A binding binds
2668
+ one or more members, or principals, to a single role.
2669
+ Principals can be user accounts, service accounts,
2670
+ Google groups, and domains (such as G Suite). A role
2671
+ is a named list of permissions; each role can be an
2672
+ IAM predefined role or a user-created custom role.
2673
+
2674
+ For some types of Google Cloud resources, a binding
2675
+ can also specify a condition, which is a logical
2676
+ expression that allows access to a resource only if
2677
+ the expression evaluates to true. A condition can add
2678
+ constraints based on attributes of the request, the
2679
+ resource, or both. To learn which resources support
2680
+ conditions in their IAM policies, see the [IAM
2681
+ documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies).
2682
+
2683
+ **JSON example:**
2684
+
2685
+ :literal:`\` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }`\ \`
2686
+
2687
+ **YAML example:**
2688
+
2689
+ :literal:`\` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3`\ \`
2690
+
2691
+ For a description of IAM and its features, see the
2692
+ [IAM
2693
+ documentation](\ https://cloud.google.com/iam/docs/).
2694
+
2695
+ """
2696
+ # Create or coerce a protobuf request object.
2697
+ # - Quick check: If we got a request object, we should *not* have
2698
+ # gotten any keyword arguments that map to the request.
2699
+ flattened_params = [resource]
2700
+ has_flattened_params = (
2701
+ len([param for param in flattened_params if param is not None]) > 0
2702
+ )
2703
+ if request is not None and has_flattened_params:
2704
+ raise ValueError(
2705
+ "If the `request` argument is set, then none of "
2706
+ "the individual field arguments should be set."
2707
+ )
2708
+
2709
+ if isinstance(request, dict):
2710
+ # - The request isn't a proto-plus wrapped type,
2711
+ # so it must be constructed via keyword expansion.
2712
+ request = iam_policy_pb2.SetIamPolicyRequest(**request)
2713
+ elif not request:
2714
+ # Null request, just make one.
2715
+ request = iam_policy_pb2.SetIamPolicyRequest()
2716
+ if resource is not None:
2717
+ request.resource = resource
2718
+
2719
+ # Wrap the RPC method; this adds retry and timeout information,
2720
+ # and friendly error handling.
2721
+ rpc = self._transport._wrapped_methods[self._transport.set_iam_policy]
2722
+
2723
+ # Certain fields should be provided within the metadata header;
2724
+ # add these here.
2725
+ metadata = tuple(metadata) + (
2726
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
2727
+ )
2728
+
2729
+ # Validate the universe domain.
2730
+ self._validate_universe_domain()
2731
+
2732
+ # Send the request.
2733
+ response = rpc(
2734
+ request,
2735
+ retry=retry,
2736
+ timeout=timeout,
2737
+ metadata=metadata,
2738
+ )
2739
+
2740
+ # Done; return the response.
2741
+ return response
2742
+
2743
+ def test_iam_permissions(
2744
+ self,
2745
+ request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None,
2746
+ *,
2747
+ resource: Optional[str] = None,
2748
+ permissions: Optional[MutableSequence[str]] = None,
2749
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2750
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2751
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2752
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
2753
+ r"""Returns permissions that the caller has on the
2754
+ specified instance resource.
2755
+
2756
+ Args:
2757
+ request (Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]):
2758
+ The request object. Request message for ``TestIamPermissions`` method.
2759
+ resource (str):
2760
+ REQUIRED: The resource for which the
2761
+ policy detail is being requested. See
2762
+ the operation documentation for the
2763
+ appropriate value for this field.
2764
+
2765
+ This corresponds to the ``resource`` field
2766
+ on the ``request`` instance; if ``request`` is provided, this
2767
+ should not be set.
2768
+ permissions (MutableSequence[str]):
2769
+ The set of permissions to check for the ``resource``.
2770
+ Permissions with wildcards (such as '*' or 'storage.*')
2771
+ are not allowed. For more information see `IAM
2772
+ Overview <https://cloud.google.com/iam/docs/overview#permissions>`__.
2773
+
2774
+ This corresponds to the ``permissions`` field
2775
+ on the ``request`` instance; if ``request`` is provided, this
2776
+ should not be set.
2777
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2778
+ should be retried.
2779
+ timeout (float): The timeout for this request.
2780
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2781
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2782
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2783
+ be of type `bytes`.
2784
+
2785
+ Returns:
2786
+ google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse:
2787
+ Response message for TestIamPermissions method.
2788
+ """
2789
+ # Create or coerce a protobuf request object.
2790
+ # - Quick check: If we got a request object, we should *not* have
2791
+ # gotten any keyword arguments that map to the request.
2792
+ flattened_params = [resource, permissions]
2793
+ has_flattened_params = (
2794
+ len([param for param in flattened_params if param is not None]) > 0
2795
+ )
2796
+ if request is not None and has_flattened_params:
2797
+ raise ValueError(
2798
+ "If the `request` argument is set, then none of "
2799
+ "the individual field arguments should be set."
2800
+ )
2801
+
2802
+ if isinstance(request, dict):
2803
+ # - The request isn't a proto-plus wrapped type,
2804
+ # so it must be constructed via keyword expansion.
2805
+ request = iam_policy_pb2.TestIamPermissionsRequest(**request)
2806
+ elif not request:
2807
+ # Null request, just make one.
2808
+ request = iam_policy_pb2.TestIamPermissionsRequest()
2809
+ if resource is not None:
2810
+ request.resource = resource
2811
+ if permissions:
2812
+ request.permissions.extend(permissions)
2813
+
2814
+ # Wrap the RPC method; this adds retry and timeout information,
2815
+ # and friendly error handling.
2816
+ rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions]
2817
+
2818
+ # Certain fields should be provided within the metadata header;
2819
+ # add these here.
2820
+ metadata = tuple(metadata) + (
2821
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
2822
+ )
2823
+
2824
+ # Validate the universe domain.
2825
+ self._validate_universe_domain()
2826
+
2827
+ # Send the request.
2828
+ response = rpc(
2829
+ request,
2830
+ retry=retry,
2831
+ timeout=timeout,
2832
+ metadata=metadata,
2833
+ )
2834
+
2835
+ # Done; return the response.
2836
+ return response
2837
+
2838
+ def list_hot_tablets(
2839
+ self,
2840
+ request: Optional[
2841
+ Union[bigtable_instance_admin.ListHotTabletsRequest, dict]
2842
+ ] = None,
2843
+ *,
2844
+ parent: Optional[str] = None,
2845
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2846
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2847
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2848
+ ) -> pagers.ListHotTabletsPager:
2849
+ r"""Lists hot tablets in a cluster, within the time range
2850
+ provided. Hot tablets are ordered based on CPU usage.
2851
+
2852
+ Args:
2853
+ request (Union[google.cloud.bigtable_admin_v2.types.ListHotTabletsRequest, dict]):
2854
+ The request object. Request message for
2855
+ BigtableInstanceAdmin.ListHotTablets.
2856
+ parent (str):
2857
+ Required. The cluster name to list hot tablets. Value is
2858
+ in the following form:
2859
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
2860
+
2861
+ This corresponds to the ``parent`` field
2862
+ on the ``request`` instance; if ``request`` is provided, this
2863
+ should not be set.
2864
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2865
+ should be retried.
2866
+ timeout (float): The timeout for this request.
2867
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2868
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2869
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2870
+ be of type `bytes`.
2871
+
2872
+ Returns:
2873
+ google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.pagers.ListHotTabletsPager:
2874
+ Response message for
2875
+ BigtableInstanceAdmin.ListHotTablets.
2876
+ Iterating over this object will yield
2877
+ results and resolve additional pages
2878
+ automatically.
2879
+
2880
+ """
2881
+ # Create or coerce a protobuf request object.
2882
+ # - Quick check: If we got a request object, we should *not* have
2883
+ # gotten any keyword arguments that map to the request.
2884
+ flattened_params = [parent]
2885
+ has_flattened_params = (
2886
+ len([param for param in flattened_params if param is not None]) > 0
2887
+ )
2888
+ if request is not None and has_flattened_params:
2889
+ raise ValueError(
2890
+ "If the `request` argument is set, then none of "
2891
+ "the individual field arguments should be set."
2892
+ )
2893
+
2894
+ # - Use the request object if provided (there's no risk of modifying the input as
2895
+ # there are no flattened fields), or create one.
2896
+ if not isinstance(request, bigtable_instance_admin.ListHotTabletsRequest):
2897
+ request = bigtable_instance_admin.ListHotTabletsRequest(request)
2898
+ # If we have keyword arguments corresponding to fields on the
2899
+ # request, apply these.
2900
+ if parent is not None:
2901
+ request.parent = parent
2902
+
2903
+ # Wrap the RPC method; this adds retry and timeout information,
2904
+ # and friendly error handling.
2905
+ rpc = self._transport._wrapped_methods[self._transport.list_hot_tablets]
2906
+
2907
+ # Certain fields should be provided within the metadata header;
2908
+ # add these here.
2909
+ metadata = tuple(metadata) + (
2910
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
2911
+ )
2912
+
2913
+ # Validate the universe domain.
2914
+ self._validate_universe_domain()
2915
+
2916
+ # Send the request.
2917
+ response = rpc(
2918
+ request,
2919
+ retry=retry,
2920
+ timeout=timeout,
2921
+ metadata=metadata,
2922
+ )
2923
+
2924
+ # This method is paged; wrap the response in a pager, which provides
2925
+ # an `__iter__` convenience method.
2926
+ response = pagers.ListHotTabletsPager(
2927
+ method=rpc,
2928
+ request=request,
2929
+ response=response,
2930
+ retry=retry,
2931
+ timeout=timeout,
2932
+ metadata=metadata,
2933
+ )
2934
+
2935
+ # Done; return the response.
2936
+ return response
2937
+
2938
+ def create_logical_view(
2939
+ self,
2940
+ request: Optional[
2941
+ Union[bigtable_instance_admin.CreateLogicalViewRequest, dict]
2942
+ ] = None,
2943
+ *,
2944
+ parent: Optional[str] = None,
2945
+ logical_view: Optional[instance.LogicalView] = None,
2946
+ logical_view_id: Optional[str] = None,
2947
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2948
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2949
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2950
+ ) -> operation.Operation:
2951
+ r"""Creates a logical view within an instance.
2952
+
2953
+ Args:
2954
+ request (Union[google.cloud.bigtable_admin_v2.types.CreateLogicalViewRequest, dict]):
2955
+ The request object. Request message for
2956
+ BigtableInstanceAdmin.CreateLogicalView.
2957
+ parent (str):
2958
+ Required. The parent instance where this logical view
2959
+ will be created. Format:
2960
+ ``projects/{project}/instances/{instance}``.
2961
+
2962
+ This corresponds to the ``parent`` field
2963
+ on the ``request`` instance; if ``request`` is provided, this
2964
+ should not be set.
2965
+ logical_view (google.cloud.bigtable_admin_v2.types.LogicalView):
2966
+ Required. The logical view to create.
2967
+ This corresponds to the ``logical_view`` field
2968
+ on the ``request`` instance; if ``request`` is provided, this
2969
+ should not be set.
2970
+ logical_view_id (str):
2971
+ Required. The ID to use for the
2972
+ logical view, which will become the
2973
+ final component of the logical view's
2974
+ resource name.
2975
+
2976
+ This corresponds to the ``logical_view_id`` field
2977
+ on the ``request`` instance; if ``request`` is provided, this
2978
+ should not be set.
2979
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2980
+ should be retried.
2981
+ timeout (float): The timeout for this request.
2982
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2983
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2984
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2985
+ be of type `bytes`.
2986
+
2987
+ Returns:
2988
+ google.api_core.operation.Operation:
2989
+ An object representing a long-running operation.
2990
+
2991
+ The result type for the operation will be
2992
+ :class:`google.cloud.bigtable_admin_v2.types.LogicalView`
2993
+ A SQL logical view object that can be referenced in SQL
2994
+ queries.
2995
+
2996
+ """
2997
+ # Create or coerce a protobuf request object.
2998
+ # - Quick check: If we got a request object, we should *not* have
2999
+ # gotten any keyword arguments that map to the request.
3000
+ flattened_params = [parent, logical_view, logical_view_id]
3001
+ has_flattened_params = (
3002
+ len([param for param in flattened_params if param is not None]) > 0
3003
+ )
3004
+ if request is not None and has_flattened_params:
3005
+ raise ValueError(
3006
+ "If the `request` argument is set, then none of "
3007
+ "the individual field arguments should be set."
3008
+ )
3009
+
3010
+ # - Use the request object if provided (there's no risk of modifying the input as
3011
+ # there are no flattened fields), or create one.
3012
+ if not isinstance(request, bigtable_instance_admin.CreateLogicalViewRequest):
3013
+ request = bigtable_instance_admin.CreateLogicalViewRequest(request)
3014
+ # If we have keyword arguments corresponding to fields on the
3015
+ # request, apply these.
3016
+ if parent is not None:
3017
+ request.parent = parent
3018
+ if logical_view is not None:
3019
+ request.logical_view = logical_view
3020
+ if logical_view_id is not None:
3021
+ request.logical_view_id = logical_view_id
3022
+
3023
+ # Wrap the RPC method; this adds retry and timeout information,
3024
+ # and friendly error handling.
3025
+ rpc = self._transport._wrapped_methods[self._transport.create_logical_view]
3026
+
3027
+ # Certain fields should be provided within the metadata header;
3028
+ # add these here.
3029
+ metadata = tuple(metadata) + (
3030
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
3031
+ )
3032
+
3033
+ # Validate the universe domain.
3034
+ self._validate_universe_domain()
3035
+
3036
+ # Send the request.
3037
+ response = rpc(
3038
+ request,
3039
+ retry=retry,
3040
+ timeout=timeout,
3041
+ metadata=metadata,
3042
+ )
3043
+
3044
+ # Wrap the response in an operation future.
3045
+ response = operation.from_gapic(
3046
+ response,
3047
+ self._transport.operations_client,
3048
+ instance.LogicalView,
3049
+ metadata_type=bigtable_instance_admin.CreateLogicalViewMetadata,
3050
+ )
3051
+
3052
+ # Done; return the response.
3053
+ return response
3054
+
3055
+ def get_logical_view(
3056
+ self,
3057
+ request: Optional[
3058
+ Union[bigtable_instance_admin.GetLogicalViewRequest, dict]
3059
+ ] = None,
3060
+ *,
3061
+ name: Optional[str] = None,
3062
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3063
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3064
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3065
+ ) -> instance.LogicalView:
3066
+ r"""Gets information about a logical view.
3067
+
3068
+ Args:
3069
+ request (Union[google.cloud.bigtable_admin_v2.types.GetLogicalViewRequest, dict]):
3070
+ The request object. Request message for
3071
+ BigtableInstanceAdmin.GetLogicalView.
3072
+ name (str):
3073
+ Required. The unique name of the requested logical view.
3074
+ Values are of the form
3075
+ ``projects/{project}/instances/{instance}/logicalViews/{logical_view}``.
3076
+
3077
+ This corresponds to the ``name`` field
3078
+ on the ``request`` instance; if ``request`` is provided, this
3079
+ should not be set.
3080
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3081
+ should be retried.
3082
+ timeout (float): The timeout for this request.
3083
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3084
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3085
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3086
+ be of type `bytes`.
3087
+
3088
+ Returns:
3089
+ google.cloud.bigtable_admin_v2.types.LogicalView:
3090
+ A SQL logical view object that can be
3091
+ referenced in SQL queries.
3092
+
3093
+ """
3094
+ # Create or coerce a protobuf request object.
3095
+ # - Quick check: If we got a request object, we should *not* have
3096
+ # gotten any keyword arguments that map to the request.
3097
+ flattened_params = [name]
3098
+ has_flattened_params = (
3099
+ len([param for param in flattened_params if param is not None]) > 0
3100
+ )
3101
+ if request is not None and has_flattened_params:
3102
+ raise ValueError(
3103
+ "If the `request` argument is set, then none of "
3104
+ "the individual field arguments should be set."
3105
+ )
3106
+
3107
+ # - Use the request object if provided (there's no risk of modifying the input as
3108
+ # there are no flattened fields), or create one.
3109
+ if not isinstance(request, bigtable_instance_admin.GetLogicalViewRequest):
3110
+ request = bigtable_instance_admin.GetLogicalViewRequest(request)
3111
+ # If we have keyword arguments corresponding to fields on the
3112
+ # request, apply these.
3113
+ if name is not None:
3114
+ request.name = name
3115
+
3116
+ # Wrap the RPC method; this adds retry and timeout information,
3117
+ # and friendly error handling.
3118
+ rpc = self._transport._wrapped_methods[self._transport.get_logical_view]
3119
+
3120
+ # Certain fields should be provided within the metadata header;
3121
+ # add these here.
3122
+ metadata = tuple(metadata) + (
3123
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
3124
+ )
3125
+
3126
+ # Validate the universe domain.
3127
+ self._validate_universe_domain()
3128
+
3129
+ # Send the request.
3130
+ response = rpc(
3131
+ request,
3132
+ retry=retry,
3133
+ timeout=timeout,
3134
+ metadata=metadata,
3135
+ )
3136
+
3137
+ # Done; return the response.
3138
+ return response
3139
+
3140
+ def list_logical_views(
3141
+ self,
3142
+ request: Optional[
3143
+ Union[bigtable_instance_admin.ListLogicalViewsRequest, dict]
3144
+ ] = None,
3145
+ *,
3146
+ parent: Optional[str] = None,
3147
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3148
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3149
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3150
+ ) -> pagers.ListLogicalViewsPager:
3151
+ r"""Lists information about logical views in an instance.
3152
+
3153
+ Args:
3154
+ request (Union[google.cloud.bigtable_admin_v2.types.ListLogicalViewsRequest, dict]):
3155
+ The request object. Request message for
3156
+ BigtableInstanceAdmin.ListLogicalViews.
3157
+ parent (str):
3158
+ Required. The unique name of the instance for which the
3159
+ list of logical views is requested. Values are of the
3160
+ form ``projects/{project}/instances/{instance}``.
3161
+
3162
+ This corresponds to the ``parent`` field
3163
+ on the ``request`` instance; if ``request`` is provided, this
3164
+ should not be set.
3165
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3166
+ should be retried.
3167
+ timeout (float): The timeout for this request.
3168
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3169
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3170
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3171
+ be of type `bytes`.
3172
+
3173
+ Returns:
3174
+ google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.pagers.ListLogicalViewsPager:
3175
+ Response message for
3176
+ BigtableInstanceAdmin.ListLogicalViews.
3177
+ Iterating over this object will yield
3178
+ results and resolve additional pages
3179
+ automatically.
3180
+
3181
+ """
3182
+ # Create or coerce a protobuf request object.
3183
+ # - Quick check: If we got a request object, we should *not* have
3184
+ # gotten any keyword arguments that map to the request.
3185
+ flattened_params = [parent]
3186
+ has_flattened_params = (
3187
+ len([param for param in flattened_params if param is not None]) > 0
3188
+ )
3189
+ if request is not None and has_flattened_params:
3190
+ raise ValueError(
3191
+ "If the `request` argument is set, then none of "
3192
+ "the individual field arguments should be set."
3193
+ )
3194
+
3195
+ # - Use the request object if provided (there's no risk of modifying the input as
3196
+ # there are no flattened fields), or create one.
3197
+ if not isinstance(request, bigtable_instance_admin.ListLogicalViewsRequest):
3198
+ request = bigtable_instance_admin.ListLogicalViewsRequest(request)
3199
+ # If we have keyword arguments corresponding to fields on the
3200
+ # request, apply these.
3201
+ if parent is not None:
3202
+ request.parent = parent
3203
+
3204
+ # Wrap the RPC method; this adds retry and timeout information,
3205
+ # and friendly error handling.
3206
+ rpc = self._transport._wrapped_methods[self._transport.list_logical_views]
3207
+
3208
+ # Certain fields should be provided within the metadata header;
3209
+ # add these here.
3210
+ metadata = tuple(metadata) + (
3211
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
3212
+ )
3213
+
3214
+ # Validate the universe domain.
3215
+ self._validate_universe_domain()
3216
+
3217
+ # Send the request.
3218
+ response = rpc(
3219
+ request,
3220
+ retry=retry,
3221
+ timeout=timeout,
3222
+ metadata=metadata,
3223
+ )
3224
+
3225
+ # This method is paged; wrap the response in a pager, which provides
3226
+ # an `__iter__` convenience method.
3227
+ response = pagers.ListLogicalViewsPager(
3228
+ method=rpc,
3229
+ request=request,
3230
+ response=response,
3231
+ retry=retry,
3232
+ timeout=timeout,
3233
+ metadata=metadata,
3234
+ )
3235
+
3236
+ # Done; return the response.
3237
+ return response
3238
+
3239
+ def update_logical_view(
3240
+ self,
3241
+ request: Optional[
3242
+ Union[bigtable_instance_admin.UpdateLogicalViewRequest, dict]
3243
+ ] = None,
3244
+ *,
3245
+ logical_view: Optional[instance.LogicalView] = None,
3246
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
3247
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3248
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3249
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3250
+ ) -> operation.Operation:
3251
+ r"""Updates a logical view within an instance.
3252
+
3253
+ Args:
3254
+ request (Union[google.cloud.bigtable_admin_v2.types.UpdateLogicalViewRequest, dict]):
3255
+ The request object. Request message for
3256
+ BigtableInstanceAdmin.UpdateLogicalView.
3257
+ logical_view (google.cloud.bigtable_admin_v2.types.LogicalView):
3258
+ Required. The logical view to update.
3259
+
3260
+ The logical view's ``name`` field is used to identify
3261
+ the view to update. Format:
3262
+ ``projects/{project}/instances/{instance}/logicalViews/{logical_view}``.
3263
+
3264
+ This corresponds to the ``logical_view`` field
3265
+ on the ``request`` instance; if ``request`` is provided, this
3266
+ should not be set.
3267
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
3268
+ Optional. The list of fields to
3269
+ update.
3270
+
3271
+ This corresponds to the ``update_mask`` field
3272
+ on the ``request`` instance; if ``request`` is provided, this
3273
+ should not be set.
3274
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3275
+ should be retried.
3276
+ timeout (float): The timeout for this request.
3277
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3278
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3279
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3280
+ be of type `bytes`.
3281
+
3282
+ Returns:
3283
+ google.api_core.operation.Operation:
3284
+ An object representing a long-running operation.
3285
+
3286
+ The result type for the operation will be
3287
+ :class:`google.cloud.bigtable_admin_v2.types.LogicalView`
3288
+ A SQL logical view object that can be referenced in SQL
3289
+ queries.
3290
+
3291
+ """
3292
+ # Create or coerce a protobuf request object.
3293
+ # - Quick check: If we got a request object, we should *not* have
3294
+ # gotten any keyword arguments that map to the request.
3295
+ flattened_params = [logical_view, update_mask]
3296
+ has_flattened_params = (
3297
+ len([param for param in flattened_params if param is not None]) > 0
3298
+ )
3299
+ if request is not None and has_flattened_params:
3300
+ raise ValueError(
3301
+ "If the `request` argument is set, then none of "
3302
+ "the individual field arguments should be set."
3303
+ )
3304
+
3305
+ # - Use the request object if provided (there's no risk of modifying the input as
3306
+ # there are no flattened fields), or create one.
3307
+ if not isinstance(request, bigtable_instance_admin.UpdateLogicalViewRequest):
3308
+ request = bigtable_instance_admin.UpdateLogicalViewRequest(request)
3309
+ # If we have keyword arguments corresponding to fields on the
3310
+ # request, apply these.
3311
+ if logical_view is not None:
3312
+ request.logical_view = logical_view
3313
+ if update_mask is not None:
3314
+ request.update_mask = update_mask
3315
+
3316
+ # Wrap the RPC method; this adds retry and timeout information,
3317
+ # and friendly error handling.
3318
+ rpc = self._transport._wrapped_methods[self._transport.update_logical_view]
3319
+
3320
+ # Certain fields should be provided within the metadata header;
3321
+ # add these here.
3322
+ metadata = tuple(metadata) + (
3323
+ gapic_v1.routing_header.to_grpc_metadata(
3324
+ (("logical_view.name", request.logical_view.name),)
3325
+ ),
3326
+ )
3327
+
3328
+ # Validate the universe domain.
3329
+ self._validate_universe_domain()
3330
+
3331
+ # Send the request.
3332
+ response = rpc(
3333
+ request,
3334
+ retry=retry,
3335
+ timeout=timeout,
3336
+ metadata=metadata,
3337
+ )
3338
+
3339
+ # Wrap the response in an operation future.
3340
+ response = operation.from_gapic(
3341
+ response,
3342
+ self._transport.operations_client,
3343
+ instance.LogicalView,
3344
+ metadata_type=bigtable_instance_admin.UpdateLogicalViewMetadata,
3345
+ )
3346
+
3347
+ # Done; return the response.
3348
+ return response
3349
+
3350
+ def delete_logical_view(
3351
+ self,
3352
+ request: Optional[
3353
+ Union[bigtable_instance_admin.DeleteLogicalViewRequest, dict]
3354
+ ] = None,
3355
+ *,
3356
+ name: Optional[str] = None,
3357
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3358
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3359
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3360
+ ) -> None:
3361
+ r"""Deletes a logical view from an instance.
3362
+
3363
+ Args:
3364
+ request (Union[google.cloud.bigtable_admin_v2.types.DeleteLogicalViewRequest, dict]):
3365
+ The request object. Request message for
3366
+ BigtableInstanceAdmin.DeleteLogicalView.
3367
+ name (str):
3368
+ Required. The unique name of the logical view to be
3369
+ deleted. Format:
3370
+ ``projects/{project}/instances/{instance}/logicalViews/{logical_view}``.
3371
+
3372
+ This corresponds to the ``name`` field
3373
+ on the ``request`` instance; if ``request`` is provided, this
3374
+ should not be set.
3375
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3376
+ should be retried.
3377
+ timeout (float): The timeout for this request.
3378
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3379
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3380
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3381
+ be of type `bytes`.
3382
+ """
3383
+ # Create or coerce a protobuf request object.
3384
+ # - Quick check: If we got a request object, we should *not* have
3385
+ # gotten any keyword arguments that map to the request.
3386
+ flattened_params = [name]
3387
+ has_flattened_params = (
3388
+ len([param for param in flattened_params if param is not None]) > 0
3389
+ )
3390
+ if request is not None and has_flattened_params:
3391
+ raise ValueError(
3392
+ "If the `request` argument is set, then none of "
3393
+ "the individual field arguments should be set."
3394
+ )
3395
+
3396
+ # - Use the request object if provided (there's no risk of modifying the input as
3397
+ # there are no flattened fields), or create one.
3398
+ if not isinstance(request, bigtable_instance_admin.DeleteLogicalViewRequest):
3399
+ request = bigtable_instance_admin.DeleteLogicalViewRequest(request)
3400
+ # If we have keyword arguments corresponding to fields on the
3401
+ # request, apply these.
3402
+ if name is not None:
3403
+ request.name = name
3404
+
3405
+ # Wrap the RPC method; this adds retry and timeout information,
3406
+ # and friendly error handling.
3407
+ rpc = self._transport._wrapped_methods[self._transport.delete_logical_view]
3408
+
3409
+ # Certain fields should be provided within the metadata header;
3410
+ # add these here.
3411
+ metadata = tuple(metadata) + (
3412
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
3413
+ )
3414
+
3415
+ # Validate the universe domain.
3416
+ self._validate_universe_domain()
3417
+
3418
+ # Send the request.
3419
+ rpc(
3420
+ request,
3421
+ retry=retry,
3422
+ timeout=timeout,
3423
+ metadata=metadata,
3424
+ )
3425
+
3426
+ def create_materialized_view(
3427
+ self,
3428
+ request: Optional[
3429
+ Union[bigtable_instance_admin.CreateMaterializedViewRequest, dict]
3430
+ ] = None,
3431
+ *,
3432
+ parent: Optional[str] = None,
3433
+ materialized_view: Optional[instance.MaterializedView] = None,
3434
+ materialized_view_id: Optional[str] = None,
3435
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3436
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3437
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3438
+ ) -> operation.Operation:
3439
+ r"""Creates a materialized view within an instance.
3440
+
3441
+ Args:
3442
+ request (Union[google.cloud.bigtable_admin_v2.types.CreateMaterializedViewRequest, dict]):
3443
+ The request object. Request message for
3444
+ BigtableInstanceAdmin.CreateMaterializedView.
3445
+ parent (str):
3446
+ Required. The parent instance where this materialized
3447
+ view will be created. Format:
3448
+ ``projects/{project}/instances/{instance}``.
3449
+
3450
+ This corresponds to the ``parent`` field
3451
+ on the ``request`` instance; if ``request`` is provided, this
3452
+ should not be set.
3453
+ materialized_view (google.cloud.bigtable_admin_v2.types.MaterializedView):
3454
+ Required. The materialized view to
3455
+ create.
3456
+
3457
+ This corresponds to the ``materialized_view`` field
3458
+ on the ``request`` instance; if ``request`` is provided, this
3459
+ should not be set.
3460
+ materialized_view_id (str):
3461
+ Required. The ID to use for the
3462
+ materialized view, which will become the
3463
+ final component of the materialized
3464
+ view's resource name.
3465
+
3466
+ This corresponds to the ``materialized_view_id`` field
3467
+ on the ``request`` instance; if ``request`` is provided, this
3468
+ should not be set.
3469
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3470
+ should be retried.
3471
+ timeout (float): The timeout for this request.
3472
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3473
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3474
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3475
+ be of type `bytes`.
3476
+
3477
+ Returns:
3478
+ google.api_core.operation.Operation:
3479
+ An object representing a long-running operation.
3480
+
3481
+ The result type for the operation will be
3482
+ :class:`google.cloud.bigtable_admin_v2.types.MaterializedView`
3483
+ A materialized view object that can be referenced in SQL
3484
+ queries.
3485
+
3486
+ """
3487
+ # Create or coerce a protobuf request object.
3488
+ # - Quick check: If we got a request object, we should *not* have
3489
+ # gotten any keyword arguments that map to the request.
3490
+ flattened_params = [parent, materialized_view, materialized_view_id]
3491
+ has_flattened_params = (
3492
+ len([param for param in flattened_params if param is not None]) > 0
3493
+ )
3494
+ if request is not None and has_flattened_params:
3495
+ raise ValueError(
3496
+ "If the `request` argument is set, then none of "
3497
+ "the individual field arguments should be set."
3498
+ )
3499
+
3500
+ # - Use the request object if provided (there's no risk of modifying the input as
3501
+ # there are no flattened fields), or create one.
3502
+ if not isinstance(
3503
+ request, bigtable_instance_admin.CreateMaterializedViewRequest
3504
+ ):
3505
+ request = bigtable_instance_admin.CreateMaterializedViewRequest(request)
3506
+ # If we have keyword arguments corresponding to fields on the
3507
+ # request, apply these.
3508
+ if parent is not None:
3509
+ request.parent = parent
3510
+ if materialized_view is not None:
3511
+ request.materialized_view = materialized_view
3512
+ if materialized_view_id is not None:
3513
+ request.materialized_view_id = materialized_view_id
3514
+
3515
+ # Wrap the RPC method; this adds retry and timeout information,
3516
+ # and friendly error handling.
3517
+ rpc = self._transport._wrapped_methods[self._transport.create_materialized_view]
3518
+
3519
+ # Certain fields should be provided within the metadata header;
3520
+ # add these here.
3521
+ metadata = tuple(metadata) + (
3522
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
3523
+ )
3524
+
3525
+ # Validate the universe domain.
3526
+ self._validate_universe_domain()
3527
+
3528
+ # Send the request.
3529
+ response = rpc(
3530
+ request,
3531
+ retry=retry,
3532
+ timeout=timeout,
3533
+ metadata=metadata,
3534
+ )
3535
+
3536
+ # Wrap the response in an operation future.
3537
+ response = operation.from_gapic(
3538
+ response,
3539
+ self._transport.operations_client,
3540
+ instance.MaterializedView,
3541
+ metadata_type=bigtable_instance_admin.CreateMaterializedViewMetadata,
3542
+ )
3543
+
3544
+ # Done; return the response.
3545
+ return response
3546
+
3547
+ def get_materialized_view(
3548
+ self,
3549
+ request: Optional[
3550
+ Union[bigtable_instance_admin.GetMaterializedViewRequest, dict]
3551
+ ] = None,
3552
+ *,
3553
+ name: Optional[str] = None,
3554
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3555
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3556
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3557
+ ) -> instance.MaterializedView:
3558
+ r"""Gets information about a materialized view.
3559
+
3560
+ Args:
3561
+ request (Union[google.cloud.bigtable_admin_v2.types.GetMaterializedViewRequest, dict]):
3562
+ The request object. Request message for
3563
+ BigtableInstanceAdmin.GetMaterializedView.
3564
+ name (str):
3565
+ Required. The unique name of the requested materialized
3566
+ view. Values are of the form
3567
+ ``projects/{project}/instances/{instance}/materializedViews/{materialized_view}``.
3568
+
3569
+ This corresponds to the ``name`` field
3570
+ on the ``request`` instance; if ``request`` is provided, this
3571
+ should not be set.
3572
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3573
+ should be retried.
3574
+ timeout (float): The timeout for this request.
3575
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3576
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3577
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3578
+ be of type `bytes`.
3579
+
3580
+ Returns:
3581
+ google.cloud.bigtable_admin_v2.types.MaterializedView:
3582
+ A materialized view object that can
3583
+ be referenced in SQL queries.
3584
+
3585
+ """
3586
+ # Create or coerce a protobuf request object.
3587
+ # - Quick check: If we got a request object, we should *not* have
3588
+ # gotten any keyword arguments that map to the request.
3589
+ flattened_params = [name]
3590
+ has_flattened_params = (
3591
+ len([param for param in flattened_params if param is not None]) > 0
3592
+ )
3593
+ if request is not None and has_flattened_params:
3594
+ raise ValueError(
3595
+ "If the `request` argument is set, then none of "
3596
+ "the individual field arguments should be set."
3597
+ )
3598
+
3599
+ # - Use the request object if provided (there's no risk of modifying the input as
3600
+ # there are no flattened fields), or create one.
3601
+ if not isinstance(request, bigtable_instance_admin.GetMaterializedViewRequest):
3602
+ request = bigtable_instance_admin.GetMaterializedViewRequest(request)
3603
+ # If we have keyword arguments corresponding to fields on the
3604
+ # request, apply these.
3605
+ if name is not None:
3606
+ request.name = name
3607
+
3608
+ # Wrap the RPC method; this adds retry and timeout information,
3609
+ # and friendly error handling.
3610
+ rpc = self._transport._wrapped_methods[self._transport.get_materialized_view]
3611
+
3612
+ # Certain fields should be provided within the metadata header;
3613
+ # add these here.
3614
+ metadata = tuple(metadata) + (
3615
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
3616
+ )
3617
+
3618
+ # Validate the universe domain.
3619
+ self._validate_universe_domain()
3620
+
3621
+ # Send the request.
3622
+ response = rpc(
3623
+ request,
3624
+ retry=retry,
3625
+ timeout=timeout,
3626
+ metadata=metadata,
3627
+ )
3628
+
3629
+ # Done; return the response.
3630
+ return response
3631
+
3632
+ def list_materialized_views(
3633
+ self,
3634
+ request: Optional[
3635
+ Union[bigtable_instance_admin.ListMaterializedViewsRequest, dict]
3636
+ ] = None,
3637
+ *,
3638
+ parent: Optional[str] = None,
3639
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3640
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3641
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3642
+ ) -> pagers.ListMaterializedViewsPager:
3643
+ r"""Lists information about materialized views in an
3644
+ instance.
3645
+
3646
+ Args:
3647
+ request (Union[google.cloud.bigtable_admin_v2.types.ListMaterializedViewsRequest, dict]):
3648
+ The request object. Request message for
3649
+ BigtableInstanceAdmin.ListMaterializedViews.
3650
+ parent (str):
3651
+ Required. The unique name of the instance for which the
3652
+ list of materialized views is requested. Values are of
3653
+ the form ``projects/{project}/instances/{instance}``.
3654
+
3655
+ This corresponds to the ``parent`` field
3656
+ on the ``request`` instance; if ``request`` is provided, this
3657
+ should not be set.
3658
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3659
+ should be retried.
3660
+ timeout (float): The timeout for this request.
3661
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3662
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3663
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3664
+ be of type `bytes`.
3665
+
3666
+ Returns:
3667
+ google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.pagers.ListMaterializedViewsPager:
3668
+ Response message for
3669
+ BigtableInstanceAdmin.ListMaterializedViews.
3670
+ Iterating over this object will yield
3671
+ results and resolve additional pages
3672
+ automatically.
3673
+
3674
+ """
3675
+ # Create or coerce a protobuf request object.
3676
+ # - Quick check: If we got a request object, we should *not* have
3677
+ # gotten any keyword arguments that map to the request.
3678
+ flattened_params = [parent]
3679
+ has_flattened_params = (
3680
+ len([param for param in flattened_params if param is not None]) > 0
3681
+ )
3682
+ if request is not None and has_flattened_params:
3683
+ raise ValueError(
3684
+ "If the `request` argument is set, then none of "
3685
+ "the individual field arguments should be set."
3686
+ )
3687
+
3688
+ # - Use the request object if provided (there's no risk of modifying the input as
3689
+ # there are no flattened fields), or create one.
3690
+ if not isinstance(
3691
+ request, bigtable_instance_admin.ListMaterializedViewsRequest
3692
+ ):
3693
+ request = bigtable_instance_admin.ListMaterializedViewsRequest(request)
3694
+ # If we have keyword arguments corresponding to fields on the
3695
+ # request, apply these.
3696
+ if parent is not None:
3697
+ request.parent = parent
3698
+
3699
+ # Wrap the RPC method; this adds retry and timeout information,
3700
+ # and friendly error handling.
3701
+ rpc = self._transport._wrapped_methods[self._transport.list_materialized_views]
3702
+
3703
+ # Certain fields should be provided within the metadata header;
3704
+ # add these here.
3705
+ metadata = tuple(metadata) + (
3706
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
3707
+ )
3708
+
3709
+ # Validate the universe domain.
3710
+ self._validate_universe_domain()
3711
+
3712
+ # Send the request.
3713
+ response = rpc(
3714
+ request,
3715
+ retry=retry,
3716
+ timeout=timeout,
3717
+ metadata=metadata,
3718
+ )
3719
+
3720
+ # This method is paged; wrap the response in a pager, which provides
3721
+ # an `__iter__` convenience method.
3722
+ response = pagers.ListMaterializedViewsPager(
3723
+ method=rpc,
3724
+ request=request,
3725
+ response=response,
3726
+ retry=retry,
3727
+ timeout=timeout,
3728
+ metadata=metadata,
3729
+ )
3730
+
3731
+ # Done; return the response.
3732
+ return response
3733
+
3734
+ def update_materialized_view(
3735
+ self,
3736
+ request: Optional[
3737
+ Union[bigtable_instance_admin.UpdateMaterializedViewRequest, dict]
3738
+ ] = None,
3739
+ *,
3740
+ materialized_view: Optional[instance.MaterializedView] = None,
3741
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
3742
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3743
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3744
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3745
+ ) -> operation.Operation:
3746
+ r"""Updates a materialized view within an instance.
3747
+
3748
+ Args:
3749
+ request (Union[google.cloud.bigtable_admin_v2.types.UpdateMaterializedViewRequest, dict]):
3750
+ The request object. Request message for
3751
+ BigtableInstanceAdmin.UpdateMaterializedView.
3752
+ materialized_view (google.cloud.bigtable_admin_v2.types.MaterializedView):
3753
+ Required. The materialized view to update.
3754
+
3755
+ The materialized view's ``name`` field is used to
3756
+ identify the view to update. Format:
3757
+ ``projects/{project}/instances/{instance}/materializedViews/{materialized_view}``.
3758
+
3759
+ This corresponds to the ``materialized_view`` field
3760
+ on the ``request`` instance; if ``request`` is provided, this
3761
+ should not be set.
3762
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
3763
+ Optional. The list of fields to
3764
+ update.
3765
+
3766
+ This corresponds to the ``update_mask`` field
3767
+ on the ``request`` instance; if ``request`` is provided, this
3768
+ should not be set.
3769
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3770
+ should be retried.
3771
+ timeout (float): The timeout for this request.
3772
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3773
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3774
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3775
+ be of type `bytes`.
3776
+
3777
+ Returns:
3778
+ google.api_core.operation.Operation:
3779
+ An object representing a long-running operation.
3780
+
3781
+ The result type for the operation will be
3782
+ :class:`google.cloud.bigtable_admin_v2.types.MaterializedView`
3783
+ A materialized view object that can be referenced in SQL
3784
+ queries.
3785
+
3786
+ """
3787
+ # Create or coerce a protobuf request object.
3788
+ # - Quick check: If we got a request object, we should *not* have
3789
+ # gotten any keyword arguments that map to the request.
3790
+ flattened_params = [materialized_view, update_mask]
3791
+ has_flattened_params = (
3792
+ len([param for param in flattened_params if param is not None]) > 0
3793
+ )
3794
+ if request is not None and has_flattened_params:
3795
+ raise ValueError(
3796
+ "If the `request` argument is set, then none of "
3797
+ "the individual field arguments should be set."
3798
+ )
3799
+
3800
+ # - Use the request object if provided (there's no risk of modifying the input as
3801
+ # there are no flattened fields), or create one.
3802
+ if not isinstance(
3803
+ request, bigtable_instance_admin.UpdateMaterializedViewRequest
3804
+ ):
3805
+ request = bigtable_instance_admin.UpdateMaterializedViewRequest(request)
3806
+ # If we have keyword arguments corresponding to fields on the
3807
+ # request, apply these.
3808
+ if materialized_view is not None:
3809
+ request.materialized_view = materialized_view
3810
+ if update_mask is not None:
3811
+ request.update_mask = update_mask
3812
+
3813
+ # Wrap the RPC method; this adds retry and timeout information,
3814
+ # and friendly error handling.
3815
+ rpc = self._transport._wrapped_methods[self._transport.update_materialized_view]
3816
+
3817
+ # Certain fields should be provided within the metadata header;
3818
+ # add these here.
3819
+ metadata = tuple(metadata) + (
3820
+ gapic_v1.routing_header.to_grpc_metadata(
3821
+ (("materialized_view.name", request.materialized_view.name),)
3822
+ ),
3823
+ )
3824
+
3825
+ # Validate the universe domain.
3826
+ self._validate_universe_domain()
3827
+
3828
+ # Send the request.
3829
+ response = rpc(
3830
+ request,
3831
+ retry=retry,
3832
+ timeout=timeout,
3833
+ metadata=metadata,
3834
+ )
3835
+
3836
+ # Wrap the response in an operation future.
3837
+ response = operation.from_gapic(
3838
+ response,
3839
+ self._transport.operations_client,
3840
+ instance.MaterializedView,
3841
+ metadata_type=bigtable_instance_admin.UpdateMaterializedViewMetadata,
3842
+ )
3843
+
3844
+ # Done; return the response.
3845
+ return response
3846
+
3847
+ def delete_materialized_view(
3848
+ self,
3849
+ request: Optional[
3850
+ Union[bigtable_instance_admin.DeleteMaterializedViewRequest, dict]
3851
+ ] = None,
3852
+ *,
3853
+ name: Optional[str] = None,
3854
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3855
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3856
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3857
+ ) -> None:
3858
+ r"""Deletes a materialized view from an instance.
3859
+
3860
+ Args:
3861
+ request (Union[google.cloud.bigtable_admin_v2.types.DeleteMaterializedViewRequest, dict]):
3862
+ The request object. Request message for
3863
+ BigtableInstanceAdmin.DeleteMaterializedView.
3864
+ name (str):
3865
+ Required. The unique name of the materialized view to be
3866
+ deleted. Format:
3867
+ ``projects/{project}/instances/{instance}/materializedViews/{materialized_view}``.
3868
+
3869
+ This corresponds to the ``name`` field
3870
+ on the ``request`` instance; if ``request`` is provided, this
3871
+ should not be set.
3872
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3873
+ should be retried.
3874
+ timeout (float): The timeout for this request.
3875
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3876
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3877
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3878
+ be of type `bytes`.
3879
+ """
3880
+ # Create or coerce a protobuf request object.
3881
+ # - Quick check: If we got a request object, we should *not* have
3882
+ # gotten any keyword arguments that map to the request.
3883
+ flattened_params = [name]
3884
+ has_flattened_params = (
3885
+ len([param for param in flattened_params if param is not None]) > 0
3886
+ )
3887
+ if request is not None and has_flattened_params:
3888
+ raise ValueError(
3889
+ "If the `request` argument is set, then none of "
3890
+ "the individual field arguments should be set."
3891
+ )
3892
+
3893
+ # - Use the request object if provided (there's no risk of modifying the input as
3894
+ # there are no flattened fields), or create one.
3895
+ if not isinstance(
3896
+ request, bigtable_instance_admin.DeleteMaterializedViewRequest
3897
+ ):
3898
+ request = bigtable_instance_admin.DeleteMaterializedViewRequest(request)
3899
+ # If we have keyword arguments corresponding to fields on the
3900
+ # request, apply these.
3901
+ if name is not None:
3902
+ request.name = name
3903
+
3904
+ # Wrap the RPC method; this adds retry and timeout information,
3905
+ # and friendly error handling.
3906
+ rpc = self._transport._wrapped_methods[self._transport.delete_materialized_view]
3907
+
3908
+ # Certain fields should be provided within the metadata header;
3909
+ # add these here.
3910
+ metadata = tuple(metadata) + (
3911
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
3912
+ )
3913
+
3914
+ # Validate the universe domain.
3915
+ self._validate_universe_domain()
3916
+
3917
+ # Send the request.
3918
+ rpc(
3919
+ request,
3920
+ retry=retry,
3921
+ timeout=timeout,
3922
+ metadata=metadata,
3923
+ )
3924
+
3925
+ def __enter__(self) -> "BigtableInstanceAdminClient":
3926
+ return self
3927
+
3928
+ def __exit__(self, type, value, traceback):
3929
+ """Releases underlying transport's resources.
3930
+
3931
+ .. warning::
3932
+ ONLY use as a context manager if the transport is NOT shared
3933
+ with other clients! Exiting the with block will CLOSE the transport
3934
+ and may cause errors in other clients!
3935
+ """
3936
+ self.transport.close()
3937
+
3938
+
3939
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
3940
+ gapic_version=package_version.__version__
3941
+ )
3942
+
3943
+
3944
+ __all__ = ("BigtableInstanceAdminClient",)