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.
Files changed (119) hide show
  1. google/cloud/spanner.py +47 -0
  2. google/cloud/spanner_admin_database_v1/__init__.py +146 -0
  3. google/cloud/spanner_admin_database_v1/gapic_metadata.json +418 -0
  4. google/cloud/spanner_admin_database_v1/gapic_version.py +16 -0
  5. google/cloud/spanner_admin_database_v1/py.typed +2 -0
  6. google/cloud/spanner_admin_database_v1/services/__init__.py +15 -0
  7. google/cloud/spanner_admin_database_v1/services/database_admin/__init__.py +22 -0
  8. google/cloud/spanner_admin_database_v1/services/database_admin/async_client.py +4097 -0
  9. google/cloud/spanner_admin_database_v1/services/database_admin/client.py +4602 -0
  10. google/cloud/spanner_admin_database_v1/services/database_admin/pagers.py +989 -0
  11. google/cloud/spanner_admin_database_v1/services/database_admin/transports/__init__.py +38 -0
  12. google/cloud/spanner_admin_database_v1/services/database_admin/transports/base.py +820 -0
  13. google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc.py +1303 -0
  14. google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc_asyncio.py +1688 -0
  15. google/cloud/spanner_admin_database_v1/services/database_admin/transports/rest.py +6512 -0
  16. google/cloud/spanner_admin_database_v1/services/database_admin/transports/rest_base.py +1650 -0
  17. google/cloud/spanner_admin_database_v1/types/__init__.py +144 -0
  18. google/cloud/spanner_admin_database_v1/types/backup.py +1106 -0
  19. google/cloud/spanner_admin_database_v1/types/backup_schedule.py +369 -0
  20. google/cloud/spanner_admin_database_v1/types/common.py +180 -0
  21. google/cloud/spanner_admin_database_v1/types/spanner_database_admin.py +1303 -0
  22. google/cloud/spanner_admin_instance_v1/__init__.py +110 -0
  23. google/cloud/spanner_admin_instance_v1/gapic_metadata.json +343 -0
  24. google/cloud/spanner_admin_instance_v1/gapic_version.py +16 -0
  25. google/cloud/spanner_admin_instance_v1/py.typed +2 -0
  26. google/cloud/spanner_admin_instance_v1/services/__init__.py +15 -0
  27. google/cloud/spanner_admin_instance_v1/services/instance_admin/__init__.py +22 -0
  28. google/cloud/spanner_admin_instance_v1/services/instance_admin/async_client.py +3466 -0
  29. google/cloud/spanner_admin_instance_v1/services/instance_admin/client.py +3881 -0
  30. google/cloud/spanner_admin_instance_v1/services/instance_admin/pagers.py +856 -0
  31. google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/__init__.py +38 -0
  32. google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/base.py +545 -0
  33. google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc.py +1347 -0
  34. google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc_asyncio.py +1539 -0
  35. google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/rest.py +4834 -0
  36. google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/rest_base.py +1198 -0
  37. google/cloud/spanner_admin_instance_v1/types/__init__.py +104 -0
  38. google/cloud/spanner_admin_instance_v1/types/common.py +99 -0
  39. google/cloud/spanner_admin_instance_v1/types/spanner_instance_admin.py +2375 -0
  40. google/cloud/spanner_dbapi/__init__.py +93 -0
  41. google/cloud/spanner_dbapi/_helpers.py +113 -0
  42. google/cloud/spanner_dbapi/batch_dml_executor.py +135 -0
  43. google/cloud/spanner_dbapi/checksum.py +80 -0
  44. google/cloud/spanner_dbapi/client_side_statement_executor.py +140 -0
  45. google/cloud/spanner_dbapi/client_side_statement_parser.py +106 -0
  46. google/cloud/spanner_dbapi/connection.py +818 -0
  47. google/cloud/spanner_dbapi/cursor.py +609 -0
  48. google/cloud/spanner_dbapi/exceptions.py +172 -0
  49. google/cloud/spanner_dbapi/parse_utils.py +392 -0
  50. google/cloud/spanner_dbapi/parsed_statement.py +63 -0
  51. google/cloud/spanner_dbapi/parser.py +258 -0
  52. google/cloud/spanner_dbapi/partition_helper.py +41 -0
  53. google/cloud/spanner_dbapi/transaction_helper.py +294 -0
  54. google/cloud/spanner_dbapi/types.py +106 -0
  55. google/cloud/spanner_dbapi/utils.py +147 -0
  56. google/cloud/spanner_dbapi/version.py +20 -0
  57. google/cloud/spanner_v1/__init__.py +154 -0
  58. google/cloud/spanner_v1/_helpers.py +751 -0
  59. google/cloud/spanner_v1/_opentelemetry_tracing.py +165 -0
  60. google/cloud/spanner_v1/backup.py +397 -0
  61. google/cloud/spanner_v1/batch.py +433 -0
  62. google/cloud/spanner_v1/client.py +538 -0
  63. google/cloud/spanner_v1/data_types.py +350 -0
  64. google/cloud/spanner_v1/database.py +1968 -0
  65. google/cloud/spanner_v1/database_sessions_manager.py +249 -0
  66. google/cloud/spanner_v1/gapic_metadata.json +268 -0
  67. google/cloud/spanner_v1/gapic_version.py +16 -0
  68. google/cloud/spanner_v1/instance.py +735 -0
  69. google/cloud/spanner_v1/keyset.py +193 -0
  70. google/cloud/spanner_v1/merged_result_set.py +146 -0
  71. google/cloud/spanner_v1/metrics/constants.py +71 -0
  72. google/cloud/spanner_v1/metrics/metrics_capture.py +75 -0
  73. google/cloud/spanner_v1/metrics/metrics_exporter.py +384 -0
  74. google/cloud/spanner_v1/metrics/metrics_interceptor.py +156 -0
  75. google/cloud/spanner_v1/metrics/metrics_tracer.py +588 -0
  76. google/cloud/spanner_v1/metrics/metrics_tracer_factory.py +328 -0
  77. google/cloud/spanner_v1/metrics/spanner_metrics_tracer_factory.py +172 -0
  78. google/cloud/spanner_v1/param_types.py +110 -0
  79. google/cloud/spanner_v1/pool.py +813 -0
  80. google/cloud/spanner_v1/py.typed +2 -0
  81. google/cloud/spanner_v1/request_id_header.py +64 -0
  82. google/cloud/spanner_v1/services/__init__.py +15 -0
  83. google/cloud/spanner_v1/services/spanner/__init__.py +22 -0
  84. google/cloud/spanner_v1/services/spanner/async_client.py +2205 -0
  85. google/cloud/spanner_v1/services/spanner/client.py +2624 -0
  86. google/cloud/spanner_v1/services/spanner/pagers.py +196 -0
  87. google/cloud/spanner_v1/services/spanner/transports/__init__.py +38 -0
  88. google/cloud/spanner_v1/services/spanner/transports/base.py +520 -0
  89. google/cloud/spanner_v1/services/spanner/transports/grpc.py +911 -0
  90. google/cloud/spanner_v1/services/spanner/transports/grpc_asyncio.py +1144 -0
  91. google/cloud/spanner_v1/services/spanner/transports/rest.py +3468 -0
  92. google/cloud/spanner_v1/services/spanner/transports/rest_base.py +981 -0
  93. google/cloud/spanner_v1/session.py +631 -0
  94. google/cloud/spanner_v1/session_options.py +133 -0
  95. google/cloud/spanner_v1/snapshot.py +1057 -0
  96. google/cloud/spanner_v1/streamed.py +402 -0
  97. google/cloud/spanner_v1/table.py +181 -0
  98. google/cloud/spanner_v1/testing/__init__.py +0 -0
  99. google/cloud/spanner_v1/testing/database_test.py +121 -0
  100. google/cloud/spanner_v1/testing/interceptors.py +118 -0
  101. google/cloud/spanner_v1/testing/mock_database_admin.py +38 -0
  102. google/cloud/spanner_v1/testing/mock_spanner.py +261 -0
  103. google/cloud/spanner_v1/testing/spanner_database_admin_pb2_grpc.py +1267 -0
  104. google/cloud/spanner_v1/testing/spanner_pb2_grpc.py +882 -0
  105. google/cloud/spanner_v1/transaction.py +747 -0
  106. google/cloud/spanner_v1/types/__init__.py +118 -0
  107. google/cloud/spanner_v1/types/commit_response.py +94 -0
  108. google/cloud/spanner_v1/types/keys.py +248 -0
  109. google/cloud/spanner_v1/types/mutation.py +201 -0
  110. google/cloud/spanner_v1/types/query_plan.py +220 -0
  111. google/cloud/spanner_v1/types/result_set.py +379 -0
  112. google/cloud/spanner_v1/types/spanner.py +1815 -0
  113. google/cloud/spanner_v1/types/transaction.py +818 -0
  114. google/cloud/spanner_v1/types/type.py +288 -0
  115. google_cloud_spanner-3.55.0.dist-info/LICENSE +202 -0
  116. google_cloud_spanner-3.55.0.dist-info/METADATA +318 -0
  117. google_cloud_spanner-3.55.0.dist-info/RECORD +119 -0
  118. google_cloud_spanner-3.55.0.dist-info/WHEEL +5 -0
  119. google_cloud_spanner-3.55.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1688 @@
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_database_v1.types import backup
38
+ from google.cloud.spanner_admin_database_v1.types import backup as gsad_backup
39
+ from google.cloud.spanner_admin_database_v1.types import backup_schedule
40
+ from google.cloud.spanner_admin_database_v1.types import (
41
+ backup_schedule as gsad_backup_schedule,
42
+ )
43
+ from google.cloud.spanner_admin_database_v1.types import spanner_database_admin
44
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
45
+ from google.iam.v1 import policy_pb2 # type: ignore
46
+ from google.longrunning import operations_pb2 # type: ignore
47
+ from google.protobuf import empty_pb2 # type: ignore
48
+ from .base import DatabaseAdminTransport, DEFAULT_CLIENT_INFO
49
+ from .grpc import DatabaseAdminGrpcTransport
50
+
51
+ try:
52
+ from google.api_core import client_logging # type: ignore
53
+
54
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
55
+ except ImportError: # pragma: NO COVER
56
+ CLIENT_LOGGING_SUPPORTED = False
57
+
58
+ _LOGGER = std_logging.getLogger(__name__)
59
+
60
+
61
+ class _LoggingClientAIOInterceptor(
62
+ grpc.aio.UnaryUnaryClientInterceptor
63
+ ): # pragma: NO COVER
64
+ async def intercept_unary_unary(self, continuation, client_call_details, request):
65
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
66
+ std_logging.DEBUG
67
+ )
68
+ if logging_enabled: # pragma: NO COVER
69
+ request_metadata = client_call_details.metadata
70
+ if isinstance(request, proto.Message):
71
+ request_payload = type(request).to_json(request)
72
+ elif isinstance(request, google.protobuf.message.Message):
73
+ request_payload = MessageToJson(request)
74
+ else:
75
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
76
+
77
+ request_metadata = {
78
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
79
+ for key, value in request_metadata
80
+ }
81
+ grpc_request = {
82
+ "payload": request_payload,
83
+ "requestMethod": "grpc",
84
+ "metadata": dict(request_metadata),
85
+ }
86
+ _LOGGER.debug(
87
+ f"Sending request for {client_call_details.method}",
88
+ extra={
89
+ "serviceName": "google.spanner.admin.database.v1.DatabaseAdmin",
90
+ "rpcName": str(client_call_details.method),
91
+ "request": grpc_request,
92
+ "metadata": grpc_request["metadata"],
93
+ },
94
+ )
95
+ response = await continuation(client_call_details, request)
96
+ if logging_enabled: # pragma: NO COVER
97
+ response_metadata = await response.trailing_metadata()
98
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
99
+ metadata = (
100
+ dict([(k, str(v)) for k, v in response_metadata])
101
+ if response_metadata
102
+ else None
103
+ )
104
+ result = await response
105
+ if isinstance(result, proto.Message):
106
+ response_payload = type(result).to_json(result)
107
+ elif isinstance(result, google.protobuf.message.Message):
108
+ response_payload = MessageToJson(result)
109
+ else:
110
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
111
+ grpc_response = {
112
+ "payload": response_payload,
113
+ "metadata": metadata,
114
+ "status": "OK",
115
+ }
116
+ _LOGGER.debug(
117
+ f"Received response to rpc {client_call_details.method}.",
118
+ extra={
119
+ "serviceName": "google.spanner.admin.database.v1.DatabaseAdmin",
120
+ "rpcName": str(client_call_details.method),
121
+ "response": grpc_response,
122
+ "metadata": grpc_response["metadata"],
123
+ },
124
+ )
125
+ return response
126
+
127
+
128
+ class DatabaseAdminGrpcAsyncIOTransport(DatabaseAdminTransport):
129
+ """gRPC AsyncIO backend transport for DatabaseAdmin.
130
+
131
+ Cloud Spanner Database Admin API
132
+
133
+ The Cloud Spanner Database Admin API can be used to:
134
+
135
+ - create, drop, and list databases
136
+ - update the schema of pre-existing databases
137
+ - create, delete, copy and list backups for a database
138
+ - restore a database from an existing backup
139
+
140
+ This class defines the same methods as the primary client, so the
141
+ primary client can load the underlying transport implementation
142
+ and call it.
143
+
144
+ It sends protocol buffers over the wire using gRPC (which is built on
145
+ top of HTTP/2); the ``grpcio`` package must be installed.
146
+ """
147
+
148
+ _grpc_channel: aio.Channel
149
+ _stubs: Dict[str, Callable] = {}
150
+
151
+ @classmethod
152
+ def create_channel(
153
+ cls,
154
+ host: str = "spanner.googleapis.com",
155
+ credentials: Optional[ga_credentials.Credentials] = None,
156
+ credentials_file: Optional[str] = None,
157
+ scopes: Optional[Sequence[str]] = None,
158
+ quota_project_id: Optional[str] = None,
159
+ **kwargs,
160
+ ) -> aio.Channel:
161
+ """Create and return a gRPC AsyncIO channel object.
162
+ Args:
163
+ host (Optional[str]): The host for the channel to use.
164
+ credentials (Optional[~.Credentials]): The
165
+ authorization credentials to attach to requests. These
166
+ credentials identify this application to the service. If
167
+ none are specified, the client will attempt to ascertain
168
+ the credentials from the environment.
169
+ credentials_file (Optional[str]): A file with credentials that can
170
+ be loaded with :func:`google.auth.load_credentials_from_file`.
171
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
172
+ service. These are only used when credentials are not specified and
173
+ are passed to :func:`google.auth.default`.
174
+ quota_project_id (Optional[str]): An optional project to use for billing
175
+ and quota.
176
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
177
+ channel creation.
178
+ Returns:
179
+ aio.Channel: A gRPC AsyncIO channel object.
180
+ """
181
+
182
+ return grpc_helpers_async.create_channel(
183
+ host,
184
+ credentials=credentials,
185
+ credentials_file=credentials_file,
186
+ quota_project_id=quota_project_id,
187
+ default_scopes=cls.AUTH_SCOPES,
188
+ scopes=scopes,
189
+ default_host=cls.DEFAULT_HOST,
190
+ **kwargs,
191
+ )
192
+
193
+ def __init__(
194
+ self,
195
+ *,
196
+ host: str = "spanner.googleapis.com",
197
+ credentials: Optional[ga_credentials.Credentials] = None,
198
+ credentials_file: Optional[str] = None,
199
+ scopes: Optional[Sequence[str]] = None,
200
+ channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
201
+ api_mtls_endpoint: Optional[str] = None,
202
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
203
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
204
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
205
+ quota_project_id: Optional[str] = None,
206
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
207
+ always_use_jwt_access: Optional[bool] = False,
208
+ api_audience: Optional[str] = None,
209
+ ) -> None:
210
+ """Instantiate the transport.
211
+
212
+ Args:
213
+ host (Optional[str]):
214
+ The hostname to connect to (default: 'spanner.googleapis.com').
215
+ credentials (Optional[google.auth.credentials.Credentials]): The
216
+ authorization credentials to attach to requests. These
217
+ credentials identify the application to the service; if none
218
+ are specified, the client will attempt to ascertain the
219
+ credentials from the environment.
220
+ This argument is ignored if a ``channel`` instance is provided.
221
+ credentials_file (Optional[str]): A file with credentials that can
222
+ be loaded with :func:`google.auth.load_credentials_from_file`.
223
+ This argument is ignored if a ``channel`` instance is provided.
224
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
225
+ service. These are only used when credentials are not specified and
226
+ are passed to :func:`google.auth.default`.
227
+ channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
228
+ A ``Channel`` instance through which to make calls, or a Callable
229
+ that constructs and returns one. If set to None, ``self.create_channel``
230
+ is used to create the channel. If a Callable is given, it will be called
231
+ with the same arguments as used in ``self.create_channel``.
232
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
233
+ If provided, it overrides the ``host`` argument and tries to create
234
+ a mutual TLS channel with client SSL credentials from
235
+ ``client_cert_source`` or application default SSL credentials.
236
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
237
+ Deprecated. A callback to provide client SSL certificate bytes and
238
+ private key bytes, both in PEM format. It is ignored if
239
+ ``api_mtls_endpoint`` is None.
240
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
241
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
242
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
243
+ A callback to provide client certificate bytes and private key bytes,
244
+ both in PEM format. It is used to configure a mutual TLS channel. It is
245
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
246
+ quota_project_id (Optional[str]): An optional project to use for billing
247
+ and quota.
248
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
249
+ The client info used to send a user-agent string along with
250
+ API requests. If ``None``, then default info will be used.
251
+ Generally, you only need to set this if you're developing
252
+ your own client library.
253
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
254
+ be used for service account credentials.
255
+
256
+ Raises:
257
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
258
+ creation failed for any reason.
259
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
260
+ and ``credentials_file`` are passed.
261
+ """
262
+ self._grpc_channel = None
263
+ self._ssl_channel_credentials = ssl_channel_credentials
264
+ self._stubs: Dict[str, Callable] = {}
265
+ self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None
266
+
267
+ if api_mtls_endpoint:
268
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
269
+ if client_cert_source:
270
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
271
+
272
+ if isinstance(channel, aio.Channel):
273
+ # Ignore credentials if a channel was passed.
274
+ credentials = None
275
+ self._ignore_credentials = True
276
+ # If a channel was explicitly provided, set it.
277
+ self._grpc_channel = channel
278
+ self._ssl_channel_credentials = None
279
+ else:
280
+ if api_mtls_endpoint:
281
+ host = api_mtls_endpoint
282
+
283
+ # Create SSL credentials with client_cert_source or application
284
+ # default SSL credentials.
285
+ if client_cert_source:
286
+ cert, key = client_cert_source()
287
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
288
+ certificate_chain=cert, private_key=key
289
+ )
290
+ else:
291
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
292
+
293
+ else:
294
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
295
+ cert, key = client_cert_source_for_mtls()
296
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
297
+ certificate_chain=cert, private_key=key
298
+ )
299
+
300
+ # The base transport sets the host, credentials and scopes
301
+ super().__init__(
302
+ host=host,
303
+ credentials=credentials,
304
+ credentials_file=credentials_file,
305
+ scopes=scopes,
306
+ quota_project_id=quota_project_id,
307
+ client_info=client_info,
308
+ always_use_jwt_access=always_use_jwt_access,
309
+ api_audience=api_audience,
310
+ )
311
+
312
+ if not self._grpc_channel:
313
+ # initialize with the provided callable or the default channel
314
+ channel_init = channel or type(self).create_channel
315
+ self._grpc_channel = channel_init(
316
+ self._host,
317
+ # use the credentials which are saved
318
+ credentials=self._credentials,
319
+ # Set ``credentials_file`` to ``None`` here as
320
+ # the credentials that we saved earlier should be used.
321
+ credentials_file=None,
322
+ scopes=self._scopes,
323
+ ssl_credentials=self._ssl_channel_credentials,
324
+ quota_project_id=quota_project_id,
325
+ options=[
326
+ ("grpc.max_send_message_length", -1),
327
+ ("grpc.max_receive_message_length", -1),
328
+ ],
329
+ )
330
+
331
+ self._interceptor = _LoggingClientAIOInterceptor()
332
+ self._grpc_channel._unary_unary_interceptors.append(self._interceptor)
333
+ self._logged_channel = self._grpc_channel
334
+ self._wrap_with_kind = (
335
+ "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
336
+ )
337
+ # Wrap messages. This must be done after self._logged_channel exists
338
+ self._prep_wrapped_messages(client_info)
339
+
340
+ @property
341
+ def grpc_channel(self) -> aio.Channel:
342
+ """Create the channel designed to connect to this service.
343
+
344
+ This property caches on the instance; repeated calls return
345
+ the same channel.
346
+ """
347
+ # Return the channel from cache.
348
+ return self._grpc_channel
349
+
350
+ @property
351
+ def operations_client(self) -> operations_v1.OperationsAsyncClient:
352
+ """Create the client designed to process long-running operations.
353
+
354
+ This property caches on the instance; repeated calls return the same
355
+ client.
356
+ """
357
+ # Quick check: Only create a new client if we do not already have one.
358
+ if self._operations_client is None:
359
+ self._operations_client = operations_v1.OperationsAsyncClient(
360
+ self._logged_channel
361
+ )
362
+
363
+ # Return the client from cache.
364
+ return self._operations_client
365
+
366
+ @property
367
+ def list_databases(
368
+ self,
369
+ ) -> Callable[
370
+ [spanner_database_admin.ListDatabasesRequest],
371
+ Awaitable[spanner_database_admin.ListDatabasesResponse],
372
+ ]:
373
+ r"""Return a callable for the list databases method over gRPC.
374
+
375
+ Lists Cloud Spanner databases.
376
+
377
+ Returns:
378
+ Callable[[~.ListDatabasesRequest],
379
+ Awaitable[~.ListDatabasesResponse]]:
380
+ A function that, when called, will call the underlying RPC
381
+ on the server.
382
+ """
383
+ # Generate a "stub function" on-the-fly which will actually make
384
+ # the request.
385
+ # gRPC handles serialization and deserialization, so we just need
386
+ # to pass in the functions for each.
387
+ if "list_databases" not in self._stubs:
388
+ self._stubs["list_databases"] = self._logged_channel.unary_unary(
389
+ "/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabases",
390
+ request_serializer=spanner_database_admin.ListDatabasesRequest.serialize,
391
+ response_deserializer=spanner_database_admin.ListDatabasesResponse.deserialize,
392
+ )
393
+ return self._stubs["list_databases"]
394
+
395
+ @property
396
+ def create_database(
397
+ self,
398
+ ) -> Callable[
399
+ [spanner_database_admin.CreateDatabaseRequest],
400
+ Awaitable[operations_pb2.Operation],
401
+ ]:
402
+ r"""Return a callable for the create database method over gRPC.
403
+
404
+ Creates a new Cloud Spanner database and starts to prepare it
405
+ for serving. The returned [long-running
406
+ operation][google.longrunning.Operation] will have a name of the
407
+ format ``<database_name>/operations/<operation_id>`` and can be
408
+ used to track preparation of the database. The
409
+ [metadata][google.longrunning.Operation.metadata] field type is
410
+ [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata].
411
+ The [response][google.longrunning.Operation.response] field type
412
+ is [Database][google.spanner.admin.database.v1.Database], if
413
+ successful.
414
+
415
+ Returns:
416
+ Callable[[~.CreateDatabaseRequest],
417
+ Awaitable[~.Operation]]:
418
+ A function that, when called, will call the underlying RPC
419
+ on the server.
420
+ """
421
+ # Generate a "stub function" on-the-fly which will actually make
422
+ # the request.
423
+ # gRPC handles serialization and deserialization, so we just need
424
+ # to pass in the functions for each.
425
+ if "create_database" not in self._stubs:
426
+ self._stubs["create_database"] = self._logged_channel.unary_unary(
427
+ "/google.spanner.admin.database.v1.DatabaseAdmin/CreateDatabase",
428
+ request_serializer=spanner_database_admin.CreateDatabaseRequest.serialize,
429
+ response_deserializer=operations_pb2.Operation.FromString,
430
+ )
431
+ return self._stubs["create_database"]
432
+
433
+ @property
434
+ def get_database(
435
+ self,
436
+ ) -> Callable[
437
+ [spanner_database_admin.GetDatabaseRequest],
438
+ Awaitable[spanner_database_admin.Database],
439
+ ]:
440
+ r"""Return a callable for the get database method over gRPC.
441
+
442
+ Gets the state of a Cloud Spanner database.
443
+
444
+ Returns:
445
+ Callable[[~.GetDatabaseRequest],
446
+ Awaitable[~.Database]]:
447
+ A function that, when called, will call the underlying RPC
448
+ on the server.
449
+ """
450
+ # Generate a "stub function" on-the-fly which will actually make
451
+ # the request.
452
+ # gRPC handles serialization and deserialization, so we just need
453
+ # to pass in the functions for each.
454
+ if "get_database" not in self._stubs:
455
+ self._stubs["get_database"] = self._logged_channel.unary_unary(
456
+ "/google.spanner.admin.database.v1.DatabaseAdmin/GetDatabase",
457
+ request_serializer=spanner_database_admin.GetDatabaseRequest.serialize,
458
+ response_deserializer=spanner_database_admin.Database.deserialize,
459
+ )
460
+ return self._stubs["get_database"]
461
+
462
+ @property
463
+ def update_database(
464
+ self,
465
+ ) -> Callable[
466
+ [spanner_database_admin.UpdateDatabaseRequest],
467
+ Awaitable[operations_pb2.Operation],
468
+ ]:
469
+ r"""Return a callable for the update database method over gRPC.
470
+
471
+ Updates a Cloud Spanner database. The returned [long-running
472
+ operation][google.longrunning.Operation] can be used to track
473
+ the progress of updating the database. If the named database
474
+ does not exist, returns ``NOT_FOUND``.
475
+
476
+ While the operation is pending:
477
+
478
+ - The database's
479
+ [reconciling][google.spanner.admin.database.v1.Database.reconciling]
480
+ field is set to true.
481
+ - Cancelling the operation is best-effort. If the cancellation
482
+ succeeds, the operation metadata's
483
+ [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time]
484
+ is set, the updates are reverted, and the operation
485
+ terminates with a ``CANCELLED`` status.
486
+ - New UpdateDatabase requests will return a
487
+ ``FAILED_PRECONDITION`` error until the pending operation is
488
+ done (returns successfully or with error).
489
+ - Reading the database via the API continues to give the
490
+ pre-request values.
491
+
492
+ Upon completion of the returned operation:
493
+
494
+ - The new values are in effect and readable via the API.
495
+ - The database's
496
+ [reconciling][google.spanner.admin.database.v1.Database.reconciling]
497
+ field becomes false.
498
+
499
+ The returned [long-running
500
+ operation][google.longrunning.Operation] will have a name of the
501
+ format
502
+ ``projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>``
503
+ and can be used to track the database modification. The
504
+ [metadata][google.longrunning.Operation.metadata] field type is
505
+ [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata].
506
+ The [response][google.longrunning.Operation.response] field type
507
+ is [Database][google.spanner.admin.database.v1.Database], if
508
+ successful.
509
+
510
+ Returns:
511
+ Callable[[~.UpdateDatabaseRequest],
512
+ Awaitable[~.Operation]]:
513
+ A function that, when called, will call the underlying RPC
514
+ on the server.
515
+ """
516
+ # Generate a "stub function" on-the-fly which will actually make
517
+ # the request.
518
+ # gRPC handles serialization and deserialization, so we just need
519
+ # to pass in the functions for each.
520
+ if "update_database" not in self._stubs:
521
+ self._stubs["update_database"] = self._logged_channel.unary_unary(
522
+ "/google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabase",
523
+ request_serializer=spanner_database_admin.UpdateDatabaseRequest.serialize,
524
+ response_deserializer=operations_pb2.Operation.FromString,
525
+ )
526
+ return self._stubs["update_database"]
527
+
528
+ @property
529
+ def update_database_ddl(
530
+ self,
531
+ ) -> Callable[
532
+ [spanner_database_admin.UpdateDatabaseDdlRequest],
533
+ Awaitable[operations_pb2.Operation],
534
+ ]:
535
+ r"""Return a callable for the update database ddl method over gRPC.
536
+
537
+ Updates the schema of a Cloud Spanner database by
538
+ creating/altering/dropping tables, columns, indexes, etc. The
539
+ returned [long-running operation][google.longrunning.Operation]
540
+ will have a name of the format
541
+ ``<database_name>/operations/<operation_id>`` and can be used to
542
+ track execution of the schema change(s). The
543
+ [metadata][google.longrunning.Operation.metadata] field type is
544
+ [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata].
545
+ The operation has no response.
546
+
547
+ Returns:
548
+ Callable[[~.UpdateDatabaseDdlRequest],
549
+ Awaitable[~.Operation]]:
550
+ A function that, when called, will call the underlying RPC
551
+ on the server.
552
+ """
553
+ # Generate a "stub function" on-the-fly which will actually make
554
+ # the request.
555
+ # gRPC handles serialization and deserialization, so we just need
556
+ # to pass in the functions for each.
557
+ if "update_database_ddl" not in self._stubs:
558
+ self._stubs["update_database_ddl"] = self._logged_channel.unary_unary(
559
+ "/google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabaseDdl",
560
+ request_serializer=spanner_database_admin.UpdateDatabaseDdlRequest.serialize,
561
+ response_deserializer=operations_pb2.Operation.FromString,
562
+ )
563
+ return self._stubs["update_database_ddl"]
564
+
565
+ @property
566
+ def drop_database(
567
+ self,
568
+ ) -> Callable[
569
+ [spanner_database_admin.DropDatabaseRequest], Awaitable[empty_pb2.Empty]
570
+ ]:
571
+ r"""Return a callable for the drop database method over gRPC.
572
+
573
+ Drops (aka deletes) a Cloud Spanner database. Completed backups
574
+ for the database will be retained according to their
575
+ ``expire_time``. Note: Cloud Spanner might continue to accept
576
+ requests for a few seconds after the database has been deleted.
577
+
578
+ Returns:
579
+ Callable[[~.DropDatabaseRequest],
580
+ Awaitable[~.Empty]]:
581
+ A function that, when called, will call the underlying RPC
582
+ on the server.
583
+ """
584
+ # Generate a "stub function" on-the-fly which will actually make
585
+ # the request.
586
+ # gRPC handles serialization and deserialization, so we just need
587
+ # to pass in the functions for each.
588
+ if "drop_database" not in self._stubs:
589
+ self._stubs["drop_database"] = self._logged_channel.unary_unary(
590
+ "/google.spanner.admin.database.v1.DatabaseAdmin/DropDatabase",
591
+ request_serializer=spanner_database_admin.DropDatabaseRequest.serialize,
592
+ response_deserializer=empty_pb2.Empty.FromString,
593
+ )
594
+ return self._stubs["drop_database"]
595
+
596
+ @property
597
+ def get_database_ddl(
598
+ self,
599
+ ) -> Callable[
600
+ [spanner_database_admin.GetDatabaseDdlRequest],
601
+ Awaitable[spanner_database_admin.GetDatabaseDdlResponse],
602
+ ]:
603
+ r"""Return a callable for the get database ddl method over gRPC.
604
+
605
+ Returns the schema of a Cloud Spanner database as a list of
606
+ formatted DDL statements. This method does not show pending
607
+ schema updates, those may be queried using the
608
+ [Operations][google.longrunning.Operations] API.
609
+
610
+ Returns:
611
+ Callable[[~.GetDatabaseDdlRequest],
612
+ Awaitable[~.GetDatabaseDdlResponse]]:
613
+ A function that, when called, will call the underlying RPC
614
+ on the server.
615
+ """
616
+ # Generate a "stub function" on-the-fly which will actually make
617
+ # the request.
618
+ # gRPC handles serialization and deserialization, so we just need
619
+ # to pass in the functions for each.
620
+ if "get_database_ddl" not in self._stubs:
621
+ self._stubs["get_database_ddl"] = self._logged_channel.unary_unary(
622
+ "/google.spanner.admin.database.v1.DatabaseAdmin/GetDatabaseDdl",
623
+ request_serializer=spanner_database_admin.GetDatabaseDdlRequest.serialize,
624
+ response_deserializer=spanner_database_admin.GetDatabaseDdlResponse.deserialize,
625
+ )
626
+ return self._stubs["get_database_ddl"]
627
+
628
+ @property
629
+ def set_iam_policy(
630
+ self,
631
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], Awaitable[policy_pb2.Policy]]:
632
+ r"""Return a callable for the set iam policy method over gRPC.
633
+
634
+ Sets the access control policy on a database or backup resource.
635
+ Replaces any existing policy.
636
+
637
+ Authorization requires ``spanner.databases.setIamPolicy``
638
+ permission on
639
+ [resource][google.iam.v1.SetIamPolicyRequest.resource]. For
640
+ backups, authorization requires ``spanner.backups.setIamPolicy``
641
+ permission on
642
+ [resource][google.iam.v1.SetIamPolicyRequest.resource].
643
+
644
+ Returns:
645
+ Callable[[~.SetIamPolicyRequest],
646
+ Awaitable[~.Policy]]:
647
+ A function that, when called, will call the underlying RPC
648
+ on the server.
649
+ """
650
+ # Generate a "stub function" on-the-fly which will actually make
651
+ # the request.
652
+ # gRPC handles serialization and deserialization, so we just need
653
+ # to pass in the functions for each.
654
+ if "set_iam_policy" not in self._stubs:
655
+ self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
656
+ "/google.spanner.admin.database.v1.DatabaseAdmin/SetIamPolicy",
657
+ request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
658
+ response_deserializer=policy_pb2.Policy.FromString,
659
+ )
660
+ return self._stubs["set_iam_policy"]
661
+
662
+ @property
663
+ def get_iam_policy(
664
+ self,
665
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], Awaitable[policy_pb2.Policy]]:
666
+ r"""Return a callable for the get iam policy method over gRPC.
667
+
668
+ Gets the access control policy for a database or backup
669
+ resource. Returns an empty policy if a database or backup exists
670
+ but does not have a policy set.
671
+
672
+ Authorization requires ``spanner.databases.getIamPolicy``
673
+ permission on
674
+ [resource][google.iam.v1.GetIamPolicyRequest.resource]. For
675
+ backups, authorization requires ``spanner.backups.getIamPolicy``
676
+ permission on
677
+ [resource][google.iam.v1.GetIamPolicyRequest.resource].
678
+
679
+ Returns:
680
+ Callable[[~.GetIamPolicyRequest],
681
+ Awaitable[~.Policy]]:
682
+ A function that, when called, will call the underlying RPC
683
+ on the server.
684
+ """
685
+ # Generate a "stub function" on-the-fly which will actually make
686
+ # the request.
687
+ # gRPC handles serialization and deserialization, so we just need
688
+ # to pass in the functions for each.
689
+ if "get_iam_policy" not in self._stubs:
690
+ self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
691
+ "/google.spanner.admin.database.v1.DatabaseAdmin/GetIamPolicy",
692
+ request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
693
+ response_deserializer=policy_pb2.Policy.FromString,
694
+ )
695
+ return self._stubs["get_iam_policy"]
696
+
697
+ @property
698
+ def test_iam_permissions(
699
+ self,
700
+ ) -> Callable[
701
+ [iam_policy_pb2.TestIamPermissionsRequest],
702
+ Awaitable[iam_policy_pb2.TestIamPermissionsResponse],
703
+ ]:
704
+ r"""Return a callable for the test iam permissions method over gRPC.
705
+
706
+ Returns permissions that the caller has on the specified
707
+ database or backup resource.
708
+
709
+ Attempting this RPC on a non-existent Cloud Spanner database
710
+ will result in a NOT_FOUND error if the user has
711
+ ``spanner.databases.list`` permission on the containing Cloud
712
+ Spanner instance. Otherwise returns an empty set of permissions.
713
+ Calling this method on a backup that does not exist will result
714
+ in a NOT_FOUND error if the user has ``spanner.backups.list``
715
+ permission on the containing instance.
716
+
717
+ Returns:
718
+ Callable[[~.TestIamPermissionsRequest],
719
+ Awaitable[~.TestIamPermissionsResponse]]:
720
+ A function that, when called, will call the underlying RPC
721
+ on the server.
722
+ """
723
+ # Generate a "stub function" on-the-fly which will actually make
724
+ # the request.
725
+ # gRPC handles serialization and deserialization, so we just need
726
+ # to pass in the functions for each.
727
+ if "test_iam_permissions" not in self._stubs:
728
+ self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
729
+ "/google.spanner.admin.database.v1.DatabaseAdmin/TestIamPermissions",
730
+ request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
731
+ response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
732
+ )
733
+ return self._stubs["test_iam_permissions"]
734
+
735
+ @property
736
+ def create_backup(
737
+ self,
738
+ ) -> Callable[
739
+ [gsad_backup.CreateBackupRequest], Awaitable[operations_pb2.Operation]
740
+ ]:
741
+ r"""Return a callable for the create backup method over gRPC.
742
+
743
+ Starts creating a new Cloud Spanner Backup. The returned backup
744
+ [long-running operation][google.longrunning.Operation] will have
745
+ a name of the format
746
+ ``projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>``
747
+ and can be used to track creation of the backup. The
748
+ [metadata][google.longrunning.Operation.metadata] field type is
749
+ [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
750
+ The [response][google.longrunning.Operation.response] field type
751
+ is [Backup][google.spanner.admin.database.v1.Backup], if
752
+ successful. Cancelling the returned operation will stop the
753
+ creation and delete the backup. There can be only one pending
754
+ backup creation per database. Backup creation of different
755
+ databases can run concurrently.
756
+
757
+ Returns:
758
+ Callable[[~.CreateBackupRequest],
759
+ Awaitable[~.Operation]]:
760
+ A function that, when called, will call the underlying RPC
761
+ on the server.
762
+ """
763
+ # Generate a "stub function" on-the-fly which will actually make
764
+ # the request.
765
+ # gRPC handles serialization and deserialization, so we just need
766
+ # to pass in the functions for each.
767
+ if "create_backup" not in self._stubs:
768
+ self._stubs["create_backup"] = self._logged_channel.unary_unary(
769
+ "/google.spanner.admin.database.v1.DatabaseAdmin/CreateBackup",
770
+ request_serializer=gsad_backup.CreateBackupRequest.serialize,
771
+ response_deserializer=operations_pb2.Operation.FromString,
772
+ )
773
+ return self._stubs["create_backup"]
774
+
775
+ @property
776
+ def copy_backup(
777
+ self,
778
+ ) -> Callable[[backup.CopyBackupRequest], Awaitable[operations_pb2.Operation]]:
779
+ r"""Return a callable for the copy backup method over gRPC.
780
+
781
+ Starts copying a Cloud Spanner Backup. The returned backup
782
+ [long-running operation][google.longrunning.Operation] will have
783
+ a name of the format
784
+ ``projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>``
785
+ and can be used to track copying of the backup. The operation is
786
+ associated with the destination backup. The
787
+ [metadata][google.longrunning.Operation.metadata] field type is
788
+ [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata].
789
+ The [response][google.longrunning.Operation.response] field type
790
+ is [Backup][google.spanner.admin.database.v1.Backup], if
791
+ successful. Cancelling the returned operation will stop the
792
+ copying and delete the destination backup. Concurrent CopyBackup
793
+ requests can run on the same source backup.
794
+
795
+ Returns:
796
+ Callable[[~.CopyBackupRequest],
797
+ Awaitable[~.Operation]]:
798
+ A function that, when called, will call the underlying RPC
799
+ on the server.
800
+ """
801
+ # Generate a "stub function" on-the-fly which will actually make
802
+ # the request.
803
+ # gRPC handles serialization and deserialization, so we just need
804
+ # to pass in the functions for each.
805
+ if "copy_backup" not in self._stubs:
806
+ self._stubs["copy_backup"] = self._logged_channel.unary_unary(
807
+ "/google.spanner.admin.database.v1.DatabaseAdmin/CopyBackup",
808
+ request_serializer=backup.CopyBackupRequest.serialize,
809
+ response_deserializer=operations_pb2.Operation.FromString,
810
+ )
811
+ return self._stubs["copy_backup"]
812
+
813
+ @property
814
+ def get_backup(
815
+ self,
816
+ ) -> Callable[[backup.GetBackupRequest], Awaitable[backup.Backup]]:
817
+ r"""Return a callable for the get backup method over gRPC.
818
+
819
+ Gets metadata on a pending or completed
820
+ [Backup][google.spanner.admin.database.v1.Backup].
821
+
822
+ Returns:
823
+ Callable[[~.GetBackupRequest],
824
+ Awaitable[~.Backup]]:
825
+ A function that, when called, will call the underlying RPC
826
+ on the server.
827
+ """
828
+ # Generate a "stub function" on-the-fly which will actually make
829
+ # the request.
830
+ # gRPC handles serialization and deserialization, so we just need
831
+ # to pass in the functions for each.
832
+ if "get_backup" not in self._stubs:
833
+ self._stubs["get_backup"] = self._logged_channel.unary_unary(
834
+ "/google.spanner.admin.database.v1.DatabaseAdmin/GetBackup",
835
+ request_serializer=backup.GetBackupRequest.serialize,
836
+ response_deserializer=backup.Backup.deserialize,
837
+ )
838
+ return self._stubs["get_backup"]
839
+
840
+ @property
841
+ def update_backup(
842
+ self,
843
+ ) -> Callable[[gsad_backup.UpdateBackupRequest], Awaitable[gsad_backup.Backup]]:
844
+ r"""Return a callable for the update backup method over gRPC.
845
+
846
+ Updates a pending or completed
847
+ [Backup][google.spanner.admin.database.v1.Backup].
848
+
849
+ Returns:
850
+ Callable[[~.UpdateBackupRequest],
851
+ Awaitable[~.Backup]]:
852
+ A function that, when called, will call the underlying RPC
853
+ on the server.
854
+ """
855
+ # Generate a "stub function" on-the-fly which will actually make
856
+ # the request.
857
+ # gRPC handles serialization and deserialization, so we just need
858
+ # to pass in the functions for each.
859
+ if "update_backup" not in self._stubs:
860
+ self._stubs["update_backup"] = self._logged_channel.unary_unary(
861
+ "/google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackup",
862
+ request_serializer=gsad_backup.UpdateBackupRequest.serialize,
863
+ response_deserializer=gsad_backup.Backup.deserialize,
864
+ )
865
+ return self._stubs["update_backup"]
866
+
867
+ @property
868
+ def delete_backup(
869
+ self,
870
+ ) -> Callable[[backup.DeleteBackupRequest], Awaitable[empty_pb2.Empty]]:
871
+ r"""Return a callable for the delete backup method over gRPC.
872
+
873
+ Deletes a pending or completed
874
+ [Backup][google.spanner.admin.database.v1.Backup].
875
+
876
+ Returns:
877
+ Callable[[~.DeleteBackupRequest],
878
+ Awaitable[~.Empty]]:
879
+ A function that, when called, will call the underlying RPC
880
+ on the server.
881
+ """
882
+ # Generate a "stub function" on-the-fly which will actually make
883
+ # the request.
884
+ # gRPC handles serialization and deserialization, so we just need
885
+ # to pass in the functions for each.
886
+ if "delete_backup" not in self._stubs:
887
+ self._stubs["delete_backup"] = self._logged_channel.unary_unary(
888
+ "/google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackup",
889
+ request_serializer=backup.DeleteBackupRequest.serialize,
890
+ response_deserializer=empty_pb2.Empty.FromString,
891
+ )
892
+ return self._stubs["delete_backup"]
893
+
894
+ @property
895
+ def list_backups(
896
+ self,
897
+ ) -> Callable[[backup.ListBackupsRequest], Awaitable[backup.ListBackupsResponse]]:
898
+ r"""Return a callable for the list backups method over gRPC.
899
+
900
+ Lists completed and pending backups. Backups returned are
901
+ ordered by ``create_time`` in descending order, starting from
902
+ the most recent ``create_time``.
903
+
904
+ Returns:
905
+ Callable[[~.ListBackupsRequest],
906
+ Awaitable[~.ListBackupsResponse]]:
907
+ A function that, when called, will call the underlying RPC
908
+ on the server.
909
+ """
910
+ # Generate a "stub function" on-the-fly which will actually make
911
+ # the request.
912
+ # gRPC handles serialization and deserialization, so we just need
913
+ # to pass in the functions for each.
914
+ if "list_backups" not in self._stubs:
915
+ self._stubs["list_backups"] = self._logged_channel.unary_unary(
916
+ "/google.spanner.admin.database.v1.DatabaseAdmin/ListBackups",
917
+ request_serializer=backup.ListBackupsRequest.serialize,
918
+ response_deserializer=backup.ListBackupsResponse.deserialize,
919
+ )
920
+ return self._stubs["list_backups"]
921
+
922
+ @property
923
+ def restore_database(
924
+ self,
925
+ ) -> Callable[
926
+ [spanner_database_admin.RestoreDatabaseRequest],
927
+ Awaitable[operations_pb2.Operation],
928
+ ]:
929
+ r"""Return a callable for the restore database method over gRPC.
930
+
931
+ Create a new database by restoring from a completed backup. The
932
+ new database must be in the same project and in an instance with
933
+ the same instance configuration as the instance containing the
934
+ backup. The returned database [long-running
935
+ operation][google.longrunning.Operation] has a name of the
936
+ format
937
+ ``projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>``,
938
+ and can be used to track the progress of the operation, and to
939
+ cancel it. The [metadata][google.longrunning.Operation.metadata]
940
+ field type is
941
+ [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata].
942
+ The [response][google.longrunning.Operation.response] type is
943
+ [Database][google.spanner.admin.database.v1.Database], if
944
+ successful. Cancelling the returned operation will stop the
945
+ restore and delete the database. There can be only one database
946
+ being restored into an instance at a time. Once the restore
947
+ operation completes, a new restore operation can be initiated,
948
+ without waiting for the optimize operation associated with the
949
+ first restore to complete.
950
+
951
+ Returns:
952
+ Callable[[~.RestoreDatabaseRequest],
953
+ Awaitable[~.Operation]]:
954
+ A function that, when called, will call the underlying RPC
955
+ on the server.
956
+ """
957
+ # Generate a "stub function" on-the-fly which will actually make
958
+ # the request.
959
+ # gRPC handles serialization and deserialization, so we just need
960
+ # to pass in the functions for each.
961
+ if "restore_database" not in self._stubs:
962
+ self._stubs["restore_database"] = self._logged_channel.unary_unary(
963
+ "/google.spanner.admin.database.v1.DatabaseAdmin/RestoreDatabase",
964
+ request_serializer=spanner_database_admin.RestoreDatabaseRequest.serialize,
965
+ response_deserializer=operations_pb2.Operation.FromString,
966
+ )
967
+ return self._stubs["restore_database"]
968
+
969
+ @property
970
+ def list_database_operations(
971
+ self,
972
+ ) -> Callable[
973
+ [spanner_database_admin.ListDatabaseOperationsRequest],
974
+ Awaitable[spanner_database_admin.ListDatabaseOperationsResponse],
975
+ ]:
976
+ r"""Return a callable for the list database operations method over gRPC.
977
+
978
+ Lists database
979
+ [longrunning-operations][google.longrunning.Operation]. A
980
+ database operation has a name of the form
981
+ ``projects/<project>/instances/<instance>/databases/<database>/operations/<operation>``.
982
+ The long-running operation
983
+ [metadata][google.longrunning.Operation.metadata] field type
984
+ ``metadata.type_url`` describes the type of the metadata.
985
+ Operations returned include those that have
986
+ completed/failed/canceled within the last 7 days, and pending
987
+ operations.
988
+
989
+ Returns:
990
+ Callable[[~.ListDatabaseOperationsRequest],
991
+ Awaitable[~.ListDatabaseOperationsResponse]]:
992
+ A function that, when called, will call the underlying RPC
993
+ on the server.
994
+ """
995
+ # Generate a "stub function" on-the-fly which will actually make
996
+ # the request.
997
+ # gRPC handles serialization and deserialization, so we just need
998
+ # to pass in the functions for each.
999
+ if "list_database_operations" not in self._stubs:
1000
+ self._stubs["list_database_operations"] = self._logged_channel.unary_unary(
1001
+ "/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseOperations",
1002
+ request_serializer=spanner_database_admin.ListDatabaseOperationsRequest.serialize,
1003
+ response_deserializer=spanner_database_admin.ListDatabaseOperationsResponse.deserialize,
1004
+ )
1005
+ return self._stubs["list_database_operations"]
1006
+
1007
+ @property
1008
+ def list_backup_operations(
1009
+ self,
1010
+ ) -> Callable[
1011
+ [backup.ListBackupOperationsRequest],
1012
+ Awaitable[backup.ListBackupOperationsResponse],
1013
+ ]:
1014
+ r"""Return a callable for the list backup operations method over gRPC.
1015
+
1016
+ Lists the backup [long-running
1017
+ operations][google.longrunning.Operation] in the given instance.
1018
+ A backup operation has a name of the form
1019
+ ``projects/<project>/instances/<instance>/backups/<backup>/operations/<operation>``.
1020
+ The long-running operation
1021
+ [metadata][google.longrunning.Operation.metadata] field type
1022
+ ``metadata.type_url`` describes the type of the metadata.
1023
+ Operations returned include those that have
1024
+ completed/failed/canceled within the last 7 days, and pending
1025
+ operations. Operations returned are ordered by
1026
+ ``operation.metadata.value.progress.start_time`` in descending
1027
+ order starting from the most recently started operation.
1028
+
1029
+ Returns:
1030
+ Callable[[~.ListBackupOperationsRequest],
1031
+ Awaitable[~.ListBackupOperationsResponse]]:
1032
+ A function that, when called, will call the underlying RPC
1033
+ on the server.
1034
+ """
1035
+ # Generate a "stub function" on-the-fly which will actually make
1036
+ # the request.
1037
+ # gRPC handles serialization and deserialization, so we just need
1038
+ # to pass in the functions for each.
1039
+ if "list_backup_operations" not in self._stubs:
1040
+ self._stubs["list_backup_operations"] = self._logged_channel.unary_unary(
1041
+ "/google.spanner.admin.database.v1.DatabaseAdmin/ListBackupOperations",
1042
+ request_serializer=backup.ListBackupOperationsRequest.serialize,
1043
+ response_deserializer=backup.ListBackupOperationsResponse.deserialize,
1044
+ )
1045
+ return self._stubs["list_backup_operations"]
1046
+
1047
+ @property
1048
+ def list_database_roles(
1049
+ self,
1050
+ ) -> Callable[
1051
+ [spanner_database_admin.ListDatabaseRolesRequest],
1052
+ Awaitable[spanner_database_admin.ListDatabaseRolesResponse],
1053
+ ]:
1054
+ r"""Return a callable for the list database roles method over gRPC.
1055
+
1056
+ Lists Cloud Spanner database roles.
1057
+
1058
+ Returns:
1059
+ Callable[[~.ListDatabaseRolesRequest],
1060
+ Awaitable[~.ListDatabaseRolesResponse]]:
1061
+ A function that, when called, will call the underlying RPC
1062
+ on the server.
1063
+ """
1064
+ # Generate a "stub function" on-the-fly which will actually make
1065
+ # the request.
1066
+ # gRPC handles serialization and deserialization, so we just need
1067
+ # to pass in the functions for each.
1068
+ if "list_database_roles" not in self._stubs:
1069
+ self._stubs["list_database_roles"] = self._logged_channel.unary_unary(
1070
+ "/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseRoles",
1071
+ request_serializer=spanner_database_admin.ListDatabaseRolesRequest.serialize,
1072
+ response_deserializer=spanner_database_admin.ListDatabaseRolesResponse.deserialize,
1073
+ )
1074
+ return self._stubs["list_database_roles"]
1075
+
1076
+ @property
1077
+ def add_split_points(
1078
+ self,
1079
+ ) -> Callable[
1080
+ [spanner_database_admin.AddSplitPointsRequest],
1081
+ Awaitable[spanner_database_admin.AddSplitPointsResponse],
1082
+ ]:
1083
+ r"""Return a callable for the add split points method over gRPC.
1084
+
1085
+ Adds split points to specified tables, indexes of a
1086
+ database.
1087
+
1088
+ Returns:
1089
+ Callable[[~.AddSplitPointsRequest],
1090
+ Awaitable[~.AddSplitPointsResponse]]:
1091
+ A function that, when called, will call the underlying RPC
1092
+ on the server.
1093
+ """
1094
+ # Generate a "stub function" on-the-fly which will actually make
1095
+ # the request.
1096
+ # gRPC handles serialization and deserialization, so we just need
1097
+ # to pass in the functions for each.
1098
+ if "add_split_points" not in self._stubs:
1099
+ self._stubs["add_split_points"] = self._logged_channel.unary_unary(
1100
+ "/google.spanner.admin.database.v1.DatabaseAdmin/AddSplitPoints",
1101
+ request_serializer=spanner_database_admin.AddSplitPointsRequest.serialize,
1102
+ response_deserializer=spanner_database_admin.AddSplitPointsResponse.deserialize,
1103
+ )
1104
+ return self._stubs["add_split_points"]
1105
+
1106
+ @property
1107
+ def create_backup_schedule(
1108
+ self,
1109
+ ) -> Callable[
1110
+ [gsad_backup_schedule.CreateBackupScheduleRequest],
1111
+ Awaitable[gsad_backup_schedule.BackupSchedule],
1112
+ ]:
1113
+ r"""Return a callable for the create backup schedule method over gRPC.
1114
+
1115
+ Creates a new backup schedule.
1116
+
1117
+ Returns:
1118
+ Callable[[~.CreateBackupScheduleRequest],
1119
+ Awaitable[~.BackupSchedule]]:
1120
+ A function that, when called, will call the underlying RPC
1121
+ on the server.
1122
+ """
1123
+ # Generate a "stub function" on-the-fly which will actually make
1124
+ # the request.
1125
+ # gRPC handles serialization and deserialization, so we just need
1126
+ # to pass in the functions for each.
1127
+ if "create_backup_schedule" not in self._stubs:
1128
+ self._stubs["create_backup_schedule"] = self._logged_channel.unary_unary(
1129
+ "/google.spanner.admin.database.v1.DatabaseAdmin/CreateBackupSchedule",
1130
+ request_serializer=gsad_backup_schedule.CreateBackupScheduleRequest.serialize,
1131
+ response_deserializer=gsad_backup_schedule.BackupSchedule.deserialize,
1132
+ )
1133
+ return self._stubs["create_backup_schedule"]
1134
+
1135
+ @property
1136
+ def get_backup_schedule(
1137
+ self,
1138
+ ) -> Callable[
1139
+ [backup_schedule.GetBackupScheduleRequest],
1140
+ Awaitable[backup_schedule.BackupSchedule],
1141
+ ]:
1142
+ r"""Return a callable for the get backup schedule method over gRPC.
1143
+
1144
+ Gets backup schedule for the input schedule name.
1145
+
1146
+ Returns:
1147
+ Callable[[~.GetBackupScheduleRequest],
1148
+ Awaitable[~.BackupSchedule]]:
1149
+ A function that, when called, will call the underlying RPC
1150
+ on the server.
1151
+ """
1152
+ # Generate a "stub function" on-the-fly which will actually make
1153
+ # the request.
1154
+ # gRPC handles serialization and deserialization, so we just need
1155
+ # to pass in the functions for each.
1156
+ if "get_backup_schedule" not in self._stubs:
1157
+ self._stubs["get_backup_schedule"] = self._logged_channel.unary_unary(
1158
+ "/google.spanner.admin.database.v1.DatabaseAdmin/GetBackupSchedule",
1159
+ request_serializer=backup_schedule.GetBackupScheduleRequest.serialize,
1160
+ response_deserializer=backup_schedule.BackupSchedule.deserialize,
1161
+ )
1162
+ return self._stubs["get_backup_schedule"]
1163
+
1164
+ @property
1165
+ def update_backup_schedule(
1166
+ self,
1167
+ ) -> Callable[
1168
+ [gsad_backup_schedule.UpdateBackupScheduleRequest],
1169
+ Awaitable[gsad_backup_schedule.BackupSchedule],
1170
+ ]:
1171
+ r"""Return a callable for the update backup schedule method over gRPC.
1172
+
1173
+ Updates a backup schedule.
1174
+
1175
+ Returns:
1176
+ Callable[[~.UpdateBackupScheduleRequest],
1177
+ Awaitable[~.BackupSchedule]]:
1178
+ A function that, when called, will call the underlying RPC
1179
+ on the server.
1180
+ """
1181
+ # Generate a "stub function" on-the-fly which will actually make
1182
+ # the request.
1183
+ # gRPC handles serialization and deserialization, so we just need
1184
+ # to pass in the functions for each.
1185
+ if "update_backup_schedule" not in self._stubs:
1186
+ self._stubs["update_backup_schedule"] = self._logged_channel.unary_unary(
1187
+ "/google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackupSchedule",
1188
+ request_serializer=gsad_backup_schedule.UpdateBackupScheduleRequest.serialize,
1189
+ response_deserializer=gsad_backup_schedule.BackupSchedule.deserialize,
1190
+ )
1191
+ return self._stubs["update_backup_schedule"]
1192
+
1193
+ @property
1194
+ def delete_backup_schedule(
1195
+ self,
1196
+ ) -> Callable[
1197
+ [backup_schedule.DeleteBackupScheduleRequest], Awaitable[empty_pb2.Empty]
1198
+ ]:
1199
+ r"""Return a callable for the delete backup schedule method over gRPC.
1200
+
1201
+ Deletes a backup schedule.
1202
+
1203
+ Returns:
1204
+ Callable[[~.DeleteBackupScheduleRequest],
1205
+ Awaitable[~.Empty]]:
1206
+ A function that, when called, will call the underlying RPC
1207
+ on the server.
1208
+ """
1209
+ # Generate a "stub function" on-the-fly which will actually make
1210
+ # the request.
1211
+ # gRPC handles serialization and deserialization, so we just need
1212
+ # to pass in the functions for each.
1213
+ if "delete_backup_schedule" not in self._stubs:
1214
+ self._stubs["delete_backup_schedule"] = self._logged_channel.unary_unary(
1215
+ "/google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackupSchedule",
1216
+ request_serializer=backup_schedule.DeleteBackupScheduleRequest.serialize,
1217
+ response_deserializer=empty_pb2.Empty.FromString,
1218
+ )
1219
+ return self._stubs["delete_backup_schedule"]
1220
+
1221
+ @property
1222
+ def list_backup_schedules(
1223
+ self,
1224
+ ) -> Callable[
1225
+ [backup_schedule.ListBackupSchedulesRequest],
1226
+ Awaitable[backup_schedule.ListBackupSchedulesResponse],
1227
+ ]:
1228
+ r"""Return a callable for the list backup schedules method over gRPC.
1229
+
1230
+ Lists all the backup schedules for the database.
1231
+
1232
+ Returns:
1233
+ Callable[[~.ListBackupSchedulesRequest],
1234
+ Awaitable[~.ListBackupSchedulesResponse]]:
1235
+ A function that, when called, will call the underlying RPC
1236
+ on the server.
1237
+ """
1238
+ # Generate a "stub function" on-the-fly which will actually make
1239
+ # the request.
1240
+ # gRPC handles serialization and deserialization, so we just need
1241
+ # to pass in the functions for each.
1242
+ if "list_backup_schedules" not in self._stubs:
1243
+ self._stubs["list_backup_schedules"] = self._logged_channel.unary_unary(
1244
+ "/google.spanner.admin.database.v1.DatabaseAdmin/ListBackupSchedules",
1245
+ request_serializer=backup_schedule.ListBackupSchedulesRequest.serialize,
1246
+ response_deserializer=backup_schedule.ListBackupSchedulesResponse.deserialize,
1247
+ )
1248
+ return self._stubs["list_backup_schedules"]
1249
+
1250
+ def _prep_wrapped_messages(self, client_info):
1251
+ """Precompute the wrapped methods, overriding the base class method to use async wrappers."""
1252
+ self._wrapped_methods = {
1253
+ self.list_databases: self._wrap_method(
1254
+ self.list_databases,
1255
+ default_retry=retries.AsyncRetry(
1256
+ initial=1.0,
1257
+ maximum=32.0,
1258
+ multiplier=1.3,
1259
+ predicate=retries.if_exception_type(
1260
+ core_exceptions.DeadlineExceeded,
1261
+ core_exceptions.ServiceUnavailable,
1262
+ ),
1263
+ deadline=3600.0,
1264
+ ),
1265
+ default_timeout=3600.0,
1266
+ client_info=client_info,
1267
+ ),
1268
+ self.create_database: self._wrap_method(
1269
+ self.create_database,
1270
+ default_timeout=3600.0,
1271
+ client_info=client_info,
1272
+ ),
1273
+ self.get_database: self._wrap_method(
1274
+ self.get_database,
1275
+ default_retry=retries.AsyncRetry(
1276
+ initial=1.0,
1277
+ maximum=32.0,
1278
+ multiplier=1.3,
1279
+ predicate=retries.if_exception_type(
1280
+ core_exceptions.DeadlineExceeded,
1281
+ core_exceptions.ServiceUnavailable,
1282
+ ),
1283
+ deadline=3600.0,
1284
+ ),
1285
+ default_timeout=3600.0,
1286
+ client_info=client_info,
1287
+ ),
1288
+ self.update_database: self._wrap_method(
1289
+ self.update_database,
1290
+ default_retry=retries.AsyncRetry(
1291
+ initial=1.0,
1292
+ maximum=32.0,
1293
+ multiplier=1.3,
1294
+ predicate=retries.if_exception_type(
1295
+ core_exceptions.DeadlineExceeded,
1296
+ core_exceptions.ServiceUnavailable,
1297
+ ),
1298
+ deadline=3600.0,
1299
+ ),
1300
+ default_timeout=3600.0,
1301
+ client_info=client_info,
1302
+ ),
1303
+ self.update_database_ddl: self._wrap_method(
1304
+ self.update_database_ddl,
1305
+ default_retry=retries.AsyncRetry(
1306
+ initial=1.0,
1307
+ maximum=32.0,
1308
+ multiplier=1.3,
1309
+ predicate=retries.if_exception_type(
1310
+ core_exceptions.DeadlineExceeded,
1311
+ core_exceptions.ServiceUnavailable,
1312
+ ),
1313
+ deadline=3600.0,
1314
+ ),
1315
+ default_timeout=3600.0,
1316
+ client_info=client_info,
1317
+ ),
1318
+ self.drop_database: self._wrap_method(
1319
+ self.drop_database,
1320
+ default_retry=retries.AsyncRetry(
1321
+ initial=1.0,
1322
+ maximum=32.0,
1323
+ multiplier=1.3,
1324
+ predicate=retries.if_exception_type(
1325
+ core_exceptions.DeadlineExceeded,
1326
+ core_exceptions.ServiceUnavailable,
1327
+ ),
1328
+ deadline=3600.0,
1329
+ ),
1330
+ default_timeout=3600.0,
1331
+ client_info=client_info,
1332
+ ),
1333
+ self.get_database_ddl: self._wrap_method(
1334
+ self.get_database_ddl,
1335
+ default_retry=retries.AsyncRetry(
1336
+ initial=1.0,
1337
+ maximum=32.0,
1338
+ multiplier=1.3,
1339
+ predicate=retries.if_exception_type(
1340
+ core_exceptions.DeadlineExceeded,
1341
+ core_exceptions.ServiceUnavailable,
1342
+ ),
1343
+ deadline=3600.0,
1344
+ ),
1345
+ default_timeout=3600.0,
1346
+ client_info=client_info,
1347
+ ),
1348
+ self.set_iam_policy: self._wrap_method(
1349
+ self.set_iam_policy,
1350
+ default_timeout=30.0,
1351
+ client_info=client_info,
1352
+ ),
1353
+ self.get_iam_policy: self._wrap_method(
1354
+ self.get_iam_policy,
1355
+ default_retry=retries.AsyncRetry(
1356
+ initial=1.0,
1357
+ maximum=32.0,
1358
+ multiplier=1.3,
1359
+ predicate=retries.if_exception_type(
1360
+ core_exceptions.DeadlineExceeded,
1361
+ core_exceptions.ServiceUnavailable,
1362
+ ),
1363
+ deadline=30.0,
1364
+ ),
1365
+ default_timeout=30.0,
1366
+ client_info=client_info,
1367
+ ),
1368
+ self.test_iam_permissions: self._wrap_method(
1369
+ self.test_iam_permissions,
1370
+ default_timeout=30.0,
1371
+ client_info=client_info,
1372
+ ),
1373
+ self.create_backup: self._wrap_method(
1374
+ self.create_backup,
1375
+ default_timeout=3600.0,
1376
+ client_info=client_info,
1377
+ ),
1378
+ self.copy_backup: self._wrap_method(
1379
+ self.copy_backup,
1380
+ default_timeout=3600.0,
1381
+ client_info=client_info,
1382
+ ),
1383
+ self.get_backup: self._wrap_method(
1384
+ self.get_backup,
1385
+ default_retry=retries.AsyncRetry(
1386
+ initial=1.0,
1387
+ maximum=32.0,
1388
+ multiplier=1.3,
1389
+ predicate=retries.if_exception_type(
1390
+ core_exceptions.DeadlineExceeded,
1391
+ core_exceptions.ServiceUnavailable,
1392
+ ),
1393
+ deadline=3600.0,
1394
+ ),
1395
+ default_timeout=3600.0,
1396
+ client_info=client_info,
1397
+ ),
1398
+ self.update_backup: self._wrap_method(
1399
+ self.update_backup,
1400
+ default_retry=retries.AsyncRetry(
1401
+ initial=1.0,
1402
+ maximum=32.0,
1403
+ multiplier=1.3,
1404
+ predicate=retries.if_exception_type(
1405
+ core_exceptions.DeadlineExceeded,
1406
+ core_exceptions.ServiceUnavailable,
1407
+ ),
1408
+ deadline=3600.0,
1409
+ ),
1410
+ default_timeout=3600.0,
1411
+ client_info=client_info,
1412
+ ),
1413
+ self.delete_backup: self._wrap_method(
1414
+ self.delete_backup,
1415
+ default_retry=retries.AsyncRetry(
1416
+ initial=1.0,
1417
+ maximum=32.0,
1418
+ multiplier=1.3,
1419
+ predicate=retries.if_exception_type(
1420
+ core_exceptions.DeadlineExceeded,
1421
+ core_exceptions.ServiceUnavailable,
1422
+ ),
1423
+ deadline=3600.0,
1424
+ ),
1425
+ default_timeout=3600.0,
1426
+ client_info=client_info,
1427
+ ),
1428
+ self.list_backups: self._wrap_method(
1429
+ self.list_backups,
1430
+ default_retry=retries.AsyncRetry(
1431
+ initial=1.0,
1432
+ maximum=32.0,
1433
+ multiplier=1.3,
1434
+ predicate=retries.if_exception_type(
1435
+ core_exceptions.DeadlineExceeded,
1436
+ core_exceptions.ServiceUnavailable,
1437
+ ),
1438
+ deadline=3600.0,
1439
+ ),
1440
+ default_timeout=3600.0,
1441
+ client_info=client_info,
1442
+ ),
1443
+ self.restore_database: self._wrap_method(
1444
+ self.restore_database,
1445
+ default_timeout=3600.0,
1446
+ client_info=client_info,
1447
+ ),
1448
+ self.list_database_operations: self._wrap_method(
1449
+ self.list_database_operations,
1450
+ default_retry=retries.AsyncRetry(
1451
+ initial=1.0,
1452
+ maximum=32.0,
1453
+ multiplier=1.3,
1454
+ predicate=retries.if_exception_type(
1455
+ core_exceptions.DeadlineExceeded,
1456
+ core_exceptions.ServiceUnavailable,
1457
+ ),
1458
+ deadline=3600.0,
1459
+ ),
1460
+ default_timeout=3600.0,
1461
+ client_info=client_info,
1462
+ ),
1463
+ self.list_backup_operations: self._wrap_method(
1464
+ self.list_backup_operations,
1465
+ default_retry=retries.AsyncRetry(
1466
+ initial=1.0,
1467
+ maximum=32.0,
1468
+ multiplier=1.3,
1469
+ predicate=retries.if_exception_type(
1470
+ core_exceptions.DeadlineExceeded,
1471
+ core_exceptions.ServiceUnavailable,
1472
+ ),
1473
+ deadline=3600.0,
1474
+ ),
1475
+ default_timeout=3600.0,
1476
+ client_info=client_info,
1477
+ ),
1478
+ self.list_database_roles: self._wrap_method(
1479
+ self.list_database_roles,
1480
+ default_retry=retries.AsyncRetry(
1481
+ initial=1.0,
1482
+ maximum=32.0,
1483
+ multiplier=1.3,
1484
+ predicate=retries.if_exception_type(
1485
+ core_exceptions.DeadlineExceeded,
1486
+ core_exceptions.ServiceUnavailable,
1487
+ ),
1488
+ deadline=3600.0,
1489
+ ),
1490
+ default_timeout=3600.0,
1491
+ client_info=client_info,
1492
+ ),
1493
+ self.add_split_points: self._wrap_method(
1494
+ self.add_split_points,
1495
+ default_retry=retries.AsyncRetry(
1496
+ initial=1.0,
1497
+ maximum=32.0,
1498
+ multiplier=1.3,
1499
+ predicate=retries.if_exception_type(
1500
+ core_exceptions.DeadlineExceeded,
1501
+ core_exceptions.ServiceUnavailable,
1502
+ ),
1503
+ deadline=3600.0,
1504
+ ),
1505
+ default_timeout=3600.0,
1506
+ client_info=client_info,
1507
+ ),
1508
+ self.create_backup_schedule: self._wrap_method(
1509
+ self.create_backup_schedule,
1510
+ default_retry=retries.AsyncRetry(
1511
+ initial=1.0,
1512
+ maximum=32.0,
1513
+ multiplier=1.3,
1514
+ predicate=retries.if_exception_type(
1515
+ core_exceptions.DeadlineExceeded,
1516
+ core_exceptions.ServiceUnavailable,
1517
+ ),
1518
+ deadline=3600.0,
1519
+ ),
1520
+ default_timeout=3600.0,
1521
+ client_info=client_info,
1522
+ ),
1523
+ self.get_backup_schedule: self._wrap_method(
1524
+ self.get_backup_schedule,
1525
+ default_retry=retries.AsyncRetry(
1526
+ initial=1.0,
1527
+ maximum=32.0,
1528
+ multiplier=1.3,
1529
+ predicate=retries.if_exception_type(
1530
+ core_exceptions.DeadlineExceeded,
1531
+ core_exceptions.ServiceUnavailable,
1532
+ ),
1533
+ deadline=3600.0,
1534
+ ),
1535
+ default_timeout=3600.0,
1536
+ client_info=client_info,
1537
+ ),
1538
+ self.update_backup_schedule: self._wrap_method(
1539
+ self.update_backup_schedule,
1540
+ default_retry=retries.AsyncRetry(
1541
+ initial=1.0,
1542
+ maximum=32.0,
1543
+ multiplier=1.3,
1544
+ predicate=retries.if_exception_type(
1545
+ core_exceptions.DeadlineExceeded,
1546
+ core_exceptions.ServiceUnavailable,
1547
+ ),
1548
+ deadline=3600.0,
1549
+ ),
1550
+ default_timeout=3600.0,
1551
+ client_info=client_info,
1552
+ ),
1553
+ self.delete_backup_schedule: self._wrap_method(
1554
+ self.delete_backup_schedule,
1555
+ default_retry=retries.AsyncRetry(
1556
+ initial=1.0,
1557
+ maximum=32.0,
1558
+ multiplier=1.3,
1559
+ predicate=retries.if_exception_type(
1560
+ core_exceptions.DeadlineExceeded,
1561
+ core_exceptions.ServiceUnavailable,
1562
+ ),
1563
+ deadline=3600.0,
1564
+ ),
1565
+ default_timeout=3600.0,
1566
+ client_info=client_info,
1567
+ ),
1568
+ self.list_backup_schedules: self._wrap_method(
1569
+ self.list_backup_schedules,
1570
+ default_retry=retries.AsyncRetry(
1571
+ initial=1.0,
1572
+ maximum=32.0,
1573
+ multiplier=1.3,
1574
+ predicate=retries.if_exception_type(
1575
+ core_exceptions.DeadlineExceeded,
1576
+ core_exceptions.ServiceUnavailable,
1577
+ ),
1578
+ deadline=3600.0,
1579
+ ),
1580
+ default_timeout=3600.0,
1581
+ client_info=client_info,
1582
+ ),
1583
+ self.cancel_operation: self._wrap_method(
1584
+ self.cancel_operation,
1585
+ default_timeout=None,
1586
+ client_info=client_info,
1587
+ ),
1588
+ self.delete_operation: self._wrap_method(
1589
+ self.delete_operation,
1590
+ default_timeout=None,
1591
+ client_info=client_info,
1592
+ ),
1593
+ self.get_operation: self._wrap_method(
1594
+ self.get_operation,
1595
+ default_timeout=None,
1596
+ client_info=client_info,
1597
+ ),
1598
+ self.list_operations: self._wrap_method(
1599
+ self.list_operations,
1600
+ default_timeout=None,
1601
+ client_info=client_info,
1602
+ ),
1603
+ }
1604
+
1605
+ def _wrap_method(self, func, *args, **kwargs):
1606
+ if self._wrap_with_kind: # pragma: NO COVER
1607
+ kwargs["kind"] = self.kind
1608
+ return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
1609
+
1610
+ def close(self):
1611
+ return self._logged_channel.close()
1612
+
1613
+ @property
1614
+ def kind(self) -> str:
1615
+ return "grpc_asyncio"
1616
+
1617
+ @property
1618
+ def delete_operation(
1619
+ self,
1620
+ ) -> Callable[[operations_pb2.DeleteOperationRequest], None]:
1621
+ r"""Return a callable for the delete_operation method over gRPC."""
1622
+ # Generate a "stub function" on-the-fly which will actually make
1623
+ # the request.
1624
+ # gRPC handles serialization and deserialization, so we just need
1625
+ # to pass in the functions for each.
1626
+ if "delete_operation" not in self._stubs:
1627
+ self._stubs["delete_operation"] = self._logged_channel.unary_unary(
1628
+ "/google.longrunning.Operations/DeleteOperation",
1629
+ request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString,
1630
+ response_deserializer=None,
1631
+ )
1632
+ return self._stubs["delete_operation"]
1633
+
1634
+ @property
1635
+ def cancel_operation(
1636
+ self,
1637
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
1638
+ r"""Return a callable for the cancel_operation method over gRPC."""
1639
+ # Generate a "stub function" on-the-fly which will actually make
1640
+ # the request.
1641
+ # gRPC handles serialization and deserialization, so we just need
1642
+ # to pass in the functions for each.
1643
+ if "cancel_operation" not in self._stubs:
1644
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
1645
+ "/google.longrunning.Operations/CancelOperation",
1646
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
1647
+ response_deserializer=None,
1648
+ )
1649
+ return self._stubs["cancel_operation"]
1650
+
1651
+ @property
1652
+ def get_operation(
1653
+ self,
1654
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
1655
+ r"""Return a callable for the get_operation method over gRPC."""
1656
+ # Generate a "stub function" on-the-fly which will actually make
1657
+ # the request.
1658
+ # gRPC handles serialization and deserialization, so we just need
1659
+ # to pass in the functions for each.
1660
+ if "get_operation" not in self._stubs:
1661
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
1662
+ "/google.longrunning.Operations/GetOperation",
1663
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
1664
+ response_deserializer=operations_pb2.Operation.FromString,
1665
+ )
1666
+ return self._stubs["get_operation"]
1667
+
1668
+ @property
1669
+ def list_operations(
1670
+ self,
1671
+ ) -> Callable[
1672
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
1673
+ ]:
1674
+ r"""Return a callable for the list_operations method over gRPC."""
1675
+ # Generate a "stub function" on-the-fly which will actually make
1676
+ # the request.
1677
+ # gRPC handles serialization and deserialization, so we just need
1678
+ # to pass in the functions for each.
1679
+ if "list_operations" not in self._stubs:
1680
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
1681
+ "/google.longrunning.Operations/ListOperations",
1682
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
1683
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
1684
+ )
1685
+ return self._stubs["list_operations"]
1686
+
1687
+
1688
+ __all__ = ("DatabaseAdminGrpcAsyncIOTransport",)