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,255 @@
|
|
|
1
|
+
# Copyright 2018 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
import base64
|
|
16
|
+
|
|
17
|
+
from google.api_core.iam import Policy as BasePolicy
|
|
18
|
+
from google.cloud._helpers import _to_bytes # type: ignore
|
|
19
|
+
from google.iam.v1 import policy_pb2 # type: ignore
|
|
20
|
+
|
|
21
|
+
"""IAM roles supported by Bigtable Instance resource"""
|
|
22
|
+
BIGTABLE_ADMIN_ROLE = "roles/bigtable.admin"
|
|
23
|
+
"""Administers all instances within a project, including the data stored
|
|
24
|
+
within tables. Can create new instances. Intended for project administrators.
|
|
25
|
+
"""
|
|
26
|
+
BIGTABLE_USER_ROLE = "roles/bigtable.user"
|
|
27
|
+
"""Provides read-write access to the data stored within tables. Intended for
|
|
28
|
+
application developers or service accounts.
|
|
29
|
+
"""
|
|
30
|
+
BIGTABLE_READER_ROLE = "roles/bigtable.reader"
|
|
31
|
+
"""Provides read-only access to the data stored within tables. Intended for
|
|
32
|
+
data scientists, dashboard generators, and other data-analysis scenarios.
|
|
33
|
+
"""
|
|
34
|
+
BIGTABLE_VIEWER_ROLE = "roles/bigtable.viewer"
|
|
35
|
+
"""Provides no data access. Intended as a minimal set of permissions to access
|
|
36
|
+
the GCP Console for Cloud Bigtable.
|
|
37
|
+
"""
|
|
38
|
+
"""For detailed information
|
|
39
|
+
See
|
|
40
|
+
https://cloud.google.com/bigtable/docs/access-control#roles
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class Policy(BasePolicy):
|
|
45
|
+
"""IAM Policy
|
|
46
|
+
|
|
47
|
+
See
|
|
48
|
+
https://cloud.google.com/bigtable/docs/reference/admin/rpc/google.iam.v1#policy
|
|
49
|
+
|
|
50
|
+
A Policy consists of a list of bindings. A binding binds a list of
|
|
51
|
+
members to a role, where the members can be user accounts, Google
|
|
52
|
+
groups, Google domains, and service accounts. A role is a named list
|
|
53
|
+
of permissions defined by IAM.
|
|
54
|
+
For more information about predefined roles currently supoprted
|
|
55
|
+
by Bigtable Instance please see
|
|
56
|
+
`Predefined roles
|
|
57
|
+
<https://cloud.google.com/bigtable/docs/access-control#roles>`_.
|
|
58
|
+
For more information about custom roles please see
|
|
59
|
+
`Custom roles
|
|
60
|
+
<https://cloud.google.com/bigtable/docs/access-control#custom-roles>`_.
|
|
61
|
+
|
|
62
|
+
:type etag: str
|
|
63
|
+
:param etag: etag is used for optimistic concurrency control as a way to
|
|
64
|
+
help prevent simultaneous updates of a policy from overwriting
|
|
65
|
+
each other. It is strongly suggested that systems make use
|
|
66
|
+
of the etag in the read-modify-write cycle to perform policy
|
|
67
|
+
updates in order to avoid race conditions:
|
|
68
|
+
An etag is returned in the response to getIamPolicy, and
|
|
69
|
+
systems are expected to put that etag in the request to
|
|
70
|
+
setIamPolicy to ensure that their change will be applied to
|
|
71
|
+
the same version of the policy.
|
|
72
|
+
|
|
73
|
+
If no etag is provided in the call to setIamPolicy, then the
|
|
74
|
+
existing policy is overwritten blindly.
|
|
75
|
+
:type version: int
|
|
76
|
+
:param version: The syntax schema version of the policy.
|
|
77
|
+
|
|
78
|
+
Note:
|
|
79
|
+
Using conditions in bindings requires the policy's version to be set
|
|
80
|
+
to `3` or greater, depending on the versions that are currently supported.
|
|
81
|
+
|
|
82
|
+
Accessing the policy using dict operations will raise InvalidOperationException
|
|
83
|
+
when the policy's version is set to 3.
|
|
84
|
+
|
|
85
|
+
Use the policy.bindings getter/setter to retrieve and modify the policy's bindings.
|
|
86
|
+
|
|
87
|
+
See:
|
|
88
|
+
IAM Policy https://cloud.google.com/iam/reference/rest/v1/Policy
|
|
89
|
+
Policy versions https://cloud.google.com/iam/docs/policies#versions
|
|
90
|
+
Conditions overview https://cloud.google.com/iam/docs/conditions-overview.
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
def __init__(self, etag=None, version=None):
|
|
94
|
+
BasePolicy.__init__(
|
|
95
|
+
self, etag=etag if etag is None else _to_bytes(etag), version=version
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
def bigtable_admins(self):
|
|
100
|
+
"""Access to bigtable.admin role memebers
|
|
101
|
+
|
|
102
|
+
Raise InvalidOperationException if version is greater than 1 or policy contains conditions.
|
|
103
|
+
|
|
104
|
+
For example:
|
|
105
|
+
|
|
106
|
+
.. literalinclude:: snippets.py
|
|
107
|
+
:start-after: [START bigtable_api_admins_policy]
|
|
108
|
+
:end-before: [END bigtable_api_admins_policy]
|
|
109
|
+
:dedent: 4
|
|
110
|
+
"""
|
|
111
|
+
result = set()
|
|
112
|
+
for member in self.get(BIGTABLE_ADMIN_ROLE, ()):
|
|
113
|
+
result.add(member)
|
|
114
|
+
return frozenset(result)
|
|
115
|
+
|
|
116
|
+
@property
|
|
117
|
+
def bigtable_readers(self):
|
|
118
|
+
"""Access to bigtable.reader role memebers
|
|
119
|
+
|
|
120
|
+
Raise InvalidOperationException if version is greater than 1 or policy contains conditions.
|
|
121
|
+
|
|
122
|
+
For example:
|
|
123
|
+
|
|
124
|
+
.. literalinclude:: snippets.py
|
|
125
|
+
:start-after: [START bigtable_api_readers_policy]
|
|
126
|
+
:end-before: [END bigtable_api_readers_policy]
|
|
127
|
+
:dedent: 4
|
|
128
|
+
"""
|
|
129
|
+
result = set()
|
|
130
|
+
for member in self.get(BIGTABLE_READER_ROLE, ()):
|
|
131
|
+
result.add(member)
|
|
132
|
+
return frozenset(result)
|
|
133
|
+
|
|
134
|
+
@property
|
|
135
|
+
def bigtable_users(self):
|
|
136
|
+
"""Access to bigtable.user role memebers
|
|
137
|
+
|
|
138
|
+
Raise InvalidOperationException if version is greater than 1 or policy contains conditions.
|
|
139
|
+
|
|
140
|
+
For example:
|
|
141
|
+
|
|
142
|
+
.. literalinclude:: snippets.py
|
|
143
|
+
:start-after: [START bigtable_api_users_policy]
|
|
144
|
+
:end-before: [END bigtable_api_users_policy]
|
|
145
|
+
:dedent: 4
|
|
146
|
+
"""
|
|
147
|
+
result = set()
|
|
148
|
+
for member in self.get(BIGTABLE_USER_ROLE, ()):
|
|
149
|
+
result.add(member)
|
|
150
|
+
return frozenset(result)
|
|
151
|
+
|
|
152
|
+
@property
|
|
153
|
+
def bigtable_viewers(self):
|
|
154
|
+
"""Access to bigtable.viewer role memebers
|
|
155
|
+
|
|
156
|
+
Raise InvalidOperationException if version is greater than 1 or policy contains conditions.
|
|
157
|
+
|
|
158
|
+
For example:
|
|
159
|
+
|
|
160
|
+
.. literalinclude:: snippets.py
|
|
161
|
+
:start-after: [START bigtable_api_viewers_policy]
|
|
162
|
+
:end-before: [END bigtable_api_viewers_policy]
|
|
163
|
+
:dedent: 4
|
|
164
|
+
"""
|
|
165
|
+
result = set()
|
|
166
|
+
for member in self.get(BIGTABLE_VIEWER_ROLE, ()):
|
|
167
|
+
result.add(member)
|
|
168
|
+
return frozenset(result)
|
|
169
|
+
|
|
170
|
+
@classmethod
|
|
171
|
+
def from_pb(cls, policy_pb):
|
|
172
|
+
"""Factory: create a policy from a protobuf message.
|
|
173
|
+
|
|
174
|
+
Args:
|
|
175
|
+
policy_pb (google.iam.policy_pb2.Policy): message returned by
|
|
176
|
+
``get_iam_policy`` gRPC API.
|
|
177
|
+
|
|
178
|
+
Returns:
|
|
179
|
+
:class:`Policy`: the parsed policy
|
|
180
|
+
"""
|
|
181
|
+
policy = cls(policy_pb.etag, policy_pb.version)
|
|
182
|
+
|
|
183
|
+
policy.bindings = bindings = []
|
|
184
|
+
for binding_pb in policy_pb.bindings:
|
|
185
|
+
binding = {"role": binding_pb.role, "members": set(binding_pb.members)}
|
|
186
|
+
condition = binding_pb.condition
|
|
187
|
+
if condition and condition.expression:
|
|
188
|
+
binding["condition"] = {
|
|
189
|
+
"title": condition.title,
|
|
190
|
+
"description": condition.description,
|
|
191
|
+
"expression": condition.expression,
|
|
192
|
+
}
|
|
193
|
+
bindings.append(binding)
|
|
194
|
+
|
|
195
|
+
return policy
|
|
196
|
+
|
|
197
|
+
def to_pb(self):
|
|
198
|
+
"""Render a protobuf message.
|
|
199
|
+
|
|
200
|
+
Returns:
|
|
201
|
+
google.iam.policy_pb2.Policy: a message to be passed to the
|
|
202
|
+
``set_iam_policy`` gRPC API.
|
|
203
|
+
"""
|
|
204
|
+
|
|
205
|
+
return policy_pb2.Policy(
|
|
206
|
+
etag=self.etag,
|
|
207
|
+
version=self.version or 0,
|
|
208
|
+
bindings=[
|
|
209
|
+
policy_pb2.Binding(
|
|
210
|
+
role=binding["role"],
|
|
211
|
+
members=sorted(binding["members"]),
|
|
212
|
+
condition=binding.get("condition"),
|
|
213
|
+
)
|
|
214
|
+
for binding in self.bindings
|
|
215
|
+
if binding["members"]
|
|
216
|
+
],
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
@classmethod
|
|
220
|
+
def from_api_repr(cls, resource):
|
|
221
|
+
"""Factory: create a policy from a JSON resource.
|
|
222
|
+
|
|
223
|
+
Overrides the base class version to store :attr:`etag` as bytes.
|
|
224
|
+
|
|
225
|
+
Args:
|
|
226
|
+
resource (dict): JSON policy resource returned by the
|
|
227
|
+
``getIamPolicy`` REST API.
|
|
228
|
+
|
|
229
|
+
Returns:
|
|
230
|
+
:class:`Policy`: the parsed policy
|
|
231
|
+
"""
|
|
232
|
+
etag = resource.get("etag")
|
|
233
|
+
|
|
234
|
+
if etag is not None:
|
|
235
|
+
resource = resource.copy()
|
|
236
|
+
resource["etag"] = base64.b64decode(etag.encode("ascii"))
|
|
237
|
+
|
|
238
|
+
return super(Policy, cls).from_api_repr(resource)
|
|
239
|
+
|
|
240
|
+
def to_api_repr(self):
|
|
241
|
+
"""Render a JSON policy resource.
|
|
242
|
+
|
|
243
|
+
Overrides the base class version to convert :attr:`etag` from bytes
|
|
244
|
+
to JSON-compatible base64-encoded text.
|
|
245
|
+
|
|
246
|
+
Returns:
|
|
247
|
+
dict: a JSON resource to be passed to the
|
|
248
|
+
``setIamPolicy`` REST API.
|
|
249
|
+
"""
|
|
250
|
+
resource = super(Policy, self).to_api_repr()
|
|
251
|
+
|
|
252
|
+
if self.etag is not None:
|
|
253
|
+
resource["etag"] = base64.b64encode(self.etag).decode("ascii")
|
|
254
|
+
|
|
255
|
+
return resource
|