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,1650 @@
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 json # type: ignore
17
+ from google.api_core import path_template
18
+ from google.api_core import gapic_v1
19
+
20
+ from google.protobuf import json_format
21
+ from .base import DatabaseAdminTransport, DEFAULT_CLIENT_INFO
22
+
23
+ import re
24
+ from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
25
+
26
+
27
+ from google.cloud.spanner_admin_database_v1.types import backup
28
+ from google.cloud.spanner_admin_database_v1.types import backup as gsad_backup
29
+ from google.cloud.spanner_admin_database_v1.types import backup_schedule
30
+ from google.cloud.spanner_admin_database_v1.types import (
31
+ backup_schedule as gsad_backup_schedule,
32
+ )
33
+ from google.cloud.spanner_admin_database_v1.types import spanner_database_admin
34
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
35
+ from google.iam.v1 import policy_pb2 # type: ignore
36
+ from google.protobuf import empty_pb2 # type: ignore
37
+ from google.longrunning import operations_pb2 # type: ignore
38
+
39
+
40
+ class _BaseDatabaseAdminRestTransport(DatabaseAdminTransport):
41
+ """Base REST backend transport for DatabaseAdmin.
42
+
43
+ Note: This class is not meant to be used directly. Use its sync and
44
+ async sub-classes instead.
45
+
46
+ This class defines the same methods as the primary client, so the
47
+ primary client can load the underlying transport implementation
48
+ and call it.
49
+
50
+ It sends JSON representations of protocol buffers over HTTP/1.1
51
+ """
52
+
53
+ def __init__(
54
+ self,
55
+ *,
56
+ host: str = "spanner.googleapis.com",
57
+ credentials: Optional[Any] = None,
58
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
59
+ always_use_jwt_access: Optional[bool] = False,
60
+ url_scheme: str = "https",
61
+ api_audience: Optional[str] = None,
62
+ ) -> None:
63
+ """Instantiate the transport.
64
+ Args:
65
+ host (Optional[str]):
66
+ The hostname to connect to (default: 'spanner.googleapis.com').
67
+ credentials (Optional[Any]): The
68
+ authorization credentials to attach to requests. These
69
+ credentials identify the application to the service; if none
70
+ are specified, the client will attempt to ascertain the
71
+ credentials from the environment.
72
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
73
+ The client info used to send a user-agent string along with
74
+ API requests. If ``None``, then default info will be used.
75
+ Generally, you only need to set this if you are developing
76
+ your own client library.
77
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
78
+ be used for service account credentials.
79
+ url_scheme: the protocol scheme for the API endpoint. Normally
80
+ "https", but for testing or local servers,
81
+ "http" can be specified.
82
+ """
83
+ # Run the base constructor
84
+ maybe_url_match = re.match("^(?P<scheme>http(?:s)?://)?(?P<host>.*)$", host)
85
+ if maybe_url_match is None:
86
+ raise ValueError(
87
+ f"Unexpected hostname structure: {host}"
88
+ ) # pragma: NO COVER
89
+
90
+ url_match_items = maybe_url_match.groupdict()
91
+
92
+ host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host
93
+
94
+ super().__init__(
95
+ host=host,
96
+ credentials=credentials,
97
+ client_info=client_info,
98
+ always_use_jwt_access=always_use_jwt_access,
99
+ api_audience=api_audience,
100
+ )
101
+
102
+ class _BaseAddSplitPoints:
103
+ def __hash__(self): # pragma: NO COVER
104
+ return NotImplementedError("__hash__ must be implemented.")
105
+
106
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
107
+
108
+ @classmethod
109
+ def _get_unset_required_fields(cls, message_dict):
110
+ return {
111
+ k: v
112
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
113
+ if k not in message_dict
114
+ }
115
+
116
+ @staticmethod
117
+ def _get_http_options():
118
+ http_options: List[Dict[str, str]] = [
119
+ {
120
+ "method": "post",
121
+ "uri": "/v1/{database=projects/*/instances/*/databases/*}:addSplitPoints",
122
+ "body": "*",
123
+ },
124
+ ]
125
+ return http_options
126
+
127
+ @staticmethod
128
+ def _get_transcoded_request(http_options, request):
129
+ pb_request = spanner_database_admin.AddSplitPointsRequest.pb(request)
130
+ transcoded_request = path_template.transcode(http_options, pb_request)
131
+ return transcoded_request
132
+
133
+ @staticmethod
134
+ def _get_request_body_json(transcoded_request):
135
+ # Jsonify the request body
136
+
137
+ body = json_format.MessageToJson(
138
+ transcoded_request["body"], use_integers_for_enums=True
139
+ )
140
+ return body
141
+
142
+ @staticmethod
143
+ def _get_query_params_json(transcoded_request):
144
+ query_params = json.loads(
145
+ json_format.MessageToJson(
146
+ transcoded_request["query_params"],
147
+ use_integers_for_enums=True,
148
+ )
149
+ )
150
+ query_params.update(
151
+ _BaseDatabaseAdminRestTransport._BaseAddSplitPoints._get_unset_required_fields(
152
+ query_params
153
+ )
154
+ )
155
+
156
+ query_params["$alt"] = "json;enum-encoding=int"
157
+ return query_params
158
+
159
+ class _BaseCopyBackup:
160
+ def __hash__(self): # pragma: NO COVER
161
+ return NotImplementedError("__hash__ must be implemented.")
162
+
163
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
164
+
165
+ @classmethod
166
+ def _get_unset_required_fields(cls, message_dict):
167
+ return {
168
+ k: v
169
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
170
+ if k not in message_dict
171
+ }
172
+
173
+ @staticmethod
174
+ def _get_http_options():
175
+ http_options: List[Dict[str, str]] = [
176
+ {
177
+ "method": "post",
178
+ "uri": "/v1/{parent=projects/*/instances/*}/backups:copy",
179
+ "body": "*",
180
+ },
181
+ ]
182
+ return http_options
183
+
184
+ @staticmethod
185
+ def _get_transcoded_request(http_options, request):
186
+ pb_request = backup.CopyBackupRequest.pb(request)
187
+ transcoded_request = path_template.transcode(http_options, pb_request)
188
+ return transcoded_request
189
+
190
+ @staticmethod
191
+ def _get_request_body_json(transcoded_request):
192
+ # Jsonify the request body
193
+
194
+ body = json_format.MessageToJson(
195
+ transcoded_request["body"], use_integers_for_enums=True
196
+ )
197
+ return body
198
+
199
+ @staticmethod
200
+ def _get_query_params_json(transcoded_request):
201
+ query_params = json.loads(
202
+ json_format.MessageToJson(
203
+ transcoded_request["query_params"],
204
+ use_integers_for_enums=True,
205
+ )
206
+ )
207
+ query_params.update(
208
+ _BaseDatabaseAdminRestTransport._BaseCopyBackup._get_unset_required_fields(
209
+ query_params
210
+ )
211
+ )
212
+
213
+ query_params["$alt"] = "json;enum-encoding=int"
214
+ return query_params
215
+
216
+ class _BaseCreateBackup:
217
+ def __hash__(self): # pragma: NO COVER
218
+ return NotImplementedError("__hash__ must be implemented.")
219
+
220
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
221
+ "backupId": "",
222
+ }
223
+
224
+ @classmethod
225
+ def _get_unset_required_fields(cls, message_dict):
226
+ return {
227
+ k: v
228
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
229
+ if k not in message_dict
230
+ }
231
+
232
+ @staticmethod
233
+ def _get_http_options():
234
+ http_options: List[Dict[str, str]] = [
235
+ {
236
+ "method": "post",
237
+ "uri": "/v1/{parent=projects/*/instances/*}/backups",
238
+ "body": "backup",
239
+ },
240
+ ]
241
+ return http_options
242
+
243
+ @staticmethod
244
+ def _get_transcoded_request(http_options, request):
245
+ pb_request = gsad_backup.CreateBackupRequest.pb(request)
246
+ transcoded_request = path_template.transcode(http_options, pb_request)
247
+ return transcoded_request
248
+
249
+ @staticmethod
250
+ def _get_request_body_json(transcoded_request):
251
+ # Jsonify the request body
252
+
253
+ body = json_format.MessageToJson(
254
+ transcoded_request["body"], use_integers_for_enums=True
255
+ )
256
+ return body
257
+
258
+ @staticmethod
259
+ def _get_query_params_json(transcoded_request):
260
+ query_params = json.loads(
261
+ json_format.MessageToJson(
262
+ transcoded_request["query_params"],
263
+ use_integers_for_enums=True,
264
+ )
265
+ )
266
+ query_params.update(
267
+ _BaseDatabaseAdminRestTransport._BaseCreateBackup._get_unset_required_fields(
268
+ query_params
269
+ )
270
+ )
271
+
272
+ query_params["$alt"] = "json;enum-encoding=int"
273
+ return query_params
274
+
275
+ class _BaseCreateBackupSchedule:
276
+ def __hash__(self): # pragma: NO COVER
277
+ return NotImplementedError("__hash__ must be implemented.")
278
+
279
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
280
+ "backupScheduleId": "",
281
+ }
282
+
283
+ @classmethod
284
+ def _get_unset_required_fields(cls, message_dict):
285
+ return {
286
+ k: v
287
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
288
+ if k not in message_dict
289
+ }
290
+
291
+ @staticmethod
292
+ def _get_http_options():
293
+ http_options: List[Dict[str, str]] = [
294
+ {
295
+ "method": "post",
296
+ "uri": "/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules",
297
+ "body": "backup_schedule",
298
+ },
299
+ ]
300
+ return http_options
301
+
302
+ @staticmethod
303
+ def _get_transcoded_request(http_options, request):
304
+ pb_request = gsad_backup_schedule.CreateBackupScheduleRequest.pb(request)
305
+ transcoded_request = path_template.transcode(http_options, pb_request)
306
+ return transcoded_request
307
+
308
+ @staticmethod
309
+ def _get_request_body_json(transcoded_request):
310
+ # Jsonify the request body
311
+
312
+ body = json_format.MessageToJson(
313
+ transcoded_request["body"], use_integers_for_enums=True
314
+ )
315
+ return body
316
+
317
+ @staticmethod
318
+ def _get_query_params_json(transcoded_request):
319
+ query_params = json.loads(
320
+ json_format.MessageToJson(
321
+ transcoded_request["query_params"],
322
+ use_integers_for_enums=True,
323
+ )
324
+ )
325
+ query_params.update(
326
+ _BaseDatabaseAdminRestTransport._BaseCreateBackupSchedule._get_unset_required_fields(
327
+ query_params
328
+ )
329
+ )
330
+
331
+ query_params["$alt"] = "json;enum-encoding=int"
332
+ return query_params
333
+
334
+ class _BaseCreateDatabase:
335
+ def __hash__(self): # pragma: NO COVER
336
+ return NotImplementedError("__hash__ must be implemented.")
337
+
338
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
339
+
340
+ @classmethod
341
+ def _get_unset_required_fields(cls, message_dict):
342
+ return {
343
+ k: v
344
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
345
+ if k not in message_dict
346
+ }
347
+
348
+ @staticmethod
349
+ def _get_http_options():
350
+ http_options: List[Dict[str, str]] = [
351
+ {
352
+ "method": "post",
353
+ "uri": "/v1/{parent=projects/*/instances/*}/databases",
354
+ "body": "*",
355
+ },
356
+ ]
357
+ return http_options
358
+
359
+ @staticmethod
360
+ def _get_transcoded_request(http_options, request):
361
+ pb_request = spanner_database_admin.CreateDatabaseRequest.pb(request)
362
+ transcoded_request = path_template.transcode(http_options, pb_request)
363
+ return transcoded_request
364
+
365
+ @staticmethod
366
+ def _get_request_body_json(transcoded_request):
367
+ # Jsonify the request body
368
+
369
+ body = json_format.MessageToJson(
370
+ transcoded_request["body"], use_integers_for_enums=True
371
+ )
372
+ return body
373
+
374
+ @staticmethod
375
+ def _get_query_params_json(transcoded_request):
376
+ query_params = json.loads(
377
+ json_format.MessageToJson(
378
+ transcoded_request["query_params"],
379
+ use_integers_for_enums=True,
380
+ )
381
+ )
382
+ query_params.update(
383
+ _BaseDatabaseAdminRestTransport._BaseCreateDatabase._get_unset_required_fields(
384
+ query_params
385
+ )
386
+ )
387
+
388
+ query_params["$alt"] = "json;enum-encoding=int"
389
+ return query_params
390
+
391
+ class _BaseDeleteBackup:
392
+ def __hash__(self): # pragma: NO COVER
393
+ return NotImplementedError("__hash__ must be implemented.")
394
+
395
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
396
+
397
+ @classmethod
398
+ def _get_unset_required_fields(cls, message_dict):
399
+ return {
400
+ k: v
401
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
402
+ if k not in message_dict
403
+ }
404
+
405
+ @staticmethod
406
+ def _get_http_options():
407
+ http_options: List[Dict[str, str]] = [
408
+ {
409
+ "method": "delete",
410
+ "uri": "/v1/{name=projects/*/instances/*/backups/*}",
411
+ },
412
+ ]
413
+ return http_options
414
+
415
+ @staticmethod
416
+ def _get_transcoded_request(http_options, request):
417
+ pb_request = backup.DeleteBackupRequest.pb(request)
418
+ transcoded_request = path_template.transcode(http_options, pb_request)
419
+ return transcoded_request
420
+
421
+ @staticmethod
422
+ def _get_query_params_json(transcoded_request):
423
+ query_params = json.loads(
424
+ json_format.MessageToJson(
425
+ transcoded_request["query_params"],
426
+ use_integers_for_enums=True,
427
+ )
428
+ )
429
+ query_params.update(
430
+ _BaseDatabaseAdminRestTransport._BaseDeleteBackup._get_unset_required_fields(
431
+ query_params
432
+ )
433
+ )
434
+
435
+ query_params["$alt"] = "json;enum-encoding=int"
436
+ return query_params
437
+
438
+ class _BaseDeleteBackupSchedule:
439
+ def __hash__(self): # pragma: NO COVER
440
+ return NotImplementedError("__hash__ must be implemented.")
441
+
442
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
443
+
444
+ @classmethod
445
+ def _get_unset_required_fields(cls, message_dict):
446
+ return {
447
+ k: v
448
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
449
+ if k not in message_dict
450
+ }
451
+
452
+ @staticmethod
453
+ def _get_http_options():
454
+ http_options: List[Dict[str, str]] = [
455
+ {
456
+ "method": "delete",
457
+ "uri": "/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}",
458
+ },
459
+ ]
460
+ return http_options
461
+
462
+ @staticmethod
463
+ def _get_transcoded_request(http_options, request):
464
+ pb_request = backup_schedule.DeleteBackupScheduleRequest.pb(request)
465
+ transcoded_request = path_template.transcode(http_options, pb_request)
466
+ return transcoded_request
467
+
468
+ @staticmethod
469
+ def _get_query_params_json(transcoded_request):
470
+ query_params = json.loads(
471
+ json_format.MessageToJson(
472
+ transcoded_request["query_params"],
473
+ use_integers_for_enums=True,
474
+ )
475
+ )
476
+ query_params.update(
477
+ _BaseDatabaseAdminRestTransport._BaseDeleteBackupSchedule._get_unset_required_fields(
478
+ query_params
479
+ )
480
+ )
481
+
482
+ query_params["$alt"] = "json;enum-encoding=int"
483
+ return query_params
484
+
485
+ class _BaseDropDatabase:
486
+ def __hash__(self): # pragma: NO COVER
487
+ return NotImplementedError("__hash__ must be implemented.")
488
+
489
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
490
+
491
+ @classmethod
492
+ def _get_unset_required_fields(cls, message_dict):
493
+ return {
494
+ k: v
495
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
496
+ if k not in message_dict
497
+ }
498
+
499
+ @staticmethod
500
+ def _get_http_options():
501
+ http_options: List[Dict[str, str]] = [
502
+ {
503
+ "method": "delete",
504
+ "uri": "/v1/{database=projects/*/instances/*/databases/*}",
505
+ },
506
+ ]
507
+ return http_options
508
+
509
+ @staticmethod
510
+ def _get_transcoded_request(http_options, request):
511
+ pb_request = spanner_database_admin.DropDatabaseRequest.pb(request)
512
+ transcoded_request = path_template.transcode(http_options, pb_request)
513
+ return transcoded_request
514
+
515
+ @staticmethod
516
+ def _get_query_params_json(transcoded_request):
517
+ query_params = json.loads(
518
+ json_format.MessageToJson(
519
+ transcoded_request["query_params"],
520
+ use_integers_for_enums=True,
521
+ )
522
+ )
523
+ query_params.update(
524
+ _BaseDatabaseAdminRestTransport._BaseDropDatabase._get_unset_required_fields(
525
+ query_params
526
+ )
527
+ )
528
+
529
+ query_params["$alt"] = "json;enum-encoding=int"
530
+ return query_params
531
+
532
+ class _BaseGetBackup:
533
+ def __hash__(self): # pragma: NO COVER
534
+ return NotImplementedError("__hash__ must be implemented.")
535
+
536
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
537
+
538
+ @classmethod
539
+ def _get_unset_required_fields(cls, message_dict):
540
+ return {
541
+ k: v
542
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
543
+ if k not in message_dict
544
+ }
545
+
546
+ @staticmethod
547
+ def _get_http_options():
548
+ http_options: List[Dict[str, str]] = [
549
+ {
550
+ "method": "get",
551
+ "uri": "/v1/{name=projects/*/instances/*/backups/*}",
552
+ },
553
+ ]
554
+ return http_options
555
+
556
+ @staticmethod
557
+ def _get_transcoded_request(http_options, request):
558
+ pb_request = backup.GetBackupRequest.pb(request)
559
+ transcoded_request = path_template.transcode(http_options, pb_request)
560
+ return transcoded_request
561
+
562
+ @staticmethod
563
+ def _get_query_params_json(transcoded_request):
564
+ query_params = json.loads(
565
+ json_format.MessageToJson(
566
+ transcoded_request["query_params"],
567
+ use_integers_for_enums=True,
568
+ )
569
+ )
570
+ query_params.update(
571
+ _BaseDatabaseAdminRestTransport._BaseGetBackup._get_unset_required_fields(
572
+ query_params
573
+ )
574
+ )
575
+
576
+ query_params["$alt"] = "json;enum-encoding=int"
577
+ return query_params
578
+
579
+ class _BaseGetBackupSchedule:
580
+ def __hash__(self): # pragma: NO COVER
581
+ return NotImplementedError("__hash__ must be implemented.")
582
+
583
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
584
+
585
+ @classmethod
586
+ def _get_unset_required_fields(cls, message_dict):
587
+ return {
588
+ k: v
589
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
590
+ if k not in message_dict
591
+ }
592
+
593
+ @staticmethod
594
+ def _get_http_options():
595
+ http_options: List[Dict[str, str]] = [
596
+ {
597
+ "method": "get",
598
+ "uri": "/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}",
599
+ },
600
+ ]
601
+ return http_options
602
+
603
+ @staticmethod
604
+ def _get_transcoded_request(http_options, request):
605
+ pb_request = backup_schedule.GetBackupScheduleRequest.pb(request)
606
+ transcoded_request = path_template.transcode(http_options, pb_request)
607
+ return transcoded_request
608
+
609
+ @staticmethod
610
+ def _get_query_params_json(transcoded_request):
611
+ query_params = json.loads(
612
+ json_format.MessageToJson(
613
+ transcoded_request["query_params"],
614
+ use_integers_for_enums=True,
615
+ )
616
+ )
617
+ query_params.update(
618
+ _BaseDatabaseAdminRestTransport._BaseGetBackupSchedule._get_unset_required_fields(
619
+ query_params
620
+ )
621
+ )
622
+
623
+ query_params["$alt"] = "json;enum-encoding=int"
624
+ return query_params
625
+
626
+ class _BaseGetDatabase:
627
+ def __hash__(self): # pragma: NO COVER
628
+ return NotImplementedError("__hash__ must be implemented.")
629
+
630
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
631
+
632
+ @classmethod
633
+ def _get_unset_required_fields(cls, message_dict):
634
+ return {
635
+ k: v
636
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
637
+ if k not in message_dict
638
+ }
639
+
640
+ @staticmethod
641
+ def _get_http_options():
642
+ http_options: List[Dict[str, str]] = [
643
+ {
644
+ "method": "get",
645
+ "uri": "/v1/{name=projects/*/instances/*/databases/*}",
646
+ },
647
+ ]
648
+ return http_options
649
+
650
+ @staticmethod
651
+ def _get_transcoded_request(http_options, request):
652
+ pb_request = spanner_database_admin.GetDatabaseRequest.pb(request)
653
+ transcoded_request = path_template.transcode(http_options, pb_request)
654
+ return transcoded_request
655
+
656
+ @staticmethod
657
+ def _get_query_params_json(transcoded_request):
658
+ query_params = json.loads(
659
+ json_format.MessageToJson(
660
+ transcoded_request["query_params"],
661
+ use_integers_for_enums=True,
662
+ )
663
+ )
664
+ query_params.update(
665
+ _BaseDatabaseAdminRestTransport._BaseGetDatabase._get_unset_required_fields(
666
+ query_params
667
+ )
668
+ )
669
+
670
+ query_params["$alt"] = "json;enum-encoding=int"
671
+ return query_params
672
+
673
+ class _BaseGetDatabaseDdl:
674
+ def __hash__(self): # pragma: NO COVER
675
+ return NotImplementedError("__hash__ must be implemented.")
676
+
677
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
678
+
679
+ @classmethod
680
+ def _get_unset_required_fields(cls, message_dict):
681
+ return {
682
+ k: v
683
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
684
+ if k not in message_dict
685
+ }
686
+
687
+ @staticmethod
688
+ def _get_http_options():
689
+ http_options: List[Dict[str, str]] = [
690
+ {
691
+ "method": "get",
692
+ "uri": "/v1/{database=projects/*/instances/*/databases/*}/ddl",
693
+ },
694
+ ]
695
+ return http_options
696
+
697
+ @staticmethod
698
+ def _get_transcoded_request(http_options, request):
699
+ pb_request = spanner_database_admin.GetDatabaseDdlRequest.pb(request)
700
+ transcoded_request = path_template.transcode(http_options, pb_request)
701
+ return transcoded_request
702
+
703
+ @staticmethod
704
+ def _get_query_params_json(transcoded_request):
705
+ query_params = json.loads(
706
+ json_format.MessageToJson(
707
+ transcoded_request["query_params"],
708
+ use_integers_for_enums=True,
709
+ )
710
+ )
711
+ query_params.update(
712
+ _BaseDatabaseAdminRestTransport._BaseGetDatabaseDdl._get_unset_required_fields(
713
+ query_params
714
+ )
715
+ )
716
+
717
+ query_params["$alt"] = "json;enum-encoding=int"
718
+ return query_params
719
+
720
+ class _BaseGetIamPolicy:
721
+ def __hash__(self): # pragma: NO COVER
722
+ return NotImplementedError("__hash__ must be implemented.")
723
+
724
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
725
+
726
+ @classmethod
727
+ def _get_unset_required_fields(cls, message_dict):
728
+ return {
729
+ k: v
730
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
731
+ if k not in message_dict
732
+ }
733
+
734
+ @staticmethod
735
+ def _get_http_options():
736
+ http_options: List[Dict[str, str]] = [
737
+ {
738
+ "method": "post",
739
+ "uri": "/v1/{resource=projects/*/instances/*/databases/*}:getIamPolicy",
740
+ "body": "*",
741
+ },
742
+ {
743
+ "method": "post",
744
+ "uri": "/v1/{resource=projects/*/instances/*/backups/*}:getIamPolicy",
745
+ "body": "*",
746
+ },
747
+ {
748
+ "method": "post",
749
+ "uri": "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:getIamPolicy",
750
+ "body": "*",
751
+ },
752
+ ]
753
+ return http_options
754
+
755
+ @staticmethod
756
+ def _get_transcoded_request(http_options, request):
757
+ pb_request = request
758
+ transcoded_request = path_template.transcode(http_options, pb_request)
759
+ return transcoded_request
760
+
761
+ @staticmethod
762
+ def _get_request_body_json(transcoded_request):
763
+ # Jsonify the request body
764
+
765
+ body = json_format.MessageToJson(
766
+ transcoded_request["body"], use_integers_for_enums=True
767
+ )
768
+ return body
769
+
770
+ @staticmethod
771
+ def _get_query_params_json(transcoded_request):
772
+ query_params = json.loads(
773
+ json_format.MessageToJson(
774
+ transcoded_request["query_params"],
775
+ use_integers_for_enums=True,
776
+ )
777
+ )
778
+ query_params.update(
779
+ _BaseDatabaseAdminRestTransport._BaseGetIamPolicy._get_unset_required_fields(
780
+ query_params
781
+ )
782
+ )
783
+
784
+ query_params["$alt"] = "json;enum-encoding=int"
785
+ return query_params
786
+
787
+ class _BaseListBackupOperations:
788
+ def __hash__(self): # pragma: NO COVER
789
+ return NotImplementedError("__hash__ must be implemented.")
790
+
791
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
792
+
793
+ @classmethod
794
+ def _get_unset_required_fields(cls, message_dict):
795
+ return {
796
+ k: v
797
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
798
+ if k not in message_dict
799
+ }
800
+
801
+ @staticmethod
802
+ def _get_http_options():
803
+ http_options: List[Dict[str, str]] = [
804
+ {
805
+ "method": "get",
806
+ "uri": "/v1/{parent=projects/*/instances/*}/backupOperations",
807
+ },
808
+ ]
809
+ return http_options
810
+
811
+ @staticmethod
812
+ def _get_transcoded_request(http_options, request):
813
+ pb_request = backup.ListBackupOperationsRequest.pb(request)
814
+ transcoded_request = path_template.transcode(http_options, pb_request)
815
+ return transcoded_request
816
+
817
+ @staticmethod
818
+ def _get_query_params_json(transcoded_request):
819
+ query_params = json.loads(
820
+ json_format.MessageToJson(
821
+ transcoded_request["query_params"],
822
+ use_integers_for_enums=True,
823
+ )
824
+ )
825
+ query_params.update(
826
+ _BaseDatabaseAdminRestTransport._BaseListBackupOperations._get_unset_required_fields(
827
+ query_params
828
+ )
829
+ )
830
+
831
+ query_params["$alt"] = "json;enum-encoding=int"
832
+ return query_params
833
+
834
+ class _BaseListBackups:
835
+ def __hash__(self): # pragma: NO COVER
836
+ return NotImplementedError("__hash__ must be implemented.")
837
+
838
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
839
+
840
+ @classmethod
841
+ def _get_unset_required_fields(cls, message_dict):
842
+ return {
843
+ k: v
844
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
845
+ if k not in message_dict
846
+ }
847
+
848
+ @staticmethod
849
+ def _get_http_options():
850
+ http_options: List[Dict[str, str]] = [
851
+ {
852
+ "method": "get",
853
+ "uri": "/v1/{parent=projects/*/instances/*}/backups",
854
+ },
855
+ ]
856
+ return http_options
857
+
858
+ @staticmethod
859
+ def _get_transcoded_request(http_options, request):
860
+ pb_request = backup.ListBackupsRequest.pb(request)
861
+ transcoded_request = path_template.transcode(http_options, pb_request)
862
+ return transcoded_request
863
+
864
+ @staticmethod
865
+ def _get_query_params_json(transcoded_request):
866
+ query_params = json.loads(
867
+ json_format.MessageToJson(
868
+ transcoded_request["query_params"],
869
+ use_integers_for_enums=True,
870
+ )
871
+ )
872
+ query_params.update(
873
+ _BaseDatabaseAdminRestTransport._BaseListBackups._get_unset_required_fields(
874
+ query_params
875
+ )
876
+ )
877
+
878
+ query_params["$alt"] = "json;enum-encoding=int"
879
+ return query_params
880
+
881
+ class _BaseListBackupSchedules:
882
+ def __hash__(self): # pragma: NO COVER
883
+ return NotImplementedError("__hash__ must be implemented.")
884
+
885
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
886
+
887
+ @classmethod
888
+ def _get_unset_required_fields(cls, message_dict):
889
+ return {
890
+ k: v
891
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
892
+ if k not in message_dict
893
+ }
894
+
895
+ @staticmethod
896
+ def _get_http_options():
897
+ http_options: List[Dict[str, str]] = [
898
+ {
899
+ "method": "get",
900
+ "uri": "/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules",
901
+ },
902
+ ]
903
+ return http_options
904
+
905
+ @staticmethod
906
+ def _get_transcoded_request(http_options, request):
907
+ pb_request = backup_schedule.ListBackupSchedulesRequest.pb(request)
908
+ transcoded_request = path_template.transcode(http_options, pb_request)
909
+ return transcoded_request
910
+
911
+ @staticmethod
912
+ def _get_query_params_json(transcoded_request):
913
+ query_params = json.loads(
914
+ json_format.MessageToJson(
915
+ transcoded_request["query_params"],
916
+ use_integers_for_enums=True,
917
+ )
918
+ )
919
+ query_params.update(
920
+ _BaseDatabaseAdminRestTransport._BaseListBackupSchedules._get_unset_required_fields(
921
+ query_params
922
+ )
923
+ )
924
+
925
+ query_params["$alt"] = "json;enum-encoding=int"
926
+ return query_params
927
+
928
+ class _BaseListDatabaseOperations:
929
+ def __hash__(self): # pragma: NO COVER
930
+ return NotImplementedError("__hash__ must be implemented.")
931
+
932
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
933
+
934
+ @classmethod
935
+ def _get_unset_required_fields(cls, message_dict):
936
+ return {
937
+ k: v
938
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
939
+ if k not in message_dict
940
+ }
941
+
942
+ @staticmethod
943
+ def _get_http_options():
944
+ http_options: List[Dict[str, str]] = [
945
+ {
946
+ "method": "get",
947
+ "uri": "/v1/{parent=projects/*/instances/*}/databaseOperations",
948
+ },
949
+ ]
950
+ return http_options
951
+
952
+ @staticmethod
953
+ def _get_transcoded_request(http_options, request):
954
+ pb_request = spanner_database_admin.ListDatabaseOperationsRequest.pb(
955
+ request
956
+ )
957
+ transcoded_request = path_template.transcode(http_options, pb_request)
958
+ return transcoded_request
959
+
960
+ @staticmethod
961
+ def _get_query_params_json(transcoded_request):
962
+ query_params = json.loads(
963
+ json_format.MessageToJson(
964
+ transcoded_request["query_params"],
965
+ use_integers_for_enums=True,
966
+ )
967
+ )
968
+ query_params.update(
969
+ _BaseDatabaseAdminRestTransport._BaseListDatabaseOperations._get_unset_required_fields(
970
+ query_params
971
+ )
972
+ )
973
+
974
+ query_params["$alt"] = "json;enum-encoding=int"
975
+ return query_params
976
+
977
+ class _BaseListDatabaseRoles:
978
+ def __hash__(self): # pragma: NO COVER
979
+ return NotImplementedError("__hash__ must be implemented.")
980
+
981
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
982
+
983
+ @classmethod
984
+ def _get_unset_required_fields(cls, message_dict):
985
+ return {
986
+ k: v
987
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
988
+ if k not in message_dict
989
+ }
990
+
991
+ @staticmethod
992
+ def _get_http_options():
993
+ http_options: List[Dict[str, str]] = [
994
+ {
995
+ "method": "get",
996
+ "uri": "/v1/{parent=projects/*/instances/*/databases/*}/databaseRoles",
997
+ },
998
+ ]
999
+ return http_options
1000
+
1001
+ @staticmethod
1002
+ def _get_transcoded_request(http_options, request):
1003
+ pb_request = spanner_database_admin.ListDatabaseRolesRequest.pb(request)
1004
+ transcoded_request = path_template.transcode(http_options, pb_request)
1005
+ return transcoded_request
1006
+
1007
+ @staticmethod
1008
+ def _get_query_params_json(transcoded_request):
1009
+ query_params = json.loads(
1010
+ json_format.MessageToJson(
1011
+ transcoded_request["query_params"],
1012
+ use_integers_for_enums=True,
1013
+ )
1014
+ )
1015
+ query_params.update(
1016
+ _BaseDatabaseAdminRestTransport._BaseListDatabaseRoles._get_unset_required_fields(
1017
+ query_params
1018
+ )
1019
+ )
1020
+
1021
+ query_params["$alt"] = "json;enum-encoding=int"
1022
+ return query_params
1023
+
1024
+ class _BaseListDatabases:
1025
+ def __hash__(self): # pragma: NO COVER
1026
+ return NotImplementedError("__hash__ must be implemented.")
1027
+
1028
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
1029
+
1030
+ @classmethod
1031
+ def _get_unset_required_fields(cls, message_dict):
1032
+ return {
1033
+ k: v
1034
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
1035
+ if k not in message_dict
1036
+ }
1037
+
1038
+ @staticmethod
1039
+ def _get_http_options():
1040
+ http_options: List[Dict[str, str]] = [
1041
+ {
1042
+ "method": "get",
1043
+ "uri": "/v1/{parent=projects/*/instances/*}/databases",
1044
+ },
1045
+ ]
1046
+ return http_options
1047
+
1048
+ @staticmethod
1049
+ def _get_transcoded_request(http_options, request):
1050
+ pb_request = spanner_database_admin.ListDatabasesRequest.pb(request)
1051
+ transcoded_request = path_template.transcode(http_options, pb_request)
1052
+ return transcoded_request
1053
+
1054
+ @staticmethod
1055
+ def _get_query_params_json(transcoded_request):
1056
+ query_params = json.loads(
1057
+ json_format.MessageToJson(
1058
+ transcoded_request["query_params"],
1059
+ use_integers_for_enums=True,
1060
+ )
1061
+ )
1062
+ query_params.update(
1063
+ _BaseDatabaseAdminRestTransport._BaseListDatabases._get_unset_required_fields(
1064
+ query_params
1065
+ )
1066
+ )
1067
+
1068
+ query_params["$alt"] = "json;enum-encoding=int"
1069
+ return query_params
1070
+
1071
+ class _BaseRestoreDatabase:
1072
+ def __hash__(self): # pragma: NO COVER
1073
+ return NotImplementedError("__hash__ must be implemented.")
1074
+
1075
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
1076
+
1077
+ @classmethod
1078
+ def _get_unset_required_fields(cls, message_dict):
1079
+ return {
1080
+ k: v
1081
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
1082
+ if k not in message_dict
1083
+ }
1084
+
1085
+ @staticmethod
1086
+ def _get_http_options():
1087
+ http_options: List[Dict[str, str]] = [
1088
+ {
1089
+ "method": "post",
1090
+ "uri": "/v1/{parent=projects/*/instances/*}/databases:restore",
1091
+ "body": "*",
1092
+ },
1093
+ ]
1094
+ return http_options
1095
+
1096
+ @staticmethod
1097
+ def _get_transcoded_request(http_options, request):
1098
+ pb_request = spanner_database_admin.RestoreDatabaseRequest.pb(request)
1099
+ transcoded_request = path_template.transcode(http_options, pb_request)
1100
+ return transcoded_request
1101
+
1102
+ @staticmethod
1103
+ def _get_request_body_json(transcoded_request):
1104
+ # Jsonify the request body
1105
+
1106
+ body = json_format.MessageToJson(
1107
+ transcoded_request["body"], use_integers_for_enums=True
1108
+ )
1109
+ return body
1110
+
1111
+ @staticmethod
1112
+ def _get_query_params_json(transcoded_request):
1113
+ query_params = json.loads(
1114
+ json_format.MessageToJson(
1115
+ transcoded_request["query_params"],
1116
+ use_integers_for_enums=True,
1117
+ )
1118
+ )
1119
+ query_params.update(
1120
+ _BaseDatabaseAdminRestTransport._BaseRestoreDatabase._get_unset_required_fields(
1121
+ query_params
1122
+ )
1123
+ )
1124
+
1125
+ query_params["$alt"] = "json;enum-encoding=int"
1126
+ return query_params
1127
+
1128
+ class _BaseSetIamPolicy:
1129
+ def __hash__(self): # pragma: NO COVER
1130
+ return NotImplementedError("__hash__ must be implemented.")
1131
+
1132
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
1133
+
1134
+ @classmethod
1135
+ def _get_unset_required_fields(cls, message_dict):
1136
+ return {
1137
+ k: v
1138
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
1139
+ if k not in message_dict
1140
+ }
1141
+
1142
+ @staticmethod
1143
+ def _get_http_options():
1144
+ http_options: List[Dict[str, str]] = [
1145
+ {
1146
+ "method": "post",
1147
+ "uri": "/v1/{resource=projects/*/instances/*/databases/*}:setIamPolicy",
1148
+ "body": "*",
1149
+ },
1150
+ {
1151
+ "method": "post",
1152
+ "uri": "/v1/{resource=projects/*/instances/*/backups/*}:setIamPolicy",
1153
+ "body": "*",
1154
+ },
1155
+ {
1156
+ "method": "post",
1157
+ "uri": "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:setIamPolicy",
1158
+ "body": "*",
1159
+ },
1160
+ ]
1161
+ return http_options
1162
+
1163
+ @staticmethod
1164
+ def _get_transcoded_request(http_options, request):
1165
+ pb_request = request
1166
+ transcoded_request = path_template.transcode(http_options, pb_request)
1167
+ return transcoded_request
1168
+
1169
+ @staticmethod
1170
+ def _get_request_body_json(transcoded_request):
1171
+ # Jsonify the request body
1172
+
1173
+ body = json_format.MessageToJson(
1174
+ transcoded_request["body"], use_integers_for_enums=True
1175
+ )
1176
+ return body
1177
+
1178
+ @staticmethod
1179
+ def _get_query_params_json(transcoded_request):
1180
+ query_params = json.loads(
1181
+ json_format.MessageToJson(
1182
+ transcoded_request["query_params"],
1183
+ use_integers_for_enums=True,
1184
+ )
1185
+ )
1186
+ query_params.update(
1187
+ _BaseDatabaseAdminRestTransport._BaseSetIamPolicy._get_unset_required_fields(
1188
+ query_params
1189
+ )
1190
+ )
1191
+
1192
+ query_params["$alt"] = "json;enum-encoding=int"
1193
+ return query_params
1194
+
1195
+ class _BaseTestIamPermissions:
1196
+ def __hash__(self): # pragma: NO COVER
1197
+ return NotImplementedError("__hash__ must be implemented.")
1198
+
1199
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
1200
+
1201
+ @classmethod
1202
+ def _get_unset_required_fields(cls, message_dict):
1203
+ return {
1204
+ k: v
1205
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
1206
+ if k not in message_dict
1207
+ }
1208
+
1209
+ @staticmethod
1210
+ def _get_http_options():
1211
+ http_options: List[Dict[str, str]] = [
1212
+ {
1213
+ "method": "post",
1214
+ "uri": "/v1/{resource=projects/*/instances/*/databases/*}:testIamPermissions",
1215
+ "body": "*",
1216
+ },
1217
+ {
1218
+ "method": "post",
1219
+ "uri": "/v1/{resource=projects/*/instances/*/backups/*}:testIamPermissions",
1220
+ "body": "*",
1221
+ },
1222
+ {
1223
+ "method": "post",
1224
+ "uri": "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:testIamPermissions",
1225
+ "body": "*",
1226
+ },
1227
+ {
1228
+ "method": "post",
1229
+ "uri": "/v1/{resource=projects/*/instances/*/databases/*/databaseRoles/*}:testIamPermissions",
1230
+ "body": "*",
1231
+ },
1232
+ ]
1233
+ return http_options
1234
+
1235
+ @staticmethod
1236
+ def _get_transcoded_request(http_options, request):
1237
+ pb_request = request
1238
+ transcoded_request = path_template.transcode(http_options, pb_request)
1239
+ return transcoded_request
1240
+
1241
+ @staticmethod
1242
+ def _get_request_body_json(transcoded_request):
1243
+ # Jsonify the request body
1244
+
1245
+ body = json_format.MessageToJson(
1246
+ transcoded_request["body"], use_integers_for_enums=True
1247
+ )
1248
+ return body
1249
+
1250
+ @staticmethod
1251
+ def _get_query_params_json(transcoded_request):
1252
+ query_params = json.loads(
1253
+ json_format.MessageToJson(
1254
+ transcoded_request["query_params"],
1255
+ use_integers_for_enums=True,
1256
+ )
1257
+ )
1258
+ query_params.update(
1259
+ _BaseDatabaseAdminRestTransport._BaseTestIamPermissions._get_unset_required_fields(
1260
+ query_params
1261
+ )
1262
+ )
1263
+
1264
+ query_params["$alt"] = "json;enum-encoding=int"
1265
+ return query_params
1266
+
1267
+ class _BaseUpdateBackup:
1268
+ def __hash__(self): # pragma: NO COVER
1269
+ return NotImplementedError("__hash__ must be implemented.")
1270
+
1271
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
1272
+ "updateMask": {},
1273
+ }
1274
+
1275
+ @classmethod
1276
+ def _get_unset_required_fields(cls, message_dict):
1277
+ return {
1278
+ k: v
1279
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
1280
+ if k not in message_dict
1281
+ }
1282
+
1283
+ @staticmethod
1284
+ def _get_http_options():
1285
+ http_options: List[Dict[str, str]] = [
1286
+ {
1287
+ "method": "patch",
1288
+ "uri": "/v1/{backup.name=projects/*/instances/*/backups/*}",
1289
+ "body": "backup",
1290
+ },
1291
+ ]
1292
+ return http_options
1293
+
1294
+ @staticmethod
1295
+ def _get_transcoded_request(http_options, request):
1296
+ pb_request = gsad_backup.UpdateBackupRequest.pb(request)
1297
+ transcoded_request = path_template.transcode(http_options, pb_request)
1298
+ return transcoded_request
1299
+
1300
+ @staticmethod
1301
+ def _get_request_body_json(transcoded_request):
1302
+ # Jsonify the request body
1303
+
1304
+ body = json_format.MessageToJson(
1305
+ transcoded_request["body"], use_integers_for_enums=True
1306
+ )
1307
+ return body
1308
+
1309
+ @staticmethod
1310
+ def _get_query_params_json(transcoded_request):
1311
+ query_params = json.loads(
1312
+ json_format.MessageToJson(
1313
+ transcoded_request["query_params"],
1314
+ use_integers_for_enums=True,
1315
+ )
1316
+ )
1317
+ query_params.update(
1318
+ _BaseDatabaseAdminRestTransport._BaseUpdateBackup._get_unset_required_fields(
1319
+ query_params
1320
+ )
1321
+ )
1322
+
1323
+ query_params["$alt"] = "json;enum-encoding=int"
1324
+ return query_params
1325
+
1326
+ class _BaseUpdateBackupSchedule:
1327
+ def __hash__(self): # pragma: NO COVER
1328
+ return NotImplementedError("__hash__ must be implemented.")
1329
+
1330
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
1331
+ "updateMask": {},
1332
+ }
1333
+
1334
+ @classmethod
1335
+ def _get_unset_required_fields(cls, message_dict):
1336
+ return {
1337
+ k: v
1338
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
1339
+ if k not in message_dict
1340
+ }
1341
+
1342
+ @staticmethod
1343
+ def _get_http_options():
1344
+ http_options: List[Dict[str, str]] = [
1345
+ {
1346
+ "method": "patch",
1347
+ "uri": "/v1/{backup_schedule.name=projects/*/instances/*/databases/*/backupSchedules/*}",
1348
+ "body": "backup_schedule",
1349
+ },
1350
+ ]
1351
+ return http_options
1352
+
1353
+ @staticmethod
1354
+ def _get_transcoded_request(http_options, request):
1355
+ pb_request = gsad_backup_schedule.UpdateBackupScheduleRequest.pb(request)
1356
+ transcoded_request = path_template.transcode(http_options, pb_request)
1357
+ return transcoded_request
1358
+
1359
+ @staticmethod
1360
+ def _get_request_body_json(transcoded_request):
1361
+ # Jsonify the request body
1362
+
1363
+ body = json_format.MessageToJson(
1364
+ transcoded_request["body"], use_integers_for_enums=True
1365
+ )
1366
+ return body
1367
+
1368
+ @staticmethod
1369
+ def _get_query_params_json(transcoded_request):
1370
+ query_params = json.loads(
1371
+ json_format.MessageToJson(
1372
+ transcoded_request["query_params"],
1373
+ use_integers_for_enums=True,
1374
+ )
1375
+ )
1376
+ query_params.update(
1377
+ _BaseDatabaseAdminRestTransport._BaseUpdateBackupSchedule._get_unset_required_fields(
1378
+ query_params
1379
+ )
1380
+ )
1381
+
1382
+ query_params["$alt"] = "json;enum-encoding=int"
1383
+ return query_params
1384
+
1385
+ class _BaseUpdateDatabase:
1386
+ def __hash__(self): # pragma: NO COVER
1387
+ return NotImplementedError("__hash__ must be implemented.")
1388
+
1389
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
1390
+ "updateMask": {},
1391
+ }
1392
+
1393
+ @classmethod
1394
+ def _get_unset_required_fields(cls, message_dict):
1395
+ return {
1396
+ k: v
1397
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
1398
+ if k not in message_dict
1399
+ }
1400
+
1401
+ @staticmethod
1402
+ def _get_http_options():
1403
+ http_options: List[Dict[str, str]] = [
1404
+ {
1405
+ "method": "patch",
1406
+ "uri": "/v1/{database.name=projects/*/instances/*/databases/*}",
1407
+ "body": "database",
1408
+ },
1409
+ ]
1410
+ return http_options
1411
+
1412
+ @staticmethod
1413
+ def _get_transcoded_request(http_options, request):
1414
+ pb_request = spanner_database_admin.UpdateDatabaseRequest.pb(request)
1415
+ transcoded_request = path_template.transcode(http_options, pb_request)
1416
+ return transcoded_request
1417
+
1418
+ @staticmethod
1419
+ def _get_request_body_json(transcoded_request):
1420
+ # Jsonify the request body
1421
+
1422
+ body = json_format.MessageToJson(
1423
+ transcoded_request["body"], use_integers_for_enums=True
1424
+ )
1425
+ return body
1426
+
1427
+ @staticmethod
1428
+ def _get_query_params_json(transcoded_request):
1429
+ query_params = json.loads(
1430
+ json_format.MessageToJson(
1431
+ transcoded_request["query_params"],
1432
+ use_integers_for_enums=True,
1433
+ )
1434
+ )
1435
+ query_params.update(
1436
+ _BaseDatabaseAdminRestTransport._BaseUpdateDatabase._get_unset_required_fields(
1437
+ query_params
1438
+ )
1439
+ )
1440
+
1441
+ query_params["$alt"] = "json;enum-encoding=int"
1442
+ return query_params
1443
+
1444
+ class _BaseUpdateDatabaseDdl:
1445
+ def __hash__(self): # pragma: NO COVER
1446
+ return NotImplementedError("__hash__ must be implemented.")
1447
+
1448
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
1449
+
1450
+ @classmethod
1451
+ def _get_unset_required_fields(cls, message_dict):
1452
+ return {
1453
+ k: v
1454
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
1455
+ if k not in message_dict
1456
+ }
1457
+
1458
+ @staticmethod
1459
+ def _get_http_options():
1460
+ http_options: List[Dict[str, str]] = [
1461
+ {
1462
+ "method": "patch",
1463
+ "uri": "/v1/{database=projects/*/instances/*/databases/*}/ddl",
1464
+ "body": "*",
1465
+ },
1466
+ ]
1467
+ return http_options
1468
+
1469
+ @staticmethod
1470
+ def _get_transcoded_request(http_options, request):
1471
+ pb_request = spanner_database_admin.UpdateDatabaseDdlRequest.pb(request)
1472
+ transcoded_request = path_template.transcode(http_options, pb_request)
1473
+ return transcoded_request
1474
+
1475
+ @staticmethod
1476
+ def _get_request_body_json(transcoded_request):
1477
+ # Jsonify the request body
1478
+
1479
+ body = json_format.MessageToJson(
1480
+ transcoded_request["body"], use_integers_for_enums=True
1481
+ )
1482
+ return body
1483
+
1484
+ @staticmethod
1485
+ def _get_query_params_json(transcoded_request):
1486
+ query_params = json.loads(
1487
+ json_format.MessageToJson(
1488
+ transcoded_request["query_params"],
1489
+ use_integers_for_enums=True,
1490
+ )
1491
+ )
1492
+ query_params.update(
1493
+ _BaseDatabaseAdminRestTransport._BaseUpdateDatabaseDdl._get_unset_required_fields(
1494
+ query_params
1495
+ )
1496
+ )
1497
+
1498
+ query_params["$alt"] = "json;enum-encoding=int"
1499
+ return query_params
1500
+
1501
+ class _BaseCancelOperation:
1502
+ def __hash__(self): # pragma: NO COVER
1503
+ return NotImplementedError("__hash__ must be implemented.")
1504
+
1505
+ @staticmethod
1506
+ def _get_http_options():
1507
+ http_options: List[Dict[str, str]] = [
1508
+ {
1509
+ "method": "post",
1510
+ "uri": "/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel",
1511
+ },
1512
+ {
1513
+ "method": "post",
1514
+ "uri": "/v1/{name=projects/*/instances/*/operations/*}:cancel",
1515
+ },
1516
+ {
1517
+ "method": "post",
1518
+ "uri": "/v1/{name=projects/*/instances/*/backups/*/operations/*}:cancel",
1519
+ },
1520
+ {
1521
+ "method": "post",
1522
+ "uri": "/v1/{name=projects/*/instanceConfigs/*/operations/*}:cancel",
1523
+ },
1524
+ ]
1525
+ return http_options
1526
+
1527
+ @staticmethod
1528
+ def _get_transcoded_request(http_options, request):
1529
+ request_kwargs = json_format.MessageToDict(request)
1530
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
1531
+ return transcoded_request
1532
+
1533
+ @staticmethod
1534
+ def _get_query_params_json(transcoded_request):
1535
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
1536
+ return query_params
1537
+
1538
+ class _BaseDeleteOperation:
1539
+ def __hash__(self): # pragma: NO COVER
1540
+ return NotImplementedError("__hash__ must be implemented.")
1541
+
1542
+ @staticmethod
1543
+ def _get_http_options():
1544
+ http_options: List[Dict[str, str]] = [
1545
+ {
1546
+ "method": "delete",
1547
+ "uri": "/v1/{name=projects/*/instances/*/databases/*/operations/*}",
1548
+ },
1549
+ {
1550
+ "method": "delete",
1551
+ "uri": "/v1/{name=projects/*/instances/*/operations/*}",
1552
+ },
1553
+ {
1554
+ "method": "delete",
1555
+ "uri": "/v1/{name=projects/*/instances/*/backups/*/operations/*}",
1556
+ },
1557
+ {
1558
+ "method": "delete",
1559
+ "uri": "/v1/{name=projects/*/instanceConfigs/*/operations/*}",
1560
+ },
1561
+ ]
1562
+ return http_options
1563
+
1564
+ @staticmethod
1565
+ def _get_transcoded_request(http_options, request):
1566
+ request_kwargs = json_format.MessageToDict(request)
1567
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
1568
+ return transcoded_request
1569
+
1570
+ @staticmethod
1571
+ def _get_query_params_json(transcoded_request):
1572
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
1573
+ return query_params
1574
+
1575
+ class _BaseGetOperation:
1576
+ def __hash__(self): # pragma: NO COVER
1577
+ return NotImplementedError("__hash__ must be implemented.")
1578
+
1579
+ @staticmethod
1580
+ def _get_http_options():
1581
+ http_options: List[Dict[str, str]] = [
1582
+ {
1583
+ "method": "get",
1584
+ "uri": "/v1/{name=projects/*/instances/*/databases/*/operations/*}",
1585
+ },
1586
+ {
1587
+ "method": "get",
1588
+ "uri": "/v1/{name=projects/*/instances/*/operations/*}",
1589
+ },
1590
+ {
1591
+ "method": "get",
1592
+ "uri": "/v1/{name=projects/*/instances/*/backups/*/operations/*}",
1593
+ },
1594
+ {
1595
+ "method": "get",
1596
+ "uri": "/v1/{name=projects/*/instanceConfigs/*/operations/*}",
1597
+ },
1598
+ ]
1599
+ return http_options
1600
+
1601
+ @staticmethod
1602
+ def _get_transcoded_request(http_options, request):
1603
+ request_kwargs = json_format.MessageToDict(request)
1604
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
1605
+ return transcoded_request
1606
+
1607
+ @staticmethod
1608
+ def _get_query_params_json(transcoded_request):
1609
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
1610
+ return query_params
1611
+
1612
+ class _BaseListOperations:
1613
+ def __hash__(self): # pragma: NO COVER
1614
+ return NotImplementedError("__hash__ must be implemented.")
1615
+
1616
+ @staticmethod
1617
+ def _get_http_options():
1618
+ http_options: List[Dict[str, str]] = [
1619
+ {
1620
+ "method": "get",
1621
+ "uri": "/v1/{name=projects/*/instances/*/databases/*/operations}",
1622
+ },
1623
+ {
1624
+ "method": "get",
1625
+ "uri": "/v1/{name=projects/*/instances/*/operations}",
1626
+ },
1627
+ {
1628
+ "method": "get",
1629
+ "uri": "/v1/{name=projects/*/instances/*/backups/*/operations}",
1630
+ },
1631
+ {
1632
+ "method": "get",
1633
+ "uri": "/v1/{name=projects/*/instanceConfigs/*/operations}",
1634
+ },
1635
+ ]
1636
+ return http_options
1637
+
1638
+ @staticmethod
1639
+ def _get_transcoded_request(http_options, request):
1640
+ request_kwargs = json_format.MessageToDict(request)
1641
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
1642
+ return transcoded_request
1643
+
1644
+ @staticmethod
1645
+ def _get_query_params_json(transcoded_request):
1646
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
1647
+ return query_params
1648
+
1649
+
1650
+ __all__ = ("_BaseDatabaseAdminRestTransport",)