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