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