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,1152 @@
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 json # type: ignore
17
+ import re
18
+ from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
19
+
20
+ from google.api_core import gapic_v1, path_template
21
+ from google.longrunning import operations_pb2 # type: ignore
22
+ from google.protobuf import json_format
23
+
24
+ from google.cloud.datastream_v1alpha1.types import datastream, datastream_resources
25
+
26
+ from .base import DEFAULT_CLIENT_INFO, DatastreamTransport
27
+
28
+
29
+ class _BaseDatastreamRestTransport(DatastreamTransport):
30
+ """Base REST backend transport for Datastream.
31
+
32
+ Note: This class is not meant to be used directly. Use its sync and
33
+ async sub-classes instead.
34
+
35
+ This class defines the same methods as the primary client, so the
36
+ primary client can load the underlying transport implementation
37
+ and call it.
38
+
39
+ It sends JSON representations of protocol buffers over HTTP/1.1
40
+ """
41
+
42
+ def __init__(
43
+ self,
44
+ *,
45
+ host: str = "datastream.googleapis.com",
46
+ credentials: Optional[Any] = None,
47
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
48
+ always_use_jwt_access: Optional[bool] = False,
49
+ url_scheme: str = "https",
50
+ api_audience: Optional[str] = None,
51
+ ) -> None:
52
+ """Instantiate the transport.
53
+ Args:
54
+ host (Optional[str]):
55
+ The hostname to connect to (default: 'datastream.googleapis.com').
56
+ credentials (Optional[Any]): The
57
+ authorization credentials to attach to requests. These
58
+ credentials identify the application to the service; if none
59
+ are specified, the client will attempt to ascertain the
60
+ credentials from the environment.
61
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
62
+ The client info used to send a user-agent string along with
63
+ API requests. If ``None``, then default info will be used.
64
+ Generally, you only need to set this if you are developing
65
+ your own client library.
66
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
67
+ be used for service account credentials.
68
+ url_scheme: the protocol scheme for the API endpoint. Normally
69
+ "https", but for testing or local servers,
70
+ "http" can be specified.
71
+ """
72
+ # Run the base constructor
73
+ maybe_url_match = re.match("^(?P<scheme>http(?:s)?://)?(?P<host>.*)$", host)
74
+ if maybe_url_match is None:
75
+ raise ValueError(
76
+ f"Unexpected hostname structure: {host}"
77
+ ) # pragma: NO COVER
78
+
79
+ url_match_items = maybe_url_match.groupdict()
80
+
81
+ host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host
82
+
83
+ super().__init__(
84
+ host=host,
85
+ credentials=credentials,
86
+ client_info=client_info,
87
+ always_use_jwt_access=always_use_jwt_access,
88
+ api_audience=api_audience,
89
+ )
90
+
91
+ class _BaseCreateConnectionProfile:
92
+ def __hash__(self): # pragma: NO COVER
93
+ return NotImplementedError("__hash__ must be implemented.")
94
+
95
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
96
+ "connectionProfileId": "",
97
+ }
98
+
99
+ @classmethod
100
+ def _get_unset_required_fields(cls, message_dict):
101
+ return {
102
+ k: v
103
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
104
+ if k not in message_dict
105
+ }
106
+
107
+ @staticmethod
108
+ def _get_http_options():
109
+ http_options: List[Dict[str, str]] = [
110
+ {
111
+ "method": "post",
112
+ "uri": "/v1alpha1/{parent=projects/*/locations/*}/connectionProfiles",
113
+ "body": "connection_profile",
114
+ },
115
+ ]
116
+ return http_options
117
+
118
+ @staticmethod
119
+ def _get_transcoded_request(http_options, request):
120
+ pb_request = datastream.CreateConnectionProfileRequest.pb(request)
121
+ transcoded_request = path_template.transcode(http_options, pb_request)
122
+ return transcoded_request
123
+
124
+ @staticmethod
125
+ def _get_request_body_json(transcoded_request):
126
+ # Jsonify the request body
127
+
128
+ body = json_format.MessageToJson(
129
+ transcoded_request["body"], use_integers_for_enums=True
130
+ )
131
+ return body
132
+
133
+ @staticmethod
134
+ def _get_query_params_json(transcoded_request):
135
+ query_params = json.loads(
136
+ json_format.MessageToJson(
137
+ transcoded_request["query_params"],
138
+ use_integers_for_enums=True,
139
+ )
140
+ )
141
+ query_params.update(
142
+ _BaseDatastreamRestTransport._BaseCreateConnectionProfile._get_unset_required_fields(
143
+ query_params
144
+ )
145
+ )
146
+
147
+ query_params["$alt"] = "json;enum-encoding=int"
148
+ return query_params
149
+
150
+ class _BaseCreatePrivateConnection:
151
+ def __hash__(self): # pragma: NO COVER
152
+ return NotImplementedError("__hash__ must be implemented.")
153
+
154
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
155
+ "privateConnectionId": "",
156
+ }
157
+
158
+ @classmethod
159
+ def _get_unset_required_fields(cls, message_dict):
160
+ return {
161
+ k: v
162
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
163
+ if k not in message_dict
164
+ }
165
+
166
+ @staticmethod
167
+ def _get_http_options():
168
+ http_options: List[Dict[str, str]] = [
169
+ {
170
+ "method": "post",
171
+ "uri": "/v1alpha1/{parent=projects/*/locations/*}/privateConnections",
172
+ "body": "private_connection",
173
+ },
174
+ ]
175
+ return http_options
176
+
177
+ @staticmethod
178
+ def _get_transcoded_request(http_options, request):
179
+ pb_request = datastream.CreatePrivateConnectionRequest.pb(request)
180
+ transcoded_request = path_template.transcode(http_options, pb_request)
181
+ return transcoded_request
182
+
183
+ @staticmethod
184
+ def _get_request_body_json(transcoded_request):
185
+ # Jsonify the request body
186
+
187
+ body = json_format.MessageToJson(
188
+ transcoded_request["body"], use_integers_for_enums=True
189
+ )
190
+ return body
191
+
192
+ @staticmethod
193
+ def _get_query_params_json(transcoded_request):
194
+ query_params = json.loads(
195
+ json_format.MessageToJson(
196
+ transcoded_request["query_params"],
197
+ use_integers_for_enums=True,
198
+ )
199
+ )
200
+ query_params.update(
201
+ _BaseDatastreamRestTransport._BaseCreatePrivateConnection._get_unset_required_fields(
202
+ query_params
203
+ )
204
+ )
205
+
206
+ query_params["$alt"] = "json;enum-encoding=int"
207
+ return query_params
208
+
209
+ class _BaseCreateRoute:
210
+ def __hash__(self): # pragma: NO COVER
211
+ return NotImplementedError("__hash__ must be implemented.")
212
+
213
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
214
+ "routeId": "",
215
+ }
216
+
217
+ @classmethod
218
+ def _get_unset_required_fields(cls, message_dict):
219
+ return {
220
+ k: v
221
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
222
+ if k not in message_dict
223
+ }
224
+
225
+ @staticmethod
226
+ def _get_http_options():
227
+ http_options: List[Dict[str, str]] = [
228
+ {
229
+ "method": "post",
230
+ "uri": "/v1alpha1/{parent=projects/*/locations/*/privateConnections/*}/routes",
231
+ "body": "route",
232
+ },
233
+ ]
234
+ return http_options
235
+
236
+ @staticmethod
237
+ def _get_transcoded_request(http_options, request):
238
+ pb_request = datastream.CreateRouteRequest.pb(request)
239
+ transcoded_request = path_template.transcode(http_options, pb_request)
240
+ return transcoded_request
241
+
242
+ @staticmethod
243
+ def _get_request_body_json(transcoded_request):
244
+ # Jsonify the request body
245
+
246
+ body = json_format.MessageToJson(
247
+ transcoded_request["body"], use_integers_for_enums=True
248
+ )
249
+ return body
250
+
251
+ @staticmethod
252
+ def _get_query_params_json(transcoded_request):
253
+ query_params = json.loads(
254
+ json_format.MessageToJson(
255
+ transcoded_request["query_params"],
256
+ use_integers_for_enums=True,
257
+ )
258
+ )
259
+ query_params.update(
260
+ _BaseDatastreamRestTransport._BaseCreateRoute._get_unset_required_fields(
261
+ query_params
262
+ )
263
+ )
264
+
265
+ query_params["$alt"] = "json;enum-encoding=int"
266
+ return query_params
267
+
268
+ class _BaseCreateStream:
269
+ def __hash__(self): # pragma: NO COVER
270
+ return NotImplementedError("__hash__ must be implemented.")
271
+
272
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
273
+ "streamId": "",
274
+ }
275
+
276
+ @classmethod
277
+ def _get_unset_required_fields(cls, message_dict):
278
+ return {
279
+ k: v
280
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
281
+ if k not in message_dict
282
+ }
283
+
284
+ @staticmethod
285
+ def _get_http_options():
286
+ http_options: List[Dict[str, str]] = [
287
+ {
288
+ "method": "post",
289
+ "uri": "/v1alpha1/{parent=projects/*/locations/*}/streams",
290
+ "body": "stream",
291
+ },
292
+ ]
293
+ return http_options
294
+
295
+ @staticmethod
296
+ def _get_transcoded_request(http_options, request):
297
+ pb_request = datastream.CreateStreamRequest.pb(request)
298
+ transcoded_request = path_template.transcode(http_options, pb_request)
299
+ return transcoded_request
300
+
301
+ @staticmethod
302
+ def _get_request_body_json(transcoded_request):
303
+ # Jsonify the request body
304
+
305
+ body = json_format.MessageToJson(
306
+ transcoded_request["body"], use_integers_for_enums=True
307
+ )
308
+ return body
309
+
310
+ @staticmethod
311
+ def _get_query_params_json(transcoded_request):
312
+ query_params = json.loads(
313
+ json_format.MessageToJson(
314
+ transcoded_request["query_params"],
315
+ use_integers_for_enums=True,
316
+ )
317
+ )
318
+ query_params.update(
319
+ _BaseDatastreamRestTransport._BaseCreateStream._get_unset_required_fields(
320
+ query_params
321
+ )
322
+ )
323
+
324
+ query_params["$alt"] = "json;enum-encoding=int"
325
+ return query_params
326
+
327
+ class _BaseDeleteConnectionProfile:
328
+ def __hash__(self): # pragma: NO COVER
329
+ return NotImplementedError("__hash__ must be implemented.")
330
+
331
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
332
+
333
+ @classmethod
334
+ def _get_unset_required_fields(cls, message_dict):
335
+ return {
336
+ k: v
337
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
338
+ if k not in message_dict
339
+ }
340
+
341
+ @staticmethod
342
+ def _get_http_options():
343
+ http_options: List[Dict[str, str]] = [
344
+ {
345
+ "method": "delete",
346
+ "uri": "/v1alpha1/{name=projects/*/locations/*/connectionProfiles/*}",
347
+ },
348
+ ]
349
+ return http_options
350
+
351
+ @staticmethod
352
+ def _get_transcoded_request(http_options, request):
353
+ pb_request = datastream.DeleteConnectionProfileRequest.pb(request)
354
+ transcoded_request = path_template.transcode(http_options, pb_request)
355
+ return transcoded_request
356
+
357
+ @staticmethod
358
+ def _get_query_params_json(transcoded_request):
359
+ query_params = json.loads(
360
+ json_format.MessageToJson(
361
+ transcoded_request["query_params"],
362
+ use_integers_for_enums=True,
363
+ )
364
+ )
365
+ query_params.update(
366
+ _BaseDatastreamRestTransport._BaseDeleteConnectionProfile._get_unset_required_fields(
367
+ query_params
368
+ )
369
+ )
370
+
371
+ query_params["$alt"] = "json;enum-encoding=int"
372
+ return query_params
373
+
374
+ class _BaseDeletePrivateConnection:
375
+ def __hash__(self): # pragma: NO COVER
376
+ return NotImplementedError("__hash__ must be implemented.")
377
+
378
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
379
+
380
+ @classmethod
381
+ def _get_unset_required_fields(cls, message_dict):
382
+ return {
383
+ k: v
384
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
385
+ if k not in message_dict
386
+ }
387
+
388
+ @staticmethod
389
+ def _get_http_options():
390
+ http_options: List[Dict[str, str]] = [
391
+ {
392
+ "method": "delete",
393
+ "uri": "/v1alpha1/{name=projects/*/locations/*/privateConnections/*}",
394
+ },
395
+ ]
396
+ return http_options
397
+
398
+ @staticmethod
399
+ def _get_transcoded_request(http_options, request):
400
+ pb_request = datastream.DeletePrivateConnectionRequest.pb(request)
401
+ transcoded_request = path_template.transcode(http_options, pb_request)
402
+ return transcoded_request
403
+
404
+ @staticmethod
405
+ def _get_query_params_json(transcoded_request):
406
+ query_params = json.loads(
407
+ json_format.MessageToJson(
408
+ transcoded_request["query_params"],
409
+ use_integers_for_enums=True,
410
+ )
411
+ )
412
+ query_params.update(
413
+ _BaseDatastreamRestTransport._BaseDeletePrivateConnection._get_unset_required_fields(
414
+ query_params
415
+ )
416
+ )
417
+
418
+ query_params["$alt"] = "json;enum-encoding=int"
419
+ return query_params
420
+
421
+ class _BaseDeleteRoute:
422
+ def __hash__(self): # pragma: NO COVER
423
+ return NotImplementedError("__hash__ must be implemented.")
424
+
425
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
426
+
427
+ @classmethod
428
+ def _get_unset_required_fields(cls, message_dict):
429
+ return {
430
+ k: v
431
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
432
+ if k not in message_dict
433
+ }
434
+
435
+ @staticmethod
436
+ def _get_http_options():
437
+ http_options: List[Dict[str, str]] = [
438
+ {
439
+ "method": "delete",
440
+ "uri": "/v1alpha1/{name=projects/*/locations/*/privateConnections/*/routes/*}",
441
+ },
442
+ ]
443
+ return http_options
444
+
445
+ @staticmethod
446
+ def _get_transcoded_request(http_options, request):
447
+ pb_request = datastream.DeleteRouteRequest.pb(request)
448
+ transcoded_request = path_template.transcode(http_options, pb_request)
449
+ return transcoded_request
450
+
451
+ @staticmethod
452
+ def _get_query_params_json(transcoded_request):
453
+ query_params = json.loads(
454
+ json_format.MessageToJson(
455
+ transcoded_request["query_params"],
456
+ use_integers_for_enums=True,
457
+ )
458
+ )
459
+ query_params.update(
460
+ _BaseDatastreamRestTransport._BaseDeleteRoute._get_unset_required_fields(
461
+ query_params
462
+ )
463
+ )
464
+
465
+ query_params["$alt"] = "json;enum-encoding=int"
466
+ return query_params
467
+
468
+ class _BaseDeleteStream:
469
+ def __hash__(self): # pragma: NO COVER
470
+ return NotImplementedError("__hash__ must be implemented.")
471
+
472
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
473
+
474
+ @classmethod
475
+ def _get_unset_required_fields(cls, message_dict):
476
+ return {
477
+ k: v
478
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
479
+ if k not in message_dict
480
+ }
481
+
482
+ @staticmethod
483
+ def _get_http_options():
484
+ http_options: List[Dict[str, str]] = [
485
+ {
486
+ "method": "delete",
487
+ "uri": "/v1alpha1/{name=projects/*/locations/*/streams/*}",
488
+ },
489
+ ]
490
+ return http_options
491
+
492
+ @staticmethod
493
+ def _get_transcoded_request(http_options, request):
494
+ pb_request = datastream.DeleteStreamRequest.pb(request)
495
+ transcoded_request = path_template.transcode(http_options, pb_request)
496
+ return transcoded_request
497
+
498
+ @staticmethod
499
+ def _get_query_params_json(transcoded_request):
500
+ query_params = json.loads(
501
+ json_format.MessageToJson(
502
+ transcoded_request["query_params"],
503
+ use_integers_for_enums=True,
504
+ )
505
+ )
506
+ query_params.update(
507
+ _BaseDatastreamRestTransport._BaseDeleteStream._get_unset_required_fields(
508
+ query_params
509
+ )
510
+ )
511
+
512
+ query_params["$alt"] = "json;enum-encoding=int"
513
+ return query_params
514
+
515
+ class _BaseDiscoverConnectionProfile:
516
+ def __hash__(self): # pragma: NO COVER
517
+ return NotImplementedError("__hash__ must be implemented.")
518
+
519
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
520
+
521
+ @classmethod
522
+ def _get_unset_required_fields(cls, message_dict):
523
+ return {
524
+ k: v
525
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
526
+ if k not in message_dict
527
+ }
528
+
529
+ @staticmethod
530
+ def _get_http_options():
531
+ http_options: List[Dict[str, str]] = [
532
+ {
533
+ "method": "post",
534
+ "uri": "/v1alpha1/{parent=projects/*/locations/*}/connectionProfiles:discover",
535
+ "body": "*",
536
+ },
537
+ ]
538
+ return http_options
539
+
540
+ @staticmethod
541
+ def _get_transcoded_request(http_options, request):
542
+ pb_request = datastream.DiscoverConnectionProfileRequest.pb(request)
543
+ transcoded_request = path_template.transcode(http_options, pb_request)
544
+ return transcoded_request
545
+
546
+ @staticmethod
547
+ def _get_request_body_json(transcoded_request):
548
+ # Jsonify the request body
549
+
550
+ body = json_format.MessageToJson(
551
+ transcoded_request["body"], use_integers_for_enums=True
552
+ )
553
+ return body
554
+
555
+ @staticmethod
556
+ def _get_query_params_json(transcoded_request):
557
+ query_params = json.loads(
558
+ json_format.MessageToJson(
559
+ transcoded_request["query_params"],
560
+ use_integers_for_enums=True,
561
+ )
562
+ )
563
+ query_params.update(
564
+ _BaseDatastreamRestTransport._BaseDiscoverConnectionProfile._get_unset_required_fields(
565
+ query_params
566
+ )
567
+ )
568
+
569
+ query_params["$alt"] = "json;enum-encoding=int"
570
+ return query_params
571
+
572
+ class _BaseFetchErrors:
573
+ def __hash__(self): # pragma: NO COVER
574
+ return NotImplementedError("__hash__ must be implemented.")
575
+
576
+ @staticmethod
577
+ def _get_http_options():
578
+ http_options: List[Dict[str, str]] = [
579
+ {
580
+ "method": "post",
581
+ "uri": "/v1alpha1/{stream=projects/*/locations/*/streams/*}:fetchErrors",
582
+ "body": "*",
583
+ },
584
+ ]
585
+ return http_options
586
+
587
+ @staticmethod
588
+ def _get_transcoded_request(http_options, request):
589
+ pb_request = datastream.FetchErrorsRequest.pb(request)
590
+ transcoded_request = path_template.transcode(http_options, pb_request)
591
+ return transcoded_request
592
+
593
+ @staticmethod
594
+ def _get_request_body_json(transcoded_request):
595
+ # Jsonify the request body
596
+
597
+ body = json_format.MessageToJson(
598
+ transcoded_request["body"], use_integers_for_enums=True
599
+ )
600
+ return body
601
+
602
+ @staticmethod
603
+ def _get_query_params_json(transcoded_request):
604
+ query_params = json.loads(
605
+ json_format.MessageToJson(
606
+ transcoded_request["query_params"],
607
+ use_integers_for_enums=True,
608
+ )
609
+ )
610
+
611
+ query_params["$alt"] = "json;enum-encoding=int"
612
+ return query_params
613
+
614
+ class _BaseFetchStaticIps:
615
+ def __hash__(self): # pragma: NO COVER
616
+ return NotImplementedError("__hash__ must be implemented.")
617
+
618
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
619
+
620
+ @classmethod
621
+ def _get_unset_required_fields(cls, message_dict):
622
+ return {
623
+ k: v
624
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
625
+ if k not in message_dict
626
+ }
627
+
628
+ @staticmethod
629
+ def _get_http_options():
630
+ http_options: List[Dict[str, str]] = [
631
+ {
632
+ "method": "get",
633
+ "uri": "/v1alpha1/{name=projects/*/locations/*}:fetchStaticIps",
634
+ },
635
+ ]
636
+ return http_options
637
+
638
+ @staticmethod
639
+ def _get_transcoded_request(http_options, request):
640
+ pb_request = datastream.FetchStaticIpsRequest.pb(request)
641
+ transcoded_request = path_template.transcode(http_options, pb_request)
642
+ return transcoded_request
643
+
644
+ @staticmethod
645
+ def _get_query_params_json(transcoded_request):
646
+ query_params = json.loads(
647
+ json_format.MessageToJson(
648
+ transcoded_request["query_params"],
649
+ use_integers_for_enums=True,
650
+ )
651
+ )
652
+ query_params.update(
653
+ _BaseDatastreamRestTransport._BaseFetchStaticIps._get_unset_required_fields(
654
+ query_params
655
+ )
656
+ )
657
+
658
+ query_params["$alt"] = "json;enum-encoding=int"
659
+ return query_params
660
+
661
+ class _BaseGetConnectionProfile:
662
+ def __hash__(self): # pragma: NO COVER
663
+ return NotImplementedError("__hash__ must be implemented.")
664
+
665
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
666
+
667
+ @classmethod
668
+ def _get_unset_required_fields(cls, message_dict):
669
+ return {
670
+ k: v
671
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
672
+ if k not in message_dict
673
+ }
674
+
675
+ @staticmethod
676
+ def _get_http_options():
677
+ http_options: List[Dict[str, str]] = [
678
+ {
679
+ "method": "get",
680
+ "uri": "/v1alpha1/{name=projects/*/locations/*/connectionProfiles/*}",
681
+ },
682
+ ]
683
+ return http_options
684
+
685
+ @staticmethod
686
+ def _get_transcoded_request(http_options, request):
687
+ pb_request = datastream.GetConnectionProfileRequest.pb(request)
688
+ transcoded_request = path_template.transcode(http_options, pb_request)
689
+ return transcoded_request
690
+
691
+ @staticmethod
692
+ def _get_query_params_json(transcoded_request):
693
+ query_params = json.loads(
694
+ json_format.MessageToJson(
695
+ transcoded_request["query_params"],
696
+ use_integers_for_enums=True,
697
+ )
698
+ )
699
+ query_params.update(
700
+ _BaseDatastreamRestTransport._BaseGetConnectionProfile._get_unset_required_fields(
701
+ query_params
702
+ )
703
+ )
704
+
705
+ query_params["$alt"] = "json;enum-encoding=int"
706
+ return query_params
707
+
708
+ class _BaseGetPrivateConnection:
709
+ def __hash__(self): # pragma: NO COVER
710
+ return NotImplementedError("__hash__ must be implemented.")
711
+
712
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
713
+
714
+ @classmethod
715
+ def _get_unset_required_fields(cls, message_dict):
716
+ return {
717
+ k: v
718
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
719
+ if k not in message_dict
720
+ }
721
+
722
+ @staticmethod
723
+ def _get_http_options():
724
+ http_options: List[Dict[str, str]] = [
725
+ {
726
+ "method": "get",
727
+ "uri": "/v1alpha1/{name=projects/*/locations/*/privateConnections/*}",
728
+ },
729
+ ]
730
+ return http_options
731
+
732
+ @staticmethod
733
+ def _get_transcoded_request(http_options, request):
734
+ pb_request = datastream.GetPrivateConnectionRequest.pb(request)
735
+ transcoded_request = path_template.transcode(http_options, pb_request)
736
+ return transcoded_request
737
+
738
+ @staticmethod
739
+ def _get_query_params_json(transcoded_request):
740
+ query_params = json.loads(
741
+ json_format.MessageToJson(
742
+ transcoded_request["query_params"],
743
+ use_integers_for_enums=True,
744
+ )
745
+ )
746
+ query_params.update(
747
+ _BaseDatastreamRestTransport._BaseGetPrivateConnection._get_unset_required_fields(
748
+ query_params
749
+ )
750
+ )
751
+
752
+ query_params["$alt"] = "json;enum-encoding=int"
753
+ return query_params
754
+
755
+ class _BaseGetRoute:
756
+ def __hash__(self): # pragma: NO COVER
757
+ return NotImplementedError("__hash__ must be implemented.")
758
+
759
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
760
+
761
+ @classmethod
762
+ def _get_unset_required_fields(cls, message_dict):
763
+ return {
764
+ k: v
765
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
766
+ if k not in message_dict
767
+ }
768
+
769
+ @staticmethod
770
+ def _get_http_options():
771
+ http_options: List[Dict[str, str]] = [
772
+ {
773
+ "method": "get",
774
+ "uri": "/v1alpha1/{name=projects/*/locations/*/privateConnections/*/routes/*}",
775
+ },
776
+ ]
777
+ return http_options
778
+
779
+ @staticmethod
780
+ def _get_transcoded_request(http_options, request):
781
+ pb_request = datastream.GetRouteRequest.pb(request)
782
+ transcoded_request = path_template.transcode(http_options, pb_request)
783
+ return transcoded_request
784
+
785
+ @staticmethod
786
+ def _get_query_params_json(transcoded_request):
787
+ query_params = json.loads(
788
+ json_format.MessageToJson(
789
+ transcoded_request["query_params"],
790
+ use_integers_for_enums=True,
791
+ )
792
+ )
793
+ query_params.update(
794
+ _BaseDatastreamRestTransport._BaseGetRoute._get_unset_required_fields(
795
+ query_params
796
+ )
797
+ )
798
+
799
+ query_params["$alt"] = "json;enum-encoding=int"
800
+ return query_params
801
+
802
+ class _BaseGetStream:
803
+ def __hash__(self): # pragma: NO COVER
804
+ return NotImplementedError("__hash__ must be implemented.")
805
+
806
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
807
+
808
+ @classmethod
809
+ def _get_unset_required_fields(cls, message_dict):
810
+ return {
811
+ k: v
812
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
813
+ if k not in message_dict
814
+ }
815
+
816
+ @staticmethod
817
+ def _get_http_options():
818
+ http_options: List[Dict[str, str]] = [
819
+ {
820
+ "method": "get",
821
+ "uri": "/v1alpha1/{name=projects/*/locations/*/streams/*}",
822
+ },
823
+ ]
824
+ return http_options
825
+
826
+ @staticmethod
827
+ def _get_transcoded_request(http_options, request):
828
+ pb_request = datastream.GetStreamRequest.pb(request)
829
+ transcoded_request = path_template.transcode(http_options, pb_request)
830
+ return transcoded_request
831
+
832
+ @staticmethod
833
+ def _get_query_params_json(transcoded_request):
834
+ query_params = json.loads(
835
+ json_format.MessageToJson(
836
+ transcoded_request["query_params"],
837
+ use_integers_for_enums=True,
838
+ )
839
+ )
840
+ query_params.update(
841
+ _BaseDatastreamRestTransport._BaseGetStream._get_unset_required_fields(
842
+ query_params
843
+ )
844
+ )
845
+
846
+ query_params["$alt"] = "json;enum-encoding=int"
847
+ return query_params
848
+
849
+ class _BaseListConnectionProfiles:
850
+ def __hash__(self): # pragma: NO COVER
851
+ return NotImplementedError("__hash__ must be implemented.")
852
+
853
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
854
+
855
+ @classmethod
856
+ def _get_unset_required_fields(cls, message_dict):
857
+ return {
858
+ k: v
859
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
860
+ if k not in message_dict
861
+ }
862
+
863
+ @staticmethod
864
+ def _get_http_options():
865
+ http_options: List[Dict[str, str]] = [
866
+ {
867
+ "method": "get",
868
+ "uri": "/v1alpha1/{parent=projects/*/locations/*}/connectionProfiles",
869
+ },
870
+ ]
871
+ return http_options
872
+
873
+ @staticmethod
874
+ def _get_transcoded_request(http_options, request):
875
+ pb_request = datastream.ListConnectionProfilesRequest.pb(request)
876
+ transcoded_request = path_template.transcode(http_options, pb_request)
877
+ return transcoded_request
878
+
879
+ @staticmethod
880
+ def _get_query_params_json(transcoded_request):
881
+ query_params = json.loads(
882
+ json_format.MessageToJson(
883
+ transcoded_request["query_params"],
884
+ use_integers_for_enums=True,
885
+ )
886
+ )
887
+ query_params.update(
888
+ _BaseDatastreamRestTransport._BaseListConnectionProfiles._get_unset_required_fields(
889
+ query_params
890
+ )
891
+ )
892
+
893
+ query_params["$alt"] = "json;enum-encoding=int"
894
+ return query_params
895
+
896
+ class _BaseListPrivateConnections:
897
+ def __hash__(self): # pragma: NO COVER
898
+ return NotImplementedError("__hash__ must be implemented.")
899
+
900
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
901
+
902
+ @classmethod
903
+ def _get_unset_required_fields(cls, message_dict):
904
+ return {
905
+ k: v
906
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
907
+ if k not in message_dict
908
+ }
909
+
910
+ @staticmethod
911
+ def _get_http_options():
912
+ http_options: List[Dict[str, str]] = [
913
+ {
914
+ "method": "get",
915
+ "uri": "/v1alpha1/{parent=projects/*/locations/*}/privateConnections",
916
+ },
917
+ ]
918
+ return http_options
919
+
920
+ @staticmethod
921
+ def _get_transcoded_request(http_options, request):
922
+ pb_request = datastream.ListPrivateConnectionsRequest.pb(request)
923
+ transcoded_request = path_template.transcode(http_options, pb_request)
924
+ return transcoded_request
925
+
926
+ @staticmethod
927
+ def _get_query_params_json(transcoded_request):
928
+ query_params = json.loads(
929
+ json_format.MessageToJson(
930
+ transcoded_request["query_params"],
931
+ use_integers_for_enums=True,
932
+ )
933
+ )
934
+ query_params.update(
935
+ _BaseDatastreamRestTransport._BaseListPrivateConnections._get_unset_required_fields(
936
+ query_params
937
+ )
938
+ )
939
+
940
+ query_params["$alt"] = "json;enum-encoding=int"
941
+ return query_params
942
+
943
+ class _BaseListRoutes:
944
+ def __hash__(self): # pragma: NO COVER
945
+ return NotImplementedError("__hash__ must be implemented.")
946
+
947
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
948
+
949
+ @classmethod
950
+ def _get_unset_required_fields(cls, message_dict):
951
+ return {
952
+ k: v
953
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
954
+ if k not in message_dict
955
+ }
956
+
957
+ @staticmethod
958
+ def _get_http_options():
959
+ http_options: List[Dict[str, str]] = [
960
+ {
961
+ "method": "get",
962
+ "uri": "/v1alpha1/{parent=projects/*/locations/*/privateConnections/*}/routes",
963
+ },
964
+ ]
965
+ return http_options
966
+
967
+ @staticmethod
968
+ def _get_transcoded_request(http_options, request):
969
+ pb_request = datastream.ListRoutesRequest.pb(request)
970
+ transcoded_request = path_template.transcode(http_options, pb_request)
971
+ return transcoded_request
972
+
973
+ @staticmethod
974
+ def _get_query_params_json(transcoded_request):
975
+ query_params = json.loads(
976
+ json_format.MessageToJson(
977
+ transcoded_request["query_params"],
978
+ use_integers_for_enums=True,
979
+ )
980
+ )
981
+ query_params.update(
982
+ _BaseDatastreamRestTransport._BaseListRoutes._get_unset_required_fields(
983
+ query_params
984
+ )
985
+ )
986
+
987
+ query_params["$alt"] = "json;enum-encoding=int"
988
+ return query_params
989
+
990
+ class _BaseListStreams:
991
+ def __hash__(self): # pragma: NO COVER
992
+ return NotImplementedError("__hash__ must be implemented.")
993
+
994
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
995
+
996
+ @classmethod
997
+ def _get_unset_required_fields(cls, message_dict):
998
+ return {
999
+ k: v
1000
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
1001
+ if k not in message_dict
1002
+ }
1003
+
1004
+ @staticmethod
1005
+ def _get_http_options():
1006
+ http_options: List[Dict[str, str]] = [
1007
+ {
1008
+ "method": "get",
1009
+ "uri": "/v1alpha1/{parent=projects/*/locations/*}/streams",
1010
+ },
1011
+ ]
1012
+ return http_options
1013
+
1014
+ @staticmethod
1015
+ def _get_transcoded_request(http_options, request):
1016
+ pb_request = datastream.ListStreamsRequest.pb(request)
1017
+ transcoded_request = path_template.transcode(http_options, pb_request)
1018
+ return transcoded_request
1019
+
1020
+ @staticmethod
1021
+ def _get_query_params_json(transcoded_request):
1022
+ query_params = json.loads(
1023
+ json_format.MessageToJson(
1024
+ transcoded_request["query_params"],
1025
+ use_integers_for_enums=True,
1026
+ )
1027
+ )
1028
+ query_params.update(
1029
+ _BaseDatastreamRestTransport._BaseListStreams._get_unset_required_fields(
1030
+ query_params
1031
+ )
1032
+ )
1033
+
1034
+ query_params["$alt"] = "json;enum-encoding=int"
1035
+ return query_params
1036
+
1037
+ class _BaseUpdateConnectionProfile:
1038
+ def __hash__(self): # pragma: NO COVER
1039
+ return NotImplementedError("__hash__ must be implemented.")
1040
+
1041
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
1042
+
1043
+ @classmethod
1044
+ def _get_unset_required_fields(cls, message_dict):
1045
+ return {
1046
+ k: v
1047
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
1048
+ if k not in message_dict
1049
+ }
1050
+
1051
+ @staticmethod
1052
+ def _get_http_options():
1053
+ http_options: List[Dict[str, str]] = [
1054
+ {
1055
+ "method": "patch",
1056
+ "uri": "/v1alpha1/{connection_profile.name=projects/*/locations/*/connectionProfiles/*}",
1057
+ "body": "connection_profile",
1058
+ },
1059
+ ]
1060
+ return http_options
1061
+
1062
+ @staticmethod
1063
+ def _get_transcoded_request(http_options, request):
1064
+ pb_request = datastream.UpdateConnectionProfileRequest.pb(request)
1065
+ transcoded_request = path_template.transcode(http_options, pb_request)
1066
+ return transcoded_request
1067
+
1068
+ @staticmethod
1069
+ def _get_request_body_json(transcoded_request):
1070
+ # Jsonify the request body
1071
+
1072
+ body = json_format.MessageToJson(
1073
+ transcoded_request["body"], use_integers_for_enums=True
1074
+ )
1075
+ return body
1076
+
1077
+ @staticmethod
1078
+ def _get_query_params_json(transcoded_request):
1079
+ query_params = json.loads(
1080
+ json_format.MessageToJson(
1081
+ transcoded_request["query_params"],
1082
+ use_integers_for_enums=True,
1083
+ )
1084
+ )
1085
+ query_params.update(
1086
+ _BaseDatastreamRestTransport._BaseUpdateConnectionProfile._get_unset_required_fields(
1087
+ query_params
1088
+ )
1089
+ )
1090
+
1091
+ query_params["$alt"] = "json;enum-encoding=int"
1092
+ return query_params
1093
+
1094
+ class _BaseUpdateStream:
1095
+ def __hash__(self): # pragma: NO COVER
1096
+ return NotImplementedError("__hash__ must be implemented.")
1097
+
1098
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
1099
+
1100
+ @classmethod
1101
+ def _get_unset_required_fields(cls, message_dict):
1102
+ return {
1103
+ k: v
1104
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
1105
+ if k not in message_dict
1106
+ }
1107
+
1108
+ @staticmethod
1109
+ def _get_http_options():
1110
+ http_options: List[Dict[str, str]] = [
1111
+ {
1112
+ "method": "patch",
1113
+ "uri": "/v1alpha1/{stream.name=projects/*/locations/*/streams/*}",
1114
+ "body": "stream",
1115
+ },
1116
+ ]
1117
+ return http_options
1118
+
1119
+ @staticmethod
1120
+ def _get_transcoded_request(http_options, request):
1121
+ pb_request = datastream.UpdateStreamRequest.pb(request)
1122
+ transcoded_request = path_template.transcode(http_options, pb_request)
1123
+ return transcoded_request
1124
+
1125
+ @staticmethod
1126
+ def _get_request_body_json(transcoded_request):
1127
+ # Jsonify the request body
1128
+
1129
+ body = json_format.MessageToJson(
1130
+ transcoded_request["body"], use_integers_for_enums=True
1131
+ )
1132
+ return body
1133
+
1134
+ @staticmethod
1135
+ def _get_query_params_json(transcoded_request):
1136
+ query_params = json.loads(
1137
+ json_format.MessageToJson(
1138
+ transcoded_request["query_params"],
1139
+ use_integers_for_enums=True,
1140
+ )
1141
+ )
1142
+ query_params.update(
1143
+ _BaseDatastreamRestTransport._BaseUpdateStream._get_unset_required_fields(
1144
+ query_params
1145
+ )
1146
+ )
1147
+
1148
+ query_params["$alt"] = "json;enum-encoding=int"
1149
+ return query_params
1150
+
1151
+
1152
+ __all__ = ("_BaseDatastreamRestTransport",)