google-cloud-spanner 3.55.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/spanner.py +47 -0
- google/cloud/spanner_admin_database_v1/__init__.py +146 -0
- google/cloud/spanner_admin_database_v1/gapic_metadata.json +418 -0
- google/cloud/spanner_admin_database_v1/gapic_version.py +16 -0
- google/cloud/spanner_admin_database_v1/py.typed +2 -0
- google/cloud/spanner_admin_database_v1/services/__init__.py +15 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/__init__.py +22 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/async_client.py +4097 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/client.py +4602 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/pagers.py +989 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/transports/__init__.py +38 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/transports/base.py +820 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc.py +1303 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc_asyncio.py +1688 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/transports/rest.py +6512 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/transports/rest_base.py +1650 -0
- google/cloud/spanner_admin_database_v1/types/__init__.py +144 -0
- google/cloud/spanner_admin_database_v1/types/backup.py +1106 -0
- google/cloud/spanner_admin_database_v1/types/backup_schedule.py +369 -0
- google/cloud/spanner_admin_database_v1/types/common.py +180 -0
- google/cloud/spanner_admin_database_v1/types/spanner_database_admin.py +1303 -0
- google/cloud/spanner_admin_instance_v1/__init__.py +110 -0
- google/cloud/spanner_admin_instance_v1/gapic_metadata.json +343 -0
- google/cloud/spanner_admin_instance_v1/gapic_version.py +16 -0
- google/cloud/spanner_admin_instance_v1/py.typed +2 -0
- google/cloud/spanner_admin_instance_v1/services/__init__.py +15 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/__init__.py +22 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/async_client.py +3466 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/client.py +3881 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/pagers.py +856 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/__init__.py +38 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/base.py +545 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc.py +1347 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc_asyncio.py +1539 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/rest.py +4834 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/rest_base.py +1198 -0
- google/cloud/spanner_admin_instance_v1/types/__init__.py +104 -0
- google/cloud/spanner_admin_instance_v1/types/common.py +99 -0
- google/cloud/spanner_admin_instance_v1/types/spanner_instance_admin.py +2375 -0
- google/cloud/spanner_dbapi/__init__.py +93 -0
- google/cloud/spanner_dbapi/_helpers.py +113 -0
- google/cloud/spanner_dbapi/batch_dml_executor.py +135 -0
- google/cloud/spanner_dbapi/checksum.py +80 -0
- google/cloud/spanner_dbapi/client_side_statement_executor.py +140 -0
- google/cloud/spanner_dbapi/client_side_statement_parser.py +106 -0
- google/cloud/spanner_dbapi/connection.py +818 -0
- google/cloud/spanner_dbapi/cursor.py +609 -0
- google/cloud/spanner_dbapi/exceptions.py +172 -0
- google/cloud/spanner_dbapi/parse_utils.py +392 -0
- google/cloud/spanner_dbapi/parsed_statement.py +63 -0
- google/cloud/spanner_dbapi/parser.py +258 -0
- google/cloud/spanner_dbapi/partition_helper.py +41 -0
- google/cloud/spanner_dbapi/transaction_helper.py +294 -0
- google/cloud/spanner_dbapi/types.py +106 -0
- google/cloud/spanner_dbapi/utils.py +147 -0
- google/cloud/spanner_dbapi/version.py +20 -0
- google/cloud/spanner_v1/__init__.py +154 -0
- google/cloud/spanner_v1/_helpers.py +751 -0
- google/cloud/spanner_v1/_opentelemetry_tracing.py +165 -0
- google/cloud/spanner_v1/backup.py +397 -0
- google/cloud/spanner_v1/batch.py +433 -0
- google/cloud/spanner_v1/client.py +538 -0
- google/cloud/spanner_v1/data_types.py +350 -0
- google/cloud/spanner_v1/database.py +1968 -0
- google/cloud/spanner_v1/database_sessions_manager.py +249 -0
- google/cloud/spanner_v1/gapic_metadata.json +268 -0
- google/cloud/spanner_v1/gapic_version.py +16 -0
- google/cloud/spanner_v1/instance.py +735 -0
- google/cloud/spanner_v1/keyset.py +193 -0
- google/cloud/spanner_v1/merged_result_set.py +146 -0
- google/cloud/spanner_v1/metrics/constants.py +71 -0
- google/cloud/spanner_v1/metrics/metrics_capture.py +75 -0
- google/cloud/spanner_v1/metrics/metrics_exporter.py +384 -0
- google/cloud/spanner_v1/metrics/metrics_interceptor.py +156 -0
- google/cloud/spanner_v1/metrics/metrics_tracer.py +588 -0
- google/cloud/spanner_v1/metrics/metrics_tracer_factory.py +328 -0
- google/cloud/spanner_v1/metrics/spanner_metrics_tracer_factory.py +172 -0
- google/cloud/spanner_v1/param_types.py +110 -0
- google/cloud/spanner_v1/pool.py +813 -0
- google/cloud/spanner_v1/py.typed +2 -0
- google/cloud/spanner_v1/request_id_header.py +64 -0
- google/cloud/spanner_v1/services/__init__.py +15 -0
- google/cloud/spanner_v1/services/spanner/__init__.py +22 -0
- google/cloud/spanner_v1/services/spanner/async_client.py +2205 -0
- google/cloud/spanner_v1/services/spanner/client.py +2624 -0
- google/cloud/spanner_v1/services/spanner/pagers.py +196 -0
- google/cloud/spanner_v1/services/spanner/transports/__init__.py +38 -0
- google/cloud/spanner_v1/services/spanner/transports/base.py +520 -0
- google/cloud/spanner_v1/services/spanner/transports/grpc.py +911 -0
- google/cloud/spanner_v1/services/spanner/transports/grpc_asyncio.py +1144 -0
- google/cloud/spanner_v1/services/spanner/transports/rest.py +3468 -0
- google/cloud/spanner_v1/services/spanner/transports/rest_base.py +981 -0
- google/cloud/spanner_v1/session.py +631 -0
- google/cloud/spanner_v1/session_options.py +133 -0
- google/cloud/spanner_v1/snapshot.py +1057 -0
- google/cloud/spanner_v1/streamed.py +402 -0
- google/cloud/spanner_v1/table.py +181 -0
- google/cloud/spanner_v1/testing/__init__.py +0 -0
- google/cloud/spanner_v1/testing/database_test.py +121 -0
- google/cloud/spanner_v1/testing/interceptors.py +118 -0
- google/cloud/spanner_v1/testing/mock_database_admin.py +38 -0
- google/cloud/spanner_v1/testing/mock_spanner.py +261 -0
- google/cloud/spanner_v1/testing/spanner_database_admin_pb2_grpc.py +1267 -0
- google/cloud/spanner_v1/testing/spanner_pb2_grpc.py +882 -0
- google/cloud/spanner_v1/transaction.py +747 -0
- google/cloud/spanner_v1/types/__init__.py +118 -0
- google/cloud/spanner_v1/types/commit_response.py +94 -0
- google/cloud/spanner_v1/types/keys.py +248 -0
- google/cloud/spanner_v1/types/mutation.py +201 -0
- google/cloud/spanner_v1/types/query_plan.py +220 -0
- google/cloud/spanner_v1/types/result_set.py +379 -0
- google/cloud/spanner_v1/types/spanner.py +1815 -0
- google/cloud/spanner_v1/types/transaction.py +818 -0
- google/cloud/spanner_v1/types/type.py +288 -0
- google_cloud_spanner-3.55.0.dist-info/LICENSE +202 -0
- google_cloud_spanner-3.55.0.dist-info/METADATA +318 -0
- google_cloud_spanner-3.55.0.dist-info/RECORD +119 -0
- google_cloud_spanner-3.55.0.dist-info/WHEEL +5 -0
- google_cloud_spanner-3.55.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1539 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright 2025 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
|
+
import inspect
|
|
17
|
+
import json
|
|
18
|
+
import pickle
|
|
19
|
+
import logging as std_logging
|
|
20
|
+
import warnings
|
|
21
|
+
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
|
|
22
|
+
|
|
23
|
+
from google.api_core import gapic_v1
|
|
24
|
+
from google.api_core import grpc_helpers_async
|
|
25
|
+
from google.api_core import exceptions as core_exceptions
|
|
26
|
+
from google.api_core import retry_async as retries
|
|
27
|
+
from google.api_core import operations_v1
|
|
28
|
+
from google.auth import credentials as ga_credentials # type: ignore
|
|
29
|
+
from google.auth.transport.grpc import SslCredentials # type: ignore
|
|
30
|
+
from google.protobuf.json_format import MessageToJson
|
|
31
|
+
import google.protobuf.message
|
|
32
|
+
|
|
33
|
+
import grpc # type: ignore
|
|
34
|
+
import proto # type: ignore
|
|
35
|
+
from grpc.experimental import aio # type: ignore
|
|
36
|
+
|
|
37
|
+
from google.cloud.spanner_admin_instance_v1.types import spanner_instance_admin
|
|
38
|
+
from google.iam.v1 import iam_policy_pb2 # type: ignore
|
|
39
|
+
from google.iam.v1 import policy_pb2 # type: ignore
|
|
40
|
+
from google.longrunning import operations_pb2 # type: ignore
|
|
41
|
+
from google.protobuf import empty_pb2 # type: ignore
|
|
42
|
+
from .base import InstanceAdminTransport, DEFAULT_CLIENT_INFO
|
|
43
|
+
from .grpc import InstanceAdminGrpcTransport
|
|
44
|
+
|
|
45
|
+
try:
|
|
46
|
+
from google.api_core import client_logging # type: ignore
|
|
47
|
+
|
|
48
|
+
CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
|
|
49
|
+
except ImportError: # pragma: NO COVER
|
|
50
|
+
CLIENT_LOGGING_SUPPORTED = False
|
|
51
|
+
|
|
52
|
+
_LOGGER = std_logging.getLogger(__name__)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class _LoggingClientAIOInterceptor(
|
|
56
|
+
grpc.aio.UnaryUnaryClientInterceptor
|
|
57
|
+
): # pragma: NO COVER
|
|
58
|
+
async def intercept_unary_unary(self, continuation, client_call_details, request):
|
|
59
|
+
logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
60
|
+
std_logging.DEBUG
|
|
61
|
+
)
|
|
62
|
+
if logging_enabled: # pragma: NO COVER
|
|
63
|
+
request_metadata = client_call_details.metadata
|
|
64
|
+
if isinstance(request, proto.Message):
|
|
65
|
+
request_payload = type(request).to_json(request)
|
|
66
|
+
elif isinstance(request, google.protobuf.message.Message):
|
|
67
|
+
request_payload = MessageToJson(request)
|
|
68
|
+
else:
|
|
69
|
+
request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
|
|
70
|
+
|
|
71
|
+
request_metadata = {
|
|
72
|
+
key: value.decode("utf-8") if isinstance(value, bytes) else value
|
|
73
|
+
for key, value in request_metadata
|
|
74
|
+
}
|
|
75
|
+
grpc_request = {
|
|
76
|
+
"payload": request_payload,
|
|
77
|
+
"requestMethod": "grpc",
|
|
78
|
+
"metadata": dict(request_metadata),
|
|
79
|
+
}
|
|
80
|
+
_LOGGER.debug(
|
|
81
|
+
f"Sending request for {client_call_details.method}",
|
|
82
|
+
extra={
|
|
83
|
+
"serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
|
|
84
|
+
"rpcName": str(client_call_details.method),
|
|
85
|
+
"request": grpc_request,
|
|
86
|
+
"metadata": grpc_request["metadata"],
|
|
87
|
+
},
|
|
88
|
+
)
|
|
89
|
+
response = await continuation(client_call_details, request)
|
|
90
|
+
if logging_enabled: # pragma: NO COVER
|
|
91
|
+
response_metadata = await response.trailing_metadata()
|
|
92
|
+
# Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
|
|
93
|
+
metadata = (
|
|
94
|
+
dict([(k, str(v)) for k, v in response_metadata])
|
|
95
|
+
if response_metadata
|
|
96
|
+
else None
|
|
97
|
+
)
|
|
98
|
+
result = await response
|
|
99
|
+
if isinstance(result, proto.Message):
|
|
100
|
+
response_payload = type(result).to_json(result)
|
|
101
|
+
elif isinstance(result, google.protobuf.message.Message):
|
|
102
|
+
response_payload = MessageToJson(result)
|
|
103
|
+
else:
|
|
104
|
+
response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
|
|
105
|
+
grpc_response = {
|
|
106
|
+
"payload": response_payload,
|
|
107
|
+
"metadata": metadata,
|
|
108
|
+
"status": "OK",
|
|
109
|
+
}
|
|
110
|
+
_LOGGER.debug(
|
|
111
|
+
f"Received response to rpc {client_call_details.method}.",
|
|
112
|
+
extra={
|
|
113
|
+
"serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
|
|
114
|
+
"rpcName": str(client_call_details.method),
|
|
115
|
+
"response": grpc_response,
|
|
116
|
+
"metadata": grpc_response["metadata"],
|
|
117
|
+
},
|
|
118
|
+
)
|
|
119
|
+
return response
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class InstanceAdminGrpcAsyncIOTransport(InstanceAdminTransport):
|
|
123
|
+
"""gRPC AsyncIO backend transport for InstanceAdmin.
|
|
124
|
+
|
|
125
|
+
Cloud Spanner Instance Admin API
|
|
126
|
+
|
|
127
|
+
The Cloud Spanner Instance Admin API can be used to create,
|
|
128
|
+
delete, modify and list instances. Instances are dedicated Cloud
|
|
129
|
+
Spanner serving and storage resources to be used by Cloud
|
|
130
|
+
Spanner databases.
|
|
131
|
+
|
|
132
|
+
Each instance has a "configuration", which dictates where the
|
|
133
|
+
serving resources for the Cloud Spanner instance are located
|
|
134
|
+
(e.g., US-central, Europe). Configurations are created by Google
|
|
135
|
+
based on resource availability.
|
|
136
|
+
|
|
137
|
+
Cloud Spanner billing is based on the instances that exist and
|
|
138
|
+
their sizes. After an instance exists, there are no additional
|
|
139
|
+
per-database or per-operation charges for use of the instance
|
|
140
|
+
(though there may be additional network bandwidth charges).
|
|
141
|
+
Instances offer isolation: problems with databases in one
|
|
142
|
+
instance will not affect other instances. However, within an
|
|
143
|
+
instance databases can affect each other. For example, if one
|
|
144
|
+
database in an instance receives a lot of requests and consumes
|
|
145
|
+
most of the instance resources, fewer resources are available
|
|
146
|
+
for other databases in that instance, and their performance may
|
|
147
|
+
suffer.
|
|
148
|
+
|
|
149
|
+
This class defines the same methods as the primary client, so the
|
|
150
|
+
primary client can load the underlying transport implementation
|
|
151
|
+
and call it.
|
|
152
|
+
|
|
153
|
+
It sends protocol buffers over the wire using gRPC (which is built on
|
|
154
|
+
top of HTTP/2); the ``grpcio`` package must be installed.
|
|
155
|
+
"""
|
|
156
|
+
|
|
157
|
+
_grpc_channel: aio.Channel
|
|
158
|
+
_stubs: Dict[str, Callable] = {}
|
|
159
|
+
|
|
160
|
+
@classmethod
|
|
161
|
+
def create_channel(
|
|
162
|
+
cls,
|
|
163
|
+
host: str = "spanner.googleapis.com",
|
|
164
|
+
credentials: Optional[ga_credentials.Credentials] = None,
|
|
165
|
+
credentials_file: Optional[str] = None,
|
|
166
|
+
scopes: Optional[Sequence[str]] = None,
|
|
167
|
+
quota_project_id: Optional[str] = None,
|
|
168
|
+
**kwargs,
|
|
169
|
+
) -> aio.Channel:
|
|
170
|
+
"""Create and return a gRPC AsyncIO channel object.
|
|
171
|
+
Args:
|
|
172
|
+
host (Optional[str]): The host for the channel to use.
|
|
173
|
+
credentials (Optional[~.Credentials]): The
|
|
174
|
+
authorization credentials to attach to requests. These
|
|
175
|
+
credentials identify this application to the service. If
|
|
176
|
+
none are specified, the client will attempt to ascertain
|
|
177
|
+
the credentials from the environment.
|
|
178
|
+
credentials_file (Optional[str]): A file with credentials that can
|
|
179
|
+
be loaded with :func:`google.auth.load_credentials_from_file`.
|
|
180
|
+
scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
|
|
181
|
+
service. These are only used when credentials are not specified and
|
|
182
|
+
are passed to :func:`google.auth.default`.
|
|
183
|
+
quota_project_id (Optional[str]): An optional project to use for billing
|
|
184
|
+
and quota.
|
|
185
|
+
kwargs (Optional[dict]): Keyword arguments, which are passed to the
|
|
186
|
+
channel creation.
|
|
187
|
+
Returns:
|
|
188
|
+
aio.Channel: A gRPC AsyncIO channel object.
|
|
189
|
+
"""
|
|
190
|
+
|
|
191
|
+
return grpc_helpers_async.create_channel(
|
|
192
|
+
host,
|
|
193
|
+
credentials=credentials,
|
|
194
|
+
credentials_file=credentials_file,
|
|
195
|
+
quota_project_id=quota_project_id,
|
|
196
|
+
default_scopes=cls.AUTH_SCOPES,
|
|
197
|
+
scopes=scopes,
|
|
198
|
+
default_host=cls.DEFAULT_HOST,
|
|
199
|
+
**kwargs,
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
def __init__(
|
|
203
|
+
self,
|
|
204
|
+
*,
|
|
205
|
+
host: str = "spanner.googleapis.com",
|
|
206
|
+
credentials: Optional[ga_credentials.Credentials] = None,
|
|
207
|
+
credentials_file: Optional[str] = None,
|
|
208
|
+
scopes: Optional[Sequence[str]] = None,
|
|
209
|
+
channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
|
|
210
|
+
api_mtls_endpoint: Optional[str] = None,
|
|
211
|
+
client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
|
|
212
|
+
ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
|
|
213
|
+
client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
|
|
214
|
+
quota_project_id: Optional[str] = None,
|
|
215
|
+
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
|
|
216
|
+
always_use_jwt_access: Optional[bool] = False,
|
|
217
|
+
api_audience: Optional[str] = None,
|
|
218
|
+
) -> None:
|
|
219
|
+
"""Instantiate the transport.
|
|
220
|
+
|
|
221
|
+
Args:
|
|
222
|
+
host (Optional[str]):
|
|
223
|
+
The hostname to connect to (default: 'spanner.googleapis.com').
|
|
224
|
+
credentials (Optional[google.auth.credentials.Credentials]): The
|
|
225
|
+
authorization credentials to attach to requests. These
|
|
226
|
+
credentials identify the application to the service; if none
|
|
227
|
+
are specified, the client will attempt to ascertain the
|
|
228
|
+
credentials from the environment.
|
|
229
|
+
This argument is ignored if a ``channel`` instance is provided.
|
|
230
|
+
credentials_file (Optional[str]): A file with credentials that can
|
|
231
|
+
be loaded with :func:`google.auth.load_credentials_from_file`.
|
|
232
|
+
This argument is ignored if a ``channel`` instance is provided.
|
|
233
|
+
scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
|
|
234
|
+
service. These are only used when credentials are not specified and
|
|
235
|
+
are passed to :func:`google.auth.default`.
|
|
236
|
+
channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
|
|
237
|
+
A ``Channel`` instance through which to make calls, or a Callable
|
|
238
|
+
that constructs and returns one. If set to None, ``self.create_channel``
|
|
239
|
+
is used to create the channel. If a Callable is given, it will be called
|
|
240
|
+
with the same arguments as used in ``self.create_channel``.
|
|
241
|
+
api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
|
|
242
|
+
If provided, it overrides the ``host`` argument and tries to create
|
|
243
|
+
a mutual TLS channel with client SSL credentials from
|
|
244
|
+
``client_cert_source`` or application default SSL credentials.
|
|
245
|
+
client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
|
|
246
|
+
Deprecated. A callback to provide client SSL certificate bytes and
|
|
247
|
+
private key bytes, both in PEM format. It is ignored if
|
|
248
|
+
``api_mtls_endpoint`` is None.
|
|
249
|
+
ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
|
|
250
|
+
for the grpc channel. It is ignored if a ``channel`` instance is provided.
|
|
251
|
+
client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
|
|
252
|
+
A callback to provide client certificate bytes and private key bytes,
|
|
253
|
+
both in PEM format. It is used to configure a mutual TLS channel. It is
|
|
254
|
+
ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
|
|
255
|
+
quota_project_id (Optional[str]): An optional project to use for billing
|
|
256
|
+
and quota.
|
|
257
|
+
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
|
|
258
|
+
The client info used to send a user-agent string along with
|
|
259
|
+
API requests. If ``None``, then default info will be used.
|
|
260
|
+
Generally, you only need to set this if you're developing
|
|
261
|
+
your own client library.
|
|
262
|
+
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
|
|
263
|
+
be used for service account credentials.
|
|
264
|
+
|
|
265
|
+
Raises:
|
|
266
|
+
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
|
|
267
|
+
creation failed for any reason.
|
|
268
|
+
google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
|
|
269
|
+
and ``credentials_file`` are passed.
|
|
270
|
+
"""
|
|
271
|
+
self._grpc_channel = None
|
|
272
|
+
self._ssl_channel_credentials = ssl_channel_credentials
|
|
273
|
+
self._stubs: Dict[str, Callable] = {}
|
|
274
|
+
self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None
|
|
275
|
+
|
|
276
|
+
if api_mtls_endpoint:
|
|
277
|
+
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
|
|
278
|
+
if client_cert_source:
|
|
279
|
+
warnings.warn("client_cert_source is deprecated", DeprecationWarning)
|
|
280
|
+
|
|
281
|
+
if isinstance(channel, aio.Channel):
|
|
282
|
+
# Ignore credentials if a channel was passed.
|
|
283
|
+
credentials = None
|
|
284
|
+
self._ignore_credentials = True
|
|
285
|
+
# If a channel was explicitly provided, set it.
|
|
286
|
+
self._grpc_channel = channel
|
|
287
|
+
self._ssl_channel_credentials = None
|
|
288
|
+
else:
|
|
289
|
+
if api_mtls_endpoint:
|
|
290
|
+
host = api_mtls_endpoint
|
|
291
|
+
|
|
292
|
+
# Create SSL credentials with client_cert_source or application
|
|
293
|
+
# default SSL credentials.
|
|
294
|
+
if client_cert_source:
|
|
295
|
+
cert, key = client_cert_source()
|
|
296
|
+
self._ssl_channel_credentials = grpc.ssl_channel_credentials(
|
|
297
|
+
certificate_chain=cert, private_key=key
|
|
298
|
+
)
|
|
299
|
+
else:
|
|
300
|
+
self._ssl_channel_credentials = SslCredentials().ssl_credentials
|
|
301
|
+
|
|
302
|
+
else:
|
|
303
|
+
if client_cert_source_for_mtls and not ssl_channel_credentials:
|
|
304
|
+
cert, key = client_cert_source_for_mtls()
|
|
305
|
+
self._ssl_channel_credentials = grpc.ssl_channel_credentials(
|
|
306
|
+
certificate_chain=cert, private_key=key
|
|
307
|
+
)
|
|
308
|
+
|
|
309
|
+
# The base transport sets the host, credentials and scopes
|
|
310
|
+
super().__init__(
|
|
311
|
+
host=host,
|
|
312
|
+
credentials=credentials,
|
|
313
|
+
credentials_file=credentials_file,
|
|
314
|
+
scopes=scopes,
|
|
315
|
+
quota_project_id=quota_project_id,
|
|
316
|
+
client_info=client_info,
|
|
317
|
+
always_use_jwt_access=always_use_jwt_access,
|
|
318
|
+
api_audience=api_audience,
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
if not self._grpc_channel:
|
|
322
|
+
# initialize with the provided callable or the default channel
|
|
323
|
+
channel_init = channel or type(self).create_channel
|
|
324
|
+
self._grpc_channel = channel_init(
|
|
325
|
+
self._host,
|
|
326
|
+
# use the credentials which are saved
|
|
327
|
+
credentials=self._credentials,
|
|
328
|
+
# Set ``credentials_file`` to ``None`` here as
|
|
329
|
+
# the credentials that we saved earlier should be used.
|
|
330
|
+
credentials_file=None,
|
|
331
|
+
scopes=self._scopes,
|
|
332
|
+
ssl_credentials=self._ssl_channel_credentials,
|
|
333
|
+
quota_project_id=quota_project_id,
|
|
334
|
+
options=[
|
|
335
|
+
("grpc.max_send_message_length", -1),
|
|
336
|
+
("grpc.max_receive_message_length", -1),
|
|
337
|
+
],
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
self._interceptor = _LoggingClientAIOInterceptor()
|
|
341
|
+
self._grpc_channel._unary_unary_interceptors.append(self._interceptor)
|
|
342
|
+
self._logged_channel = self._grpc_channel
|
|
343
|
+
self._wrap_with_kind = (
|
|
344
|
+
"kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
|
|
345
|
+
)
|
|
346
|
+
# Wrap messages. This must be done after self._logged_channel exists
|
|
347
|
+
self._prep_wrapped_messages(client_info)
|
|
348
|
+
|
|
349
|
+
@property
|
|
350
|
+
def grpc_channel(self) -> aio.Channel:
|
|
351
|
+
"""Create the channel designed to connect to this service.
|
|
352
|
+
|
|
353
|
+
This property caches on the instance; repeated calls return
|
|
354
|
+
the same channel.
|
|
355
|
+
"""
|
|
356
|
+
# Return the channel from cache.
|
|
357
|
+
return self._grpc_channel
|
|
358
|
+
|
|
359
|
+
@property
|
|
360
|
+
def operations_client(self) -> operations_v1.OperationsAsyncClient:
|
|
361
|
+
"""Create the client designed to process long-running operations.
|
|
362
|
+
|
|
363
|
+
This property caches on the instance; repeated calls return the same
|
|
364
|
+
client.
|
|
365
|
+
"""
|
|
366
|
+
# Quick check: Only create a new client if we do not already have one.
|
|
367
|
+
if self._operations_client is None:
|
|
368
|
+
self._operations_client = operations_v1.OperationsAsyncClient(
|
|
369
|
+
self._logged_channel
|
|
370
|
+
)
|
|
371
|
+
|
|
372
|
+
# Return the client from cache.
|
|
373
|
+
return self._operations_client
|
|
374
|
+
|
|
375
|
+
@property
|
|
376
|
+
def list_instance_configs(
|
|
377
|
+
self,
|
|
378
|
+
) -> Callable[
|
|
379
|
+
[spanner_instance_admin.ListInstanceConfigsRequest],
|
|
380
|
+
Awaitable[spanner_instance_admin.ListInstanceConfigsResponse],
|
|
381
|
+
]:
|
|
382
|
+
r"""Return a callable for the list instance configs method over gRPC.
|
|
383
|
+
|
|
384
|
+
Lists the supported instance configurations for a
|
|
385
|
+
given project.
|
|
386
|
+
Returns both Google-managed configurations and
|
|
387
|
+
user-managed configurations.
|
|
388
|
+
|
|
389
|
+
Returns:
|
|
390
|
+
Callable[[~.ListInstanceConfigsRequest],
|
|
391
|
+
Awaitable[~.ListInstanceConfigsResponse]]:
|
|
392
|
+
A function that, when called, will call the underlying RPC
|
|
393
|
+
on the server.
|
|
394
|
+
"""
|
|
395
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
396
|
+
# the request.
|
|
397
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
398
|
+
# to pass in the functions for each.
|
|
399
|
+
if "list_instance_configs" not in self._stubs:
|
|
400
|
+
self._stubs["list_instance_configs"] = self._logged_channel.unary_unary(
|
|
401
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigs",
|
|
402
|
+
request_serializer=spanner_instance_admin.ListInstanceConfigsRequest.serialize,
|
|
403
|
+
response_deserializer=spanner_instance_admin.ListInstanceConfigsResponse.deserialize,
|
|
404
|
+
)
|
|
405
|
+
return self._stubs["list_instance_configs"]
|
|
406
|
+
|
|
407
|
+
@property
|
|
408
|
+
def get_instance_config(
|
|
409
|
+
self,
|
|
410
|
+
) -> Callable[
|
|
411
|
+
[spanner_instance_admin.GetInstanceConfigRequest],
|
|
412
|
+
Awaitable[spanner_instance_admin.InstanceConfig],
|
|
413
|
+
]:
|
|
414
|
+
r"""Return a callable for the get instance config method over gRPC.
|
|
415
|
+
|
|
416
|
+
Gets information about a particular instance
|
|
417
|
+
configuration.
|
|
418
|
+
|
|
419
|
+
Returns:
|
|
420
|
+
Callable[[~.GetInstanceConfigRequest],
|
|
421
|
+
Awaitable[~.InstanceConfig]]:
|
|
422
|
+
A function that, when called, will call the underlying RPC
|
|
423
|
+
on the server.
|
|
424
|
+
"""
|
|
425
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
426
|
+
# the request.
|
|
427
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
428
|
+
# to pass in the functions for each.
|
|
429
|
+
if "get_instance_config" not in self._stubs:
|
|
430
|
+
self._stubs["get_instance_config"] = self._logged_channel.unary_unary(
|
|
431
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/GetInstanceConfig",
|
|
432
|
+
request_serializer=spanner_instance_admin.GetInstanceConfigRequest.serialize,
|
|
433
|
+
response_deserializer=spanner_instance_admin.InstanceConfig.deserialize,
|
|
434
|
+
)
|
|
435
|
+
return self._stubs["get_instance_config"]
|
|
436
|
+
|
|
437
|
+
@property
|
|
438
|
+
def create_instance_config(
|
|
439
|
+
self,
|
|
440
|
+
) -> Callable[
|
|
441
|
+
[spanner_instance_admin.CreateInstanceConfigRequest],
|
|
442
|
+
Awaitable[operations_pb2.Operation],
|
|
443
|
+
]:
|
|
444
|
+
r"""Return a callable for the create instance config method over gRPC.
|
|
445
|
+
|
|
446
|
+
Creates an instance configuration and begins preparing it to be
|
|
447
|
+
used. The returned long-running operation can be used to track
|
|
448
|
+
the progress of preparing the new instance configuration. The
|
|
449
|
+
instance configuration name is assigned by the caller. If the
|
|
450
|
+
named instance configuration already exists,
|
|
451
|
+
``CreateInstanceConfig`` returns ``ALREADY_EXISTS``.
|
|
452
|
+
|
|
453
|
+
Immediately after the request returns:
|
|
454
|
+
|
|
455
|
+
- The instance configuration is readable via the API, with all
|
|
456
|
+
requested attributes. The instance configuration's
|
|
457
|
+
[reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
|
|
458
|
+
field is set to true. Its state is ``CREATING``.
|
|
459
|
+
|
|
460
|
+
While the operation is pending:
|
|
461
|
+
|
|
462
|
+
- Cancelling the operation renders the instance configuration
|
|
463
|
+
immediately unreadable via the API.
|
|
464
|
+
- Except for deleting the creating resource, all other attempts
|
|
465
|
+
to modify the instance configuration are rejected.
|
|
466
|
+
|
|
467
|
+
Upon completion of the returned operation:
|
|
468
|
+
|
|
469
|
+
- Instances can be created using the instance configuration.
|
|
470
|
+
- The instance configuration's
|
|
471
|
+
[reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
|
|
472
|
+
field becomes false. Its state becomes ``READY``.
|
|
473
|
+
|
|
474
|
+
The returned long-running operation will have a name of the
|
|
475
|
+
format ``<instance_config_name>/operations/<operation_id>`` and
|
|
476
|
+
can be used to track creation of the instance configuration. The
|
|
477
|
+
metadata field type is
|
|
478
|
+
[CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata].
|
|
479
|
+
The response field type is
|
|
480
|
+
[InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig],
|
|
481
|
+
if successful.
|
|
482
|
+
|
|
483
|
+
Authorization requires ``spanner.instanceConfigs.create``
|
|
484
|
+
permission on the resource
|
|
485
|
+
[parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent].
|
|
486
|
+
|
|
487
|
+
Returns:
|
|
488
|
+
Callable[[~.CreateInstanceConfigRequest],
|
|
489
|
+
Awaitable[~.Operation]]:
|
|
490
|
+
A function that, when called, will call the underlying RPC
|
|
491
|
+
on the server.
|
|
492
|
+
"""
|
|
493
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
494
|
+
# the request.
|
|
495
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
496
|
+
# to pass in the functions for each.
|
|
497
|
+
if "create_instance_config" not in self._stubs:
|
|
498
|
+
self._stubs["create_instance_config"] = self._logged_channel.unary_unary(
|
|
499
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstanceConfig",
|
|
500
|
+
request_serializer=spanner_instance_admin.CreateInstanceConfigRequest.serialize,
|
|
501
|
+
response_deserializer=operations_pb2.Operation.FromString,
|
|
502
|
+
)
|
|
503
|
+
return self._stubs["create_instance_config"]
|
|
504
|
+
|
|
505
|
+
@property
|
|
506
|
+
def update_instance_config(
|
|
507
|
+
self,
|
|
508
|
+
) -> Callable[
|
|
509
|
+
[spanner_instance_admin.UpdateInstanceConfigRequest],
|
|
510
|
+
Awaitable[operations_pb2.Operation],
|
|
511
|
+
]:
|
|
512
|
+
r"""Return a callable for the update instance config method over gRPC.
|
|
513
|
+
|
|
514
|
+
Updates an instance configuration. The returned long-running
|
|
515
|
+
operation can be used to track the progress of updating the
|
|
516
|
+
instance. If the named instance configuration does not exist,
|
|
517
|
+
returns ``NOT_FOUND``.
|
|
518
|
+
|
|
519
|
+
Only user-managed configurations can be updated.
|
|
520
|
+
|
|
521
|
+
Immediately after the request returns:
|
|
522
|
+
|
|
523
|
+
- The instance configuration's
|
|
524
|
+
[reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
|
|
525
|
+
field is set to true.
|
|
526
|
+
|
|
527
|
+
While the operation is pending:
|
|
528
|
+
|
|
529
|
+
- Cancelling the operation sets its metadata's
|
|
530
|
+
[cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.cancel_time].
|
|
531
|
+
The operation is guaranteed to succeed at undoing all
|
|
532
|
+
changes, after which point it terminates with a ``CANCELLED``
|
|
533
|
+
status.
|
|
534
|
+
- All other attempts to modify the instance configuration are
|
|
535
|
+
rejected.
|
|
536
|
+
- Reading the instance configuration via the API continues to
|
|
537
|
+
give the pre-request values.
|
|
538
|
+
|
|
539
|
+
Upon completion of the returned operation:
|
|
540
|
+
|
|
541
|
+
- Creating instances using the instance configuration uses the
|
|
542
|
+
new values.
|
|
543
|
+
- The new values of the instance configuration are readable via
|
|
544
|
+
the API.
|
|
545
|
+
- The instance configuration's
|
|
546
|
+
[reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
|
|
547
|
+
field becomes false.
|
|
548
|
+
|
|
549
|
+
The returned long-running operation will have a name of the
|
|
550
|
+
format ``<instance_config_name>/operations/<operation_id>`` and
|
|
551
|
+
can be used to track the instance configuration modification.
|
|
552
|
+
The metadata field type is
|
|
553
|
+
[UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata].
|
|
554
|
+
The response field type is
|
|
555
|
+
[InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig],
|
|
556
|
+
if successful.
|
|
557
|
+
|
|
558
|
+
Authorization requires ``spanner.instanceConfigs.update``
|
|
559
|
+
permission on the resource
|
|
560
|
+
[name][google.spanner.admin.instance.v1.InstanceConfig.name].
|
|
561
|
+
|
|
562
|
+
Returns:
|
|
563
|
+
Callable[[~.UpdateInstanceConfigRequest],
|
|
564
|
+
Awaitable[~.Operation]]:
|
|
565
|
+
A function that, when called, will call the underlying RPC
|
|
566
|
+
on the server.
|
|
567
|
+
"""
|
|
568
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
569
|
+
# the request.
|
|
570
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
571
|
+
# to pass in the functions for each.
|
|
572
|
+
if "update_instance_config" not in self._stubs:
|
|
573
|
+
self._stubs["update_instance_config"] = self._logged_channel.unary_unary(
|
|
574
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstanceConfig",
|
|
575
|
+
request_serializer=spanner_instance_admin.UpdateInstanceConfigRequest.serialize,
|
|
576
|
+
response_deserializer=operations_pb2.Operation.FromString,
|
|
577
|
+
)
|
|
578
|
+
return self._stubs["update_instance_config"]
|
|
579
|
+
|
|
580
|
+
@property
|
|
581
|
+
def delete_instance_config(
|
|
582
|
+
self,
|
|
583
|
+
) -> Callable[
|
|
584
|
+
[spanner_instance_admin.DeleteInstanceConfigRequest], Awaitable[empty_pb2.Empty]
|
|
585
|
+
]:
|
|
586
|
+
r"""Return a callable for the delete instance config method over gRPC.
|
|
587
|
+
|
|
588
|
+
Deletes the instance configuration. Deletion is only allowed
|
|
589
|
+
when no instances are using the configuration. If any instances
|
|
590
|
+
are using the configuration, returns ``FAILED_PRECONDITION``.
|
|
591
|
+
|
|
592
|
+
Only user-managed configurations can be deleted.
|
|
593
|
+
|
|
594
|
+
Authorization requires ``spanner.instanceConfigs.delete``
|
|
595
|
+
permission on the resource
|
|
596
|
+
[name][google.spanner.admin.instance.v1.InstanceConfig.name].
|
|
597
|
+
|
|
598
|
+
Returns:
|
|
599
|
+
Callable[[~.DeleteInstanceConfigRequest],
|
|
600
|
+
Awaitable[~.Empty]]:
|
|
601
|
+
A function that, when called, will call the underlying RPC
|
|
602
|
+
on the server.
|
|
603
|
+
"""
|
|
604
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
605
|
+
# the request.
|
|
606
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
607
|
+
# to pass in the functions for each.
|
|
608
|
+
if "delete_instance_config" not in self._stubs:
|
|
609
|
+
self._stubs["delete_instance_config"] = self._logged_channel.unary_unary(
|
|
610
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstanceConfig",
|
|
611
|
+
request_serializer=spanner_instance_admin.DeleteInstanceConfigRequest.serialize,
|
|
612
|
+
response_deserializer=empty_pb2.Empty.FromString,
|
|
613
|
+
)
|
|
614
|
+
return self._stubs["delete_instance_config"]
|
|
615
|
+
|
|
616
|
+
@property
|
|
617
|
+
def list_instance_config_operations(
|
|
618
|
+
self,
|
|
619
|
+
) -> Callable[
|
|
620
|
+
[spanner_instance_admin.ListInstanceConfigOperationsRequest],
|
|
621
|
+
Awaitable[spanner_instance_admin.ListInstanceConfigOperationsResponse],
|
|
622
|
+
]:
|
|
623
|
+
r"""Return a callable for the list instance config
|
|
624
|
+
operations method over gRPC.
|
|
625
|
+
|
|
626
|
+
Lists the user-managed instance configuration long-running
|
|
627
|
+
operations in the given project. An instance configuration
|
|
628
|
+
operation has a name of the form
|
|
629
|
+
``projects/<project>/instanceConfigs/<instance_config>/operations/<operation>``.
|
|
630
|
+
The long-running operation metadata field type
|
|
631
|
+
``metadata.type_url`` describes the type of the metadata.
|
|
632
|
+
Operations returned include those that have
|
|
633
|
+
completed/failed/canceled within the last 7 days, and pending
|
|
634
|
+
operations. Operations returned are ordered by
|
|
635
|
+
``operation.metadata.value.start_time`` in descending order
|
|
636
|
+
starting from the most recently started operation.
|
|
637
|
+
|
|
638
|
+
Returns:
|
|
639
|
+
Callable[[~.ListInstanceConfigOperationsRequest],
|
|
640
|
+
Awaitable[~.ListInstanceConfigOperationsResponse]]:
|
|
641
|
+
A function that, when called, will call the underlying RPC
|
|
642
|
+
on the server.
|
|
643
|
+
"""
|
|
644
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
645
|
+
# the request.
|
|
646
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
647
|
+
# to pass in the functions for each.
|
|
648
|
+
if "list_instance_config_operations" not in self._stubs:
|
|
649
|
+
self._stubs[
|
|
650
|
+
"list_instance_config_operations"
|
|
651
|
+
] = self._logged_channel.unary_unary(
|
|
652
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigOperations",
|
|
653
|
+
request_serializer=spanner_instance_admin.ListInstanceConfigOperationsRequest.serialize,
|
|
654
|
+
response_deserializer=spanner_instance_admin.ListInstanceConfigOperationsResponse.deserialize,
|
|
655
|
+
)
|
|
656
|
+
return self._stubs["list_instance_config_operations"]
|
|
657
|
+
|
|
658
|
+
@property
|
|
659
|
+
def list_instances(
|
|
660
|
+
self,
|
|
661
|
+
) -> Callable[
|
|
662
|
+
[spanner_instance_admin.ListInstancesRequest],
|
|
663
|
+
Awaitable[spanner_instance_admin.ListInstancesResponse],
|
|
664
|
+
]:
|
|
665
|
+
r"""Return a callable for the list instances method over gRPC.
|
|
666
|
+
|
|
667
|
+
Lists all instances in the given project.
|
|
668
|
+
|
|
669
|
+
Returns:
|
|
670
|
+
Callable[[~.ListInstancesRequest],
|
|
671
|
+
Awaitable[~.ListInstancesResponse]]:
|
|
672
|
+
A function that, when called, will call the underlying RPC
|
|
673
|
+
on the server.
|
|
674
|
+
"""
|
|
675
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
676
|
+
# the request.
|
|
677
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
678
|
+
# to pass in the functions for each.
|
|
679
|
+
if "list_instances" not in self._stubs:
|
|
680
|
+
self._stubs["list_instances"] = self._logged_channel.unary_unary(
|
|
681
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/ListInstances",
|
|
682
|
+
request_serializer=spanner_instance_admin.ListInstancesRequest.serialize,
|
|
683
|
+
response_deserializer=spanner_instance_admin.ListInstancesResponse.deserialize,
|
|
684
|
+
)
|
|
685
|
+
return self._stubs["list_instances"]
|
|
686
|
+
|
|
687
|
+
@property
|
|
688
|
+
def list_instance_partitions(
|
|
689
|
+
self,
|
|
690
|
+
) -> Callable[
|
|
691
|
+
[spanner_instance_admin.ListInstancePartitionsRequest],
|
|
692
|
+
Awaitable[spanner_instance_admin.ListInstancePartitionsResponse],
|
|
693
|
+
]:
|
|
694
|
+
r"""Return a callable for the list instance partitions method over gRPC.
|
|
695
|
+
|
|
696
|
+
Lists all instance partitions for the given instance.
|
|
697
|
+
|
|
698
|
+
Returns:
|
|
699
|
+
Callable[[~.ListInstancePartitionsRequest],
|
|
700
|
+
Awaitable[~.ListInstancePartitionsResponse]]:
|
|
701
|
+
A function that, when called, will call the underlying RPC
|
|
702
|
+
on the server.
|
|
703
|
+
"""
|
|
704
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
705
|
+
# the request.
|
|
706
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
707
|
+
# to pass in the functions for each.
|
|
708
|
+
if "list_instance_partitions" not in self._stubs:
|
|
709
|
+
self._stubs["list_instance_partitions"] = self._logged_channel.unary_unary(
|
|
710
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitions",
|
|
711
|
+
request_serializer=spanner_instance_admin.ListInstancePartitionsRequest.serialize,
|
|
712
|
+
response_deserializer=spanner_instance_admin.ListInstancePartitionsResponse.deserialize,
|
|
713
|
+
)
|
|
714
|
+
return self._stubs["list_instance_partitions"]
|
|
715
|
+
|
|
716
|
+
@property
|
|
717
|
+
def get_instance(
|
|
718
|
+
self,
|
|
719
|
+
) -> Callable[
|
|
720
|
+
[spanner_instance_admin.GetInstanceRequest],
|
|
721
|
+
Awaitable[spanner_instance_admin.Instance],
|
|
722
|
+
]:
|
|
723
|
+
r"""Return a callable for the get instance method over gRPC.
|
|
724
|
+
|
|
725
|
+
Gets information about a particular instance.
|
|
726
|
+
|
|
727
|
+
Returns:
|
|
728
|
+
Callable[[~.GetInstanceRequest],
|
|
729
|
+
Awaitable[~.Instance]]:
|
|
730
|
+
A function that, when called, will call the underlying RPC
|
|
731
|
+
on the server.
|
|
732
|
+
"""
|
|
733
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
734
|
+
# the request.
|
|
735
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
736
|
+
# to pass in the functions for each.
|
|
737
|
+
if "get_instance" not in self._stubs:
|
|
738
|
+
self._stubs["get_instance"] = self._logged_channel.unary_unary(
|
|
739
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/GetInstance",
|
|
740
|
+
request_serializer=spanner_instance_admin.GetInstanceRequest.serialize,
|
|
741
|
+
response_deserializer=spanner_instance_admin.Instance.deserialize,
|
|
742
|
+
)
|
|
743
|
+
return self._stubs["get_instance"]
|
|
744
|
+
|
|
745
|
+
@property
|
|
746
|
+
def create_instance(
|
|
747
|
+
self,
|
|
748
|
+
) -> Callable[
|
|
749
|
+
[spanner_instance_admin.CreateInstanceRequest],
|
|
750
|
+
Awaitable[operations_pb2.Operation],
|
|
751
|
+
]:
|
|
752
|
+
r"""Return a callable for the create instance method over gRPC.
|
|
753
|
+
|
|
754
|
+
Creates an instance and begins preparing it to begin serving.
|
|
755
|
+
The returned long-running operation can be used to track the
|
|
756
|
+
progress of preparing the new instance. The instance name is
|
|
757
|
+
assigned by the caller. If the named instance already exists,
|
|
758
|
+
``CreateInstance`` returns ``ALREADY_EXISTS``.
|
|
759
|
+
|
|
760
|
+
Immediately upon completion of this request:
|
|
761
|
+
|
|
762
|
+
- The instance is readable via the API, with all requested
|
|
763
|
+
attributes but no allocated resources. Its state is
|
|
764
|
+
``CREATING``.
|
|
765
|
+
|
|
766
|
+
Until completion of the returned operation:
|
|
767
|
+
|
|
768
|
+
- Cancelling the operation renders the instance immediately
|
|
769
|
+
unreadable via the API.
|
|
770
|
+
- The instance can be deleted.
|
|
771
|
+
- All other attempts to modify the instance are rejected.
|
|
772
|
+
|
|
773
|
+
Upon completion of the returned operation:
|
|
774
|
+
|
|
775
|
+
- Billing for all successfully-allocated resources begins (some
|
|
776
|
+
types may have lower than the requested levels).
|
|
777
|
+
- Databases can be created in the instance.
|
|
778
|
+
- The instance's allocated resource levels are readable via the
|
|
779
|
+
API.
|
|
780
|
+
- The instance's state becomes ``READY``.
|
|
781
|
+
|
|
782
|
+
The returned long-running operation will have a name of the
|
|
783
|
+
format ``<instance_name>/operations/<operation_id>`` and can be
|
|
784
|
+
used to track creation of the instance. The metadata field type
|
|
785
|
+
is
|
|
786
|
+
[CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata].
|
|
787
|
+
The response field type is
|
|
788
|
+
[Instance][google.spanner.admin.instance.v1.Instance], if
|
|
789
|
+
successful.
|
|
790
|
+
|
|
791
|
+
Returns:
|
|
792
|
+
Callable[[~.CreateInstanceRequest],
|
|
793
|
+
Awaitable[~.Operation]]:
|
|
794
|
+
A function that, when called, will call the underlying RPC
|
|
795
|
+
on the server.
|
|
796
|
+
"""
|
|
797
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
798
|
+
# the request.
|
|
799
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
800
|
+
# to pass in the functions for each.
|
|
801
|
+
if "create_instance" not in self._stubs:
|
|
802
|
+
self._stubs["create_instance"] = self._logged_channel.unary_unary(
|
|
803
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstance",
|
|
804
|
+
request_serializer=spanner_instance_admin.CreateInstanceRequest.serialize,
|
|
805
|
+
response_deserializer=operations_pb2.Operation.FromString,
|
|
806
|
+
)
|
|
807
|
+
return self._stubs["create_instance"]
|
|
808
|
+
|
|
809
|
+
@property
|
|
810
|
+
def update_instance(
|
|
811
|
+
self,
|
|
812
|
+
) -> Callable[
|
|
813
|
+
[spanner_instance_admin.UpdateInstanceRequest],
|
|
814
|
+
Awaitable[operations_pb2.Operation],
|
|
815
|
+
]:
|
|
816
|
+
r"""Return a callable for the update instance method over gRPC.
|
|
817
|
+
|
|
818
|
+
Updates an instance, and begins allocating or releasing
|
|
819
|
+
resources as requested. The returned long-running operation can
|
|
820
|
+
be used to track the progress of updating the instance. If the
|
|
821
|
+
named instance does not exist, returns ``NOT_FOUND``.
|
|
822
|
+
|
|
823
|
+
Immediately upon completion of this request:
|
|
824
|
+
|
|
825
|
+
- For resource types for which a decrease in the instance's
|
|
826
|
+
allocation has been requested, billing is based on the
|
|
827
|
+
newly-requested level.
|
|
828
|
+
|
|
829
|
+
Until completion of the returned operation:
|
|
830
|
+
|
|
831
|
+
- Cancelling the operation sets its metadata's
|
|
832
|
+
[cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time],
|
|
833
|
+
and begins restoring resources to their pre-request values.
|
|
834
|
+
The operation is guaranteed to succeed at undoing all
|
|
835
|
+
resource changes, after which point it terminates with a
|
|
836
|
+
``CANCELLED`` status.
|
|
837
|
+
- All other attempts to modify the instance are rejected.
|
|
838
|
+
- Reading the instance via the API continues to give the
|
|
839
|
+
pre-request resource levels.
|
|
840
|
+
|
|
841
|
+
Upon completion of the returned operation:
|
|
842
|
+
|
|
843
|
+
- Billing begins for all successfully-allocated resources (some
|
|
844
|
+
types may have lower than the requested levels).
|
|
845
|
+
- All newly-reserved resources are available for serving the
|
|
846
|
+
instance's tables.
|
|
847
|
+
- The instance's new resource levels are readable via the API.
|
|
848
|
+
|
|
849
|
+
The returned long-running operation will have a name of the
|
|
850
|
+
format ``<instance_name>/operations/<operation_id>`` and can be
|
|
851
|
+
used to track the instance modification. The metadata field type
|
|
852
|
+
is
|
|
853
|
+
[UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata].
|
|
854
|
+
The response field type is
|
|
855
|
+
[Instance][google.spanner.admin.instance.v1.Instance], if
|
|
856
|
+
successful.
|
|
857
|
+
|
|
858
|
+
Authorization requires ``spanner.instances.update`` permission
|
|
859
|
+
on the resource
|
|
860
|
+
[name][google.spanner.admin.instance.v1.Instance.name].
|
|
861
|
+
|
|
862
|
+
Returns:
|
|
863
|
+
Callable[[~.UpdateInstanceRequest],
|
|
864
|
+
Awaitable[~.Operation]]:
|
|
865
|
+
A function that, when called, will call the underlying RPC
|
|
866
|
+
on the server.
|
|
867
|
+
"""
|
|
868
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
869
|
+
# the request.
|
|
870
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
871
|
+
# to pass in the functions for each.
|
|
872
|
+
if "update_instance" not in self._stubs:
|
|
873
|
+
self._stubs["update_instance"] = self._logged_channel.unary_unary(
|
|
874
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstance",
|
|
875
|
+
request_serializer=spanner_instance_admin.UpdateInstanceRequest.serialize,
|
|
876
|
+
response_deserializer=operations_pb2.Operation.FromString,
|
|
877
|
+
)
|
|
878
|
+
return self._stubs["update_instance"]
|
|
879
|
+
|
|
880
|
+
@property
|
|
881
|
+
def delete_instance(
|
|
882
|
+
self,
|
|
883
|
+
) -> Callable[
|
|
884
|
+
[spanner_instance_admin.DeleteInstanceRequest], Awaitable[empty_pb2.Empty]
|
|
885
|
+
]:
|
|
886
|
+
r"""Return a callable for the delete instance method over gRPC.
|
|
887
|
+
|
|
888
|
+
Deletes an instance.
|
|
889
|
+
|
|
890
|
+
Immediately upon completion of the request:
|
|
891
|
+
|
|
892
|
+
- Billing ceases for all of the instance's reserved resources.
|
|
893
|
+
|
|
894
|
+
Soon afterward:
|
|
895
|
+
|
|
896
|
+
- The instance and *all of its databases* immediately and
|
|
897
|
+
irrevocably disappear from the API. All data in the databases
|
|
898
|
+
is permanently deleted.
|
|
899
|
+
|
|
900
|
+
Returns:
|
|
901
|
+
Callable[[~.DeleteInstanceRequest],
|
|
902
|
+
Awaitable[~.Empty]]:
|
|
903
|
+
A function that, when called, will call the underlying RPC
|
|
904
|
+
on the server.
|
|
905
|
+
"""
|
|
906
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
907
|
+
# the request.
|
|
908
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
909
|
+
# to pass in the functions for each.
|
|
910
|
+
if "delete_instance" not in self._stubs:
|
|
911
|
+
self._stubs["delete_instance"] = self._logged_channel.unary_unary(
|
|
912
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstance",
|
|
913
|
+
request_serializer=spanner_instance_admin.DeleteInstanceRequest.serialize,
|
|
914
|
+
response_deserializer=empty_pb2.Empty.FromString,
|
|
915
|
+
)
|
|
916
|
+
return self._stubs["delete_instance"]
|
|
917
|
+
|
|
918
|
+
@property
|
|
919
|
+
def set_iam_policy(
|
|
920
|
+
self,
|
|
921
|
+
) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], Awaitable[policy_pb2.Policy]]:
|
|
922
|
+
r"""Return a callable for the set iam policy method over gRPC.
|
|
923
|
+
|
|
924
|
+
Sets the access control policy on an instance resource. Replaces
|
|
925
|
+
any existing policy.
|
|
926
|
+
|
|
927
|
+
Authorization requires ``spanner.instances.setIamPolicy`` on
|
|
928
|
+
[resource][google.iam.v1.SetIamPolicyRequest.resource].
|
|
929
|
+
|
|
930
|
+
Returns:
|
|
931
|
+
Callable[[~.SetIamPolicyRequest],
|
|
932
|
+
Awaitable[~.Policy]]:
|
|
933
|
+
A function that, when called, will call the underlying RPC
|
|
934
|
+
on the server.
|
|
935
|
+
"""
|
|
936
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
937
|
+
# the request.
|
|
938
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
939
|
+
# to pass in the functions for each.
|
|
940
|
+
if "set_iam_policy" not in self._stubs:
|
|
941
|
+
self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
|
|
942
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/SetIamPolicy",
|
|
943
|
+
request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
|
|
944
|
+
response_deserializer=policy_pb2.Policy.FromString,
|
|
945
|
+
)
|
|
946
|
+
return self._stubs["set_iam_policy"]
|
|
947
|
+
|
|
948
|
+
@property
|
|
949
|
+
def get_iam_policy(
|
|
950
|
+
self,
|
|
951
|
+
) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], Awaitable[policy_pb2.Policy]]:
|
|
952
|
+
r"""Return a callable for the get iam policy method over gRPC.
|
|
953
|
+
|
|
954
|
+
Gets the access control policy for an instance resource. Returns
|
|
955
|
+
an empty policy if an instance exists but does not have a policy
|
|
956
|
+
set.
|
|
957
|
+
|
|
958
|
+
Authorization requires ``spanner.instances.getIamPolicy`` on
|
|
959
|
+
[resource][google.iam.v1.GetIamPolicyRequest.resource].
|
|
960
|
+
|
|
961
|
+
Returns:
|
|
962
|
+
Callable[[~.GetIamPolicyRequest],
|
|
963
|
+
Awaitable[~.Policy]]:
|
|
964
|
+
A function that, when called, will call the underlying RPC
|
|
965
|
+
on the server.
|
|
966
|
+
"""
|
|
967
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
968
|
+
# the request.
|
|
969
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
970
|
+
# to pass in the functions for each.
|
|
971
|
+
if "get_iam_policy" not in self._stubs:
|
|
972
|
+
self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
|
|
973
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/GetIamPolicy",
|
|
974
|
+
request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
|
|
975
|
+
response_deserializer=policy_pb2.Policy.FromString,
|
|
976
|
+
)
|
|
977
|
+
return self._stubs["get_iam_policy"]
|
|
978
|
+
|
|
979
|
+
@property
|
|
980
|
+
def test_iam_permissions(
|
|
981
|
+
self,
|
|
982
|
+
) -> Callable[
|
|
983
|
+
[iam_policy_pb2.TestIamPermissionsRequest],
|
|
984
|
+
Awaitable[iam_policy_pb2.TestIamPermissionsResponse],
|
|
985
|
+
]:
|
|
986
|
+
r"""Return a callable for the test iam permissions method over gRPC.
|
|
987
|
+
|
|
988
|
+
Returns permissions that the caller has on the specified
|
|
989
|
+
instance resource.
|
|
990
|
+
|
|
991
|
+
Attempting this RPC on a non-existent Cloud Spanner instance
|
|
992
|
+
resource will result in a NOT_FOUND error if the user has
|
|
993
|
+
``spanner.instances.list`` permission on the containing Google
|
|
994
|
+
Cloud Project. Otherwise returns an empty set of permissions.
|
|
995
|
+
|
|
996
|
+
Returns:
|
|
997
|
+
Callable[[~.TestIamPermissionsRequest],
|
|
998
|
+
Awaitable[~.TestIamPermissionsResponse]]:
|
|
999
|
+
A function that, when called, will call the underlying RPC
|
|
1000
|
+
on the server.
|
|
1001
|
+
"""
|
|
1002
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
1003
|
+
# the request.
|
|
1004
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
1005
|
+
# to pass in the functions for each.
|
|
1006
|
+
if "test_iam_permissions" not in self._stubs:
|
|
1007
|
+
self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
|
|
1008
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/TestIamPermissions",
|
|
1009
|
+
request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
|
|
1010
|
+
response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
|
|
1011
|
+
)
|
|
1012
|
+
return self._stubs["test_iam_permissions"]
|
|
1013
|
+
|
|
1014
|
+
@property
|
|
1015
|
+
def get_instance_partition(
|
|
1016
|
+
self,
|
|
1017
|
+
) -> Callable[
|
|
1018
|
+
[spanner_instance_admin.GetInstancePartitionRequest],
|
|
1019
|
+
Awaitable[spanner_instance_admin.InstancePartition],
|
|
1020
|
+
]:
|
|
1021
|
+
r"""Return a callable for the get instance partition method over gRPC.
|
|
1022
|
+
|
|
1023
|
+
Gets information about a particular instance
|
|
1024
|
+
partition.
|
|
1025
|
+
|
|
1026
|
+
Returns:
|
|
1027
|
+
Callable[[~.GetInstancePartitionRequest],
|
|
1028
|
+
Awaitable[~.InstancePartition]]:
|
|
1029
|
+
A function that, when called, will call the underlying RPC
|
|
1030
|
+
on the server.
|
|
1031
|
+
"""
|
|
1032
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
1033
|
+
# the request.
|
|
1034
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
1035
|
+
# to pass in the functions for each.
|
|
1036
|
+
if "get_instance_partition" not in self._stubs:
|
|
1037
|
+
self._stubs["get_instance_partition"] = self._logged_channel.unary_unary(
|
|
1038
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/GetInstancePartition",
|
|
1039
|
+
request_serializer=spanner_instance_admin.GetInstancePartitionRequest.serialize,
|
|
1040
|
+
response_deserializer=spanner_instance_admin.InstancePartition.deserialize,
|
|
1041
|
+
)
|
|
1042
|
+
return self._stubs["get_instance_partition"]
|
|
1043
|
+
|
|
1044
|
+
@property
|
|
1045
|
+
def create_instance_partition(
|
|
1046
|
+
self,
|
|
1047
|
+
) -> Callable[
|
|
1048
|
+
[spanner_instance_admin.CreateInstancePartitionRequest],
|
|
1049
|
+
Awaitable[operations_pb2.Operation],
|
|
1050
|
+
]:
|
|
1051
|
+
r"""Return a callable for the create instance partition method over gRPC.
|
|
1052
|
+
|
|
1053
|
+
Creates an instance partition and begins preparing it to be
|
|
1054
|
+
used. The returned long-running operation can be used to track
|
|
1055
|
+
the progress of preparing the new instance partition. The
|
|
1056
|
+
instance partition name is assigned by the caller. If the named
|
|
1057
|
+
instance partition already exists, ``CreateInstancePartition``
|
|
1058
|
+
returns ``ALREADY_EXISTS``.
|
|
1059
|
+
|
|
1060
|
+
Immediately upon completion of this request:
|
|
1061
|
+
|
|
1062
|
+
- The instance partition is readable via the API, with all
|
|
1063
|
+
requested attributes but no allocated resources. Its state is
|
|
1064
|
+
``CREATING``.
|
|
1065
|
+
|
|
1066
|
+
Until completion of the returned operation:
|
|
1067
|
+
|
|
1068
|
+
- Cancelling the operation renders the instance partition
|
|
1069
|
+
immediately unreadable via the API.
|
|
1070
|
+
- The instance partition can be deleted.
|
|
1071
|
+
- All other attempts to modify the instance partition are
|
|
1072
|
+
rejected.
|
|
1073
|
+
|
|
1074
|
+
Upon completion of the returned operation:
|
|
1075
|
+
|
|
1076
|
+
- Billing for all successfully-allocated resources begins (some
|
|
1077
|
+
types may have lower than the requested levels).
|
|
1078
|
+
- Databases can start using this instance partition.
|
|
1079
|
+
- The instance partition's allocated resource levels are
|
|
1080
|
+
readable via the API.
|
|
1081
|
+
- The instance partition's state becomes ``READY``.
|
|
1082
|
+
|
|
1083
|
+
The returned long-running operation will have a name of the
|
|
1084
|
+
format ``<instance_partition_name>/operations/<operation_id>``
|
|
1085
|
+
and can be used to track creation of the instance partition. The
|
|
1086
|
+
metadata field type is
|
|
1087
|
+
[CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
|
|
1088
|
+
The response field type is
|
|
1089
|
+
[InstancePartition][google.spanner.admin.instance.v1.InstancePartition],
|
|
1090
|
+
if successful.
|
|
1091
|
+
|
|
1092
|
+
Returns:
|
|
1093
|
+
Callable[[~.CreateInstancePartitionRequest],
|
|
1094
|
+
Awaitable[~.Operation]]:
|
|
1095
|
+
A function that, when called, will call the underlying RPC
|
|
1096
|
+
on the server.
|
|
1097
|
+
"""
|
|
1098
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
1099
|
+
# the request.
|
|
1100
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
1101
|
+
# to pass in the functions for each.
|
|
1102
|
+
if "create_instance_partition" not in self._stubs:
|
|
1103
|
+
self._stubs["create_instance_partition"] = self._logged_channel.unary_unary(
|
|
1104
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstancePartition",
|
|
1105
|
+
request_serializer=spanner_instance_admin.CreateInstancePartitionRequest.serialize,
|
|
1106
|
+
response_deserializer=operations_pb2.Operation.FromString,
|
|
1107
|
+
)
|
|
1108
|
+
return self._stubs["create_instance_partition"]
|
|
1109
|
+
|
|
1110
|
+
@property
|
|
1111
|
+
def delete_instance_partition(
|
|
1112
|
+
self,
|
|
1113
|
+
) -> Callable[
|
|
1114
|
+
[spanner_instance_admin.DeleteInstancePartitionRequest],
|
|
1115
|
+
Awaitable[empty_pb2.Empty],
|
|
1116
|
+
]:
|
|
1117
|
+
r"""Return a callable for the delete instance partition method over gRPC.
|
|
1118
|
+
|
|
1119
|
+
Deletes an existing instance partition. Requires that the
|
|
1120
|
+
instance partition is not used by any database or backup and is
|
|
1121
|
+
not the default instance partition of an instance.
|
|
1122
|
+
|
|
1123
|
+
Authorization requires ``spanner.instancePartitions.delete``
|
|
1124
|
+
permission on the resource
|
|
1125
|
+
[name][google.spanner.admin.instance.v1.InstancePartition.name].
|
|
1126
|
+
|
|
1127
|
+
Returns:
|
|
1128
|
+
Callable[[~.DeleteInstancePartitionRequest],
|
|
1129
|
+
Awaitable[~.Empty]]:
|
|
1130
|
+
A function that, when called, will call the underlying RPC
|
|
1131
|
+
on the server.
|
|
1132
|
+
"""
|
|
1133
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
1134
|
+
# the request.
|
|
1135
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
1136
|
+
# to pass in the functions for each.
|
|
1137
|
+
if "delete_instance_partition" not in self._stubs:
|
|
1138
|
+
self._stubs["delete_instance_partition"] = self._logged_channel.unary_unary(
|
|
1139
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstancePartition",
|
|
1140
|
+
request_serializer=spanner_instance_admin.DeleteInstancePartitionRequest.serialize,
|
|
1141
|
+
response_deserializer=empty_pb2.Empty.FromString,
|
|
1142
|
+
)
|
|
1143
|
+
return self._stubs["delete_instance_partition"]
|
|
1144
|
+
|
|
1145
|
+
@property
|
|
1146
|
+
def update_instance_partition(
|
|
1147
|
+
self,
|
|
1148
|
+
) -> Callable[
|
|
1149
|
+
[spanner_instance_admin.UpdateInstancePartitionRequest],
|
|
1150
|
+
Awaitable[operations_pb2.Operation],
|
|
1151
|
+
]:
|
|
1152
|
+
r"""Return a callable for the update instance partition method over gRPC.
|
|
1153
|
+
|
|
1154
|
+
Updates an instance partition, and begins allocating or
|
|
1155
|
+
releasing resources as requested. The returned long-running
|
|
1156
|
+
operation can be used to track the progress of updating the
|
|
1157
|
+
instance partition. If the named instance partition does not
|
|
1158
|
+
exist, returns ``NOT_FOUND``.
|
|
1159
|
+
|
|
1160
|
+
Immediately upon completion of this request:
|
|
1161
|
+
|
|
1162
|
+
- For resource types for which a decrease in the instance
|
|
1163
|
+
partition's allocation has been requested, billing is based
|
|
1164
|
+
on the newly-requested level.
|
|
1165
|
+
|
|
1166
|
+
Until completion of the returned operation:
|
|
1167
|
+
|
|
1168
|
+
- Cancelling the operation sets its metadata's
|
|
1169
|
+
[cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time],
|
|
1170
|
+
and begins restoring resources to their pre-request values.
|
|
1171
|
+
The operation is guaranteed to succeed at undoing all
|
|
1172
|
+
resource changes, after which point it terminates with a
|
|
1173
|
+
``CANCELLED`` status.
|
|
1174
|
+
- All other attempts to modify the instance partition are
|
|
1175
|
+
rejected.
|
|
1176
|
+
- Reading the instance partition via the API continues to give
|
|
1177
|
+
the pre-request resource levels.
|
|
1178
|
+
|
|
1179
|
+
Upon completion of the returned operation:
|
|
1180
|
+
|
|
1181
|
+
- Billing begins for all successfully-allocated resources (some
|
|
1182
|
+
types may have lower than the requested levels).
|
|
1183
|
+
- All newly-reserved resources are available for serving the
|
|
1184
|
+
instance partition's tables.
|
|
1185
|
+
- The instance partition's new resource levels are readable via
|
|
1186
|
+
the API.
|
|
1187
|
+
|
|
1188
|
+
The returned long-running operation will have a name of the
|
|
1189
|
+
format ``<instance_partition_name>/operations/<operation_id>``
|
|
1190
|
+
and can be used to track the instance partition modification.
|
|
1191
|
+
The metadata field type is
|
|
1192
|
+
[UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata].
|
|
1193
|
+
The response field type is
|
|
1194
|
+
[InstancePartition][google.spanner.admin.instance.v1.InstancePartition],
|
|
1195
|
+
if successful.
|
|
1196
|
+
|
|
1197
|
+
Authorization requires ``spanner.instancePartitions.update``
|
|
1198
|
+
permission on the resource
|
|
1199
|
+
[name][google.spanner.admin.instance.v1.InstancePartition.name].
|
|
1200
|
+
|
|
1201
|
+
Returns:
|
|
1202
|
+
Callable[[~.UpdateInstancePartitionRequest],
|
|
1203
|
+
Awaitable[~.Operation]]:
|
|
1204
|
+
A function that, when called, will call the underlying RPC
|
|
1205
|
+
on the server.
|
|
1206
|
+
"""
|
|
1207
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
1208
|
+
# the request.
|
|
1209
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
1210
|
+
# to pass in the functions for each.
|
|
1211
|
+
if "update_instance_partition" not in self._stubs:
|
|
1212
|
+
self._stubs["update_instance_partition"] = self._logged_channel.unary_unary(
|
|
1213
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstancePartition",
|
|
1214
|
+
request_serializer=spanner_instance_admin.UpdateInstancePartitionRequest.serialize,
|
|
1215
|
+
response_deserializer=operations_pb2.Operation.FromString,
|
|
1216
|
+
)
|
|
1217
|
+
return self._stubs["update_instance_partition"]
|
|
1218
|
+
|
|
1219
|
+
@property
|
|
1220
|
+
def list_instance_partition_operations(
|
|
1221
|
+
self,
|
|
1222
|
+
) -> Callable[
|
|
1223
|
+
[spanner_instance_admin.ListInstancePartitionOperationsRequest],
|
|
1224
|
+
Awaitable[spanner_instance_admin.ListInstancePartitionOperationsResponse],
|
|
1225
|
+
]:
|
|
1226
|
+
r"""Return a callable for the list instance partition
|
|
1227
|
+
operations method over gRPC.
|
|
1228
|
+
|
|
1229
|
+
Lists instance partition long-running operations in the given
|
|
1230
|
+
instance. An instance partition operation has a name of the form
|
|
1231
|
+
``projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>``.
|
|
1232
|
+
The long-running operation metadata field type
|
|
1233
|
+
``metadata.type_url`` describes the type of the metadata.
|
|
1234
|
+
Operations returned include those that have
|
|
1235
|
+
completed/failed/canceled within the last 7 days, and pending
|
|
1236
|
+
operations. Operations returned are ordered by
|
|
1237
|
+
``operation.metadata.value.start_time`` in descending order
|
|
1238
|
+
starting from the most recently started operation.
|
|
1239
|
+
|
|
1240
|
+
Authorization requires
|
|
1241
|
+
``spanner.instancePartitionOperations.list`` permission on the
|
|
1242
|
+
resource
|
|
1243
|
+
[parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent].
|
|
1244
|
+
|
|
1245
|
+
Returns:
|
|
1246
|
+
Callable[[~.ListInstancePartitionOperationsRequest],
|
|
1247
|
+
Awaitable[~.ListInstancePartitionOperationsResponse]]:
|
|
1248
|
+
A function that, when called, will call the underlying RPC
|
|
1249
|
+
on the server.
|
|
1250
|
+
"""
|
|
1251
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
1252
|
+
# the request.
|
|
1253
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
1254
|
+
# to pass in the functions for each.
|
|
1255
|
+
if "list_instance_partition_operations" not in self._stubs:
|
|
1256
|
+
self._stubs[
|
|
1257
|
+
"list_instance_partition_operations"
|
|
1258
|
+
] = self._logged_channel.unary_unary(
|
|
1259
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitionOperations",
|
|
1260
|
+
request_serializer=spanner_instance_admin.ListInstancePartitionOperationsRequest.serialize,
|
|
1261
|
+
response_deserializer=spanner_instance_admin.ListInstancePartitionOperationsResponse.deserialize,
|
|
1262
|
+
)
|
|
1263
|
+
return self._stubs["list_instance_partition_operations"]
|
|
1264
|
+
|
|
1265
|
+
@property
|
|
1266
|
+
def move_instance(
|
|
1267
|
+
self,
|
|
1268
|
+
) -> Callable[
|
|
1269
|
+
[spanner_instance_admin.MoveInstanceRequest],
|
|
1270
|
+
Awaitable[operations_pb2.Operation],
|
|
1271
|
+
]:
|
|
1272
|
+
r"""Return a callable for the move instance method over gRPC.
|
|
1273
|
+
|
|
1274
|
+
Moves an instance to the target instance configuration. You can
|
|
1275
|
+
use the returned long-running operation to track the progress of
|
|
1276
|
+
moving the instance.
|
|
1277
|
+
|
|
1278
|
+
``MoveInstance`` returns ``FAILED_PRECONDITION`` if the instance
|
|
1279
|
+
meets any of the following criteria:
|
|
1280
|
+
|
|
1281
|
+
- Is undergoing a move to a different instance configuration
|
|
1282
|
+
- Has backups
|
|
1283
|
+
- Has an ongoing update
|
|
1284
|
+
- Contains any CMEK-enabled databases
|
|
1285
|
+
- Is a free trial instance
|
|
1286
|
+
|
|
1287
|
+
While the operation is pending:
|
|
1288
|
+
|
|
1289
|
+
- All other attempts to modify the instance, including changes
|
|
1290
|
+
to its compute capacity, are rejected.
|
|
1291
|
+
|
|
1292
|
+
- The following database and backup admin operations are
|
|
1293
|
+
rejected:
|
|
1294
|
+
|
|
1295
|
+
- ``DatabaseAdmin.CreateDatabase``
|
|
1296
|
+
- ``DatabaseAdmin.UpdateDatabaseDdl`` (disabled if
|
|
1297
|
+
default_leader is specified in the request.)
|
|
1298
|
+
- ``DatabaseAdmin.RestoreDatabase``
|
|
1299
|
+
- ``DatabaseAdmin.CreateBackup``
|
|
1300
|
+
- ``DatabaseAdmin.CopyBackup``
|
|
1301
|
+
|
|
1302
|
+
- Both the source and target instance configurations are
|
|
1303
|
+
subject to hourly compute and storage charges.
|
|
1304
|
+
|
|
1305
|
+
- The instance might experience higher read-write latencies and
|
|
1306
|
+
a higher transaction abort rate. However, moving an instance
|
|
1307
|
+
doesn't cause any downtime.
|
|
1308
|
+
|
|
1309
|
+
The returned long-running operation has a name of the format
|
|
1310
|
+
``<instance_name>/operations/<operation_id>`` and can be used to
|
|
1311
|
+
track the move instance operation. The metadata field type is
|
|
1312
|
+
[MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata].
|
|
1313
|
+
The response field type is
|
|
1314
|
+
[Instance][google.spanner.admin.instance.v1.Instance], if
|
|
1315
|
+
successful. Cancelling the operation sets its metadata's
|
|
1316
|
+
[cancel_time][google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time].
|
|
1317
|
+
Cancellation is not immediate because it involves moving any
|
|
1318
|
+
data previously moved to the target instance configuration back
|
|
1319
|
+
to the original instance configuration. You can use this
|
|
1320
|
+
operation to track the progress of the cancellation. Upon
|
|
1321
|
+
successful completion of the cancellation, the operation
|
|
1322
|
+
terminates with ``CANCELLED`` status.
|
|
1323
|
+
|
|
1324
|
+
If not cancelled, upon completion of the returned operation:
|
|
1325
|
+
|
|
1326
|
+
- The instance successfully moves to the target instance
|
|
1327
|
+
configuration.
|
|
1328
|
+
- You are billed for compute and storage in target instance
|
|
1329
|
+
configuration.
|
|
1330
|
+
|
|
1331
|
+
Authorization requires the ``spanner.instances.update``
|
|
1332
|
+
permission on the resource
|
|
1333
|
+
[instance][google.spanner.admin.instance.v1.Instance].
|
|
1334
|
+
|
|
1335
|
+
For more details, see `Move an
|
|
1336
|
+
instance <https://cloud.google.com/spanner/docs/move-instance>`__.
|
|
1337
|
+
|
|
1338
|
+
Returns:
|
|
1339
|
+
Callable[[~.MoveInstanceRequest],
|
|
1340
|
+
Awaitable[~.Operation]]:
|
|
1341
|
+
A function that, when called, will call the underlying RPC
|
|
1342
|
+
on the server.
|
|
1343
|
+
"""
|
|
1344
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
1345
|
+
# the request.
|
|
1346
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
1347
|
+
# to pass in the functions for each.
|
|
1348
|
+
if "move_instance" not in self._stubs:
|
|
1349
|
+
self._stubs["move_instance"] = self._logged_channel.unary_unary(
|
|
1350
|
+
"/google.spanner.admin.instance.v1.InstanceAdmin/MoveInstance",
|
|
1351
|
+
request_serializer=spanner_instance_admin.MoveInstanceRequest.serialize,
|
|
1352
|
+
response_deserializer=operations_pb2.Operation.FromString,
|
|
1353
|
+
)
|
|
1354
|
+
return self._stubs["move_instance"]
|
|
1355
|
+
|
|
1356
|
+
def _prep_wrapped_messages(self, client_info):
|
|
1357
|
+
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
|
|
1358
|
+
self._wrapped_methods = {
|
|
1359
|
+
self.list_instance_configs: self._wrap_method(
|
|
1360
|
+
self.list_instance_configs,
|
|
1361
|
+
default_retry=retries.AsyncRetry(
|
|
1362
|
+
initial=1.0,
|
|
1363
|
+
maximum=32.0,
|
|
1364
|
+
multiplier=1.3,
|
|
1365
|
+
predicate=retries.if_exception_type(
|
|
1366
|
+
core_exceptions.DeadlineExceeded,
|
|
1367
|
+
core_exceptions.ServiceUnavailable,
|
|
1368
|
+
),
|
|
1369
|
+
deadline=3600.0,
|
|
1370
|
+
),
|
|
1371
|
+
default_timeout=3600.0,
|
|
1372
|
+
client_info=client_info,
|
|
1373
|
+
),
|
|
1374
|
+
self.get_instance_config: self._wrap_method(
|
|
1375
|
+
self.get_instance_config,
|
|
1376
|
+
default_retry=retries.AsyncRetry(
|
|
1377
|
+
initial=1.0,
|
|
1378
|
+
maximum=32.0,
|
|
1379
|
+
multiplier=1.3,
|
|
1380
|
+
predicate=retries.if_exception_type(
|
|
1381
|
+
core_exceptions.DeadlineExceeded,
|
|
1382
|
+
core_exceptions.ServiceUnavailable,
|
|
1383
|
+
),
|
|
1384
|
+
deadline=3600.0,
|
|
1385
|
+
),
|
|
1386
|
+
default_timeout=3600.0,
|
|
1387
|
+
client_info=client_info,
|
|
1388
|
+
),
|
|
1389
|
+
self.create_instance_config: self._wrap_method(
|
|
1390
|
+
self.create_instance_config,
|
|
1391
|
+
default_timeout=None,
|
|
1392
|
+
client_info=client_info,
|
|
1393
|
+
),
|
|
1394
|
+
self.update_instance_config: self._wrap_method(
|
|
1395
|
+
self.update_instance_config,
|
|
1396
|
+
default_timeout=None,
|
|
1397
|
+
client_info=client_info,
|
|
1398
|
+
),
|
|
1399
|
+
self.delete_instance_config: self._wrap_method(
|
|
1400
|
+
self.delete_instance_config,
|
|
1401
|
+
default_timeout=None,
|
|
1402
|
+
client_info=client_info,
|
|
1403
|
+
),
|
|
1404
|
+
self.list_instance_config_operations: self._wrap_method(
|
|
1405
|
+
self.list_instance_config_operations,
|
|
1406
|
+
default_timeout=None,
|
|
1407
|
+
client_info=client_info,
|
|
1408
|
+
),
|
|
1409
|
+
self.list_instances: self._wrap_method(
|
|
1410
|
+
self.list_instances,
|
|
1411
|
+
default_retry=retries.AsyncRetry(
|
|
1412
|
+
initial=1.0,
|
|
1413
|
+
maximum=32.0,
|
|
1414
|
+
multiplier=1.3,
|
|
1415
|
+
predicate=retries.if_exception_type(
|
|
1416
|
+
core_exceptions.DeadlineExceeded,
|
|
1417
|
+
core_exceptions.ServiceUnavailable,
|
|
1418
|
+
),
|
|
1419
|
+
deadline=3600.0,
|
|
1420
|
+
),
|
|
1421
|
+
default_timeout=3600.0,
|
|
1422
|
+
client_info=client_info,
|
|
1423
|
+
),
|
|
1424
|
+
self.list_instance_partitions: self._wrap_method(
|
|
1425
|
+
self.list_instance_partitions,
|
|
1426
|
+
default_timeout=None,
|
|
1427
|
+
client_info=client_info,
|
|
1428
|
+
),
|
|
1429
|
+
self.get_instance: self._wrap_method(
|
|
1430
|
+
self.get_instance,
|
|
1431
|
+
default_retry=retries.AsyncRetry(
|
|
1432
|
+
initial=1.0,
|
|
1433
|
+
maximum=32.0,
|
|
1434
|
+
multiplier=1.3,
|
|
1435
|
+
predicate=retries.if_exception_type(
|
|
1436
|
+
core_exceptions.DeadlineExceeded,
|
|
1437
|
+
core_exceptions.ServiceUnavailable,
|
|
1438
|
+
),
|
|
1439
|
+
deadline=3600.0,
|
|
1440
|
+
),
|
|
1441
|
+
default_timeout=3600.0,
|
|
1442
|
+
client_info=client_info,
|
|
1443
|
+
),
|
|
1444
|
+
self.create_instance: self._wrap_method(
|
|
1445
|
+
self.create_instance,
|
|
1446
|
+
default_timeout=3600.0,
|
|
1447
|
+
client_info=client_info,
|
|
1448
|
+
),
|
|
1449
|
+
self.update_instance: self._wrap_method(
|
|
1450
|
+
self.update_instance,
|
|
1451
|
+
default_timeout=3600.0,
|
|
1452
|
+
client_info=client_info,
|
|
1453
|
+
),
|
|
1454
|
+
self.delete_instance: self._wrap_method(
|
|
1455
|
+
self.delete_instance,
|
|
1456
|
+
default_retry=retries.AsyncRetry(
|
|
1457
|
+
initial=1.0,
|
|
1458
|
+
maximum=32.0,
|
|
1459
|
+
multiplier=1.3,
|
|
1460
|
+
predicate=retries.if_exception_type(
|
|
1461
|
+
core_exceptions.DeadlineExceeded,
|
|
1462
|
+
core_exceptions.ServiceUnavailable,
|
|
1463
|
+
),
|
|
1464
|
+
deadline=3600.0,
|
|
1465
|
+
),
|
|
1466
|
+
default_timeout=3600.0,
|
|
1467
|
+
client_info=client_info,
|
|
1468
|
+
),
|
|
1469
|
+
self.set_iam_policy: self._wrap_method(
|
|
1470
|
+
self.set_iam_policy,
|
|
1471
|
+
default_timeout=30.0,
|
|
1472
|
+
client_info=client_info,
|
|
1473
|
+
),
|
|
1474
|
+
self.get_iam_policy: self._wrap_method(
|
|
1475
|
+
self.get_iam_policy,
|
|
1476
|
+
default_retry=retries.AsyncRetry(
|
|
1477
|
+
initial=1.0,
|
|
1478
|
+
maximum=32.0,
|
|
1479
|
+
multiplier=1.3,
|
|
1480
|
+
predicate=retries.if_exception_type(
|
|
1481
|
+
core_exceptions.DeadlineExceeded,
|
|
1482
|
+
core_exceptions.ServiceUnavailable,
|
|
1483
|
+
),
|
|
1484
|
+
deadline=30.0,
|
|
1485
|
+
),
|
|
1486
|
+
default_timeout=30.0,
|
|
1487
|
+
client_info=client_info,
|
|
1488
|
+
),
|
|
1489
|
+
self.test_iam_permissions: self._wrap_method(
|
|
1490
|
+
self.test_iam_permissions,
|
|
1491
|
+
default_timeout=30.0,
|
|
1492
|
+
client_info=client_info,
|
|
1493
|
+
),
|
|
1494
|
+
self.get_instance_partition: self._wrap_method(
|
|
1495
|
+
self.get_instance_partition,
|
|
1496
|
+
default_timeout=None,
|
|
1497
|
+
client_info=client_info,
|
|
1498
|
+
),
|
|
1499
|
+
self.create_instance_partition: self._wrap_method(
|
|
1500
|
+
self.create_instance_partition,
|
|
1501
|
+
default_timeout=None,
|
|
1502
|
+
client_info=client_info,
|
|
1503
|
+
),
|
|
1504
|
+
self.delete_instance_partition: self._wrap_method(
|
|
1505
|
+
self.delete_instance_partition,
|
|
1506
|
+
default_timeout=None,
|
|
1507
|
+
client_info=client_info,
|
|
1508
|
+
),
|
|
1509
|
+
self.update_instance_partition: self._wrap_method(
|
|
1510
|
+
self.update_instance_partition,
|
|
1511
|
+
default_timeout=None,
|
|
1512
|
+
client_info=client_info,
|
|
1513
|
+
),
|
|
1514
|
+
self.list_instance_partition_operations: self._wrap_method(
|
|
1515
|
+
self.list_instance_partition_operations,
|
|
1516
|
+
default_timeout=None,
|
|
1517
|
+
client_info=client_info,
|
|
1518
|
+
),
|
|
1519
|
+
self.move_instance: self._wrap_method(
|
|
1520
|
+
self.move_instance,
|
|
1521
|
+
default_timeout=None,
|
|
1522
|
+
client_info=client_info,
|
|
1523
|
+
),
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
def _wrap_method(self, func, *args, **kwargs):
|
|
1527
|
+
if self._wrap_with_kind: # pragma: NO COVER
|
|
1528
|
+
kwargs["kind"] = self.kind
|
|
1529
|
+
return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
|
|
1530
|
+
|
|
1531
|
+
def close(self):
|
|
1532
|
+
return self._logged_channel.close()
|
|
1533
|
+
|
|
1534
|
+
@property
|
|
1535
|
+
def kind(self) -> str:
|
|
1536
|
+
return "grpc_asyncio"
|
|
1537
|
+
|
|
1538
|
+
|
|
1539
|
+
__all__ = ("InstanceAdminGrpcAsyncIOTransport",)
|