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,4834 @@
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 logging
17
+ import json # type: ignore
18
+
19
+ from google.auth.transport.requests import AuthorizedSession # type: ignore
20
+ from google.auth import credentials as ga_credentials # type: ignore
21
+ from google.api_core import exceptions as core_exceptions
22
+ from google.api_core import retry as retries
23
+ from google.api_core import rest_helpers
24
+ from google.api_core import rest_streaming
25
+ from google.api_core import gapic_v1
26
+ import google.protobuf
27
+
28
+ from google.protobuf import json_format
29
+ from google.api_core import operations_v1
30
+
31
+ from requests import __version__ as requests_version
32
+ import dataclasses
33
+ from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
34
+ import warnings
35
+
36
+
37
+ from google.cloud.spanner_admin_instance_v1.types import spanner_instance_admin
38
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
39
+ from google.iam.v1 import policy_pb2 # type: ignore
40
+ from google.protobuf import empty_pb2 # type: ignore
41
+ from google.longrunning import operations_pb2 # type: ignore
42
+
43
+
44
+ from .rest_base import _BaseInstanceAdminRestTransport
45
+ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO
46
+
47
+ try:
48
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
49
+ except AttributeError: # pragma: NO COVER
50
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
51
+
52
+ try:
53
+ from google.api_core import client_logging # type: ignore
54
+
55
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
56
+ except ImportError: # pragma: NO COVER
57
+ CLIENT_LOGGING_SUPPORTED = False
58
+
59
+ _LOGGER = logging.getLogger(__name__)
60
+
61
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
62
+ gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version,
63
+ grpc_version=None,
64
+ rest_version=f"requests@{requests_version}",
65
+ )
66
+
67
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
68
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
69
+
70
+
71
+ class InstanceAdminRestInterceptor:
72
+ """Interceptor for InstanceAdmin.
73
+
74
+ Interceptors are used to manipulate requests, request metadata, and responses
75
+ in arbitrary ways.
76
+ Example use cases include:
77
+ * Logging
78
+ * Verifying requests according to service or custom semantics
79
+ * Stripping extraneous information from responses
80
+
81
+ These use cases and more can be enabled by injecting an
82
+ instance of a custom subclass when constructing the InstanceAdminRestTransport.
83
+
84
+ .. code-block:: python
85
+ class MyCustomInstanceAdminInterceptor(InstanceAdminRestInterceptor):
86
+ def pre_create_instance(self, request, metadata):
87
+ logging.log(f"Received request: {request}")
88
+ return request, metadata
89
+
90
+ def post_create_instance(self, response):
91
+ logging.log(f"Received response: {response}")
92
+ return response
93
+
94
+ def pre_create_instance_config(self, request, metadata):
95
+ logging.log(f"Received request: {request}")
96
+ return request, metadata
97
+
98
+ def post_create_instance_config(self, response):
99
+ logging.log(f"Received response: {response}")
100
+ return response
101
+
102
+ def pre_create_instance_partition(self, request, metadata):
103
+ logging.log(f"Received request: {request}")
104
+ return request, metadata
105
+
106
+ def post_create_instance_partition(self, response):
107
+ logging.log(f"Received response: {response}")
108
+ return response
109
+
110
+ def pre_delete_instance(self, request, metadata):
111
+ logging.log(f"Received request: {request}")
112
+ return request, metadata
113
+
114
+ def pre_delete_instance_config(self, request, metadata):
115
+ logging.log(f"Received request: {request}")
116
+ return request, metadata
117
+
118
+ def pre_delete_instance_partition(self, request, metadata):
119
+ logging.log(f"Received request: {request}")
120
+ return request, metadata
121
+
122
+ def pre_get_iam_policy(self, request, metadata):
123
+ logging.log(f"Received request: {request}")
124
+ return request, metadata
125
+
126
+ def post_get_iam_policy(self, response):
127
+ logging.log(f"Received response: {response}")
128
+ return response
129
+
130
+ def pre_get_instance(self, request, metadata):
131
+ logging.log(f"Received request: {request}")
132
+ return request, metadata
133
+
134
+ def post_get_instance(self, response):
135
+ logging.log(f"Received response: {response}")
136
+ return response
137
+
138
+ def pre_get_instance_config(self, request, metadata):
139
+ logging.log(f"Received request: {request}")
140
+ return request, metadata
141
+
142
+ def post_get_instance_config(self, response):
143
+ logging.log(f"Received response: {response}")
144
+ return response
145
+
146
+ def pre_get_instance_partition(self, request, metadata):
147
+ logging.log(f"Received request: {request}")
148
+ return request, metadata
149
+
150
+ def post_get_instance_partition(self, response):
151
+ logging.log(f"Received response: {response}")
152
+ return response
153
+
154
+ def pre_list_instance_config_operations(self, request, metadata):
155
+ logging.log(f"Received request: {request}")
156
+ return request, metadata
157
+
158
+ def post_list_instance_config_operations(self, response):
159
+ logging.log(f"Received response: {response}")
160
+ return response
161
+
162
+ def pre_list_instance_configs(self, request, metadata):
163
+ logging.log(f"Received request: {request}")
164
+ return request, metadata
165
+
166
+ def post_list_instance_configs(self, response):
167
+ logging.log(f"Received response: {response}")
168
+ return response
169
+
170
+ def pre_list_instance_partition_operations(self, request, metadata):
171
+ logging.log(f"Received request: {request}")
172
+ return request, metadata
173
+
174
+ def post_list_instance_partition_operations(self, response):
175
+ logging.log(f"Received response: {response}")
176
+ return response
177
+
178
+ def pre_list_instance_partitions(self, request, metadata):
179
+ logging.log(f"Received request: {request}")
180
+ return request, metadata
181
+
182
+ def post_list_instance_partitions(self, response):
183
+ logging.log(f"Received response: {response}")
184
+ return response
185
+
186
+ def pre_list_instances(self, request, metadata):
187
+ logging.log(f"Received request: {request}")
188
+ return request, metadata
189
+
190
+ def post_list_instances(self, response):
191
+ logging.log(f"Received response: {response}")
192
+ return response
193
+
194
+ def pre_move_instance(self, request, metadata):
195
+ logging.log(f"Received request: {request}")
196
+ return request, metadata
197
+
198
+ def post_move_instance(self, response):
199
+ logging.log(f"Received response: {response}")
200
+ return response
201
+
202
+ def pre_set_iam_policy(self, request, metadata):
203
+ logging.log(f"Received request: {request}")
204
+ return request, metadata
205
+
206
+ def post_set_iam_policy(self, response):
207
+ logging.log(f"Received response: {response}")
208
+ return response
209
+
210
+ def pre_test_iam_permissions(self, request, metadata):
211
+ logging.log(f"Received request: {request}")
212
+ return request, metadata
213
+
214
+ def post_test_iam_permissions(self, response):
215
+ logging.log(f"Received response: {response}")
216
+ return response
217
+
218
+ def pre_update_instance(self, request, metadata):
219
+ logging.log(f"Received request: {request}")
220
+ return request, metadata
221
+
222
+ def post_update_instance(self, response):
223
+ logging.log(f"Received response: {response}")
224
+ return response
225
+
226
+ def pre_update_instance_config(self, request, metadata):
227
+ logging.log(f"Received request: {request}")
228
+ return request, metadata
229
+
230
+ def post_update_instance_config(self, response):
231
+ logging.log(f"Received response: {response}")
232
+ return response
233
+
234
+ def pre_update_instance_partition(self, request, metadata):
235
+ logging.log(f"Received request: {request}")
236
+ return request, metadata
237
+
238
+ def post_update_instance_partition(self, response):
239
+ logging.log(f"Received response: {response}")
240
+ return response
241
+
242
+ transport = InstanceAdminRestTransport(interceptor=MyCustomInstanceAdminInterceptor())
243
+ client = InstanceAdminClient(transport=transport)
244
+
245
+
246
+ """
247
+
248
+ def pre_create_instance(
249
+ self,
250
+ request: spanner_instance_admin.CreateInstanceRequest,
251
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
252
+ ) -> Tuple[
253
+ spanner_instance_admin.CreateInstanceRequest,
254
+ Sequence[Tuple[str, Union[str, bytes]]],
255
+ ]:
256
+ """Pre-rpc interceptor for create_instance
257
+
258
+ Override in a subclass to manipulate the request or metadata
259
+ before they are sent to the InstanceAdmin server.
260
+ """
261
+ return request, metadata
262
+
263
+ def post_create_instance(
264
+ self, response: operations_pb2.Operation
265
+ ) -> operations_pb2.Operation:
266
+ """Post-rpc interceptor for create_instance
267
+
268
+ DEPRECATED. Please use the `post_create_instance_with_metadata`
269
+ interceptor instead.
270
+
271
+ Override in a subclass to read or manipulate the response
272
+ after it is returned by the InstanceAdmin server but before
273
+ it is returned to user code. This `post_create_instance` interceptor runs
274
+ before the `post_create_instance_with_metadata` interceptor.
275
+ """
276
+ return response
277
+
278
+ def post_create_instance_with_metadata(
279
+ self,
280
+ response: operations_pb2.Operation,
281
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
282
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
283
+ """Post-rpc interceptor for create_instance
284
+
285
+ Override in a subclass to read or manipulate the response or metadata after it
286
+ is returned by the InstanceAdmin server but before it is returned to user code.
287
+
288
+ We recommend only using this `post_create_instance_with_metadata`
289
+ interceptor in new development instead of the `post_create_instance` interceptor.
290
+ When both interceptors are used, this `post_create_instance_with_metadata` interceptor runs after the
291
+ `post_create_instance` interceptor. The (possibly modified) response returned by
292
+ `post_create_instance` will be passed to
293
+ `post_create_instance_with_metadata`.
294
+ """
295
+ return response, metadata
296
+
297
+ def pre_create_instance_config(
298
+ self,
299
+ request: spanner_instance_admin.CreateInstanceConfigRequest,
300
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
301
+ ) -> Tuple[
302
+ spanner_instance_admin.CreateInstanceConfigRequest,
303
+ Sequence[Tuple[str, Union[str, bytes]]],
304
+ ]:
305
+ """Pre-rpc interceptor for create_instance_config
306
+
307
+ Override in a subclass to manipulate the request or metadata
308
+ before they are sent to the InstanceAdmin server.
309
+ """
310
+ return request, metadata
311
+
312
+ def post_create_instance_config(
313
+ self, response: operations_pb2.Operation
314
+ ) -> operations_pb2.Operation:
315
+ """Post-rpc interceptor for create_instance_config
316
+
317
+ DEPRECATED. Please use the `post_create_instance_config_with_metadata`
318
+ interceptor instead.
319
+
320
+ Override in a subclass to read or manipulate the response
321
+ after it is returned by the InstanceAdmin server but before
322
+ it is returned to user code. This `post_create_instance_config` interceptor runs
323
+ before the `post_create_instance_config_with_metadata` interceptor.
324
+ """
325
+ return response
326
+
327
+ def post_create_instance_config_with_metadata(
328
+ self,
329
+ response: operations_pb2.Operation,
330
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
331
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
332
+ """Post-rpc interceptor for create_instance_config
333
+
334
+ Override in a subclass to read or manipulate the response or metadata after it
335
+ is returned by the InstanceAdmin server but before it is returned to user code.
336
+
337
+ We recommend only using this `post_create_instance_config_with_metadata`
338
+ interceptor in new development instead of the `post_create_instance_config` interceptor.
339
+ When both interceptors are used, this `post_create_instance_config_with_metadata` interceptor runs after the
340
+ `post_create_instance_config` interceptor. The (possibly modified) response returned by
341
+ `post_create_instance_config` will be passed to
342
+ `post_create_instance_config_with_metadata`.
343
+ """
344
+ return response, metadata
345
+
346
+ def pre_create_instance_partition(
347
+ self,
348
+ request: spanner_instance_admin.CreateInstancePartitionRequest,
349
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
350
+ ) -> Tuple[
351
+ spanner_instance_admin.CreateInstancePartitionRequest,
352
+ Sequence[Tuple[str, Union[str, bytes]]],
353
+ ]:
354
+ """Pre-rpc interceptor for create_instance_partition
355
+
356
+ Override in a subclass to manipulate the request or metadata
357
+ before they are sent to the InstanceAdmin server.
358
+ """
359
+ return request, metadata
360
+
361
+ def post_create_instance_partition(
362
+ self, response: operations_pb2.Operation
363
+ ) -> operations_pb2.Operation:
364
+ """Post-rpc interceptor for create_instance_partition
365
+
366
+ DEPRECATED. Please use the `post_create_instance_partition_with_metadata`
367
+ interceptor instead.
368
+
369
+ Override in a subclass to read or manipulate the response
370
+ after it is returned by the InstanceAdmin server but before
371
+ it is returned to user code. This `post_create_instance_partition` interceptor runs
372
+ before the `post_create_instance_partition_with_metadata` interceptor.
373
+ """
374
+ return response
375
+
376
+ def post_create_instance_partition_with_metadata(
377
+ self,
378
+ response: operations_pb2.Operation,
379
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
380
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
381
+ """Post-rpc interceptor for create_instance_partition
382
+
383
+ Override in a subclass to read or manipulate the response or metadata after it
384
+ is returned by the InstanceAdmin server but before it is returned to user code.
385
+
386
+ We recommend only using this `post_create_instance_partition_with_metadata`
387
+ interceptor in new development instead of the `post_create_instance_partition` interceptor.
388
+ When both interceptors are used, this `post_create_instance_partition_with_metadata` interceptor runs after the
389
+ `post_create_instance_partition` interceptor. The (possibly modified) response returned by
390
+ `post_create_instance_partition` will be passed to
391
+ `post_create_instance_partition_with_metadata`.
392
+ """
393
+ return response, metadata
394
+
395
+ def pre_delete_instance(
396
+ self,
397
+ request: spanner_instance_admin.DeleteInstanceRequest,
398
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
399
+ ) -> Tuple[
400
+ spanner_instance_admin.DeleteInstanceRequest,
401
+ Sequence[Tuple[str, Union[str, bytes]]],
402
+ ]:
403
+ """Pre-rpc interceptor for delete_instance
404
+
405
+ Override in a subclass to manipulate the request or metadata
406
+ before they are sent to the InstanceAdmin server.
407
+ """
408
+ return request, metadata
409
+
410
+ def pre_delete_instance_config(
411
+ self,
412
+ request: spanner_instance_admin.DeleteInstanceConfigRequest,
413
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
414
+ ) -> Tuple[
415
+ spanner_instance_admin.DeleteInstanceConfigRequest,
416
+ Sequence[Tuple[str, Union[str, bytes]]],
417
+ ]:
418
+ """Pre-rpc interceptor for delete_instance_config
419
+
420
+ Override in a subclass to manipulate the request or metadata
421
+ before they are sent to the InstanceAdmin server.
422
+ """
423
+ return request, metadata
424
+
425
+ def pre_delete_instance_partition(
426
+ self,
427
+ request: spanner_instance_admin.DeleteInstancePartitionRequest,
428
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
429
+ ) -> Tuple[
430
+ spanner_instance_admin.DeleteInstancePartitionRequest,
431
+ Sequence[Tuple[str, Union[str, bytes]]],
432
+ ]:
433
+ """Pre-rpc interceptor for delete_instance_partition
434
+
435
+ Override in a subclass to manipulate the request or metadata
436
+ before they are sent to the InstanceAdmin server.
437
+ """
438
+ return request, metadata
439
+
440
+ def pre_get_iam_policy(
441
+ self,
442
+ request: iam_policy_pb2.GetIamPolicyRequest,
443
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
444
+ ) -> Tuple[
445
+ iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]
446
+ ]:
447
+ """Pre-rpc interceptor for get_iam_policy
448
+
449
+ Override in a subclass to manipulate the request or metadata
450
+ before they are sent to the InstanceAdmin server.
451
+ """
452
+ return request, metadata
453
+
454
+ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy:
455
+ """Post-rpc interceptor for get_iam_policy
456
+
457
+ DEPRECATED. Please use the `post_get_iam_policy_with_metadata`
458
+ interceptor instead.
459
+
460
+ Override in a subclass to read or manipulate the response
461
+ after it is returned by the InstanceAdmin server but before
462
+ it is returned to user code. This `post_get_iam_policy` interceptor runs
463
+ before the `post_get_iam_policy_with_metadata` interceptor.
464
+ """
465
+ return response
466
+
467
+ def post_get_iam_policy_with_metadata(
468
+ self,
469
+ response: policy_pb2.Policy,
470
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
471
+ ) -> Tuple[policy_pb2.Policy, Sequence[Tuple[str, Union[str, bytes]]]]:
472
+ """Post-rpc interceptor for get_iam_policy
473
+
474
+ Override in a subclass to read or manipulate the response or metadata after it
475
+ is returned by the InstanceAdmin server but before it is returned to user code.
476
+
477
+ We recommend only using this `post_get_iam_policy_with_metadata`
478
+ interceptor in new development instead of the `post_get_iam_policy` interceptor.
479
+ When both interceptors are used, this `post_get_iam_policy_with_metadata` interceptor runs after the
480
+ `post_get_iam_policy` interceptor. The (possibly modified) response returned by
481
+ `post_get_iam_policy` will be passed to
482
+ `post_get_iam_policy_with_metadata`.
483
+ """
484
+ return response, metadata
485
+
486
+ def pre_get_instance(
487
+ self,
488
+ request: spanner_instance_admin.GetInstanceRequest,
489
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
490
+ ) -> Tuple[
491
+ spanner_instance_admin.GetInstanceRequest,
492
+ Sequence[Tuple[str, Union[str, bytes]]],
493
+ ]:
494
+ """Pre-rpc interceptor for get_instance
495
+
496
+ Override in a subclass to manipulate the request or metadata
497
+ before they are sent to the InstanceAdmin server.
498
+ """
499
+ return request, metadata
500
+
501
+ def post_get_instance(
502
+ self, response: spanner_instance_admin.Instance
503
+ ) -> spanner_instance_admin.Instance:
504
+ """Post-rpc interceptor for get_instance
505
+
506
+ DEPRECATED. Please use the `post_get_instance_with_metadata`
507
+ interceptor instead.
508
+
509
+ Override in a subclass to read or manipulate the response
510
+ after it is returned by the InstanceAdmin server but before
511
+ it is returned to user code. This `post_get_instance` interceptor runs
512
+ before the `post_get_instance_with_metadata` interceptor.
513
+ """
514
+ return response
515
+
516
+ def post_get_instance_with_metadata(
517
+ self,
518
+ response: spanner_instance_admin.Instance,
519
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
520
+ ) -> Tuple[
521
+ spanner_instance_admin.Instance, Sequence[Tuple[str, Union[str, bytes]]]
522
+ ]:
523
+ """Post-rpc interceptor for get_instance
524
+
525
+ Override in a subclass to read or manipulate the response or metadata after it
526
+ is returned by the InstanceAdmin server but before it is returned to user code.
527
+
528
+ We recommend only using this `post_get_instance_with_metadata`
529
+ interceptor in new development instead of the `post_get_instance` interceptor.
530
+ When both interceptors are used, this `post_get_instance_with_metadata` interceptor runs after the
531
+ `post_get_instance` interceptor. The (possibly modified) response returned by
532
+ `post_get_instance` will be passed to
533
+ `post_get_instance_with_metadata`.
534
+ """
535
+ return response, metadata
536
+
537
+ def pre_get_instance_config(
538
+ self,
539
+ request: spanner_instance_admin.GetInstanceConfigRequest,
540
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
541
+ ) -> Tuple[
542
+ spanner_instance_admin.GetInstanceConfigRequest,
543
+ Sequence[Tuple[str, Union[str, bytes]]],
544
+ ]:
545
+ """Pre-rpc interceptor for get_instance_config
546
+
547
+ Override in a subclass to manipulate the request or metadata
548
+ before they are sent to the InstanceAdmin server.
549
+ """
550
+ return request, metadata
551
+
552
+ def post_get_instance_config(
553
+ self, response: spanner_instance_admin.InstanceConfig
554
+ ) -> spanner_instance_admin.InstanceConfig:
555
+ """Post-rpc interceptor for get_instance_config
556
+
557
+ DEPRECATED. Please use the `post_get_instance_config_with_metadata`
558
+ interceptor instead.
559
+
560
+ Override in a subclass to read or manipulate the response
561
+ after it is returned by the InstanceAdmin server but before
562
+ it is returned to user code. This `post_get_instance_config` interceptor runs
563
+ before the `post_get_instance_config_with_metadata` interceptor.
564
+ """
565
+ return response
566
+
567
+ def post_get_instance_config_with_metadata(
568
+ self,
569
+ response: spanner_instance_admin.InstanceConfig,
570
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
571
+ ) -> Tuple[
572
+ spanner_instance_admin.InstanceConfig, Sequence[Tuple[str, Union[str, bytes]]]
573
+ ]:
574
+ """Post-rpc interceptor for get_instance_config
575
+
576
+ Override in a subclass to read or manipulate the response or metadata after it
577
+ is returned by the InstanceAdmin server but before it is returned to user code.
578
+
579
+ We recommend only using this `post_get_instance_config_with_metadata`
580
+ interceptor in new development instead of the `post_get_instance_config` interceptor.
581
+ When both interceptors are used, this `post_get_instance_config_with_metadata` interceptor runs after the
582
+ `post_get_instance_config` interceptor. The (possibly modified) response returned by
583
+ `post_get_instance_config` will be passed to
584
+ `post_get_instance_config_with_metadata`.
585
+ """
586
+ return response, metadata
587
+
588
+ def pre_get_instance_partition(
589
+ self,
590
+ request: spanner_instance_admin.GetInstancePartitionRequest,
591
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
592
+ ) -> Tuple[
593
+ spanner_instance_admin.GetInstancePartitionRequest,
594
+ Sequence[Tuple[str, Union[str, bytes]]],
595
+ ]:
596
+ """Pre-rpc interceptor for get_instance_partition
597
+
598
+ Override in a subclass to manipulate the request or metadata
599
+ before they are sent to the InstanceAdmin server.
600
+ """
601
+ return request, metadata
602
+
603
+ def post_get_instance_partition(
604
+ self, response: spanner_instance_admin.InstancePartition
605
+ ) -> spanner_instance_admin.InstancePartition:
606
+ """Post-rpc interceptor for get_instance_partition
607
+
608
+ DEPRECATED. Please use the `post_get_instance_partition_with_metadata`
609
+ interceptor instead.
610
+
611
+ Override in a subclass to read or manipulate the response
612
+ after it is returned by the InstanceAdmin server but before
613
+ it is returned to user code. This `post_get_instance_partition` interceptor runs
614
+ before the `post_get_instance_partition_with_metadata` interceptor.
615
+ """
616
+ return response
617
+
618
+ def post_get_instance_partition_with_metadata(
619
+ self,
620
+ response: spanner_instance_admin.InstancePartition,
621
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
622
+ ) -> Tuple[
623
+ spanner_instance_admin.InstancePartition,
624
+ Sequence[Tuple[str, Union[str, bytes]]],
625
+ ]:
626
+ """Post-rpc interceptor for get_instance_partition
627
+
628
+ Override in a subclass to read or manipulate the response or metadata after it
629
+ is returned by the InstanceAdmin server but before it is returned to user code.
630
+
631
+ We recommend only using this `post_get_instance_partition_with_metadata`
632
+ interceptor in new development instead of the `post_get_instance_partition` interceptor.
633
+ When both interceptors are used, this `post_get_instance_partition_with_metadata` interceptor runs after the
634
+ `post_get_instance_partition` interceptor. The (possibly modified) response returned by
635
+ `post_get_instance_partition` will be passed to
636
+ `post_get_instance_partition_with_metadata`.
637
+ """
638
+ return response, metadata
639
+
640
+ def pre_list_instance_config_operations(
641
+ self,
642
+ request: spanner_instance_admin.ListInstanceConfigOperationsRequest,
643
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
644
+ ) -> Tuple[
645
+ spanner_instance_admin.ListInstanceConfigOperationsRequest,
646
+ Sequence[Tuple[str, Union[str, bytes]]],
647
+ ]:
648
+ """Pre-rpc interceptor for list_instance_config_operations
649
+
650
+ Override in a subclass to manipulate the request or metadata
651
+ before they are sent to the InstanceAdmin server.
652
+ """
653
+ return request, metadata
654
+
655
+ def post_list_instance_config_operations(
656
+ self, response: spanner_instance_admin.ListInstanceConfigOperationsResponse
657
+ ) -> spanner_instance_admin.ListInstanceConfigOperationsResponse:
658
+ """Post-rpc interceptor for list_instance_config_operations
659
+
660
+ DEPRECATED. Please use the `post_list_instance_config_operations_with_metadata`
661
+ interceptor instead.
662
+
663
+ Override in a subclass to read or manipulate the response
664
+ after it is returned by the InstanceAdmin server but before
665
+ it is returned to user code. This `post_list_instance_config_operations` interceptor runs
666
+ before the `post_list_instance_config_operations_with_metadata` interceptor.
667
+ """
668
+ return response
669
+
670
+ def post_list_instance_config_operations_with_metadata(
671
+ self,
672
+ response: spanner_instance_admin.ListInstanceConfigOperationsResponse,
673
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
674
+ ) -> Tuple[
675
+ spanner_instance_admin.ListInstanceConfigOperationsResponse,
676
+ Sequence[Tuple[str, Union[str, bytes]]],
677
+ ]:
678
+ """Post-rpc interceptor for list_instance_config_operations
679
+
680
+ Override in a subclass to read or manipulate the response or metadata after it
681
+ is returned by the InstanceAdmin server but before it is returned to user code.
682
+
683
+ We recommend only using this `post_list_instance_config_operations_with_metadata`
684
+ interceptor in new development instead of the `post_list_instance_config_operations` interceptor.
685
+ When both interceptors are used, this `post_list_instance_config_operations_with_metadata` interceptor runs after the
686
+ `post_list_instance_config_operations` interceptor. The (possibly modified) response returned by
687
+ `post_list_instance_config_operations` will be passed to
688
+ `post_list_instance_config_operations_with_metadata`.
689
+ """
690
+ return response, metadata
691
+
692
+ def pre_list_instance_configs(
693
+ self,
694
+ request: spanner_instance_admin.ListInstanceConfigsRequest,
695
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
696
+ ) -> Tuple[
697
+ spanner_instance_admin.ListInstanceConfigsRequest,
698
+ Sequence[Tuple[str, Union[str, bytes]]],
699
+ ]:
700
+ """Pre-rpc interceptor for list_instance_configs
701
+
702
+ Override in a subclass to manipulate the request or metadata
703
+ before they are sent to the InstanceAdmin server.
704
+ """
705
+ return request, metadata
706
+
707
+ def post_list_instance_configs(
708
+ self, response: spanner_instance_admin.ListInstanceConfigsResponse
709
+ ) -> spanner_instance_admin.ListInstanceConfigsResponse:
710
+ """Post-rpc interceptor for list_instance_configs
711
+
712
+ DEPRECATED. Please use the `post_list_instance_configs_with_metadata`
713
+ interceptor instead.
714
+
715
+ Override in a subclass to read or manipulate the response
716
+ after it is returned by the InstanceAdmin server but before
717
+ it is returned to user code. This `post_list_instance_configs` interceptor runs
718
+ before the `post_list_instance_configs_with_metadata` interceptor.
719
+ """
720
+ return response
721
+
722
+ def post_list_instance_configs_with_metadata(
723
+ self,
724
+ response: spanner_instance_admin.ListInstanceConfigsResponse,
725
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
726
+ ) -> Tuple[
727
+ spanner_instance_admin.ListInstanceConfigsResponse,
728
+ Sequence[Tuple[str, Union[str, bytes]]],
729
+ ]:
730
+ """Post-rpc interceptor for list_instance_configs
731
+
732
+ Override in a subclass to read or manipulate the response or metadata after it
733
+ is returned by the InstanceAdmin server but before it is returned to user code.
734
+
735
+ We recommend only using this `post_list_instance_configs_with_metadata`
736
+ interceptor in new development instead of the `post_list_instance_configs` interceptor.
737
+ When both interceptors are used, this `post_list_instance_configs_with_metadata` interceptor runs after the
738
+ `post_list_instance_configs` interceptor. The (possibly modified) response returned by
739
+ `post_list_instance_configs` will be passed to
740
+ `post_list_instance_configs_with_metadata`.
741
+ """
742
+ return response, metadata
743
+
744
+ def pre_list_instance_partition_operations(
745
+ self,
746
+ request: spanner_instance_admin.ListInstancePartitionOperationsRequest,
747
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
748
+ ) -> Tuple[
749
+ spanner_instance_admin.ListInstancePartitionOperationsRequest,
750
+ Sequence[Tuple[str, Union[str, bytes]]],
751
+ ]:
752
+ """Pre-rpc interceptor for list_instance_partition_operations
753
+
754
+ Override in a subclass to manipulate the request or metadata
755
+ before they are sent to the InstanceAdmin server.
756
+ """
757
+ return request, metadata
758
+
759
+ def post_list_instance_partition_operations(
760
+ self, response: spanner_instance_admin.ListInstancePartitionOperationsResponse
761
+ ) -> spanner_instance_admin.ListInstancePartitionOperationsResponse:
762
+ """Post-rpc interceptor for list_instance_partition_operations
763
+
764
+ DEPRECATED. Please use the `post_list_instance_partition_operations_with_metadata`
765
+ interceptor instead.
766
+
767
+ Override in a subclass to read or manipulate the response
768
+ after it is returned by the InstanceAdmin server but before
769
+ it is returned to user code. This `post_list_instance_partition_operations` interceptor runs
770
+ before the `post_list_instance_partition_operations_with_metadata` interceptor.
771
+ """
772
+ return response
773
+
774
+ def post_list_instance_partition_operations_with_metadata(
775
+ self,
776
+ response: spanner_instance_admin.ListInstancePartitionOperationsResponse,
777
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
778
+ ) -> Tuple[
779
+ spanner_instance_admin.ListInstancePartitionOperationsResponse,
780
+ Sequence[Tuple[str, Union[str, bytes]]],
781
+ ]:
782
+ """Post-rpc interceptor for list_instance_partition_operations
783
+
784
+ Override in a subclass to read or manipulate the response or metadata after it
785
+ is returned by the InstanceAdmin server but before it is returned to user code.
786
+
787
+ We recommend only using this `post_list_instance_partition_operations_with_metadata`
788
+ interceptor in new development instead of the `post_list_instance_partition_operations` interceptor.
789
+ When both interceptors are used, this `post_list_instance_partition_operations_with_metadata` interceptor runs after the
790
+ `post_list_instance_partition_operations` interceptor. The (possibly modified) response returned by
791
+ `post_list_instance_partition_operations` will be passed to
792
+ `post_list_instance_partition_operations_with_metadata`.
793
+ """
794
+ return response, metadata
795
+
796
+ def pre_list_instance_partitions(
797
+ self,
798
+ request: spanner_instance_admin.ListInstancePartitionsRequest,
799
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
800
+ ) -> Tuple[
801
+ spanner_instance_admin.ListInstancePartitionsRequest,
802
+ Sequence[Tuple[str, Union[str, bytes]]],
803
+ ]:
804
+ """Pre-rpc interceptor for list_instance_partitions
805
+
806
+ Override in a subclass to manipulate the request or metadata
807
+ before they are sent to the InstanceAdmin server.
808
+ """
809
+ return request, metadata
810
+
811
+ def post_list_instance_partitions(
812
+ self, response: spanner_instance_admin.ListInstancePartitionsResponse
813
+ ) -> spanner_instance_admin.ListInstancePartitionsResponse:
814
+ """Post-rpc interceptor for list_instance_partitions
815
+
816
+ DEPRECATED. Please use the `post_list_instance_partitions_with_metadata`
817
+ interceptor instead.
818
+
819
+ Override in a subclass to read or manipulate the response
820
+ after it is returned by the InstanceAdmin server but before
821
+ it is returned to user code. This `post_list_instance_partitions` interceptor runs
822
+ before the `post_list_instance_partitions_with_metadata` interceptor.
823
+ """
824
+ return response
825
+
826
+ def post_list_instance_partitions_with_metadata(
827
+ self,
828
+ response: spanner_instance_admin.ListInstancePartitionsResponse,
829
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
830
+ ) -> Tuple[
831
+ spanner_instance_admin.ListInstancePartitionsResponse,
832
+ Sequence[Tuple[str, Union[str, bytes]]],
833
+ ]:
834
+ """Post-rpc interceptor for list_instance_partitions
835
+
836
+ Override in a subclass to read or manipulate the response or metadata after it
837
+ is returned by the InstanceAdmin server but before it is returned to user code.
838
+
839
+ We recommend only using this `post_list_instance_partitions_with_metadata`
840
+ interceptor in new development instead of the `post_list_instance_partitions` interceptor.
841
+ When both interceptors are used, this `post_list_instance_partitions_with_metadata` interceptor runs after the
842
+ `post_list_instance_partitions` interceptor. The (possibly modified) response returned by
843
+ `post_list_instance_partitions` will be passed to
844
+ `post_list_instance_partitions_with_metadata`.
845
+ """
846
+ return response, metadata
847
+
848
+ def pre_list_instances(
849
+ self,
850
+ request: spanner_instance_admin.ListInstancesRequest,
851
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
852
+ ) -> Tuple[
853
+ spanner_instance_admin.ListInstancesRequest,
854
+ Sequence[Tuple[str, Union[str, bytes]]],
855
+ ]:
856
+ """Pre-rpc interceptor for list_instances
857
+
858
+ Override in a subclass to manipulate the request or metadata
859
+ before they are sent to the InstanceAdmin server.
860
+ """
861
+ return request, metadata
862
+
863
+ def post_list_instances(
864
+ self, response: spanner_instance_admin.ListInstancesResponse
865
+ ) -> spanner_instance_admin.ListInstancesResponse:
866
+ """Post-rpc interceptor for list_instances
867
+
868
+ DEPRECATED. Please use the `post_list_instances_with_metadata`
869
+ interceptor instead.
870
+
871
+ Override in a subclass to read or manipulate the response
872
+ after it is returned by the InstanceAdmin server but before
873
+ it is returned to user code. This `post_list_instances` interceptor runs
874
+ before the `post_list_instances_with_metadata` interceptor.
875
+ """
876
+ return response
877
+
878
+ def post_list_instances_with_metadata(
879
+ self,
880
+ response: spanner_instance_admin.ListInstancesResponse,
881
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
882
+ ) -> Tuple[
883
+ spanner_instance_admin.ListInstancesResponse,
884
+ Sequence[Tuple[str, Union[str, bytes]]],
885
+ ]:
886
+ """Post-rpc interceptor for list_instances
887
+
888
+ Override in a subclass to read or manipulate the response or metadata after it
889
+ is returned by the InstanceAdmin server but before it is returned to user code.
890
+
891
+ We recommend only using this `post_list_instances_with_metadata`
892
+ interceptor in new development instead of the `post_list_instances` interceptor.
893
+ When both interceptors are used, this `post_list_instances_with_metadata` interceptor runs after the
894
+ `post_list_instances` interceptor. The (possibly modified) response returned by
895
+ `post_list_instances` will be passed to
896
+ `post_list_instances_with_metadata`.
897
+ """
898
+ return response, metadata
899
+
900
+ def pre_move_instance(
901
+ self,
902
+ request: spanner_instance_admin.MoveInstanceRequest,
903
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
904
+ ) -> Tuple[
905
+ spanner_instance_admin.MoveInstanceRequest,
906
+ Sequence[Tuple[str, Union[str, bytes]]],
907
+ ]:
908
+ """Pre-rpc interceptor for move_instance
909
+
910
+ Override in a subclass to manipulate the request or metadata
911
+ before they are sent to the InstanceAdmin server.
912
+ """
913
+ return request, metadata
914
+
915
+ def post_move_instance(
916
+ self, response: operations_pb2.Operation
917
+ ) -> operations_pb2.Operation:
918
+ """Post-rpc interceptor for move_instance
919
+
920
+ DEPRECATED. Please use the `post_move_instance_with_metadata`
921
+ interceptor instead.
922
+
923
+ Override in a subclass to read or manipulate the response
924
+ after it is returned by the InstanceAdmin server but before
925
+ it is returned to user code. This `post_move_instance` interceptor runs
926
+ before the `post_move_instance_with_metadata` interceptor.
927
+ """
928
+ return response
929
+
930
+ def post_move_instance_with_metadata(
931
+ self,
932
+ response: operations_pb2.Operation,
933
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
934
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
935
+ """Post-rpc interceptor for move_instance
936
+
937
+ Override in a subclass to read or manipulate the response or metadata after it
938
+ is returned by the InstanceAdmin server but before it is returned to user code.
939
+
940
+ We recommend only using this `post_move_instance_with_metadata`
941
+ interceptor in new development instead of the `post_move_instance` interceptor.
942
+ When both interceptors are used, this `post_move_instance_with_metadata` interceptor runs after the
943
+ `post_move_instance` interceptor. The (possibly modified) response returned by
944
+ `post_move_instance` will be passed to
945
+ `post_move_instance_with_metadata`.
946
+ """
947
+ return response, metadata
948
+
949
+ def pre_set_iam_policy(
950
+ self,
951
+ request: iam_policy_pb2.SetIamPolicyRequest,
952
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
953
+ ) -> Tuple[
954
+ iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]
955
+ ]:
956
+ """Pre-rpc interceptor for set_iam_policy
957
+
958
+ Override in a subclass to manipulate the request or metadata
959
+ before they are sent to the InstanceAdmin server.
960
+ """
961
+ return request, metadata
962
+
963
+ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy:
964
+ """Post-rpc interceptor for set_iam_policy
965
+
966
+ DEPRECATED. Please use the `post_set_iam_policy_with_metadata`
967
+ interceptor instead.
968
+
969
+ Override in a subclass to read or manipulate the response
970
+ after it is returned by the InstanceAdmin server but before
971
+ it is returned to user code. This `post_set_iam_policy` interceptor runs
972
+ before the `post_set_iam_policy_with_metadata` interceptor.
973
+ """
974
+ return response
975
+
976
+ def post_set_iam_policy_with_metadata(
977
+ self,
978
+ response: policy_pb2.Policy,
979
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
980
+ ) -> Tuple[policy_pb2.Policy, Sequence[Tuple[str, Union[str, bytes]]]]:
981
+ """Post-rpc interceptor for set_iam_policy
982
+
983
+ Override in a subclass to read or manipulate the response or metadata after it
984
+ is returned by the InstanceAdmin server but before it is returned to user code.
985
+
986
+ We recommend only using this `post_set_iam_policy_with_metadata`
987
+ interceptor in new development instead of the `post_set_iam_policy` interceptor.
988
+ When both interceptors are used, this `post_set_iam_policy_with_metadata` interceptor runs after the
989
+ `post_set_iam_policy` interceptor. The (possibly modified) response returned by
990
+ `post_set_iam_policy` will be passed to
991
+ `post_set_iam_policy_with_metadata`.
992
+ """
993
+ return response, metadata
994
+
995
+ def pre_test_iam_permissions(
996
+ self,
997
+ request: iam_policy_pb2.TestIamPermissionsRequest,
998
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
999
+ ) -> Tuple[
1000
+ iam_policy_pb2.TestIamPermissionsRequest,
1001
+ Sequence[Tuple[str, Union[str, bytes]]],
1002
+ ]:
1003
+ """Pre-rpc interceptor for test_iam_permissions
1004
+
1005
+ Override in a subclass to manipulate the request or metadata
1006
+ before they are sent to the InstanceAdmin server.
1007
+ """
1008
+ return request, metadata
1009
+
1010
+ def post_test_iam_permissions(
1011
+ self, response: iam_policy_pb2.TestIamPermissionsResponse
1012
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
1013
+ """Post-rpc interceptor for test_iam_permissions
1014
+
1015
+ DEPRECATED. Please use the `post_test_iam_permissions_with_metadata`
1016
+ interceptor instead.
1017
+
1018
+ Override in a subclass to read or manipulate the response
1019
+ after it is returned by the InstanceAdmin server but before
1020
+ it is returned to user code. This `post_test_iam_permissions` interceptor runs
1021
+ before the `post_test_iam_permissions_with_metadata` interceptor.
1022
+ """
1023
+ return response
1024
+
1025
+ def post_test_iam_permissions_with_metadata(
1026
+ self,
1027
+ response: iam_policy_pb2.TestIamPermissionsResponse,
1028
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
1029
+ ) -> Tuple[
1030
+ iam_policy_pb2.TestIamPermissionsResponse,
1031
+ Sequence[Tuple[str, Union[str, bytes]]],
1032
+ ]:
1033
+ """Post-rpc interceptor for test_iam_permissions
1034
+
1035
+ Override in a subclass to read or manipulate the response or metadata after it
1036
+ is returned by the InstanceAdmin server but before it is returned to user code.
1037
+
1038
+ We recommend only using this `post_test_iam_permissions_with_metadata`
1039
+ interceptor in new development instead of the `post_test_iam_permissions` interceptor.
1040
+ When both interceptors are used, this `post_test_iam_permissions_with_metadata` interceptor runs after the
1041
+ `post_test_iam_permissions` interceptor. The (possibly modified) response returned by
1042
+ `post_test_iam_permissions` will be passed to
1043
+ `post_test_iam_permissions_with_metadata`.
1044
+ """
1045
+ return response, metadata
1046
+
1047
+ def pre_update_instance(
1048
+ self,
1049
+ request: spanner_instance_admin.UpdateInstanceRequest,
1050
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
1051
+ ) -> Tuple[
1052
+ spanner_instance_admin.UpdateInstanceRequest,
1053
+ Sequence[Tuple[str, Union[str, bytes]]],
1054
+ ]:
1055
+ """Pre-rpc interceptor for update_instance
1056
+
1057
+ Override in a subclass to manipulate the request or metadata
1058
+ before they are sent to the InstanceAdmin server.
1059
+ """
1060
+ return request, metadata
1061
+
1062
+ def post_update_instance(
1063
+ self, response: operations_pb2.Operation
1064
+ ) -> operations_pb2.Operation:
1065
+ """Post-rpc interceptor for update_instance
1066
+
1067
+ DEPRECATED. Please use the `post_update_instance_with_metadata`
1068
+ interceptor instead.
1069
+
1070
+ Override in a subclass to read or manipulate the response
1071
+ after it is returned by the InstanceAdmin server but before
1072
+ it is returned to user code. This `post_update_instance` interceptor runs
1073
+ before the `post_update_instance_with_metadata` interceptor.
1074
+ """
1075
+ return response
1076
+
1077
+ def post_update_instance_with_metadata(
1078
+ self,
1079
+ response: operations_pb2.Operation,
1080
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
1081
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
1082
+ """Post-rpc interceptor for update_instance
1083
+
1084
+ Override in a subclass to read or manipulate the response or metadata after it
1085
+ is returned by the InstanceAdmin server but before it is returned to user code.
1086
+
1087
+ We recommend only using this `post_update_instance_with_metadata`
1088
+ interceptor in new development instead of the `post_update_instance` interceptor.
1089
+ When both interceptors are used, this `post_update_instance_with_metadata` interceptor runs after the
1090
+ `post_update_instance` interceptor. The (possibly modified) response returned by
1091
+ `post_update_instance` will be passed to
1092
+ `post_update_instance_with_metadata`.
1093
+ """
1094
+ return response, metadata
1095
+
1096
+ def pre_update_instance_config(
1097
+ self,
1098
+ request: spanner_instance_admin.UpdateInstanceConfigRequest,
1099
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
1100
+ ) -> Tuple[
1101
+ spanner_instance_admin.UpdateInstanceConfigRequest,
1102
+ Sequence[Tuple[str, Union[str, bytes]]],
1103
+ ]:
1104
+ """Pre-rpc interceptor for update_instance_config
1105
+
1106
+ Override in a subclass to manipulate the request or metadata
1107
+ before they are sent to the InstanceAdmin server.
1108
+ """
1109
+ return request, metadata
1110
+
1111
+ def post_update_instance_config(
1112
+ self, response: operations_pb2.Operation
1113
+ ) -> operations_pb2.Operation:
1114
+ """Post-rpc interceptor for update_instance_config
1115
+
1116
+ DEPRECATED. Please use the `post_update_instance_config_with_metadata`
1117
+ interceptor instead.
1118
+
1119
+ Override in a subclass to read or manipulate the response
1120
+ after it is returned by the InstanceAdmin server but before
1121
+ it is returned to user code. This `post_update_instance_config` interceptor runs
1122
+ before the `post_update_instance_config_with_metadata` interceptor.
1123
+ """
1124
+ return response
1125
+
1126
+ def post_update_instance_config_with_metadata(
1127
+ self,
1128
+ response: operations_pb2.Operation,
1129
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
1130
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
1131
+ """Post-rpc interceptor for update_instance_config
1132
+
1133
+ Override in a subclass to read or manipulate the response or metadata after it
1134
+ is returned by the InstanceAdmin server but before it is returned to user code.
1135
+
1136
+ We recommend only using this `post_update_instance_config_with_metadata`
1137
+ interceptor in new development instead of the `post_update_instance_config` interceptor.
1138
+ When both interceptors are used, this `post_update_instance_config_with_metadata` interceptor runs after the
1139
+ `post_update_instance_config` interceptor. The (possibly modified) response returned by
1140
+ `post_update_instance_config` will be passed to
1141
+ `post_update_instance_config_with_metadata`.
1142
+ """
1143
+ return response, metadata
1144
+
1145
+ def pre_update_instance_partition(
1146
+ self,
1147
+ request: spanner_instance_admin.UpdateInstancePartitionRequest,
1148
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
1149
+ ) -> Tuple[
1150
+ spanner_instance_admin.UpdateInstancePartitionRequest,
1151
+ Sequence[Tuple[str, Union[str, bytes]]],
1152
+ ]:
1153
+ """Pre-rpc interceptor for update_instance_partition
1154
+
1155
+ Override in a subclass to manipulate the request or metadata
1156
+ before they are sent to the InstanceAdmin server.
1157
+ """
1158
+ return request, metadata
1159
+
1160
+ def post_update_instance_partition(
1161
+ self, response: operations_pb2.Operation
1162
+ ) -> operations_pb2.Operation:
1163
+ """Post-rpc interceptor for update_instance_partition
1164
+
1165
+ DEPRECATED. Please use the `post_update_instance_partition_with_metadata`
1166
+ interceptor instead.
1167
+
1168
+ Override in a subclass to read or manipulate the response
1169
+ after it is returned by the InstanceAdmin server but before
1170
+ it is returned to user code. This `post_update_instance_partition` interceptor runs
1171
+ before the `post_update_instance_partition_with_metadata` interceptor.
1172
+ """
1173
+ return response
1174
+
1175
+ def post_update_instance_partition_with_metadata(
1176
+ self,
1177
+ response: operations_pb2.Operation,
1178
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
1179
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
1180
+ """Post-rpc interceptor for update_instance_partition
1181
+
1182
+ Override in a subclass to read or manipulate the response or metadata after it
1183
+ is returned by the InstanceAdmin server but before it is returned to user code.
1184
+
1185
+ We recommend only using this `post_update_instance_partition_with_metadata`
1186
+ interceptor in new development instead of the `post_update_instance_partition` interceptor.
1187
+ When both interceptors are used, this `post_update_instance_partition_with_metadata` interceptor runs after the
1188
+ `post_update_instance_partition` interceptor. The (possibly modified) response returned by
1189
+ `post_update_instance_partition` will be passed to
1190
+ `post_update_instance_partition_with_metadata`.
1191
+ """
1192
+ return response, metadata
1193
+
1194
+
1195
+ @dataclasses.dataclass
1196
+ class InstanceAdminRestStub:
1197
+ _session: AuthorizedSession
1198
+ _host: str
1199
+ _interceptor: InstanceAdminRestInterceptor
1200
+
1201
+
1202
+ class InstanceAdminRestTransport(_BaseInstanceAdminRestTransport):
1203
+ """REST backend synchronous transport for InstanceAdmin.
1204
+
1205
+ Cloud Spanner Instance Admin API
1206
+
1207
+ The Cloud Spanner Instance Admin API can be used to create,
1208
+ delete, modify and list instances. Instances are dedicated Cloud
1209
+ Spanner serving and storage resources to be used by Cloud
1210
+ Spanner databases.
1211
+
1212
+ Each instance has a "configuration", which dictates where the
1213
+ serving resources for the Cloud Spanner instance are located
1214
+ (e.g., US-central, Europe). Configurations are created by Google
1215
+ based on resource availability.
1216
+
1217
+ Cloud Spanner billing is based on the instances that exist and
1218
+ their sizes. After an instance exists, there are no additional
1219
+ per-database or per-operation charges for use of the instance
1220
+ (though there may be additional network bandwidth charges).
1221
+ Instances offer isolation: problems with databases in one
1222
+ instance will not affect other instances. However, within an
1223
+ instance databases can affect each other. For example, if one
1224
+ database in an instance receives a lot of requests and consumes
1225
+ most of the instance resources, fewer resources are available
1226
+ for other databases in that instance, and their performance may
1227
+ suffer.
1228
+
1229
+ This class defines the same methods as the primary client, so the
1230
+ primary client can load the underlying transport implementation
1231
+ and call it.
1232
+
1233
+ It sends JSON representations of protocol buffers over HTTP/1.1
1234
+ """
1235
+
1236
+ def __init__(
1237
+ self,
1238
+ *,
1239
+ host: str = "spanner.googleapis.com",
1240
+ credentials: Optional[ga_credentials.Credentials] = None,
1241
+ credentials_file: Optional[str] = None,
1242
+ scopes: Optional[Sequence[str]] = None,
1243
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
1244
+ quota_project_id: Optional[str] = None,
1245
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
1246
+ always_use_jwt_access: Optional[bool] = False,
1247
+ url_scheme: str = "https",
1248
+ interceptor: Optional[InstanceAdminRestInterceptor] = None,
1249
+ api_audience: Optional[str] = None,
1250
+ ) -> None:
1251
+ """Instantiate the transport.
1252
+
1253
+ Args:
1254
+ host (Optional[str]):
1255
+ The hostname to connect to (default: 'spanner.googleapis.com').
1256
+ credentials (Optional[google.auth.credentials.Credentials]): The
1257
+ authorization credentials to attach to requests. These
1258
+ credentials identify the application to the service; if none
1259
+ are specified, the client will attempt to ascertain the
1260
+ credentials from the environment.
1261
+
1262
+ credentials_file (Optional[str]): A file with credentials that can
1263
+ be loaded with :func:`google.auth.load_credentials_from_file`.
1264
+ This argument is ignored if ``channel`` is provided.
1265
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
1266
+ ignored if ``channel`` is provided.
1267
+ client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client
1268
+ certificate to configure mutual TLS HTTP channel. It is ignored
1269
+ if ``channel`` is provided.
1270
+ quota_project_id (Optional[str]): An optional project to use for billing
1271
+ and quota.
1272
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
1273
+ The client info used to send a user-agent string along with
1274
+ API requests. If ``None``, then default info will be used.
1275
+ Generally, you only need to set this if you are developing
1276
+ your own client library.
1277
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
1278
+ be used for service account credentials.
1279
+ url_scheme: the protocol scheme for the API endpoint. Normally
1280
+ "https", but for testing or local servers,
1281
+ "http" can be specified.
1282
+ """
1283
+ # Run the base constructor
1284
+ # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc.
1285
+ # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the
1286
+ # credentials object
1287
+ super().__init__(
1288
+ host=host,
1289
+ credentials=credentials,
1290
+ client_info=client_info,
1291
+ always_use_jwt_access=always_use_jwt_access,
1292
+ url_scheme=url_scheme,
1293
+ api_audience=api_audience,
1294
+ )
1295
+ self._session = AuthorizedSession(
1296
+ self._credentials, default_host=self.DEFAULT_HOST
1297
+ )
1298
+ self._operations_client: Optional[operations_v1.AbstractOperationsClient] = None
1299
+ if client_cert_source_for_mtls:
1300
+ self._session.configure_mtls_channel(client_cert_source_for_mtls)
1301
+ self._interceptor = interceptor or InstanceAdminRestInterceptor()
1302
+ self._prep_wrapped_messages(client_info)
1303
+
1304
+ @property
1305
+ def operations_client(self) -> operations_v1.AbstractOperationsClient:
1306
+ """Create the client designed to process long-running operations.
1307
+
1308
+ This property caches on the instance; repeated calls return the same
1309
+ client.
1310
+ """
1311
+ # Only create a new client if we do not already have one.
1312
+ if self._operations_client is None:
1313
+ http_options: Dict[str, List[Dict[str, str]]] = {
1314
+ "google.longrunning.Operations.GetOperation": [
1315
+ {
1316
+ "method": "get",
1317
+ "uri": "/v1/{name=projects/*/instances/*/databases/*/operations/*}",
1318
+ },
1319
+ {
1320
+ "method": "get",
1321
+ "uri": "/v1/{name=projects/*/instances/*/operations/*}",
1322
+ },
1323
+ ],
1324
+ "google.longrunning.Operations.ListOperations": [
1325
+ {
1326
+ "method": "get",
1327
+ "uri": "/v1/{name=projects/*/instances/*/databases/*/operations}",
1328
+ },
1329
+ {
1330
+ "method": "get",
1331
+ "uri": "/v1/{name=projects/*/instances/*/operations}",
1332
+ },
1333
+ ],
1334
+ "google.longrunning.Operations.CancelOperation": [
1335
+ {
1336
+ "method": "post",
1337
+ "uri": "/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel",
1338
+ },
1339
+ {
1340
+ "method": "post",
1341
+ "uri": "/v1/{name=projects/*/instances/*/operations/*}:cancel",
1342
+ },
1343
+ ],
1344
+ "google.longrunning.Operations.DeleteOperation": [
1345
+ {
1346
+ "method": "delete",
1347
+ "uri": "/v1/{name=projects/*/instances/*/databases/*/operations/*}",
1348
+ },
1349
+ {
1350
+ "method": "delete",
1351
+ "uri": "/v1/{name=projects/*/instances/*/operations/*}",
1352
+ },
1353
+ ],
1354
+ }
1355
+
1356
+ rest_transport = operations_v1.OperationsRestTransport(
1357
+ host=self._host,
1358
+ # use the credentials which are saved
1359
+ credentials=self._credentials,
1360
+ scopes=self._scopes,
1361
+ http_options=http_options,
1362
+ path_prefix="v1",
1363
+ )
1364
+
1365
+ self._operations_client = operations_v1.AbstractOperationsClient(
1366
+ transport=rest_transport
1367
+ )
1368
+
1369
+ # Return the client from cache.
1370
+ return self._operations_client
1371
+
1372
+ class _CreateInstance(
1373
+ _BaseInstanceAdminRestTransport._BaseCreateInstance, InstanceAdminRestStub
1374
+ ):
1375
+ def __hash__(self):
1376
+ return hash("InstanceAdminRestTransport.CreateInstance")
1377
+
1378
+ @staticmethod
1379
+ def _get_response(
1380
+ host,
1381
+ metadata,
1382
+ query_params,
1383
+ session,
1384
+ timeout,
1385
+ transcoded_request,
1386
+ body=None,
1387
+ ):
1388
+ uri = transcoded_request["uri"]
1389
+ method = transcoded_request["method"]
1390
+ headers = dict(metadata)
1391
+ headers["Content-Type"] = "application/json"
1392
+ response = getattr(session, method)(
1393
+ "{host}{uri}".format(host=host, uri=uri),
1394
+ timeout=timeout,
1395
+ headers=headers,
1396
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1397
+ data=body,
1398
+ )
1399
+ return response
1400
+
1401
+ def __call__(
1402
+ self,
1403
+ request: spanner_instance_admin.CreateInstanceRequest,
1404
+ *,
1405
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1406
+ timeout: Optional[float] = None,
1407
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1408
+ ) -> operations_pb2.Operation:
1409
+ r"""Call the create instance method over HTTP.
1410
+
1411
+ Args:
1412
+ request (~.spanner_instance_admin.CreateInstanceRequest):
1413
+ The request object. The request for
1414
+ [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance].
1415
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1416
+ should be retried.
1417
+ timeout (float): The timeout for this request.
1418
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1419
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1420
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1421
+ be of type `bytes`.
1422
+
1423
+ Returns:
1424
+ ~.operations_pb2.Operation:
1425
+ This resource represents a
1426
+ long-running operation that is the
1427
+ result of a network API call.
1428
+
1429
+ """
1430
+
1431
+ http_options = (
1432
+ _BaseInstanceAdminRestTransport._BaseCreateInstance._get_http_options()
1433
+ )
1434
+
1435
+ request, metadata = self._interceptor.pre_create_instance(request, metadata)
1436
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseCreateInstance._get_transcoded_request(
1437
+ http_options, request
1438
+ )
1439
+
1440
+ body = _BaseInstanceAdminRestTransport._BaseCreateInstance._get_request_body_json(
1441
+ transcoded_request
1442
+ )
1443
+
1444
+ # Jsonify the query params
1445
+ query_params = _BaseInstanceAdminRestTransport._BaseCreateInstance._get_query_params_json(
1446
+ transcoded_request
1447
+ )
1448
+
1449
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1450
+ logging.DEBUG
1451
+ ): # pragma: NO COVER
1452
+ request_url = "{host}{uri}".format(
1453
+ host=self._host, uri=transcoded_request["uri"]
1454
+ )
1455
+ method = transcoded_request["method"]
1456
+ try:
1457
+ request_payload = json_format.MessageToJson(request)
1458
+ except:
1459
+ request_payload = None
1460
+ http_request = {
1461
+ "payload": request_payload,
1462
+ "requestMethod": method,
1463
+ "requestUrl": request_url,
1464
+ "headers": dict(metadata),
1465
+ }
1466
+ _LOGGER.debug(
1467
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.CreateInstance",
1468
+ extra={
1469
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
1470
+ "rpcName": "CreateInstance",
1471
+ "httpRequest": http_request,
1472
+ "metadata": http_request["headers"],
1473
+ },
1474
+ )
1475
+
1476
+ # Send the request
1477
+ response = InstanceAdminRestTransport._CreateInstance._get_response(
1478
+ self._host,
1479
+ metadata,
1480
+ query_params,
1481
+ self._session,
1482
+ timeout,
1483
+ transcoded_request,
1484
+ body,
1485
+ )
1486
+
1487
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1488
+ # subclass.
1489
+ if response.status_code >= 400:
1490
+ raise core_exceptions.from_http_response(response)
1491
+
1492
+ # Return the response
1493
+ resp = operations_pb2.Operation()
1494
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
1495
+
1496
+ resp = self._interceptor.post_create_instance(resp)
1497
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
1498
+ resp, _ = self._interceptor.post_create_instance_with_metadata(
1499
+ resp, response_metadata
1500
+ )
1501
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1502
+ logging.DEBUG
1503
+ ): # pragma: NO COVER
1504
+ try:
1505
+ response_payload = json_format.MessageToJson(resp)
1506
+ except:
1507
+ response_payload = None
1508
+ http_response = {
1509
+ "payload": response_payload,
1510
+ "headers": dict(response.headers),
1511
+ "status": response.status_code,
1512
+ }
1513
+ _LOGGER.debug(
1514
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.create_instance",
1515
+ extra={
1516
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
1517
+ "rpcName": "CreateInstance",
1518
+ "metadata": http_response["headers"],
1519
+ "httpResponse": http_response,
1520
+ },
1521
+ )
1522
+ return resp
1523
+
1524
+ class _CreateInstanceConfig(
1525
+ _BaseInstanceAdminRestTransport._BaseCreateInstanceConfig, InstanceAdminRestStub
1526
+ ):
1527
+ def __hash__(self):
1528
+ return hash("InstanceAdminRestTransport.CreateInstanceConfig")
1529
+
1530
+ @staticmethod
1531
+ def _get_response(
1532
+ host,
1533
+ metadata,
1534
+ query_params,
1535
+ session,
1536
+ timeout,
1537
+ transcoded_request,
1538
+ body=None,
1539
+ ):
1540
+ uri = transcoded_request["uri"]
1541
+ method = transcoded_request["method"]
1542
+ headers = dict(metadata)
1543
+ headers["Content-Type"] = "application/json"
1544
+ response = getattr(session, method)(
1545
+ "{host}{uri}".format(host=host, uri=uri),
1546
+ timeout=timeout,
1547
+ headers=headers,
1548
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1549
+ data=body,
1550
+ )
1551
+ return response
1552
+
1553
+ def __call__(
1554
+ self,
1555
+ request: spanner_instance_admin.CreateInstanceConfigRequest,
1556
+ *,
1557
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1558
+ timeout: Optional[float] = None,
1559
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1560
+ ) -> operations_pb2.Operation:
1561
+ r"""Call the create instance config method over HTTP.
1562
+
1563
+ Args:
1564
+ request (~.spanner_instance_admin.CreateInstanceConfigRequest):
1565
+ The request object. The request for
1566
+ [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig].
1567
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1568
+ should be retried.
1569
+ timeout (float): The timeout for this request.
1570
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1571
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1572
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1573
+ be of type `bytes`.
1574
+
1575
+ Returns:
1576
+ ~.operations_pb2.Operation:
1577
+ This resource represents a
1578
+ long-running operation that is the
1579
+ result of a network API call.
1580
+
1581
+ """
1582
+
1583
+ http_options = (
1584
+ _BaseInstanceAdminRestTransport._BaseCreateInstanceConfig._get_http_options()
1585
+ )
1586
+
1587
+ request, metadata = self._interceptor.pre_create_instance_config(
1588
+ request, metadata
1589
+ )
1590
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseCreateInstanceConfig._get_transcoded_request(
1591
+ http_options, request
1592
+ )
1593
+
1594
+ body = _BaseInstanceAdminRestTransport._BaseCreateInstanceConfig._get_request_body_json(
1595
+ transcoded_request
1596
+ )
1597
+
1598
+ # Jsonify the query params
1599
+ query_params = _BaseInstanceAdminRestTransport._BaseCreateInstanceConfig._get_query_params_json(
1600
+ transcoded_request
1601
+ )
1602
+
1603
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1604
+ logging.DEBUG
1605
+ ): # pragma: NO COVER
1606
+ request_url = "{host}{uri}".format(
1607
+ host=self._host, uri=transcoded_request["uri"]
1608
+ )
1609
+ method = transcoded_request["method"]
1610
+ try:
1611
+ request_payload = json_format.MessageToJson(request)
1612
+ except:
1613
+ request_payload = None
1614
+ http_request = {
1615
+ "payload": request_payload,
1616
+ "requestMethod": method,
1617
+ "requestUrl": request_url,
1618
+ "headers": dict(metadata),
1619
+ }
1620
+ _LOGGER.debug(
1621
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.CreateInstanceConfig",
1622
+ extra={
1623
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
1624
+ "rpcName": "CreateInstanceConfig",
1625
+ "httpRequest": http_request,
1626
+ "metadata": http_request["headers"],
1627
+ },
1628
+ )
1629
+
1630
+ # Send the request
1631
+ response = InstanceAdminRestTransport._CreateInstanceConfig._get_response(
1632
+ self._host,
1633
+ metadata,
1634
+ query_params,
1635
+ self._session,
1636
+ timeout,
1637
+ transcoded_request,
1638
+ body,
1639
+ )
1640
+
1641
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1642
+ # subclass.
1643
+ if response.status_code >= 400:
1644
+ raise core_exceptions.from_http_response(response)
1645
+
1646
+ # Return the response
1647
+ resp = operations_pb2.Operation()
1648
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
1649
+
1650
+ resp = self._interceptor.post_create_instance_config(resp)
1651
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
1652
+ resp, _ = self._interceptor.post_create_instance_config_with_metadata(
1653
+ resp, response_metadata
1654
+ )
1655
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1656
+ logging.DEBUG
1657
+ ): # pragma: NO COVER
1658
+ try:
1659
+ response_payload = json_format.MessageToJson(resp)
1660
+ except:
1661
+ response_payload = None
1662
+ http_response = {
1663
+ "payload": response_payload,
1664
+ "headers": dict(response.headers),
1665
+ "status": response.status_code,
1666
+ }
1667
+ _LOGGER.debug(
1668
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.create_instance_config",
1669
+ extra={
1670
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
1671
+ "rpcName": "CreateInstanceConfig",
1672
+ "metadata": http_response["headers"],
1673
+ "httpResponse": http_response,
1674
+ },
1675
+ )
1676
+ return resp
1677
+
1678
+ class _CreateInstancePartition(
1679
+ _BaseInstanceAdminRestTransport._BaseCreateInstancePartition,
1680
+ InstanceAdminRestStub,
1681
+ ):
1682
+ def __hash__(self):
1683
+ return hash("InstanceAdminRestTransport.CreateInstancePartition")
1684
+
1685
+ @staticmethod
1686
+ def _get_response(
1687
+ host,
1688
+ metadata,
1689
+ query_params,
1690
+ session,
1691
+ timeout,
1692
+ transcoded_request,
1693
+ body=None,
1694
+ ):
1695
+ uri = transcoded_request["uri"]
1696
+ method = transcoded_request["method"]
1697
+ headers = dict(metadata)
1698
+ headers["Content-Type"] = "application/json"
1699
+ response = getattr(session, method)(
1700
+ "{host}{uri}".format(host=host, uri=uri),
1701
+ timeout=timeout,
1702
+ headers=headers,
1703
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1704
+ data=body,
1705
+ )
1706
+ return response
1707
+
1708
+ def __call__(
1709
+ self,
1710
+ request: spanner_instance_admin.CreateInstancePartitionRequest,
1711
+ *,
1712
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1713
+ timeout: Optional[float] = None,
1714
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1715
+ ) -> operations_pb2.Operation:
1716
+ r"""Call the create instance partition method over HTTP.
1717
+
1718
+ Args:
1719
+ request (~.spanner_instance_admin.CreateInstancePartitionRequest):
1720
+ The request object. The request for
1721
+ [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition].
1722
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1723
+ should be retried.
1724
+ timeout (float): The timeout for this request.
1725
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1726
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1727
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1728
+ be of type `bytes`.
1729
+
1730
+ Returns:
1731
+ ~.operations_pb2.Operation:
1732
+ This resource represents a
1733
+ long-running operation that is the
1734
+ result of a network API call.
1735
+
1736
+ """
1737
+
1738
+ http_options = (
1739
+ _BaseInstanceAdminRestTransport._BaseCreateInstancePartition._get_http_options()
1740
+ )
1741
+
1742
+ request, metadata = self._interceptor.pre_create_instance_partition(
1743
+ request, metadata
1744
+ )
1745
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseCreateInstancePartition._get_transcoded_request(
1746
+ http_options, request
1747
+ )
1748
+
1749
+ body = _BaseInstanceAdminRestTransport._BaseCreateInstancePartition._get_request_body_json(
1750
+ transcoded_request
1751
+ )
1752
+
1753
+ # Jsonify the query params
1754
+ query_params = _BaseInstanceAdminRestTransport._BaseCreateInstancePartition._get_query_params_json(
1755
+ transcoded_request
1756
+ )
1757
+
1758
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1759
+ logging.DEBUG
1760
+ ): # pragma: NO COVER
1761
+ request_url = "{host}{uri}".format(
1762
+ host=self._host, uri=transcoded_request["uri"]
1763
+ )
1764
+ method = transcoded_request["method"]
1765
+ try:
1766
+ request_payload = json_format.MessageToJson(request)
1767
+ except:
1768
+ request_payload = None
1769
+ http_request = {
1770
+ "payload": request_payload,
1771
+ "requestMethod": method,
1772
+ "requestUrl": request_url,
1773
+ "headers": dict(metadata),
1774
+ }
1775
+ _LOGGER.debug(
1776
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.CreateInstancePartition",
1777
+ extra={
1778
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
1779
+ "rpcName": "CreateInstancePartition",
1780
+ "httpRequest": http_request,
1781
+ "metadata": http_request["headers"],
1782
+ },
1783
+ )
1784
+
1785
+ # Send the request
1786
+ response = (
1787
+ InstanceAdminRestTransport._CreateInstancePartition._get_response(
1788
+ self._host,
1789
+ metadata,
1790
+ query_params,
1791
+ self._session,
1792
+ timeout,
1793
+ transcoded_request,
1794
+ body,
1795
+ )
1796
+ )
1797
+
1798
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1799
+ # subclass.
1800
+ if response.status_code >= 400:
1801
+ raise core_exceptions.from_http_response(response)
1802
+
1803
+ # Return the response
1804
+ resp = operations_pb2.Operation()
1805
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
1806
+
1807
+ resp = self._interceptor.post_create_instance_partition(resp)
1808
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
1809
+ resp, _ = self._interceptor.post_create_instance_partition_with_metadata(
1810
+ resp, response_metadata
1811
+ )
1812
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1813
+ logging.DEBUG
1814
+ ): # pragma: NO COVER
1815
+ try:
1816
+ response_payload = json_format.MessageToJson(resp)
1817
+ except:
1818
+ response_payload = None
1819
+ http_response = {
1820
+ "payload": response_payload,
1821
+ "headers": dict(response.headers),
1822
+ "status": response.status_code,
1823
+ }
1824
+ _LOGGER.debug(
1825
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.create_instance_partition",
1826
+ extra={
1827
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
1828
+ "rpcName": "CreateInstancePartition",
1829
+ "metadata": http_response["headers"],
1830
+ "httpResponse": http_response,
1831
+ },
1832
+ )
1833
+ return resp
1834
+
1835
+ class _DeleteInstance(
1836
+ _BaseInstanceAdminRestTransport._BaseDeleteInstance, InstanceAdminRestStub
1837
+ ):
1838
+ def __hash__(self):
1839
+ return hash("InstanceAdminRestTransport.DeleteInstance")
1840
+
1841
+ @staticmethod
1842
+ def _get_response(
1843
+ host,
1844
+ metadata,
1845
+ query_params,
1846
+ session,
1847
+ timeout,
1848
+ transcoded_request,
1849
+ body=None,
1850
+ ):
1851
+ uri = transcoded_request["uri"]
1852
+ method = transcoded_request["method"]
1853
+ headers = dict(metadata)
1854
+ headers["Content-Type"] = "application/json"
1855
+ response = getattr(session, method)(
1856
+ "{host}{uri}".format(host=host, uri=uri),
1857
+ timeout=timeout,
1858
+ headers=headers,
1859
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1860
+ )
1861
+ return response
1862
+
1863
+ def __call__(
1864
+ self,
1865
+ request: spanner_instance_admin.DeleteInstanceRequest,
1866
+ *,
1867
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1868
+ timeout: Optional[float] = None,
1869
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1870
+ ):
1871
+ r"""Call the delete instance method over HTTP.
1872
+
1873
+ Args:
1874
+ request (~.spanner_instance_admin.DeleteInstanceRequest):
1875
+ The request object. The request for
1876
+ [DeleteInstance][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstance].
1877
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1878
+ should be retried.
1879
+ timeout (float): The timeout for this request.
1880
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1881
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1882
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1883
+ be of type `bytes`.
1884
+ """
1885
+
1886
+ http_options = (
1887
+ _BaseInstanceAdminRestTransport._BaseDeleteInstance._get_http_options()
1888
+ )
1889
+
1890
+ request, metadata = self._interceptor.pre_delete_instance(request, metadata)
1891
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseDeleteInstance._get_transcoded_request(
1892
+ http_options, request
1893
+ )
1894
+
1895
+ # Jsonify the query params
1896
+ query_params = _BaseInstanceAdminRestTransport._BaseDeleteInstance._get_query_params_json(
1897
+ transcoded_request
1898
+ )
1899
+
1900
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1901
+ logging.DEBUG
1902
+ ): # pragma: NO COVER
1903
+ request_url = "{host}{uri}".format(
1904
+ host=self._host, uri=transcoded_request["uri"]
1905
+ )
1906
+ method = transcoded_request["method"]
1907
+ try:
1908
+ request_payload = json_format.MessageToJson(request)
1909
+ except:
1910
+ request_payload = None
1911
+ http_request = {
1912
+ "payload": request_payload,
1913
+ "requestMethod": method,
1914
+ "requestUrl": request_url,
1915
+ "headers": dict(metadata),
1916
+ }
1917
+ _LOGGER.debug(
1918
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.DeleteInstance",
1919
+ extra={
1920
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
1921
+ "rpcName": "DeleteInstance",
1922
+ "httpRequest": http_request,
1923
+ "metadata": http_request["headers"],
1924
+ },
1925
+ )
1926
+
1927
+ # Send the request
1928
+ response = InstanceAdminRestTransport._DeleteInstance._get_response(
1929
+ self._host,
1930
+ metadata,
1931
+ query_params,
1932
+ self._session,
1933
+ timeout,
1934
+ transcoded_request,
1935
+ )
1936
+
1937
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1938
+ # subclass.
1939
+ if response.status_code >= 400:
1940
+ raise core_exceptions.from_http_response(response)
1941
+
1942
+ class _DeleteInstanceConfig(
1943
+ _BaseInstanceAdminRestTransport._BaseDeleteInstanceConfig, InstanceAdminRestStub
1944
+ ):
1945
+ def __hash__(self):
1946
+ return hash("InstanceAdminRestTransport.DeleteInstanceConfig")
1947
+
1948
+ @staticmethod
1949
+ def _get_response(
1950
+ host,
1951
+ metadata,
1952
+ query_params,
1953
+ session,
1954
+ timeout,
1955
+ transcoded_request,
1956
+ body=None,
1957
+ ):
1958
+ uri = transcoded_request["uri"]
1959
+ method = transcoded_request["method"]
1960
+ headers = dict(metadata)
1961
+ headers["Content-Type"] = "application/json"
1962
+ response = getattr(session, method)(
1963
+ "{host}{uri}".format(host=host, uri=uri),
1964
+ timeout=timeout,
1965
+ headers=headers,
1966
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1967
+ )
1968
+ return response
1969
+
1970
+ def __call__(
1971
+ self,
1972
+ request: spanner_instance_admin.DeleteInstanceConfigRequest,
1973
+ *,
1974
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1975
+ timeout: Optional[float] = None,
1976
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1977
+ ):
1978
+ r"""Call the delete instance config method over HTTP.
1979
+
1980
+ Args:
1981
+ request (~.spanner_instance_admin.DeleteInstanceConfigRequest):
1982
+ The request object. The request for
1983
+ [DeleteInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstanceConfig].
1984
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1985
+ should be retried.
1986
+ timeout (float): The timeout for this request.
1987
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1988
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1989
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1990
+ be of type `bytes`.
1991
+ """
1992
+
1993
+ http_options = (
1994
+ _BaseInstanceAdminRestTransport._BaseDeleteInstanceConfig._get_http_options()
1995
+ )
1996
+
1997
+ request, metadata = self._interceptor.pre_delete_instance_config(
1998
+ request, metadata
1999
+ )
2000
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseDeleteInstanceConfig._get_transcoded_request(
2001
+ http_options, request
2002
+ )
2003
+
2004
+ # Jsonify the query params
2005
+ query_params = _BaseInstanceAdminRestTransport._BaseDeleteInstanceConfig._get_query_params_json(
2006
+ transcoded_request
2007
+ )
2008
+
2009
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2010
+ logging.DEBUG
2011
+ ): # pragma: NO COVER
2012
+ request_url = "{host}{uri}".format(
2013
+ host=self._host, uri=transcoded_request["uri"]
2014
+ )
2015
+ method = transcoded_request["method"]
2016
+ try:
2017
+ request_payload = json_format.MessageToJson(request)
2018
+ except:
2019
+ request_payload = None
2020
+ http_request = {
2021
+ "payload": request_payload,
2022
+ "requestMethod": method,
2023
+ "requestUrl": request_url,
2024
+ "headers": dict(metadata),
2025
+ }
2026
+ _LOGGER.debug(
2027
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.DeleteInstanceConfig",
2028
+ extra={
2029
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
2030
+ "rpcName": "DeleteInstanceConfig",
2031
+ "httpRequest": http_request,
2032
+ "metadata": http_request["headers"],
2033
+ },
2034
+ )
2035
+
2036
+ # Send the request
2037
+ response = InstanceAdminRestTransport._DeleteInstanceConfig._get_response(
2038
+ self._host,
2039
+ metadata,
2040
+ query_params,
2041
+ self._session,
2042
+ timeout,
2043
+ transcoded_request,
2044
+ )
2045
+
2046
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
2047
+ # subclass.
2048
+ if response.status_code >= 400:
2049
+ raise core_exceptions.from_http_response(response)
2050
+
2051
+ class _DeleteInstancePartition(
2052
+ _BaseInstanceAdminRestTransport._BaseDeleteInstancePartition,
2053
+ InstanceAdminRestStub,
2054
+ ):
2055
+ def __hash__(self):
2056
+ return hash("InstanceAdminRestTransport.DeleteInstancePartition")
2057
+
2058
+ @staticmethod
2059
+ def _get_response(
2060
+ host,
2061
+ metadata,
2062
+ query_params,
2063
+ session,
2064
+ timeout,
2065
+ transcoded_request,
2066
+ body=None,
2067
+ ):
2068
+ uri = transcoded_request["uri"]
2069
+ method = transcoded_request["method"]
2070
+ headers = dict(metadata)
2071
+ headers["Content-Type"] = "application/json"
2072
+ response = getattr(session, method)(
2073
+ "{host}{uri}".format(host=host, uri=uri),
2074
+ timeout=timeout,
2075
+ headers=headers,
2076
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
2077
+ )
2078
+ return response
2079
+
2080
+ def __call__(
2081
+ self,
2082
+ request: spanner_instance_admin.DeleteInstancePartitionRequest,
2083
+ *,
2084
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2085
+ timeout: Optional[float] = None,
2086
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2087
+ ):
2088
+ r"""Call the delete instance partition method over HTTP.
2089
+
2090
+ Args:
2091
+ request (~.spanner_instance_admin.DeleteInstancePartitionRequest):
2092
+ The request object. The request for
2093
+ [DeleteInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstancePartition].
2094
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2095
+ should be retried.
2096
+ timeout (float): The timeout for this request.
2097
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2098
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2099
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2100
+ be of type `bytes`.
2101
+ """
2102
+
2103
+ http_options = (
2104
+ _BaseInstanceAdminRestTransport._BaseDeleteInstancePartition._get_http_options()
2105
+ )
2106
+
2107
+ request, metadata = self._interceptor.pre_delete_instance_partition(
2108
+ request, metadata
2109
+ )
2110
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseDeleteInstancePartition._get_transcoded_request(
2111
+ http_options, request
2112
+ )
2113
+
2114
+ # Jsonify the query params
2115
+ query_params = _BaseInstanceAdminRestTransport._BaseDeleteInstancePartition._get_query_params_json(
2116
+ transcoded_request
2117
+ )
2118
+
2119
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2120
+ logging.DEBUG
2121
+ ): # pragma: NO COVER
2122
+ request_url = "{host}{uri}".format(
2123
+ host=self._host, uri=transcoded_request["uri"]
2124
+ )
2125
+ method = transcoded_request["method"]
2126
+ try:
2127
+ request_payload = json_format.MessageToJson(request)
2128
+ except:
2129
+ request_payload = None
2130
+ http_request = {
2131
+ "payload": request_payload,
2132
+ "requestMethod": method,
2133
+ "requestUrl": request_url,
2134
+ "headers": dict(metadata),
2135
+ }
2136
+ _LOGGER.debug(
2137
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.DeleteInstancePartition",
2138
+ extra={
2139
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
2140
+ "rpcName": "DeleteInstancePartition",
2141
+ "httpRequest": http_request,
2142
+ "metadata": http_request["headers"],
2143
+ },
2144
+ )
2145
+
2146
+ # Send the request
2147
+ response = (
2148
+ InstanceAdminRestTransport._DeleteInstancePartition._get_response(
2149
+ self._host,
2150
+ metadata,
2151
+ query_params,
2152
+ self._session,
2153
+ timeout,
2154
+ transcoded_request,
2155
+ )
2156
+ )
2157
+
2158
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
2159
+ # subclass.
2160
+ if response.status_code >= 400:
2161
+ raise core_exceptions.from_http_response(response)
2162
+
2163
+ class _GetIamPolicy(
2164
+ _BaseInstanceAdminRestTransport._BaseGetIamPolicy, InstanceAdminRestStub
2165
+ ):
2166
+ def __hash__(self):
2167
+ return hash("InstanceAdminRestTransport.GetIamPolicy")
2168
+
2169
+ @staticmethod
2170
+ def _get_response(
2171
+ host,
2172
+ metadata,
2173
+ query_params,
2174
+ session,
2175
+ timeout,
2176
+ transcoded_request,
2177
+ body=None,
2178
+ ):
2179
+ uri = transcoded_request["uri"]
2180
+ method = transcoded_request["method"]
2181
+ headers = dict(metadata)
2182
+ headers["Content-Type"] = "application/json"
2183
+ response = getattr(session, method)(
2184
+ "{host}{uri}".format(host=host, uri=uri),
2185
+ timeout=timeout,
2186
+ headers=headers,
2187
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
2188
+ data=body,
2189
+ )
2190
+ return response
2191
+
2192
+ def __call__(
2193
+ self,
2194
+ request: iam_policy_pb2.GetIamPolicyRequest,
2195
+ *,
2196
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2197
+ timeout: Optional[float] = None,
2198
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2199
+ ) -> policy_pb2.Policy:
2200
+ r"""Call the get iam policy method over HTTP.
2201
+
2202
+ Args:
2203
+ request (~.iam_policy_pb2.GetIamPolicyRequest):
2204
+ The request object. Request message for ``GetIamPolicy`` method.
2205
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2206
+ should be retried.
2207
+ timeout (float): The timeout for this request.
2208
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2209
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2210
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2211
+ be of type `bytes`.
2212
+
2213
+ Returns:
2214
+ ~.policy_pb2.Policy:
2215
+ An Identity and Access Management (IAM) policy, which
2216
+ specifies access controls for Google Cloud resources.
2217
+
2218
+ A ``Policy`` is a collection of ``bindings``. A
2219
+ ``binding`` binds one or more ``members``, or
2220
+ principals, to a single ``role``. Principals can be user
2221
+ accounts, service accounts, Google groups, and domains
2222
+ (such as G Suite). A ``role`` is a named list of
2223
+ permissions; each ``role`` can be an IAM predefined role
2224
+ or a user-created custom role.
2225
+
2226
+ For some types of Google Cloud resources, a ``binding``
2227
+ can also specify a ``condition``, which is a logical
2228
+ expression that allows access to a resource only if the
2229
+ expression evaluates to ``true``. A condition can add
2230
+ constraints based on attributes of the request, the
2231
+ resource, or both. To learn which resources support
2232
+ conditions in their IAM policies, see the `IAM
2233
+ documentation <https://cloud.google.com/iam/help/conditions/resource-policies>`__.
2234
+
2235
+ **JSON example:**
2236
+
2237
+ ::
2238
+
2239
+ {
2240
+ "bindings": [
2241
+ {
2242
+ "role": "roles/resourcemanager.organizationAdmin",
2243
+ "members": [
2244
+ "user:mike@example.com",
2245
+ "group:admins@example.com",
2246
+ "domain:google.com",
2247
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
2248
+ ]
2249
+ },
2250
+ {
2251
+ "role": "roles/resourcemanager.organizationViewer",
2252
+ "members": [
2253
+ "user:eve@example.com"
2254
+ ],
2255
+ "condition": {
2256
+ "title": "expirable access",
2257
+ "description": "Does not grant access after Sep 2020",
2258
+ "expression": "request.time <
2259
+ timestamp('2020-10-01T00:00:00.000Z')",
2260
+ }
2261
+ }
2262
+ ],
2263
+ "etag": "BwWWja0YfJA=",
2264
+ "version": 3
2265
+ }
2266
+
2267
+ **YAML example:**
2268
+
2269
+ ::
2270
+
2271
+ bindings:
2272
+ - members:
2273
+ - user:mike@example.com
2274
+ - group:admins@example.com
2275
+ - domain:google.com
2276
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
2277
+ role: roles/resourcemanager.organizationAdmin
2278
+ - members:
2279
+ - user:eve@example.com
2280
+ role: roles/resourcemanager.organizationViewer
2281
+ condition:
2282
+ title: expirable access
2283
+ description: Does not grant access after Sep 2020
2284
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
2285
+ etag: BwWWja0YfJA=
2286
+ version: 3
2287
+
2288
+ For a description of IAM and its features, see the `IAM
2289
+ documentation <https://cloud.google.com/iam/docs/>`__.
2290
+
2291
+ """
2292
+
2293
+ http_options = (
2294
+ _BaseInstanceAdminRestTransport._BaseGetIamPolicy._get_http_options()
2295
+ )
2296
+
2297
+ request, metadata = self._interceptor.pre_get_iam_policy(request, metadata)
2298
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseGetIamPolicy._get_transcoded_request(
2299
+ http_options, request
2300
+ )
2301
+
2302
+ body = _BaseInstanceAdminRestTransport._BaseGetIamPolicy._get_request_body_json(
2303
+ transcoded_request
2304
+ )
2305
+
2306
+ # Jsonify the query params
2307
+ query_params = _BaseInstanceAdminRestTransport._BaseGetIamPolicy._get_query_params_json(
2308
+ transcoded_request
2309
+ )
2310
+
2311
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2312
+ logging.DEBUG
2313
+ ): # pragma: NO COVER
2314
+ request_url = "{host}{uri}".format(
2315
+ host=self._host, uri=transcoded_request["uri"]
2316
+ )
2317
+ method = transcoded_request["method"]
2318
+ try:
2319
+ request_payload = json_format.MessageToJson(request)
2320
+ except:
2321
+ request_payload = None
2322
+ http_request = {
2323
+ "payload": request_payload,
2324
+ "requestMethod": method,
2325
+ "requestUrl": request_url,
2326
+ "headers": dict(metadata),
2327
+ }
2328
+ _LOGGER.debug(
2329
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.GetIamPolicy",
2330
+ extra={
2331
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
2332
+ "rpcName": "GetIamPolicy",
2333
+ "httpRequest": http_request,
2334
+ "metadata": http_request["headers"],
2335
+ },
2336
+ )
2337
+
2338
+ # Send the request
2339
+ response = InstanceAdminRestTransport._GetIamPolicy._get_response(
2340
+ self._host,
2341
+ metadata,
2342
+ query_params,
2343
+ self._session,
2344
+ timeout,
2345
+ transcoded_request,
2346
+ body,
2347
+ )
2348
+
2349
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
2350
+ # subclass.
2351
+ if response.status_code >= 400:
2352
+ raise core_exceptions.from_http_response(response)
2353
+
2354
+ # Return the response
2355
+ resp = policy_pb2.Policy()
2356
+ pb_resp = resp
2357
+
2358
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
2359
+
2360
+ resp = self._interceptor.post_get_iam_policy(resp)
2361
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
2362
+ resp, _ = self._interceptor.post_get_iam_policy_with_metadata(
2363
+ resp, response_metadata
2364
+ )
2365
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2366
+ logging.DEBUG
2367
+ ): # pragma: NO COVER
2368
+ try:
2369
+ response_payload = json_format.MessageToJson(resp)
2370
+ except:
2371
+ response_payload = None
2372
+ http_response = {
2373
+ "payload": response_payload,
2374
+ "headers": dict(response.headers),
2375
+ "status": response.status_code,
2376
+ }
2377
+ _LOGGER.debug(
2378
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.get_iam_policy",
2379
+ extra={
2380
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
2381
+ "rpcName": "GetIamPolicy",
2382
+ "metadata": http_response["headers"],
2383
+ "httpResponse": http_response,
2384
+ },
2385
+ )
2386
+ return resp
2387
+
2388
+ class _GetInstance(
2389
+ _BaseInstanceAdminRestTransport._BaseGetInstance, InstanceAdminRestStub
2390
+ ):
2391
+ def __hash__(self):
2392
+ return hash("InstanceAdminRestTransport.GetInstance")
2393
+
2394
+ @staticmethod
2395
+ def _get_response(
2396
+ host,
2397
+ metadata,
2398
+ query_params,
2399
+ session,
2400
+ timeout,
2401
+ transcoded_request,
2402
+ body=None,
2403
+ ):
2404
+ uri = transcoded_request["uri"]
2405
+ method = transcoded_request["method"]
2406
+ headers = dict(metadata)
2407
+ headers["Content-Type"] = "application/json"
2408
+ response = getattr(session, method)(
2409
+ "{host}{uri}".format(host=host, uri=uri),
2410
+ timeout=timeout,
2411
+ headers=headers,
2412
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
2413
+ )
2414
+ return response
2415
+
2416
+ def __call__(
2417
+ self,
2418
+ request: spanner_instance_admin.GetInstanceRequest,
2419
+ *,
2420
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2421
+ timeout: Optional[float] = None,
2422
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2423
+ ) -> spanner_instance_admin.Instance:
2424
+ r"""Call the get instance method over HTTP.
2425
+
2426
+ Args:
2427
+ request (~.spanner_instance_admin.GetInstanceRequest):
2428
+ The request object. The request for
2429
+ [GetInstance][google.spanner.admin.instance.v1.InstanceAdmin.GetInstance].
2430
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2431
+ should be retried.
2432
+ timeout (float): The timeout for this request.
2433
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2434
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2435
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2436
+ be of type `bytes`.
2437
+
2438
+ Returns:
2439
+ ~.spanner_instance_admin.Instance:
2440
+ An isolated set of Cloud Spanner
2441
+ resources on which databases can be
2442
+ hosted.
2443
+
2444
+ """
2445
+
2446
+ http_options = (
2447
+ _BaseInstanceAdminRestTransport._BaseGetInstance._get_http_options()
2448
+ )
2449
+
2450
+ request, metadata = self._interceptor.pre_get_instance(request, metadata)
2451
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseGetInstance._get_transcoded_request(
2452
+ http_options, request
2453
+ )
2454
+
2455
+ # Jsonify the query params
2456
+ query_params = (
2457
+ _BaseInstanceAdminRestTransport._BaseGetInstance._get_query_params_json(
2458
+ transcoded_request
2459
+ )
2460
+ )
2461
+
2462
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2463
+ logging.DEBUG
2464
+ ): # pragma: NO COVER
2465
+ request_url = "{host}{uri}".format(
2466
+ host=self._host, uri=transcoded_request["uri"]
2467
+ )
2468
+ method = transcoded_request["method"]
2469
+ try:
2470
+ request_payload = type(request).to_json(request)
2471
+ except:
2472
+ request_payload = None
2473
+ http_request = {
2474
+ "payload": request_payload,
2475
+ "requestMethod": method,
2476
+ "requestUrl": request_url,
2477
+ "headers": dict(metadata),
2478
+ }
2479
+ _LOGGER.debug(
2480
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.GetInstance",
2481
+ extra={
2482
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
2483
+ "rpcName": "GetInstance",
2484
+ "httpRequest": http_request,
2485
+ "metadata": http_request["headers"],
2486
+ },
2487
+ )
2488
+
2489
+ # Send the request
2490
+ response = InstanceAdminRestTransport._GetInstance._get_response(
2491
+ self._host,
2492
+ metadata,
2493
+ query_params,
2494
+ self._session,
2495
+ timeout,
2496
+ transcoded_request,
2497
+ )
2498
+
2499
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
2500
+ # subclass.
2501
+ if response.status_code >= 400:
2502
+ raise core_exceptions.from_http_response(response)
2503
+
2504
+ # Return the response
2505
+ resp = spanner_instance_admin.Instance()
2506
+ pb_resp = spanner_instance_admin.Instance.pb(resp)
2507
+
2508
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
2509
+
2510
+ resp = self._interceptor.post_get_instance(resp)
2511
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
2512
+ resp, _ = self._interceptor.post_get_instance_with_metadata(
2513
+ resp, response_metadata
2514
+ )
2515
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2516
+ logging.DEBUG
2517
+ ): # pragma: NO COVER
2518
+ try:
2519
+ response_payload = spanner_instance_admin.Instance.to_json(response)
2520
+ except:
2521
+ response_payload = None
2522
+ http_response = {
2523
+ "payload": response_payload,
2524
+ "headers": dict(response.headers),
2525
+ "status": response.status_code,
2526
+ }
2527
+ _LOGGER.debug(
2528
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.get_instance",
2529
+ extra={
2530
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
2531
+ "rpcName": "GetInstance",
2532
+ "metadata": http_response["headers"],
2533
+ "httpResponse": http_response,
2534
+ },
2535
+ )
2536
+ return resp
2537
+
2538
+ class _GetInstanceConfig(
2539
+ _BaseInstanceAdminRestTransport._BaseGetInstanceConfig, InstanceAdminRestStub
2540
+ ):
2541
+ def __hash__(self):
2542
+ return hash("InstanceAdminRestTransport.GetInstanceConfig")
2543
+
2544
+ @staticmethod
2545
+ def _get_response(
2546
+ host,
2547
+ metadata,
2548
+ query_params,
2549
+ session,
2550
+ timeout,
2551
+ transcoded_request,
2552
+ body=None,
2553
+ ):
2554
+ uri = transcoded_request["uri"]
2555
+ method = transcoded_request["method"]
2556
+ headers = dict(metadata)
2557
+ headers["Content-Type"] = "application/json"
2558
+ response = getattr(session, method)(
2559
+ "{host}{uri}".format(host=host, uri=uri),
2560
+ timeout=timeout,
2561
+ headers=headers,
2562
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
2563
+ )
2564
+ return response
2565
+
2566
+ def __call__(
2567
+ self,
2568
+ request: spanner_instance_admin.GetInstanceConfigRequest,
2569
+ *,
2570
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2571
+ timeout: Optional[float] = None,
2572
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2573
+ ) -> spanner_instance_admin.InstanceConfig:
2574
+ r"""Call the get instance config method over HTTP.
2575
+
2576
+ Args:
2577
+ request (~.spanner_instance_admin.GetInstanceConfigRequest):
2578
+ The request object. The request for
2579
+ [GetInstanceConfigRequest][google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig].
2580
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2581
+ should be retried.
2582
+ timeout (float): The timeout for this request.
2583
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2584
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2585
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2586
+ be of type `bytes`.
2587
+
2588
+ Returns:
2589
+ ~.spanner_instance_admin.InstanceConfig:
2590
+ A possible configuration for a Cloud
2591
+ Spanner instance. Configurations define
2592
+ the geographic placement of nodes and
2593
+ their replication.
2594
+
2595
+ """
2596
+
2597
+ http_options = (
2598
+ _BaseInstanceAdminRestTransport._BaseGetInstanceConfig._get_http_options()
2599
+ )
2600
+
2601
+ request, metadata = self._interceptor.pre_get_instance_config(
2602
+ request, metadata
2603
+ )
2604
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseGetInstanceConfig._get_transcoded_request(
2605
+ http_options, request
2606
+ )
2607
+
2608
+ # Jsonify the query params
2609
+ query_params = _BaseInstanceAdminRestTransport._BaseGetInstanceConfig._get_query_params_json(
2610
+ transcoded_request
2611
+ )
2612
+
2613
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2614
+ logging.DEBUG
2615
+ ): # pragma: NO COVER
2616
+ request_url = "{host}{uri}".format(
2617
+ host=self._host, uri=transcoded_request["uri"]
2618
+ )
2619
+ method = transcoded_request["method"]
2620
+ try:
2621
+ request_payload = type(request).to_json(request)
2622
+ except:
2623
+ request_payload = None
2624
+ http_request = {
2625
+ "payload": request_payload,
2626
+ "requestMethod": method,
2627
+ "requestUrl": request_url,
2628
+ "headers": dict(metadata),
2629
+ }
2630
+ _LOGGER.debug(
2631
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.GetInstanceConfig",
2632
+ extra={
2633
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
2634
+ "rpcName": "GetInstanceConfig",
2635
+ "httpRequest": http_request,
2636
+ "metadata": http_request["headers"],
2637
+ },
2638
+ )
2639
+
2640
+ # Send the request
2641
+ response = InstanceAdminRestTransport._GetInstanceConfig._get_response(
2642
+ self._host,
2643
+ metadata,
2644
+ query_params,
2645
+ self._session,
2646
+ timeout,
2647
+ transcoded_request,
2648
+ )
2649
+
2650
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
2651
+ # subclass.
2652
+ if response.status_code >= 400:
2653
+ raise core_exceptions.from_http_response(response)
2654
+
2655
+ # Return the response
2656
+ resp = spanner_instance_admin.InstanceConfig()
2657
+ pb_resp = spanner_instance_admin.InstanceConfig.pb(resp)
2658
+
2659
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
2660
+
2661
+ resp = self._interceptor.post_get_instance_config(resp)
2662
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
2663
+ resp, _ = self._interceptor.post_get_instance_config_with_metadata(
2664
+ resp, response_metadata
2665
+ )
2666
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2667
+ logging.DEBUG
2668
+ ): # pragma: NO COVER
2669
+ try:
2670
+ response_payload = spanner_instance_admin.InstanceConfig.to_json(
2671
+ response
2672
+ )
2673
+ except:
2674
+ response_payload = None
2675
+ http_response = {
2676
+ "payload": response_payload,
2677
+ "headers": dict(response.headers),
2678
+ "status": response.status_code,
2679
+ }
2680
+ _LOGGER.debug(
2681
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.get_instance_config",
2682
+ extra={
2683
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
2684
+ "rpcName": "GetInstanceConfig",
2685
+ "metadata": http_response["headers"],
2686
+ "httpResponse": http_response,
2687
+ },
2688
+ )
2689
+ return resp
2690
+
2691
+ class _GetInstancePartition(
2692
+ _BaseInstanceAdminRestTransport._BaseGetInstancePartition, InstanceAdminRestStub
2693
+ ):
2694
+ def __hash__(self):
2695
+ return hash("InstanceAdminRestTransport.GetInstancePartition")
2696
+
2697
+ @staticmethod
2698
+ def _get_response(
2699
+ host,
2700
+ metadata,
2701
+ query_params,
2702
+ session,
2703
+ timeout,
2704
+ transcoded_request,
2705
+ body=None,
2706
+ ):
2707
+ uri = transcoded_request["uri"]
2708
+ method = transcoded_request["method"]
2709
+ headers = dict(metadata)
2710
+ headers["Content-Type"] = "application/json"
2711
+ response = getattr(session, method)(
2712
+ "{host}{uri}".format(host=host, uri=uri),
2713
+ timeout=timeout,
2714
+ headers=headers,
2715
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
2716
+ )
2717
+ return response
2718
+
2719
+ def __call__(
2720
+ self,
2721
+ request: spanner_instance_admin.GetInstancePartitionRequest,
2722
+ *,
2723
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2724
+ timeout: Optional[float] = None,
2725
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2726
+ ) -> spanner_instance_admin.InstancePartition:
2727
+ r"""Call the get instance partition method over HTTP.
2728
+
2729
+ Args:
2730
+ request (~.spanner_instance_admin.GetInstancePartitionRequest):
2731
+ The request object. The request for
2732
+ [GetInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.GetInstancePartition].
2733
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2734
+ should be retried.
2735
+ timeout (float): The timeout for this request.
2736
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2737
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2738
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2739
+ be of type `bytes`.
2740
+
2741
+ Returns:
2742
+ ~.spanner_instance_admin.InstancePartition:
2743
+ An isolated set of Cloud Spanner
2744
+ resources that databases can define
2745
+ placements on.
2746
+
2747
+ """
2748
+
2749
+ http_options = (
2750
+ _BaseInstanceAdminRestTransport._BaseGetInstancePartition._get_http_options()
2751
+ )
2752
+
2753
+ request, metadata = self._interceptor.pre_get_instance_partition(
2754
+ request, metadata
2755
+ )
2756
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseGetInstancePartition._get_transcoded_request(
2757
+ http_options, request
2758
+ )
2759
+
2760
+ # Jsonify the query params
2761
+ query_params = _BaseInstanceAdminRestTransport._BaseGetInstancePartition._get_query_params_json(
2762
+ transcoded_request
2763
+ )
2764
+
2765
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2766
+ logging.DEBUG
2767
+ ): # pragma: NO COVER
2768
+ request_url = "{host}{uri}".format(
2769
+ host=self._host, uri=transcoded_request["uri"]
2770
+ )
2771
+ method = transcoded_request["method"]
2772
+ try:
2773
+ request_payload = type(request).to_json(request)
2774
+ except:
2775
+ request_payload = None
2776
+ http_request = {
2777
+ "payload": request_payload,
2778
+ "requestMethod": method,
2779
+ "requestUrl": request_url,
2780
+ "headers": dict(metadata),
2781
+ }
2782
+ _LOGGER.debug(
2783
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.GetInstancePartition",
2784
+ extra={
2785
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
2786
+ "rpcName": "GetInstancePartition",
2787
+ "httpRequest": http_request,
2788
+ "metadata": http_request["headers"],
2789
+ },
2790
+ )
2791
+
2792
+ # Send the request
2793
+ response = InstanceAdminRestTransport._GetInstancePartition._get_response(
2794
+ self._host,
2795
+ metadata,
2796
+ query_params,
2797
+ self._session,
2798
+ timeout,
2799
+ transcoded_request,
2800
+ )
2801
+
2802
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
2803
+ # subclass.
2804
+ if response.status_code >= 400:
2805
+ raise core_exceptions.from_http_response(response)
2806
+
2807
+ # Return the response
2808
+ resp = spanner_instance_admin.InstancePartition()
2809
+ pb_resp = spanner_instance_admin.InstancePartition.pb(resp)
2810
+
2811
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
2812
+
2813
+ resp = self._interceptor.post_get_instance_partition(resp)
2814
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
2815
+ resp, _ = self._interceptor.post_get_instance_partition_with_metadata(
2816
+ resp, response_metadata
2817
+ )
2818
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2819
+ logging.DEBUG
2820
+ ): # pragma: NO COVER
2821
+ try:
2822
+ response_payload = spanner_instance_admin.InstancePartition.to_json(
2823
+ response
2824
+ )
2825
+ except:
2826
+ response_payload = None
2827
+ http_response = {
2828
+ "payload": response_payload,
2829
+ "headers": dict(response.headers),
2830
+ "status": response.status_code,
2831
+ }
2832
+ _LOGGER.debug(
2833
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.get_instance_partition",
2834
+ extra={
2835
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
2836
+ "rpcName": "GetInstancePartition",
2837
+ "metadata": http_response["headers"],
2838
+ "httpResponse": http_response,
2839
+ },
2840
+ )
2841
+ return resp
2842
+
2843
+ class _ListInstanceConfigOperations(
2844
+ _BaseInstanceAdminRestTransport._BaseListInstanceConfigOperations,
2845
+ InstanceAdminRestStub,
2846
+ ):
2847
+ def __hash__(self):
2848
+ return hash("InstanceAdminRestTransport.ListInstanceConfigOperations")
2849
+
2850
+ @staticmethod
2851
+ def _get_response(
2852
+ host,
2853
+ metadata,
2854
+ query_params,
2855
+ session,
2856
+ timeout,
2857
+ transcoded_request,
2858
+ body=None,
2859
+ ):
2860
+ uri = transcoded_request["uri"]
2861
+ method = transcoded_request["method"]
2862
+ headers = dict(metadata)
2863
+ headers["Content-Type"] = "application/json"
2864
+ response = getattr(session, method)(
2865
+ "{host}{uri}".format(host=host, uri=uri),
2866
+ timeout=timeout,
2867
+ headers=headers,
2868
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
2869
+ )
2870
+ return response
2871
+
2872
+ def __call__(
2873
+ self,
2874
+ request: spanner_instance_admin.ListInstanceConfigOperationsRequest,
2875
+ *,
2876
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2877
+ timeout: Optional[float] = None,
2878
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2879
+ ) -> spanner_instance_admin.ListInstanceConfigOperationsResponse:
2880
+ r"""Call the list instance config
2881
+ operations method over HTTP.
2882
+
2883
+ Args:
2884
+ request (~.spanner_instance_admin.ListInstanceConfigOperationsRequest):
2885
+ The request object. The request for
2886
+ [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations].
2887
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2888
+ should be retried.
2889
+ timeout (float): The timeout for this request.
2890
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2891
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2892
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2893
+ be of type `bytes`.
2894
+
2895
+ Returns:
2896
+ ~.spanner_instance_admin.ListInstanceConfigOperationsResponse:
2897
+ The response for
2898
+ [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations].
2899
+
2900
+ """
2901
+
2902
+ http_options = (
2903
+ _BaseInstanceAdminRestTransport._BaseListInstanceConfigOperations._get_http_options()
2904
+ )
2905
+
2906
+ request, metadata = self._interceptor.pre_list_instance_config_operations(
2907
+ request, metadata
2908
+ )
2909
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseListInstanceConfigOperations._get_transcoded_request(
2910
+ http_options, request
2911
+ )
2912
+
2913
+ # Jsonify the query params
2914
+ query_params = _BaseInstanceAdminRestTransport._BaseListInstanceConfigOperations._get_query_params_json(
2915
+ transcoded_request
2916
+ )
2917
+
2918
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2919
+ logging.DEBUG
2920
+ ): # pragma: NO COVER
2921
+ request_url = "{host}{uri}".format(
2922
+ host=self._host, uri=transcoded_request["uri"]
2923
+ )
2924
+ method = transcoded_request["method"]
2925
+ try:
2926
+ request_payload = type(request).to_json(request)
2927
+ except:
2928
+ request_payload = None
2929
+ http_request = {
2930
+ "payload": request_payload,
2931
+ "requestMethod": method,
2932
+ "requestUrl": request_url,
2933
+ "headers": dict(metadata),
2934
+ }
2935
+ _LOGGER.debug(
2936
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.ListInstanceConfigOperations",
2937
+ extra={
2938
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
2939
+ "rpcName": "ListInstanceConfigOperations",
2940
+ "httpRequest": http_request,
2941
+ "metadata": http_request["headers"],
2942
+ },
2943
+ )
2944
+
2945
+ # Send the request
2946
+ response = (
2947
+ InstanceAdminRestTransport._ListInstanceConfigOperations._get_response(
2948
+ self._host,
2949
+ metadata,
2950
+ query_params,
2951
+ self._session,
2952
+ timeout,
2953
+ transcoded_request,
2954
+ )
2955
+ )
2956
+
2957
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
2958
+ # subclass.
2959
+ if response.status_code >= 400:
2960
+ raise core_exceptions.from_http_response(response)
2961
+
2962
+ # Return the response
2963
+ resp = spanner_instance_admin.ListInstanceConfigOperationsResponse()
2964
+ pb_resp = spanner_instance_admin.ListInstanceConfigOperationsResponse.pb(
2965
+ resp
2966
+ )
2967
+
2968
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
2969
+
2970
+ resp = self._interceptor.post_list_instance_config_operations(resp)
2971
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
2972
+ (
2973
+ resp,
2974
+ _,
2975
+ ) = self._interceptor.post_list_instance_config_operations_with_metadata(
2976
+ resp, response_metadata
2977
+ )
2978
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2979
+ logging.DEBUG
2980
+ ): # pragma: NO COVER
2981
+ try:
2982
+ response_payload = spanner_instance_admin.ListInstanceConfigOperationsResponse.to_json(
2983
+ response
2984
+ )
2985
+ except:
2986
+ response_payload = None
2987
+ http_response = {
2988
+ "payload": response_payload,
2989
+ "headers": dict(response.headers),
2990
+ "status": response.status_code,
2991
+ }
2992
+ _LOGGER.debug(
2993
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.list_instance_config_operations",
2994
+ extra={
2995
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
2996
+ "rpcName": "ListInstanceConfigOperations",
2997
+ "metadata": http_response["headers"],
2998
+ "httpResponse": http_response,
2999
+ },
3000
+ )
3001
+ return resp
3002
+
3003
+ class _ListInstanceConfigs(
3004
+ _BaseInstanceAdminRestTransport._BaseListInstanceConfigs, InstanceAdminRestStub
3005
+ ):
3006
+ def __hash__(self):
3007
+ return hash("InstanceAdminRestTransport.ListInstanceConfigs")
3008
+
3009
+ @staticmethod
3010
+ def _get_response(
3011
+ host,
3012
+ metadata,
3013
+ query_params,
3014
+ session,
3015
+ timeout,
3016
+ transcoded_request,
3017
+ body=None,
3018
+ ):
3019
+ uri = transcoded_request["uri"]
3020
+ method = transcoded_request["method"]
3021
+ headers = dict(metadata)
3022
+ headers["Content-Type"] = "application/json"
3023
+ response = getattr(session, method)(
3024
+ "{host}{uri}".format(host=host, uri=uri),
3025
+ timeout=timeout,
3026
+ headers=headers,
3027
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
3028
+ )
3029
+ return response
3030
+
3031
+ def __call__(
3032
+ self,
3033
+ request: spanner_instance_admin.ListInstanceConfigsRequest,
3034
+ *,
3035
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3036
+ timeout: Optional[float] = None,
3037
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3038
+ ) -> spanner_instance_admin.ListInstanceConfigsResponse:
3039
+ r"""Call the list instance configs method over HTTP.
3040
+
3041
+ Args:
3042
+ request (~.spanner_instance_admin.ListInstanceConfigsRequest):
3043
+ The request object. The request for
3044
+ [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
3045
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3046
+ should be retried.
3047
+ timeout (float): The timeout for this request.
3048
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3049
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3050
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3051
+ be of type `bytes`.
3052
+
3053
+ Returns:
3054
+ ~.spanner_instance_admin.ListInstanceConfigsResponse:
3055
+ The response for
3056
+ [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
3057
+
3058
+ """
3059
+
3060
+ http_options = (
3061
+ _BaseInstanceAdminRestTransport._BaseListInstanceConfigs._get_http_options()
3062
+ )
3063
+
3064
+ request, metadata = self._interceptor.pre_list_instance_configs(
3065
+ request, metadata
3066
+ )
3067
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseListInstanceConfigs._get_transcoded_request(
3068
+ http_options, request
3069
+ )
3070
+
3071
+ # Jsonify the query params
3072
+ query_params = _BaseInstanceAdminRestTransport._BaseListInstanceConfigs._get_query_params_json(
3073
+ transcoded_request
3074
+ )
3075
+
3076
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
3077
+ logging.DEBUG
3078
+ ): # pragma: NO COVER
3079
+ request_url = "{host}{uri}".format(
3080
+ host=self._host, uri=transcoded_request["uri"]
3081
+ )
3082
+ method = transcoded_request["method"]
3083
+ try:
3084
+ request_payload = type(request).to_json(request)
3085
+ except:
3086
+ request_payload = None
3087
+ http_request = {
3088
+ "payload": request_payload,
3089
+ "requestMethod": method,
3090
+ "requestUrl": request_url,
3091
+ "headers": dict(metadata),
3092
+ }
3093
+ _LOGGER.debug(
3094
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.ListInstanceConfigs",
3095
+ extra={
3096
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
3097
+ "rpcName": "ListInstanceConfigs",
3098
+ "httpRequest": http_request,
3099
+ "metadata": http_request["headers"],
3100
+ },
3101
+ )
3102
+
3103
+ # Send the request
3104
+ response = InstanceAdminRestTransport._ListInstanceConfigs._get_response(
3105
+ self._host,
3106
+ metadata,
3107
+ query_params,
3108
+ self._session,
3109
+ timeout,
3110
+ transcoded_request,
3111
+ )
3112
+
3113
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
3114
+ # subclass.
3115
+ if response.status_code >= 400:
3116
+ raise core_exceptions.from_http_response(response)
3117
+
3118
+ # Return the response
3119
+ resp = spanner_instance_admin.ListInstanceConfigsResponse()
3120
+ pb_resp = spanner_instance_admin.ListInstanceConfigsResponse.pb(resp)
3121
+
3122
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
3123
+
3124
+ resp = self._interceptor.post_list_instance_configs(resp)
3125
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
3126
+ resp, _ = self._interceptor.post_list_instance_configs_with_metadata(
3127
+ resp, response_metadata
3128
+ )
3129
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
3130
+ logging.DEBUG
3131
+ ): # pragma: NO COVER
3132
+ try:
3133
+ response_payload = (
3134
+ spanner_instance_admin.ListInstanceConfigsResponse.to_json(
3135
+ response
3136
+ )
3137
+ )
3138
+ except:
3139
+ response_payload = None
3140
+ http_response = {
3141
+ "payload": response_payload,
3142
+ "headers": dict(response.headers),
3143
+ "status": response.status_code,
3144
+ }
3145
+ _LOGGER.debug(
3146
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.list_instance_configs",
3147
+ extra={
3148
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
3149
+ "rpcName": "ListInstanceConfigs",
3150
+ "metadata": http_response["headers"],
3151
+ "httpResponse": http_response,
3152
+ },
3153
+ )
3154
+ return resp
3155
+
3156
+ class _ListInstancePartitionOperations(
3157
+ _BaseInstanceAdminRestTransport._BaseListInstancePartitionOperations,
3158
+ InstanceAdminRestStub,
3159
+ ):
3160
+ def __hash__(self):
3161
+ return hash("InstanceAdminRestTransport.ListInstancePartitionOperations")
3162
+
3163
+ @staticmethod
3164
+ def _get_response(
3165
+ host,
3166
+ metadata,
3167
+ query_params,
3168
+ session,
3169
+ timeout,
3170
+ transcoded_request,
3171
+ body=None,
3172
+ ):
3173
+ uri = transcoded_request["uri"]
3174
+ method = transcoded_request["method"]
3175
+ headers = dict(metadata)
3176
+ headers["Content-Type"] = "application/json"
3177
+ response = getattr(session, method)(
3178
+ "{host}{uri}".format(host=host, uri=uri),
3179
+ timeout=timeout,
3180
+ headers=headers,
3181
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
3182
+ )
3183
+ return response
3184
+
3185
+ def __call__(
3186
+ self,
3187
+ request: spanner_instance_admin.ListInstancePartitionOperationsRequest,
3188
+ *,
3189
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3190
+ timeout: Optional[float] = None,
3191
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3192
+ ) -> spanner_instance_admin.ListInstancePartitionOperationsResponse:
3193
+ r"""Call the list instance partition
3194
+ operations method over HTTP.
3195
+
3196
+ Args:
3197
+ request (~.spanner_instance_admin.ListInstancePartitionOperationsRequest):
3198
+ The request object. The request for
3199
+ [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations].
3200
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3201
+ should be retried.
3202
+ timeout (float): The timeout for this request.
3203
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3204
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3205
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3206
+ be of type `bytes`.
3207
+
3208
+ Returns:
3209
+ ~.spanner_instance_admin.ListInstancePartitionOperationsResponse:
3210
+ The response for
3211
+ [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations].
3212
+
3213
+ """
3214
+
3215
+ http_options = (
3216
+ _BaseInstanceAdminRestTransport._BaseListInstancePartitionOperations._get_http_options()
3217
+ )
3218
+
3219
+ (
3220
+ request,
3221
+ metadata,
3222
+ ) = self._interceptor.pre_list_instance_partition_operations(
3223
+ request, metadata
3224
+ )
3225
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseListInstancePartitionOperations._get_transcoded_request(
3226
+ http_options, request
3227
+ )
3228
+
3229
+ # Jsonify the query params
3230
+ query_params = _BaseInstanceAdminRestTransport._BaseListInstancePartitionOperations._get_query_params_json(
3231
+ transcoded_request
3232
+ )
3233
+
3234
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
3235
+ logging.DEBUG
3236
+ ): # pragma: NO COVER
3237
+ request_url = "{host}{uri}".format(
3238
+ host=self._host, uri=transcoded_request["uri"]
3239
+ )
3240
+ method = transcoded_request["method"]
3241
+ try:
3242
+ request_payload = type(request).to_json(request)
3243
+ except:
3244
+ request_payload = None
3245
+ http_request = {
3246
+ "payload": request_payload,
3247
+ "requestMethod": method,
3248
+ "requestUrl": request_url,
3249
+ "headers": dict(metadata),
3250
+ }
3251
+ _LOGGER.debug(
3252
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.ListInstancePartitionOperations",
3253
+ extra={
3254
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
3255
+ "rpcName": "ListInstancePartitionOperations",
3256
+ "httpRequest": http_request,
3257
+ "metadata": http_request["headers"],
3258
+ },
3259
+ )
3260
+
3261
+ # Send the request
3262
+ response = InstanceAdminRestTransport._ListInstancePartitionOperations._get_response(
3263
+ self._host,
3264
+ metadata,
3265
+ query_params,
3266
+ self._session,
3267
+ timeout,
3268
+ transcoded_request,
3269
+ )
3270
+
3271
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
3272
+ # subclass.
3273
+ if response.status_code >= 400:
3274
+ raise core_exceptions.from_http_response(response)
3275
+
3276
+ # Return the response
3277
+ resp = spanner_instance_admin.ListInstancePartitionOperationsResponse()
3278
+ pb_resp = spanner_instance_admin.ListInstancePartitionOperationsResponse.pb(
3279
+ resp
3280
+ )
3281
+
3282
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
3283
+
3284
+ resp = self._interceptor.post_list_instance_partition_operations(resp)
3285
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
3286
+ (
3287
+ resp,
3288
+ _,
3289
+ ) = self._interceptor.post_list_instance_partition_operations_with_metadata(
3290
+ resp, response_metadata
3291
+ )
3292
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
3293
+ logging.DEBUG
3294
+ ): # pragma: NO COVER
3295
+ try:
3296
+ response_payload = spanner_instance_admin.ListInstancePartitionOperationsResponse.to_json(
3297
+ response
3298
+ )
3299
+ except:
3300
+ response_payload = None
3301
+ http_response = {
3302
+ "payload": response_payload,
3303
+ "headers": dict(response.headers),
3304
+ "status": response.status_code,
3305
+ }
3306
+ _LOGGER.debug(
3307
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.list_instance_partition_operations",
3308
+ extra={
3309
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
3310
+ "rpcName": "ListInstancePartitionOperations",
3311
+ "metadata": http_response["headers"],
3312
+ "httpResponse": http_response,
3313
+ },
3314
+ )
3315
+ return resp
3316
+
3317
+ class _ListInstancePartitions(
3318
+ _BaseInstanceAdminRestTransport._BaseListInstancePartitions,
3319
+ InstanceAdminRestStub,
3320
+ ):
3321
+ def __hash__(self):
3322
+ return hash("InstanceAdminRestTransport.ListInstancePartitions")
3323
+
3324
+ @staticmethod
3325
+ def _get_response(
3326
+ host,
3327
+ metadata,
3328
+ query_params,
3329
+ session,
3330
+ timeout,
3331
+ transcoded_request,
3332
+ body=None,
3333
+ ):
3334
+ uri = transcoded_request["uri"]
3335
+ method = transcoded_request["method"]
3336
+ headers = dict(metadata)
3337
+ headers["Content-Type"] = "application/json"
3338
+ response = getattr(session, method)(
3339
+ "{host}{uri}".format(host=host, uri=uri),
3340
+ timeout=timeout,
3341
+ headers=headers,
3342
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
3343
+ )
3344
+ return response
3345
+
3346
+ def __call__(
3347
+ self,
3348
+ request: spanner_instance_admin.ListInstancePartitionsRequest,
3349
+ *,
3350
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3351
+ timeout: Optional[float] = None,
3352
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3353
+ ) -> spanner_instance_admin.ListInstancePartitionsResponse:
3354
+ r"""Call the list instance partitions method over HTTP.
3355
+
3356
+ Args:
3357
+ request (~.spanner_instance_admin.ListInstancePartitionsRequest):
3358
+ The request object. The request for
3359
+ [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions].
3360
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3361
+ should be retried.
3362
+ timeout (float): The timeout for this request.
3363
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3364
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3365
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3366
+ be of type `bytes`.
3367
+
3368
+ Returns:
3369
+ ~.spanner_instance_admin.ListInstancePartitionsResponse:
3370
+ The response for
3371
+ [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions].
3372
+
3373
+ """
3374
+
3375
+ http_options = (
3376
+ _BaseInstanceAdminRestTransport._BaseListInstancePartitions._get_http_options()
3377
+ )
3378
+
3379
+ request, metadata = self._interceptor.pre_list_instance_partitions(
3380
+ request, metadata
3381
+ )
3382
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseListInstancePartitions._get_transcoded_request(
3383
+ http_options, request
3384
+ )
3385
+
3386
+ # Jsonify the query params
3387
+ query_params = _BaseInstanceAdminRestTransport._BaseListInstancePartitions._get_query_params_json(
3388
+ transcoded_request
3389
+ )
3390
+
3391
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
3392
+ logging.DEBUG
3393
+ ): # pragma: NO COVER
3394
+ request_url = "{host}{uri}".format(
3395
+ host=self._host, uri=transcoded_request["uri"]
3396
+ )
3397
+ method = transcoded_request["method"]
3398
+ try:
3399
+ request_payload = type(request).to_json(request)
3400
+ except:
3401
+ request_payload = None
3402
+ http_request = {
3403
+ "payload": request_payload,
3404
+ "requestMethod": method,
3405
+ "requestUrl": request_url,
3406
+ "headers": dict(metadata),
3407
+ }
3408
+ _LOGGER.debug(
3409
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.ListInstancePartitions",
3410
+ extra={
3411
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
3412
+ "rpcName": "ListInstancePartitions",
3413
+ "httpRequest": http_request,
3414
+ "metadata": http_request["headers"],
3415
+ },
3416
+ )
3417
+
3418
+ # Send the request
3419
+ response = InstanceAdminRestTransport._ListInstancePartitions._get_response(
3420
+ self._host,
3421
+ metadata,
3422
+ query_params,
3423
+ self._session,
3424
+ timeout,
3425
+ transcoded_request,
3426
+ )
3427
+
3428
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
3429
+ # subclass.
3430
+ if response.status_code >= 400:
3431
+ raise core_exceptions.from_http_response(response)
3432
+
3433
+ # Return the response
3434
+ resp = spanner_instance_admin.ListInstancePartitionsResponse()
3435
+ pb_resp = spanner_instance_admin.ListInstancePartitionsResponse.pb(resp)
3436
+
3437
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
3438
+
3439
+ resp = self._interceptor.post_list_instance_partitions(resp)
3440
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
3441
+ resp, _ = self._interceptor.post_list_instance_partitions_with_metadata(
3442
+ resp, response_metadata
3443
+ )
3444
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
3445
+ logging.DEBUG
3446
+ ): # pragma: NO COVER
3447
+ try:
3448
+ response_payload = (
3449
+ spanner_instance_admin.ListInstancePartitionsResponse.to_json(
3450
+ response
3451
+ )
3452
+ )
3453
+ except:
3454
+ response_payload = None
3455
+ http_response = {
3456
+ "payload": response_payload,
3457
+ "headers": dict(response.headers),
3458
+ "status": response.status_code,
3459
+ }
3460
+ _LOGGER.debug(
3461
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.list_instance_partitions",
3462
+ extra={
3463
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
3464
+ "rpcName": "ListInstancePartitions",
3465
+ "metadata": http_response["headers"],
3466
+ "httpResponse": http_response,
3467
+ },
3468
+ )
3469
+ return resp
3470
+
3471
+ class _ListInstances(
3472
+ _BaseInstanceAdminRestTransport._BaseListInstances, InstanceAdminRestStub
3473
+ ):
3474
+ def __hash__(self):
3475
+ return hash("InstanceAdminRestTransport.ListInstances")
3476
+
3477
+ @staticmethod
3478
+ def _get_response(
3479
+ host,
3480
+ metadata,
3481
+ query_params,
3482
+ session,
3483
+ timeout,
3484
+ transcoded_request,
3485
+ body=None,
3486
+ ):
3487
+ uri = transcoded_request["uri"]
3488
+ method = transcoded_request["method"]
3489
+ headers = dict(metadata)
3490
+ headers["Content-Type"] = "application/json"
3491
+ response = getattr(session, method)(
3492
+ "{host}{uri}".format(host=host, uri=uri),
3493
+ timeout=timeout,
3494
+ headers=headers,
3495
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
3496
+ )
3497
+ return response
3498
+
3499
+ def __call__(
3500
+ self,
3501
+ request: spanner_instance_admin.ListInstancesRequest,
3502
+ *,
3503
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3504
+ timeout: Optional[float] = None,
3505
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3506
+ ) -> spanner_instance_admin.ListInstancesResponse:
3507
+ r"""Call the list instances method over HTTP.
3508
+
3509
+ Args:
3510
+ request (~.spanner_instance_admin.ListInstancesRequest):
3511
+ The request object. The request for
3512
+ [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances].
3513
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3514
+ should be retried.
3515
+ timeout (float): The timeout for this request.
3516
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3517
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3518
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3519
+ be of type `bytes`.
3520
+
3521
+ Returns:
3522
+ ~.spanner_instance_admin.ListInstancesResponse:
3523
+ The response for
3524
+ [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances].
3525
+
3526
+ """
3527
+
3528
+ http_options = (
3529
+ _BaseInstanceAdminRestTransport._BaseListInstances._get_http_options()
3530
+ )
3531
+
3532
+ request, metadata = self._interceptor.pre_list_instances(request, metadata)
3533
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseListInstances._get_transcoded_request(
3534
+ http_options, request
3535
+ )
3536
+
3537
+ # Jsonify the query params
3538
+ query_params = _BaseInstanceAdminRestTransport._BaseListInstances._get_query_params_json(
3539
+ transcoded_request
3540
+ )
3541
+
3542
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
3543
+ logging.DEBUG
3544
+ ): # pragma: NO COVER
3545
+ request_url = "{host}{uri}".format(
3546
+ host=self._host, uri=transcoded_request["uri"]
3547
+ )
3548
+ method = transcoded_request["method"]
3549
+ try:
3550
+ request_payload = type(request).to_json(request)
3551
+ except:
3552
+ request_payload = None
3553
+ http_request = {
3554
+ "payload": request_payload,
3555
+ "requestMethod": method,
3556
+ "requestUrl": request_url,
3557
+ "headers": dict(metadata),
3558
+ }
3559
+ _LOGGER.debug(
3560
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.ListInstances",
3561
+ extra={
3562
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
3563
+ "rpcName": "ListInstances",
3564
+ "httpRequest": http_request,
3565
+ "metadata": http_request["headers"],
3566
+ },
3567
+ )
3568
+
3569
+ # Send the request
3570
+ response = InstanceAdminRestTransport._ListInstances._get_response(
3571
+ self._host,
3572
+ metadata,
3573
+ query_params,
3574
+ self._session,
3575
+ timeout,
3576
+ transcoded_request,
3577
+ )
3578
+
3579
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
3580
+ # subclass.
3581
+ if response.status_code >= 400:
3582
+ raise core_exceptions.from_http_response(response)
3583
+
3584
+ # Return the response
3585
+ resp = spanner_instance_admin.ListInstancesResponse()
3586
+ pb_resp = spanner_instance_admin.ListInstancesResponse.pb(resp)
3587
+
3588
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
3589
+
3590
+ resp = self._interceptor.post_list_instances(resp)
3591
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
3592
+ resp, _ = self._interceptor.post_list_instances_with_metadata(
3593
+ resp, response_metadata
3594
+ )
3595
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
3596
+ logging.DEBUG
3597
+ ): # pragma: NO COVER
3598
+ try:
3599
+ response_payload = (
3600
+ spanner_instance_admin.ListInstancesResponse.to_json(response)
3601
+ )
3602
+ except:
3603
+ response_payload = None
3604
+ http_response = {
3605
+ "payload": response_payload,
3606
+ "headers": dict(response.headers),
3607
+ "status": response.status_code,
3608
+ }
3609
+ _LOGGER.debug(
3610
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.list_instances",
3611
+ extra={
3612
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
3613
+ "rpcName": "ListInstances",
3614
+ "metadata": http_response["headers"],
3615
+ "httpResponse": http_response,
3616
+ },
3617
+ )
3618
+ return resp
3619
+
3620
+ class _MoveInstance(
3621
+ _BaseInstanceAdminRestTransport._BaseMoveInstance, InstanceAdminRestStub
3622
+ ):
3623
+ def __hash__(self):
3624
+ return hash("InstanceAdminRestTransport.MoveInstance")
3625
+
3626
+ @staticmethod
3627
+ def _get_response(
3628
+ host,
3629
+ metadata,
3630
+ query_params,
3631
+ session,
3632
+ timeout,
3633
+ transcoded_request,
3634
+ body=None,
3635
+ ):
3636
+ uri = transcoded_request["uri"]
3637
+ method = transcoded_request["method"]
3638
+ headers = dict(metadata)
3639
+ headers["Content-Type"] = "application/json"
3640
+ response = getattr(session, method)(
3641
+ "{host}{uri}".format(host=host, uri=uri),
3642
+ timeout=timeout,
3643
+ headers=headers,
3644
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
3645
+ data=body,
3646
+ )
3647
+ return response
3648
+
3649
+ def __call__(
3650
+ self,
3651
+ request: spanner_instance_admin.MoveInstanceRequest,
3652
+ *,
3653
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3654
+ timeout: Optional[float] = None,
3655
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3656
+ ) -> operations_pb2.Operation:
3657
+ r"""Call the move instance method over HTTP.
3658
+
3659
+ Args:
3660
+ request (~.spanner_instance_admin.MoveInstanceRequest):
3661
+ The request object. The request for
3662
+ [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance].
3663
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3664
+ should be retried.
3665
+ timeout (float): The timeout for this request.
3666
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3667
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3668
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3669
+ be of type `bytes`.
3670
+
3671
+ Returns:
3672
+ ~.operations_pb2.Operation:
3673
+ This resource represents a
3674
+ long-running operation that is the
3675
+ result of a network API call.
3676
+
3677
+ """
3678
+
3679
+ http_options = (
3680
+ _BaseInstanceAdminRestTransport._BaseMoveInstance._get_http_options()
3681
+ )
3682
+
3683
+ request, metadata = self._interceptor.pre_move_instance(request, metadata)
3684
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseMoveInstance._get_transcoded_request(
3685
+ http_options, request
3686
+ )
3687
+
3688
+ body = _BaseInstanceAdminRestTransport._BaseMoveInstance._get_request_body_json(
3689
+ transcoded_request
3690
+ )
3691
+
3692
+ # Jsonify the query params
3693
+ query_params = _BaseInstanceAdminRestTransport._BaseMoveInstance._get_query_params_json(
3694
+ transcoded_request
3695
+ )
3696
+
3697
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
3698
+ logging.DEBUG
3699
+ ): # pragma: NO COVER
3700
+ request_url = "{host}{uri}".format(
3701
+ host=self._host, uri=transcoded_request["uri"]
3702
+ )
3703
+ method = transcoded_request["method"]
3704
+ try:
3705
+ request_payload = json_format.MessageToJson(request)
3706
+ except:
3707
+ request_payload = None
3708
+ http_request = {
3709
+ "payload": request_payload,
3710
+ "requestMethod": method,
3711
+ "requestUrl": request_url,
3712
+ "headers": dict(metadata),
3713
+ }
3714
+ _LOGGER.debug(
3715
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.MoveInstance",
3716
+ extra={
3717
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
3718
+ "rpcName": "MoveInstance",
3719
+ "httpRequest": http_request,
3720
+ "metadata": http_request["headers"],
3721
+ },
3722
+ )
3723
+
3724
+ # Send the request
3725
+ response = InstanceAdminRestTransport._MoveInstance._get_response(
3726
+ self._host,
3727
+ metadata,
3728
+ query_params,
3729
+ self._session,
3730
+ timeout,
3731
+ transcoded_request,
3732
+ body,
3733
+ )
3734
+
3735
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
3736
+ # subclass.
3737
+ if response.status_code >= 400:
3738
+ raise core_exceptions.from_http_response(response)
3739
+
3740
+ # Return the response
3741
+ resp = operations_pb2.Operation()
3742
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
3743
+
3744
+ resp = self._interceptor.post_move_instance(resp)
3745
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
3746
+ resp, _ = self._interceptor.post_move_instance_with_metadata(
3747
+ resp, response_metadata
3748
+ )
3749
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
3750
+ logging.DEBUG
3751
+ ): # pragma: NO COVER
3752
+ try:
3753
+ response_payload = json_format.MessageToJson(resp)
3754
+ except:
3755
+ response_payload = None
3756
+ http_response = {
3757
+ "payload": response_payload,
3758
+ "headers": dict(response.headers),
3759
+ "status": response.status_code,
3760
+ }
3761
+ _LOGGER.debug(
3762
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.move_instance",
3763
+ extra={
3764
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
3765
+ "rpcName": "MoveInstance",
3766
+ "metadata": http_response["headers"],
3767
+ "httpResponse": http_response,
3768
+ },
3769
+ )
3770
+ return resp
3771
+
3772
+ class _SetIamPolicy(
3773
+ _BaseInstanceAdminRestTransport._BaseSetIamPolicy, InstanceAdminRestStub
3774
+ ):
3775
+ def __hash__(self):
3776
+ return hash("InstanceAdminRestTransport.SetIamPolicy")
3777
+
3778
+ @staticmethod
3779
+ def _get_response(
3780
+ host,
3781
+ metadata,
3782
+ query_params,
3783
+ session,
3784
+ timeout,
3785
+ transcoded_request,
3786
+ body=None,
3787
+ ):
3788
+ uri = transcoded_request["uri"]
3789
+ method = transcoded_request["method"]
3790
+ headers = dict(metadata)
3791
+ headers["Content-Type"] = "application/json"
3792
+ response = getattr(session, method)(
3793
+ "{host}{uri}".format(host=host, uri=uri),
3794
+ timeout=timeout,
3795
+ headers=headers,
3796
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
3797
+ data=body,
3798
+ )
3799
+ return response
3800
+
3801
+ def __call__(
3802
+ self,
3803
+ request: iam_policy_pb2.SetIamPolicyRequest,
3804
+ *,
3805
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3806
+ timeout: Optional[float] = None,
3807
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3808
+ ) -> policy_pb2.Policy:
3809
+ r"""Call the set iam policy method over HTTP.
3810
+
3811
+ Args:
3812
+ request (~.iam_policy_pb2.SetIamPolicyRequest):
3813
+ The request object. Request message for ``SetIamPolicy`` method.
3814
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3815
+ should be retried.
3816
+ timeout (float): The timeout for this request.
3817
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3818
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3819
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3820
+ be of type `bytes`.
3821
+
3822
+ Returns:
3823
+ ~.policy_pb2.Policy:
3824
+ An Identity and Access Management (IAM) policy, which
3825
+ specifies access controls for Google Cloud resources.
3826
+
3827
+ A ``Policy`` is a collection of ``bindings``. A
3828
+ ``binding`` binds one or more ``members``, or
3829
+ principals, to a single ``role``. Principals can be user
3830
+ accounts, service accounts, Google groups, and domains
3831
+ (such as G Suite). A ``role`` is a named list of
3832
+ permissions; each ``role`` can be an IAM predefined role
3833
+ or a user-created custom role.
3834
+
3835
+ For some types of Google Cloud resources, a ``binding``
3836
+ can also specify a ``condition``, which is a logical
3837
+ expression that allows access to a resource only if the
3838
+ expression evaluates to ``true``. A condition can add
3839
+ constraints based on attributes of the request, the
3840
+ resource, or both. To learn which resources support
3841
+ conditions in their IAM policies, see the `IAM
3842
+ documentation <https://cloud.google.com/iam/help/conditions/resource-policies>`__.
3843
+
3844
+ **JSON example:**
3845
+
3846
+ ::
3847
+
3848
+ {
3849
+ "bindings": [
3850
+ {
3851
+ "role": "roles/resourcemanager.organizationAdmin",
3852
+ "members": [
3853
+ "user:mike@example.com",
3854
+ "group:admins@example.com",
3855
+ "domain:google.com",
3856
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
3857
+ ]
3858
+ },
3859
+ {
3860
+ "role": "roles/resourcemanager.organizationViewer",
3861
+ "members": [
3862
+ "user:eve@example.com"
3863
+ ],
3864
+ "condition": {
3865
+ "title": "expirable access",
3866
+ "description": "Does not grant access after Sep 2020",
3867
+ "expression": "request.time <
3868
+ timestamp('2020-10-01T00:00:00.000Z')",
3869
+ }
3870
+ }
3871
+ ],
3872
+ "etag": "BwWWja0YfJA=",
3873
+ "version": 3
3874
+ }
3875
+
3876
+ **YAML example:**
3877
+
3878
+ ::
3879
+
3880
+ bindings:
3881
+ - members:
3882
+ - user:mike@example.com
3883
+ - group:admins@example.com
3884
+ - domain:google.com
3885
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
3886
+ role: roles/resourcemanager.organizationAdmin
3887
+ - members:
3888
+ - user:eve@example.com
3889
+ role: roles/resourcemanager.organizationViewer
3890
+ condition:
3891
+ title: expirable access
3892
+ description: Does not grant access after Sep 2020
3893
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
3894
+ etag: BwWWja0YfJA=
3895
+ version: 3
3896
+
3897
+ For a description of IAM and its features, see the `IAM
3898
+ documentation <https://cloud.google.com/iam/docs/>`__.
3899
+
3900
+ """
3901
+
3902
+ http_options = (
3903
+ _BaseInstanceAdminRestTransport._BaseSetIamPolicy._get_http_options()
3904
+ )
3905
+
3906
+ request, metadata = self._interceptor.pre_set_iam_policy(request, metadata)
3907
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseSetIamPolicy._get_transcoded_request(
3908
+ http_options, request
3909
+ )
3910
+
3911
+ body = _BaseInstanceAdminRestTransport._BaseSetIamPolicy._get_request_body_json(
3912
+ transcoded_request
3913
+ )
3914
+
3915
+ # Jsonify the query params
3916
+ query_params = _BaseInstanceAdminRestTransport._BaseSetIamPolicy._get_query_params_json(
3917
+ transcoded_request
3918
+ )
3919
+
3920
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
3921
+ logging.DEBUG
3922
+ ): # pragma: NO COVER
3923
+ request_url = "{host}{uri}".format(
3924
+ host=self._host, uri=transcoded_request["uri"]
3925
+ )
3926
+ method = transcoded_request["method"]
3927
+ try:
3928
+ request_payload = json_format.MessageToJson(request)
3929
+ except:
3930
+ request_payload = None
3931
+ http_request = {
3932
+ "payload": request_payload,
3933
+ "requestMethod": method,
3934
+ "requestUrl": request_url,
3935
+ "headers": dict(metadata),
3936
+ }
3937
+ _LOGGER.debug(
3938
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.SetIamPolicy",
3939
+ extra={
3940
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
3941
+ "rpcName": "SetIamPolicy",
3942
+ "httpRequest": http_request,
3943
+ "metadata": http_request["headers"],
3944
+ },
3945
+ )
3946
+
3947
+ # Send the request
3948
+ response = InstanceAdminRestTransport._SetIamPolicy._get_response(
3949
+ self._host,
3950
+ metadata,
3951
+ query_params,
3952
+ self._session,
3953
+ timeout,
3954
+ transcoded_request,
3955
+ body,
3956
+ )
3957
+
3958
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
3959
+ # subclass.
3960
+ if response.status_code >= 400:
3961
+ raise core_exceptions.from_http_response(response)
3962
+
3963
+ # Return the response
3964
+ resp = policy_pb2.Policy()
3965
+ pb_resp = resp
3966
+
3967
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
3968
+
3969
+ resp = self._interceptor.post_set_iam_policy(resp)
3970
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
3971
+ resp, _ = self._interceptor.post_set_iam_policy_with_metadata(
3972
+ resp, response_metadata
3973
+ )
3974
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
3975
+ logging.DEBUG
3976
+ ): # pragma: NO COVER
3977
+ try:
3978
+ response_payload = json_format.MessageToJson(resp)
3979
+ except:
3980
+ response_payload = None
3981
+ http_response = {
3982
+ "payload": response_payload,
3983
+ "headers": dict(response.headers),
3984
+ "status": response.status_code,
3985
+ }
3986
+ _LOGGER.debug(
3987
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.set_iam_policy",
3988
+ extra={
3989
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
3990
+ "rpcName": "SetIamPolicy",
3991
+ "metadata": http_response["headers"],
3992
+ "httpResponse": http_response,
3993
+ },
3994
+ )
3995
+ return resp
3996
+
3997
+ class _TestIamPermissions(
3998
+ _BaseInstanceAdminRestTransport._BaseTestIamPermissions, InstanceAdminRestStub
3999
+ ):
4000
+ def __hash__(self):
4001
+ return hash("InstanceAdminRestTransport.TestIamPermissions")
4002
+
4003
+ @staticmethod
4004
+ def _get_response(
4005
+ host,
4006
+ metadata,
4007
+ query_params,
4008
+ session,
4009
+ timeout,
4010
+ transcoded_request,
4011
+ body=None,
4012
+ ):
4013
+ uri = transcoded_request["uri"]
4014
+ method = transcoded_request["method"]
4015
+ headers = dict(metadata)
4016
+ headers["Content-Type"] = "application/json"
4017
+ response = getattr(session, method)(
4018
+ "{host}{uri}".format(host=host, uri=uri),
4019
+ timeout=timeout,
4020
+ headers=headers,
4021
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
4022
+ data=body,
4023
+ )
4024
+ return response
4025
+
4026
+ def __call__(
4027
+ self,
4028
+ request: iam_policy_pb2.TestIamPermissionsRequest,
4029
+ *,
4030
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
4031
+ timeout: Optional[float] = None,
4032
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
4033
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
4034
+ r"""Call the test iam permissions method over HTTP.
4035
+
4036
+ Args:
4037
+ request (~.iam_policy_pb2.TestIamPermissionsRequest):
4038
+ The request object. Request message for ``TestIamPermissions`` method.
4039
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
4040
+ should be retried.
4041
+ timeout (float): The timeout for this request.
4042
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
4043
+ sent along with the request as metadata. Normally, each value must be of type `str`,
4044
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
4045
+ be of type `bytes`.
4046
+
4047
+ Returns:
4048
+ ~.iam_policy_pb2.TestIamPermissionsResponse:
4049
+ Response message for ``TestIamPermissions`` method.
4050
+ """
4051
+
4052
+ http_options = (
4053
+ _BaseInstanceAdminRestTransport._BaseTestIamPermissions._get_http_options()
4054
+ )
4055
+
4056
+ request, metadata = self._interceptor.pre_test_iam_permissions(
4057
+ request, metadata
4058
+ )
4059
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseTestIamPermissions._get_transcoded_request(
4060
+ http_options, request
4061
+ )
4062
+
4063
+ body = _BaseInstanceAdminRestTransport._BaseTestIamPermissions._get_request_body_json(
4064
+ transcoded_request
4065
+ )
4066
+
4067
+ # Jsonify the query params
4068
+ query_params = _BaseInstanceAdminRestTransport._BaseTestIamPermissions._get_query_params_json(
4069
+ transcoded_request
4070
+ )
4071
+
4072
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
4073
+ logging.DEBUG
4074
+ ): # pragma: NO COVER
4075
+ request_url = "{host}{uri}".format(
4076
+ host=self._host, uri=transcoded_request["uri"]
4077
+ )
4078
+ method = transcoded_request["method"]
4079
+ try:
4080
+ request_payload = json_format.MessageToJson(request)
4081
+ except:
4082
+ request_payload = None
4083
+ http_request = {
4084
+ "payload": request_payload,
4085
+ "requestMethod": method,
4086
+ "requestUrl": request_url,
4087
+ "headers": dict(metadata),
4088
+ }
4089
+ _LOGGER.debug(
4090
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.TestIamPermissions",
4091
+ extra={
4092
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
4093
+ "rpcName": "TestIamPermissions",
4094
+ "httpRequest": http_request,
4095
+ "metadata": http_request["headers"],
4096
+ },
4097
+ )
4098
+
4099
+ # Send the request
4100
+ response = InstanceAdminRestTransport._TestIamPermissions._get_response(
4101
+ self._host,
4102
+ metadata,
4103
+ query_params,
4104
+ self._session,
4105
+ timeout,
4106
+ transcoded_request,
4107
+ body,
4108
+ )
4109
+
4110
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
4111
+ # subclass.
4112
+ if response.status_code >= 400:
4113
+ raise core_exceptions.from_http_response(response)
4114
+
4115
+ # Return the response
4116
+ resp = iam_policy_pb2.TestIamPermissionsResponse()
4117
+ pb_resp = resp
4118
+
4119
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
4120
+
4121
+ resp = self._interceptor.post_test_iam_permissions(resp)
4122
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
4123
+ resp, _ = self._interceptor.post_test_iam_permissions_with_metadata(
4124
+ resp, response_metadata
4125
+ )
4126
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
4127
+ logging.DEBUG
4128
+ ): # pragma: NO COVER
4129
+ try:
4130
+ response_payload = json_format.MessageToJson(resp)
4131
+ except:
4132
+ response_payload = None
4133
+ http_response = {
4134
+ "payload": response_payload,
4135
+ "headers": dict(response.headers),
4136
+ "status": response.status_code,
4137
+ }
4138
+ _LOGGER.debug(
4139
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.test_iam_permissions",
4140
+ extra={
4141
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
4142
+ "rpcName": "TestIamPermissions",
4143
+ "metadata": http_response["headers"],
4144
+ "httpResponse": http_response,
4145
+ },
4146
+ )
4147
+ return resp
4148
+
4149
+ class _UpdateInstance(
4150
+ _BaseInstanceAdminRestTransport._BaseUpdateInstance, InstanceAdminRestStub
4151
+ ):
4152
+ def __hash__(self):
4153
+ return hash("InstanceAdminRestTransport.UpdateInstance")
4154
+
4155
+ @staticmethod
4156
+ def _get_response(
4157
+ host,
4158
+ metadata,
4159
+ query_params,
4160
+ session,
4161
+ timeout,
4162
+ transcoded_request,
4163
+ body=None,
4164
+ ):
4165
+ uri = transcoded_request["uri"]
4166
+ method = transcoded_request["method"]
4167
+ headers = dict(metadata)
4168
+ headers["Content-Type"] = "application/json"
4169
+ response = getattr(session, method)(
4170
+ "{host}{uri}".format(host=host, uri=uri),
4171
+ timeout=timeout,
4172
+ headers=headers,
4173
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
4174
+ data=body,
4175
+ )
4176
+ return response
4177
+
4178
+ def __call__(
4179
+ self,
4180
+ request: spanner_instance_admin.UpdateInstanceRequest,
4181
+ *,
4182
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
4183
+ timeout: Optional[float] = None,
4184
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
4185
+ ) -> operations_pb2.Operation:
4186
+ r"""Call the update instance method over HTTP.
4187
+
4188
+ Args:
4189
+ request (~.spanner_instance_admin.UpdateInstanceRequest):
4190
+ The request object. The request for
4191
+ [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance].
4192
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
4193
+ should be retried.
4194
+ timeout (float): The timeout for this request.
4195
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
4196
+ sent along with the request as metadata. Normally, each value must be of type `str`,
4197
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
4198
+ be of type `bytes`.
4199
+
4200
+ Returns:
4201
+ ~.operations_pb2.Operation:
4202
+ This resource represents a
4203
+ long-running operation that is the
4204
+ result of a network API call.
4205
+
4206
+ """
4207
+
4208
+ http_options = (
4209
+ _BaseInstanceAdminRestTransport._BaseUpdateInstance._get_http_options()
4210
+ )
4211
+
4212
+ request, metadata = self._interceptor.pre_update_instance(request, metadata)
4213
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseUpdateInstance._get_transcoded_request(
4214
+ http_options, request
4215
+ )
4216
+
4217
+ body = _BaseInstanceAdminRestTransport._BaseUpdateInstance._get_request_body_json(
4218
+ transcoded_request
4219
+ )
4220
+
4221
+ # Jsonify the query params
4222
+ query_params = _BaseInstanceAdminRestTransport._BaseUpdateInstance._get_query_params_json(
4223
+ transcoded_request
4224
+ )
4225
+
4226
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
4227
+ logging.DEBUG
4228
+ ): # pragma: NO COVER
4229
+ request_url = "{host}{uri}".format(
4230
+ host=self._host, uri=transcoded_request["uri"]
4231
+ )
4232
+ method = transcoded_request["method"]
4233
+ try:
4234
+ request_payload = json_format.MessageToJson(request)
4235
+ except:
4236
+ request_payload = None
4237
+ http_request = {
4238
+ "payload": request_payload,
4239
+ "requestMethod": method,
4240
+ "requestUrl": request_url,
4241
+ "headers": dict(metadata),
4242
+ }
4243
+ _LOGGER.debug(
4244
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.UpdateInstance",
4245
+ extra={
4246
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
4247
+ "rpcName": "UpdateInstance",
4248
+ "httpRequest": http_request,
4249
+ "metadata": http_request["headers"],
4250
+ },
4251
+ )
4252
+
4253
+ # Send the request
4254
+ response = InstanceAdminRestTransport._UpdateInstance._get_response(
4255
+ self._host,
4256
+ metadata,
4257
+ query_params,
4258
+ self._session,
4259
+ timeout,
4260
+ transcoded_request,
4261
+ body,
4262
+ )
4263
+
4264
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
4265
+ # subclass.
4266
+ if response.status_code >= 400:
4267
+ raise core_exceptions.from_http_response(response)
4268
+
4269
+ # Return the response
4270
+ resp = operations_pb2.Operation()
4271
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
4272
+
4273
+ resp = self._interceptor.post_update_instance(resp)
4274
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
4275
+ resp, _ = self._interceptor.post_update_instance_with_metadata(
4276
+ resp, response_metadata
4277
+ )
4278
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
4279
+ logging.DEBUG
4280
+ ): # pragma: NO COVER
4281
+ try:
4282
+ response_payload = json_format.MessageToJson(resp)
4283
+ except:
4284
+ response_payload = None
4285
+ http_response = {
4286
+ "payload": response_payload,
4287
+ "headers": dict(response.headers),
4288
+ "status": response.status_code,
4289
+ }
4290
+ _LOGGER.debug(
4291
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.update_instance",
4292
+ extra={
4293
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
4294
+ "rpcName": "UpdateInstance",
4295
+ "metadata": http_response["headers"],
4296
+ "httpResponse": http_response,
4297
+ },
4298
+ )
4299
+ return resp
4300
+
4301
+ class _UpdateInstanceConfig(
4302
+ _BaseInstanceAdminRestTransport._BaseUpdateInstanceConfig, InstanceAdminRestStub
4303
+ ):
4304
+ def __hash__(self):
4305
+ return hash("InstanceAdminRestTransport.UpdateInstanceConfig")
4306
+
4307
+ @staticmethod
4308
+ def _get_response(
4309
+ host,
4310
+ metadata,
4311
+ query_params,
4312
+ session,
4313
+ timeout,
4314
+ transcoded_request,
4315
+ body=None,
4316
+ ):
4317
+ uri = transcoded_request["uri"]
4318
+ method = transcoded_request["method"]
4319
+ headers = dict(metadata)
4320
+ headers["Content-Type"] = "application/json"
4321
+ response = getattr(session, method)(
4322
+ "{host}{uri}".format(host=host, uri=uri),
4323
+ timeout=timeout,
4324
+ headers=headers,
4325
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
4326
+ data=body,
4327
+ )
4328
+ return response
4329
+
4330
+ def __call__(
4331
+ self,
4332
+ request: spanner_instance_admin.UpdateInstanceConfigRequest,
4333
+ *,
4334
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
4335
+ timeout: Optional[float] = None,
4336
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
4337
+ ) -> operations_pb2.Operation:
4338
+ r"""Call the update instance config method over HTTP.
4339
+
4340
+ Args:
4341
+ request (~.spanner_instance_admin.UpdateInstanceConfigRequest):
4342
+ The request object. The request for
4343
+ [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig].
4344
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
4345
+ should be retried.
4346
+ timeout (float): The timeout for this request.
4347
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
4348
+ sent along with the request as metadata. Normally, each value must be of type `str`,
4349
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
4350
+ be of type `bytes`.
4351
+
4352
+ Returns:
4353
+ ~.operations_pb2.Operation:
4354
+ This resource represents a
4355
+ long-running operation that is the
4356
+ result of a network API call.
4357
+
4358
+ """
4359
+
4360
+ http_options = (
4361
+ _BaseInstanceAdminRestTransport._BaseUpdateInstanceConfig._get_http_options()
4362
+ )
4363
+
4364
+ request, metadata = self._interceptor.pre_update_instance_config(
4365
+ request, metadata
4366
+ )
4367
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseUpdateInstanceConfig._get_transcoded_request(
4368
+ http_options, request
4369
+ )
4370
+
4371
+ body = _BaseInstanceAdminRestTransport._BaseUpdateInstanceConfig._get_request_body_json(
4372
+ transcoded_request
4373
+ )
4374
+
4375
+ # Jsonify the query params
4376
+ query_params = _BaseInstanceAdminRestTransport._BaseUpdateInstanceConfig._get_query_params_json(
4377
+ transcoded_request
4378
+ )
4379
+
4380
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
4381
+ logging.DEBUG
4382
+ ): # pragma: NO COVER
4383
+ request_url = "{host}{uri}".format(
4384
+ host=self._host, uri=transcoded_request["uri"]
4385
+ )
4386
+ method = transcoded_request["method"]
4387
+ try:
4388
+ request_payload = json_format.MessageToJson(request)
4389
+ except:
4390
+ request_payload = None
4391
+ http_request = {
4392
+ "payload": request_payload,
4393
+ "requestMethod": method,
4394
+ "requestUrl": request_url,
4395
+ "headers": dict(metadata),
4396
+ }
4397
+ _LOGGER.debug(
4398
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.UpdateInstanceConfig",
4399
+ extra={
4400
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
4401
+ "rpcName": "UpdateInstanceConfig",
4402
+ "httpRequest": http_request,
4403
+ "metadata": http_request["headers"],
4404
+ },
4405
+ )
4406
+
4407
+ # Send the request
4408
+ response = InstanceAdminRestTransport._UpdateInstanceConfig._get_response(
4409
+ self._host,
4410
+ metadata,
4411
+ query_params,
4412
+ self._session,
4413
+ timeout,
4414
+ transcoded_request,
4415
+ body,
4416
+ )
4417
+
4418
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
4419
+ # subclass.
4420
+ if response.status_code >= 400:
4421
+ raise core_exceptions.from_http_response(response)
4422
+
4423
+ # Return the response
4424
+ resp = operations_pb2.Operation()
4425
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
4426
+
4427
+ resp = self._interceptor.post_update_instance_config(resp)
4428
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
4429
+ resp, _ = self._interceptor.post_update_instance_config_with_metadata(
4430
+ resp, response_metadata
4431
+ )
4432
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
4433
+ logging.DEBUG
4434
+ ): # pragma: NO COVER
4435
+ try:
4436
+ response_payload = json_format.MessageToJson(resp)
4437
+ except:
4438
+ response_payload = None
4439
+ http_response = {
4440
+ "payload": response_payload,
4441
+ "headers": dict(response.headers),
4442
+ "status": response.status_code,
4443
+ }
4444
+ _LOGGER.debug(
4445
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.update_instance_config",
4446
+ extra={
4447
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
4448
+ "rpcName": "UpdateInstanceConfig",
4449
+ "metadata": http_response["headers"],
4450
+ "httpResponse": http_response,
4451
+ },
4452
+ )
4453
+ return resp
4454
+
4455
+ class _UpdateInstancePartition(
4456
+ _BaseInstanceAdminRestTransport._BaseUpdateInstancePartition,
4457
+ InstanceAdminRestStub,
4458
+ ):
4459
+ def __hash__(self):
4460
+ return hash("InstanceAdminRestTransport.UpdateInstancePartition")
4461
+
4462
+ @staticmethod
4463
+ def _get_response(
4464
+ host,
4465
+ metadata,
4466
+ query_params,
4467
+ session,
4468
+ timeout,
4469
+ transcoded_request,
4470
+ body=None,
4471
+ ):
4472
+ uri = transcoded_request["uri"]
4473
+ method = transcoded_request["method"]
4474
+ headers = dict(metadata)
4475
+ headers["Content-Type"] = "application/json"
4476
+ response = getattr(session, method)(
4477
+ "{host}{uri}".format(host=host, uri=uri),
4478
+ timeout=timeout,
4479
+ headers=headers,
4480
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
4481
+ data=body,
4482
+ )
4483
+ return response
4484
+
4485
+ def __call__(
4486
+ self,
4487
+ request: spanner_instance_admin.UpdateInstancePartitionRequest,
4488
+ *,
4489
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
4490
+ timeout: Optional[float] = None,
4491
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
4492
+ ) -> operations_pb2.Operation:
4493
+ r"""Call the update instance partition method over HTTP.
4494
+
4495
+ Args:
4496
+ request (~.spanner_instance_admin.UpdateInstancePartitionRequest):
4497
+ The request object. The request for
4498
+ [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition].
4499
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
4500
+ should be retried.
4501
+ timeout (float): The timeout for this request.
4502
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
4503
+ sent along with the request as metadata. Normally, each value must be of type `str`,
4504
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
4505
+ be of type `bytes`.
4506
+
4507
+ Returns:
4508
+ ~.operations_pb2.Operation:
4509
+ This resource represents a
4510
+ long-running operation that is the
4511
+ result of a network API call.
4512
+
4513
+ """
4514
+
4515
+ http_options = (
4516
+ _BaseInstanceAdminRestTransport._BaseUpdateInstancePartition._get_http_options()
4517
+ )
4518
+
4519
+ request, metadata = self._interceptor.pre_update_instance_partition(
4520
+ request, metadata
4521
+ )
4522
+ transcoded_request = _BaseInstanceAdminRestTransport._BaseUpdateInstancePartition._get_transcoded_request(
4523
+ http_options, request
4524
+ )
4525
+
4526
+ body = _BaseInstanceAdminRestTransport._BaseUpdateInstancePartition._get_request_body_json(
4527
+ transcoded_request
4528
+ )
4529
+
4530
+ # Jsonify the query params
4531
+ query_params = _BaseInstanceAdminRestTransport._BaseUpdateInstancePartition._get_query_params_json(
4532
+ transcoded_request
4533
+ )
4534
+
4535
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
4536
+ logging.DEBUG
4537
+ ): # pragma: NO COVER
4538
+ request_url = "{host}{uri}".format(
4539
+ host=self._host, uri=transcoded_request["uri"]
4540
+ )
4541
+ method = transcoded_request["method"]
4542
+ try:
4543
+ request_payload = json_format.MessageToJson(request)
4544
+ except:
4545
+ request_payload = None
4546
+ http_request = {
4547
+ "payload": request_payload,
4548
+ "requestMethod": method,
4549
+ "requestUrl": request_url,
4550
+ "headers": dict(metadata),
4551
+ }
4552
+ _LOGGER.debug(
4553
+ f"Sending request for google.spanner.admin.instance_v1.InstanceAdminClient.UpdateInstancePartition",
4554
+ extra={
4555
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
4556
+ "rpcName": "UpdateInstancePartition",
4557
+ "httpRequest": http_request,
4558
+ "metadata": http_request["headers"],
4559
+ },
4560
+ )
4561
+
4562
+ # Send the request
4563
+ response = (
4564
+ InstanceAdminRestTransport._UpdateInstancePartition._get_response(
4565
+ self._host,
4566
+ metadata,
4567
+ query_params,
4568
+ self._session,
4569
+ timeout,
4570
+ transcoded_request,
4571
+ body,
4572
+ )
4573
+ )
4574
+
4575
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
4576
+ # subclass.
4577
+ if response.status_code >= 400:
4578
+ raise core_exceptions.from_http_response(response)
4579
+
4580
+ # Return the response
4581
+ resp = operations_pb2.Operation()
4582
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
4583
+
4584
+ resp = self._interceptor.post_update_instance_partition(resp)
4585
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
4586
+ resp, _ = self._interceptor.post_update_instance_partition_with_metadata(
4587
+ resp, response_metadata
4588
+ )
4589
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
4590
+ logging.DEBUG
4591
+ ): # pragma: NO COVER
4592
+ try:
4593
+ response_payload = json_format.MessageToJson(resp)
4594
+ except:
4595
+ response_payload = None
4596
+ http_response = {
4597
+ "payload": response_payload,
4598
+ "headers": dict(response.headers),
4599
+ "status": response.status_code,
4600
+ }
4601
+ _LOGGER.debug(
4602
+ "Received response for google.spanner.admin.instance_v1.InstanceAdminClient.update_instance_partition",
4603
+ extra={
4604
+ "serviceName": "google.spanner.admin.instance.v1.InstanceAdmin",
4605
+ "rpcName": "UpdateInstancePartition",
4606
+ "metadata": http_response["headers"],
4607
+ "httpResponse": http_response,
4608
+ },
4609
+ )
4610
+ return resp
4611
+
4612
+ @property
4613
+ def create_instance(
4614
+ self,
4615
+ ) -> Callable[
4616
+ [spanner_instance_admin.CreateInstanceRequest], operations_pb2.Operation
4617
+ ]:
4618
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4619
+ # In C++ this would require a dynamic_cast
4620
+ return self._CreateInstance(self._session, self._host, self._interceptor) # type: ignore
4621
+
4622
+ @property
4623
+ def create_instance_config(
4624
+ self,
4625
+ ) -> Callable[
4626
+ [spanner_instance_admin.CreateInstanceConfigRequest], operations_pb2.Operation
4627
+ ]:
4628
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4629
+ # In C++ this would require a dynamic_cast
4630
+ return self._CreateInstanceConfig(self._session, self._host, self._interceptor) # type: ignore
4631
+
4632
+ @property
4633
+ def create_instance_partition(
4634
+ self,
4635
+ ) -> Callable[
4636
+ [spanner_instance_admin.CreateInstancePartitionRequest],
4637
+ operations_pb2.Operation,
4638
+ ]:
4639
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4640
+ # In C++ this would require a dynamic_cast
4641
+ return self._CreateInstancePartition(self._session, self._host, self._interceptor) # type: ignore
4642
+
4643
+ @property
4644
+ def delete_instance(
4645
+ self,
4646
+ ) -> Callable[[spanner_instance_admin.DeleteInstanceRequest], empty_pb2.Empty]:
4647
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4648
+ # In C++ this would require a dynamic_cast
4649
+ return self._DeleteInstance(self._session, self._host, self._interceptor) # type: ignore
4650
+
4651
+ @property
4652
+ def delete_instance_config(
4653
+ self,
4654
+ ) -> Callable[
4655
+ [spanner_instance_admin.DeleteInstanceConfigRequest], empty_pb2.Empty
4656
+ ]:
4657
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4658
+ # In C++ this would require a dynamic_cast
4659
+ return self._DeleteInstanceConfig(self._session, self._host, self._interceptor) # type: ignore
4660
+
4661
+ @property
4662
+ def delete_instance_partition(
4663
+ self,
4664
+ ) -> Callable[
4665
+ [spanner_instance_admin.DeleteInstancePartitionRequest], empty_pb2.Empty
4666
+ ]:
4667
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4668
+ # In C++ this would require a dynamic_cast
4669
+ return self._DeleteInstancePartition(self._session, self._host, self._interceptor) # type: ignore
4670
+
4671
+ @property
4672
+ def get_iam_policy(
4673
+ self,
4674
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
4675
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4676
+ # In C++ this would require a dynamic_cast
4677
+ return self._GetIamPolicy(self._session, self._host, self._interceptor) # type: ignore
4678
+
4679
+ @property
4680
+ def get_instance(
4681
+ self,
4682
+ ) -> Callable[
4683
+ [spanner_instance_admin.GetInstanceRequest], spanner_instance_admin.Instance
4684
+ ]:
4685
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4686
+ # In C++ this would require a dynamic_cast
4687
+ return self._GetInstance(self._session, self._host, self._interceptor) # type: ignore
4688
+
4689
+ @property
4690
+ def get_instance_config(
4691
+ self,
4692
+ ) -> Callable[
4693
+ [spanner_instance_admin.GetInstanceConfigRequest],
4694
+ spanner_instance_admin.InstanceConfig,
4695
+ ]:
4696
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4697
+ # In C++ this would require a dynamic_cast
4698
+ return self._GetInstanceConfig(self._session, self._host, self._interceptor) # type: ignore
4699
+
4700
+ @property
4701
+ def get_instance_partition(
4702
+ self,
4703
+ ) -> Callable[
4704
+ [spanner_instance_admin.GetInstancePartitionRequest],
4705
+ spanner_instance_admin.InstancePartition,
4706
+ ]:
4707
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4708
+ # In C++ this would require a dynamic_cast
4709
+ return self._GetInstancePartition(self._session, self._host, self._interceptor) # type: ignore
4710
+
4711
+ @property
4712
+ def list_instance_config_operations(
4713
+ self,
4714
+ ) -> Callable[
4715
+ [spanner_instance_admin.ListInstanceConfigOperationsRequest],
4716
+ spanner_instance_admin.ListInstanceConfigOperationsResponse,
4717
+ ]:
4718
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4719
+ # In C++ this would require a dynamic_cast
4720
+ return self._ListInstanceConfigOperations(self._session, self._host, self._interceptor) # type: ignore
4721
+
4722
+ @property
4723
+ def list_instance_configs(
4724
+ self,
4725
+ ) -> Callable[
4726
+ [spanner_instance_admin.ListInstanceConfigsRequest],
4727
+ spanner_instance_admin.ListInstanceConfigsResponse,
4728
+ ]:
4729
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4730
+ # In C++ this would require a dynamic_cast
4731
+ return self._ListInstanceConfigs(self._session, self._host, self._interceptor) # type: ignore
4732
+
4733
+ @property
4734
+ def list_instance_partition_operations(
4735
+ self,
4736
+ ) -> Callable[
4737
+ [spanner_instance_admin.ListInstancePartitionOperationsRequest],
4738
+ spanner_instance_admin.ListInstancePartitionOperationsResponse,
4739
+ ]:
4740
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4741
+ # In C++ this would require a dynamic_cast
4742
+ return self._ListInstancePartitionOperations(self._session, self._host, self._interceptor) # type: ignore
4743
+
4744
+ @property
4745
+ def list_instance_partitions(
4746
+ self,
4747
+ ) -> Callable[
4748
+ [spanner_instance_admin.ListInstancePartitionsRequest],
4749
+ spanner_instance_admin.ListInstancePartitionsResponse,
4750
+ ]:
4751
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4752
+ # In C++ this would require a dynamic_cast
4753
+ return self._ListInstancePartitions(self._session, self._host, self._interceptor) # type: ignore
4754
+
4755
+ @property
4756
+ def list_instances(
4757
+ self,
4758
+ ) -> Callable[
4759
+ [spanner_instance_admin.ListInstancesRequest],
4760
+ spanner_instance_admin.ListInstancesResponse,
4761
+ ]:
4762
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4763
+ # In C++ this would require a dynamic_cast
4764
+ return self._ListInstances(self._session, self._host, self._interceptor) # type: ignore
4765
+
4766
+ @property
4767
+ def move_instance(
4768
+ self,
4769
+ ) -> Callable[
4770
+ [spanner_instance_admin.MoveInstanceRequest], operations_pb2.Operation
4771
+ ]:
4772
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4773
+ # In C++ this would require a dynamic_cast
4774
+ return self._MoveInstance(self._session, self._host, self._interceptor) # type: ignore
4775
+
4776
+ @property
4777
+ def set_iam_policy(
4778
+ self,
4779
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
4780
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4781
+ # In C++ this would require a dynamic_cast
4782
+ return self._SetIamPolicy(self._session, self._host, self._interceptor) # type: ignore
4783
+
4784
+ @property
4785
+ def test_iam_permissions(
4786
+ self,
4787
+ ) -> Callable[
4788
+ [iam_policy_pb2.TestIamPermissionsRequest],
4789
+ iam_policy_pb2.TestIamPermissionsResponse,
4790
+ ]:
4791
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4792
+ # In C++ this would require a dynamic_cast
4793
+ return self._TestIamPermissions(self._session, self._host, self._interceptor) # type: ignore
4794
+
4795
+ @property
4796
+ def update_instance(
4797
+ self,
4798
+ ) -> Callable[
4799
+ [spanner_instance_admin.UpdateInstanceRequest], operations_pb2.Operation
4800
+ ]:
4801
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4802
+ # In C++ this would require a dynamic_cast
4803
+ return self._UpdateInstance(self._session, self._host, self._interceptor) # type: ignore
4804
+
4805
+ @property
4806
+ def update_instance_config(
4807
+ self,
4808
+ ) -> Callable[
4809
+ [spanner_instance_admin.UpdateInstanceConfigRequest], operations_pb2.Operation
4810
+ ]:
4811
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4812
+ # In C++ this would require a dynamic_cast
4813
+ return self._UpdateInstanceConfig(self._session, self._host, self._interceptor) # type: ignore
4814
+
4815
+ @property
4816
+ def update_instance_partition(
4817
+ self,
4818
+ ) -> Callable[
4819
+ [spanner_instance_admin.UpdateInstancePartitionRequest],
4820
+ operations_pb2.Operation,
4821
+ ]:
4822
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
4823
+ # In C++ this would require a dynamic_cast
4824
+ return self._UpdateInstancePartition(self._session, self._host, self._interceptor) # type: ignore
4825
+
4826
+ @property
4827
+ def kind(self) -> str:
4828
+ return "rest"
4829
+
4830
+ def close(self):
4831
+ self._session.close()
4832
+
4833
+
4834
+ __all__ = ("InstanceAdminRestTransport",)