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,1078 @@
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 inspect
17
+ import json
18
+ import logging as std_logging
19
+ import pickle
20
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
21
+ import warnings
22
+
23
+ from google.api_core import exceptions as core_exceptions
24
+ from google.api_core import gapic_v1, grpc_helpers_async, operations_v1
25
+ from google.api_core import retry_async as retries
26
+ from google.auth import credentials as ga_credentials # type: ignore
27
+ from google.auth.transport.grpc import SslCredentials # type: ignore
28
+ from google.longrunning import operations_pb2 # type: ignore
29
+ from google.protobuf.json_format import MessageToJson
30
+ import google.protobuf.message
31
+ import grpc # type: ignore
32
+ from grpc.experimental import aio # type: ignore
33
+ import proto # type: ignore
34
+
35
+ from google.cloud.datastream_v1alpha1.types import datastream, datastream_resources
36
+
37
+ from .base import DEFAULT_CLIENT_INFO, DatastreamTransport
38
+ from .grpc import DatastreamGrpcTransport
39
+
40
+ try:
41
+ from google.api_core import client_logging # type: ignore
42
+
43
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
44
+ except ImportError: # pragma: NO COVER
45
+ CLIENT_LOGGING_SUPPORTED = False
46
+
47
+ _LOGGER = std_logging.getLogger(__name__)
48
+
49
+
50
+ class _LoggingClientAIOInterceptor(
51
+ grpc.aio.UnaryUnaryClientInterceptor
52
+ ): # pragma: NO COVER
53
+ async def intercept_unary_unary(self, continuation, client_call_details, request):
54
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
55
+ std_logging.DEBUG
56
+ )
57
+ if logging_enabled: # pragma: NO COVER
58
+ request_metadata = client_call_details.metadata
59
+ if isinstance(request, proto.Message):
60
+ request_payload = type(request).to_json(request)
61
+ elif isinstance(request, google.protobuf.message.Message):
62
+ request_payload = MessageToJson(request)
63
+ else:
64
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
65
+
66
+ request_metadata = {
67
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
68
+ for key, value in request_metadata
69
+ }
70
+ grpc_request = {
71
+ "payload": request_payload,
72
+ "requestMethod": "grpc",
73
+ "metadata": dict(request_metadata),
74
+ }
75
+ _LOGGER.debug(
76
+ f"Sending request for {client_call_details.method}",
77
+ extra={
78
+ "serviceName": "google.cloud.datastream.v1alpha1.Datastream",
79
+ "rpcName": str(client_call_details.method),
80
+ "request": grpc_request,
81
+ "metadata": grpc_request["metadata"],
82
+ },
83
+ )
84
+ response = await continuation(client_call_details, request)
85
+ if logging_enabled: # pragma: NO COVER
86
+ response_metadata = await response.trailing_metadata()
87
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
88
+ metadata = (
89
+ dict([(k, str(v)) for k, v in response_metadata])
90
+ if response_metadata
91
+ else None
92
+ )
93
+ result = await response
94
+ if isinstance(result, proto.Message):
95
+ response_payload = type(result).to_json(result)
96
+ elif isinstance(result, google.protobuf.message.Message):
97
+ response_payload = MessageToJson(result)
98
+ else:
99
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
100
+ grpc_response = {
101
+ "payload": response_payload,
102
+ "metadata": metadata,
103
+ "status": "OK",
104
+ }
105
+ _LOGGER.debug(
106
+ f"Received response to rpc {client_call_details.method}.",
107
+ extra={
108
+ "serviceName": "google.cloud.datastream.v1alpha1.Datastream",
109
+ "rpcName": str(client_call_details.method),
110
+ "response": grpc_response,
111
+ "metadata": grpc_response["metadata"],
112
+ },
113
+ )
114
+ return response
115
+
116
+
117
+ class DatastreamGrpcAsyncIOTransport(DatastreamTransport):
118
+ """gRPC AsyncIO backend transport for Datastream.
119
+
120
+ Datastream service
121
+
122
+ This class defines the same methods as the primary client, so the
123
+ primary client can load the underlying transport implementation
124
+ and call it.
125
+
126
+ It sends protocol buffers over the wire using gRPC (which is built on
127
+ top of HTTP/2); the ``grpcio`` package must be installed.
128
+ """
129
+
130
+ _grpc_channel: aio.Channel
131
+ _stubs: Dict[str, Callable] = {}
132
+
133
+ @classmethod
134
+ def create_channel(
135
+ cls,
136
+ host: str = "datastream.googleapis.com",
137
+ credentials: Optional[ga_credentials.Credentials] = None,
138
+ credentials_file: Optional[str] = None,
139
+ scopes: Optional[Sequence[str]] = None,
140
+ quota_project_id: Optional[str] = None,
141
+ **kwargs,
142
+ ) -> aio.Channel:
143
+ """Create and return a gRPC AsyncIO channel object.
144
+ Args:
145
+ host (Optional[str]): The host for the channel to use.
146
+ credentials (Optional[~.Credentials]): The
147
+ authorization credentials to attach to requests. These
148
+ credentials identify this application to the service. If
149
+ none are specified, the client will attempt to ascertain
150
+ the credentials from the environment.
151
+ credentials_file (Optional[str]): A file with credentials that can
152
+ be loaded with :func:`google.auth.load_credentials_from_file`.
153
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
154
+ service. These are only used when credentials are not specified and
155
+ are passed to :func:`google.auth.default`.
156
+ quota_project_id (Optional[str]): An optional project to use for billing
157
+ and quota.
158
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
159
+ channel creation.
160
+ Returns:
161
+ aio.Channel: A gRPC AsyncIO channel object.
162
+ """
163
+
164
+ return grpc_helpers_async.create_channel(
165
+ host,
166
+ credentials=credentials,
167
+ credentials_file=credentials_file,
168
+ quota_project_id=quota_project_id,
169
+ default_scopes=cls.AUTH_SCOPES,
170
+ scopes=scopes,
171
+ default_host=cls.DEFAULT_HOST,
172
+ **kwargs,
173
+ )
174
+
175
+ def __init__(
176
+ self,
177
+ *,
178
+ host: str = "datastream.googleapis.com",
179
+ credentials: Optional[ga_credentials.Credentials] = None,
180
+ credentials_file: Optional[str] = None,
181
+ scopes: Optional[Sequence[str]] = None,
182
+ channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
183
+ api_mtls_endpoint: Optional[str] = None,
184
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
185
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
186
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
187
+ quota_project_id: Optional[str] = None,
188
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
189
+ always_use_jwt_access: Optional[bool] = False,
190
+ api_audience: Optional[str] = None,
191
+ ) -> None:
192
+ """Instantiate the transport.
193
+
194
+ Args:
195
+ host (Optional[str]):
196
+ The hostname to connect to (default: 'datastream.googleapis.com').
197
+ credentials (Optional[google.auth.credentials.Credentials]): The
198
+ authorization credentials to attach to requests. These
199
+ credentials identify the application to the service; if none
200
+ are specified, the client will attempt to ascertain the
201
+ credentials from the environment.
202
+ This argument is ignored if a ``channel`` instance is provided.
203
+ credentials_file (Optional[str]): A file with credentials that can
204
+ be loaded with :func:`google.auth.load_credentials_from_file`.
205
+ This argument is ignored if a ``channel`` instance is provided.
206
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
207
+ service. These are only used when credentials are not specified and
208
+ are passed to :func:`google.auth.default`.
209
+ channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
210
+ A ``Channel`` instance through which to make calls, or a Callable
211
+ that constructs and returns one. If set to None, ``self.create_channel``
212
+ is used to create the channel. If a Callable is given, it will be called
213
+ with the same arguments as used in ``self.create_channel``.
214
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
215
+ If provided, it overrides the ``host`` argument and tries to create
216
+ a mutual TLS channel with client SSL credentials from
217
+ ``client_cert_source`` or application default SSL credentials.
218
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
219
+ Deprecated. A callback to provide client SSL certificate bytes and
220
+ private key bytes, both in PEM format. It is ignored if
221
+ ``api_mtls_endpoint`` is None.
222
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
223
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
224
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
225
+ A callback to provide client certificate bytes and private key bytes,
226
+ both in PEM format. It is used to configure a mutual TLS channel. It is
227
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
228
+ quota_project_id (Optional[str]): An optional project to use for billing
229
+ and quota.
230
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
231
+ The client info used to send a user-agent string along with
232
+ API requests. If ``None``, then default info will be used.
233
+ Generally, you only need to set this if you're developing
234
+ your own client library.
235
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
236
+ be used for service account credentials.
237
+
238
+ Raises:
239
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
240
+ creation failed for any reason.
241
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
242
+ and ``credentials_file`` are passed.
243
+ """
244
+ self._grpc_channel = None
245
+ self._ssl_channel_credentials = ssl_channel_credentials
246
+ self._stubs: Dict[str, Callable] = {}
247
+ self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None
248
+
249
+ if api_mtls_endpoint:
250
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
251
+ if client_cert_source:
252
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
253
+
254
+ if isinstance(channel, aio.Channel):
255
+ # Ignore credentials if a channel was passed.
256
+ credentials = None
257
+ self._ignore_credentials = True
258
+ # If a channel was explicitly provided, set it.
259
+ self._grpc_channel = channel
260
+ self._ssl_channel_credentials = None
261
+ else:
262
+ if api_mtls_endpoint:
263
+ host = api_mtls_endpoint
264
+
265
+ # Create SSL credentials with client_cert_source or application
266
+ # default SSL credentials.
267
+ if client_cert_source:
268
+ cert, key = client_cert_source()
269
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
270
+ certificate_chain=cert, private_key=key
271
+ )
272
+ else:
273
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
274
+
275
+ else:
276
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
277
+ cert, key = client_cert_source_for_mtls()
278
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
279
+ certificate_chain=cert, private_key=key
280
+ )
281
+
282
+ # The base transport sets the host, credentials and scopes
283
+ super().__init__(
284
+ host=host,
285
+ credentials=credentials,
286
+ credentials_file=credentials_file,
287
+ scopes=scopes,
288
+ quota_project_id=quota_project_id,
289
+ client_info=client_info,
290
+ always_use_jwt_access=always_use_jwt_access,
291
+ api_audience=api_audience,
292
+ )
293
+
294
+ if not self._grpc_channel:
295
+ # initialize with the provided callable or the default channel
296
+ channel_init = channel or type(self).create_channel
297
+ self._grpc_channel = channel_init(
298
+ self._host,
299
+ # use the credentials which are saved
300
+ credentials=self._credentials,
301
+ # Set ``credentials_file`` to ``None`` here as
302
+ # the credentials that we saved earlier should be used.
303
+ credentials_file=None,
304
+ scopes=self._scopes,
305
+ ssl_credentials=self._ssl_channel_credentials,
306
+ quota_project_id=quota_project_id,
307
+ options=[
308
+ ("grpc.max_send_message_length", -1),
309
+ ("grpc.max_receive_message_length", -1),
310
+ ],
311
+ )
312
+
313
+ self._interceptor = _LoggingClientAIOInterceptor()
314
+ self._grpc_channel._unary_unary_interceptors.append(self._interceptor)
315
+ self._logged_channel = self._grpc_channel
316
+ self._wrap_with_kind = (
317
+ "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
318
+ )
319
+ # Wrap messages. This must be done after self._logged_channel exists
320
+ self._prep_wrapped_messages(client_info)
321
+
322
+ @property
323
+ def grpc_channel(self) -> aio.Channel:
324
+ """Create the channel designed to connect to this service.
325
+
326
+ This property caches on the instance; repeated calls return
327
+ the same channel.
328
+ """
329
+ # Return the channel from cache.
330
+ return self._grpc_channel
331
+
332
+ @property
333
+ def operations_client(self) -> operations_v1.OperationsAsyncClient:
334
+ """Create the client designed to process long-running operations.
335
+
336
+ This property caches on the instance; repeated calls return the same
337
+ client.
338
+ """
339
+ # Quick check: Only create a new client if we do not already have one.
340
+ if self._operations_client is None:
341
+ self._operations_client = operations_v1.OperationsAsyncClient(
342
+ self._logged_channel
343
+ )
344
+
345
+ # Return the client from cache.
346
+ return self._operations_client
347
+
348
+ @property
349
+ def list_connection_profiles(
350
+ self,
351
+ ) -> Callable[
352
+ [datastream.ListConnectionProfilesRequest],
353
+ Awaitable[datastream.ListConnectionProfilesResponse],
354
+ ]:
355
+ r"""Return a callable for the list connection profiles method over gRPC.
356
+
357
+ Use this method to list connection profiles created
358
+ in a project and location.
359
+
360
+ Returns:
361
+ Callable[[~.ListConnectionProfilesRequest],
362
+ Awaitable[~.ListConnectionProfilesResponse]]:
363
+ A function that, when called, will call the underlying RPC
364
+ on the server.
365
+ """
366
+ # Generate a "stub function" on-the-fly which will actually make
367
+ # the request.
368
+ # gRPC handles serialization and deserialization, so we just need
369
+ # to pass in the functions for each.
370
+ if "list_connection_profiles" not in self._stubs:
371
+ self._stubs["list_connection_profiles"] = self._logged_channel.unary_unary(
372
+ "/google.cloud.datastream.v1alpha1.Datastream/ListConnectionProfiles",
373
+ request_serializer=datastream.ListConnectionProfilesRequest.serialize,
374
+ response_deserializer=datastream.ListConnectionProfilesResponse.deserialize,
375
+ )
376
+ return self._stubs["list_connection_profiles"]
377
+
378
+ @property
379
+ def get_connection_profile(
380
+ self,
381
+ ) -> Callable[
382
+ [datastream.GetConnectionProfileRequest],
383
+ Awaitable[datastream_resources.ConnectionProfile],
384
+ ]:
385
+ r"""Return a callable for the get connection profile method over gRPC.
386
+
387
+ Use this method to get details about a connection
388
+ profile.
389
+
390
+ Returns:
391
+ Callable[[~.GetConnectionProfileRequest],
392
+ Awaitable[~.ConnectionProfile]]:
393
+ A function that, when called, will call the underlying RPC
394
+ on the server.
395
+ """
396
+ # Generate a "stub function" on-the-fly which will actually make
397
+ # the request.
398
+ # gRPC handles serialization and deserialization, so we just need
399
+ # to pass in the functions for each.
400
+ if "get_connection_profile" not in self._stubs:
401
+ self._stubs["get_connection_profile"] = self._logged_channel.unary_unary(
402
+ "/google.cloud.datastream.v1alpha1.Datastream/GetConnectionProfile",
403
+ request_serializer=datastream.GetConnectionProfileRequest.serialize,
404
+ response_deserializer=datastream_resources.ConnectionProfile.deserialize,
405
+ )
406
+ return self._stubs["get_connection_profile"]
407
+
408
+ @property
409
+ def create_connection_profile(
410
+ self,
411
+ ) -> Callable[
412
+ [datastream.CreateConnectionProfileRequest], Awaitable[operations_pb2.Operation]
413
+ ]:
414
+ r"""Return a callable for the create connection profile method over gRPC.
415
+
416
+ Use this method to create a connection profile in a
417
+ project and location.
418
+
419
+ Returns:
420
+ Callable[[~.CreateConnectionProfileRequest],
421
+ Awaitable[~.Operation]]:
422
+ A function that, when called, will call the underlying RPC
423
+ on the server.
424
+ """
425
+ # Generate a "stub function" on-the-fly which will actually make
426
+ # the request.
427
+ # gRPC handles serialization and deserialization, so we just need
428
+ # to pass in the functions for each.
429
+ if "create_connection_profile" not in self._stubs:
430
+ self._stubs["create_connection_profile"] = self._logged_channel.unary_unary(
431
+ "/google.cloud.datastream.v1alpha1.Datastream/CreateConnectionProfile",
432
+ request_serializer=datastream.CreateConnectionProfileRequest.serialize,
433
+ response_deserializer=operations_pb2.Operation.FromString,
434
+ )
435
+ return self._stubs["create_connection_profile"]
436
+
437
+ @property
438
+ def update_connection_profile(
439
+ self,
440
+ ) -> Callable[
441
+ [datastream.UpdateConnectionProfileRequest], Awaitable[operations_pb2.Operation]
442
+ ]:
443
+ r"""Return a callable for the update connection profile method over gRPC.
444
+
445
+ Use this method to update the parameters of a
446
+ connection profile.
447
+
448
+ Returns:
449
+ Callable[[~.UpdateConnectionProfileRequest],
450
+ Awaitable[~.Operation]]:
451
+ A function that, when called, will call the underlying RPC
452
+ on the server.
453
+ """
454
+ # Generate a "stub function" on-the-fly which will actually make
455
+ # the request.
456
+ # gRPC handles serialization and deserialization, so we just need
457
+ # to pass in the functions for each.
458
+ if "update_connection_profile" not in self._stubs:
459
+ self._stubs["update_connection_profile"] = self._logged_channel.unary_unary(
460
+ "/google.cloud.datastream.v1alpha1.Datastream/UpdateConnectionProfile",
461
+ request_serializer=datastream.UpdateConnectionProfileRequest.serialize,
462
+ response_deserializer=operations_pb2.Operation.FromString,
463
+ )
464
+ return self._stubs["update_connection_profile"]
465
+
466
+ @property
467
+ def delete_connection_profile(
468
+ self,
469
+ ) -> Callable[
470
+ [datastream.DeleteConnectionProfileRequest], Awaitable[operations_pb2.Operation]
471
+ ]:
472
+ r"""Return a callable for the delete connection profile method over gRPC.
473
+
474
+ Use this method to delete a connection profile..
475
+
476
+ Returns:
477
+ Callable[[~.DeleteConnectionProfileRequest],
478
+ Awaitable[~.Operation]]:
479
+ A function that, when called, will call the underlying RPC
480
+ on the server.
481
+ """
482
+ # Generate a "stub function" on-the-fly which will actually make
483
+ # the request.
484
+ # gRPC handles serialization and deserialization, so we just need
485
+ # to pass in the functions for each.
486
+ if "delete_connection_profile" not in self._stubs:
487
+ self._stubs["delete_connection_profile"] = self._logged_channel.unary_unary(
488
+ "/google.cloud.datastream.v1alpha1.Datastream/DeleteConnectionProfile",
489
+ request_serializer=datastream.DeleteConnectionProfileRequest.serialize,
490
+ response_deserializer=operations_pb2.Operation.FromString,
491
+ )
492
+ return self._stubs["delete_connection_profile"]
493
+
494
+ @property
495
+ def discover_connection_profile(
496
+ self,
497
+ ) -> Callable[
498
+ [datastream.DiscoverConnectionProfileRequest],
499
+ Awaitable[datastream.DiscoverConnectionProfileResponse],
500
+ ]:
501
+ r"""Return a callable for the discover connection profile method over gRPC.
502
+
503
+ Use this method to discover a connection profile.
504
+ The discover API call exposes the data objects and
505
+ metadata belonging to the profile. Typically, a request
506
+ returns children data objects under a parent data object
507
+ that's optionally supplied in the request.
508
+
509
+ Returns:
510
+ Callable[[~.DiscoverConnectionProfileRequest],
511
+ Awaitable[~.DiscoverConnectionProfileResponse]]:
512
+ A function that, when called, will call the underlying RPC
513
+ on the server.
514
+ """
515
+ # Generate a "stub function" on-the-fly which will actually make
516
+ # the request.
517
+ # gRPC handles serialization and deserialization, so we just need
518
+ # to pass in the functions for each.
519
+ if "discover_connection_profile" not in self._stubs:
520
+ self._stubs[
521
+ "discover_connection_profile"
522
+ ] = self._logged_channel.unary_unary(
523
+ "/google.cloud.datastream.v1alpha1.Datastream/DiscoverConnectionProfile",
524
+ request_serializer=datastream.DiscoverConnectionProfileRequest.serialize,
525
+ response_deserializer=datastream.DiscoverConnectionProfileResponse.deserialize,
526
+ )
527
+ return self._stubs["discover_connection_profile"]
528
+
529
+ @property
530
+ def list_streams(
531
+ self,
532
+ ) -> Callable[
533
+ [datastream.ListStreamsRequest], Awaitable[datastream.ListStreamsResponse]
534
+ ]:
535
+ r"""Return a callable for the list streams method over gRPC.
536
+
537
+ Use this method to list streams in a project and
538
+ location.
539
+
540
+ Returns:
541
+ Callable[[~.ListStreamsRequest],
542
+ Awaitable[~.ListStreamsResponse]]:
543
+ A function that, when called, will call the underlying RPC
544
+ on the server.
545
+ """
546
+ # Generate a "stub function" on-the-fly which will actually make
547
+ # the request.
548
+ # gRPC handles serialization and deserialization, so we just need
549
+ # to pass in the functions for each.
550
+ if "list_streams" not in self._stubs:
551
+ self._stubs["list_streams"] = self._logged_channel.unary_unary(
552
+ "/google.cloud.datastream.v1alpha1.Datastream/ListStreams",
553
+ request_serializer=datastream.ListStreamsRequest.serialize,
554
+ response_deserializer=datastream.ListStreamsResponse.deserialize,
555
+ )
556
+ return self._stubs["list_streams"]
557
+
558
+ @property
559
+ def get_stream(
560
+ self,
561
+ ) -> Callable[
562
+ [datastream.GetStreamRequest], Awaitable[datastream_resources.Stream]
563
+ ]:
564
+ r"""Return a callable for the get stream method over gRPC.
565
+
566
+ Use this method to get details about a stream.
567
+
568
+ Returns:
569
+ Callable[[~.GetStreamRequest],
570
+ Awaitable[~.Stream]]:
571
+ A function that, when called, will call the underlying RPC
572
+ on the server.
573
+ """
574
+ # Generate a "stub function" on-the-fly which will actually make
575
+ # the request.
576
+ # gRPC handles serialization and deserialization, so we just need
577
+ # to pass in the functions for each.
578
+ if "get_stream" not in self._stubs:
579
+ self._stubs["get_stream"] = self._logged_channel.unary_unary(
580
+ "/google.cloud.datastream.v1alpha1.Datastream/GetStream",
581
+ request_serializer=datastream.GetStreamRequest.serialize,
582
+ response_deserializer=datastream_resources.Stream.deserialize,
583
+ )
584
+ return self._stubs["get_stream"]
585
+
586
+ @property
587
+ def create_stream(
588
+ self,
589
+ ) -> Callable[
590
+ [datastream.CreateStreamRequest], Awaitable[operations_pb2.Operation]
591
+ ]:
592
+ r"""Return a callable for the create stream method over gRPC.
593
+
594
+ Use this method to create a stream.
595
+
596
+ Returns:
597
+ Callable[[~.CreateStreamRequest],
598
+ Awaitable[~.Operation]]:
599
+ A function that, when called, will call the underlying RPC
600
+ on the server.
601
+ """
602
+ # Generate a "stub function" on-the-fly which will actually make
603
+ # the request.
604
+ # gRPC handles serialization and deserialization, so we just need
605
+ # to pass in the functions for each.
606
+ if "create_stream" not in self._stubs:
607
+ self._stubs["create_stream"] = self._logged_channel.unary_unary(
608
+ "/google.cloud.datastream.v1alpha1.Datastream/CreateStream",
609
+ request_serializer=datastream.CreateStreamRequest.serialize,
610
+ response_deserializer=operations_pb2.Operation.FromString,
611
+ )
612
+ return self._stubs["create_stream"]
613
+
614
+ @property
615
+ def update_stream(
616
+ self,
617
+ ) -> Callable[
618
+ [datastream.UpdateStreamRequest], Awaitable[operations_pb2.Operation]
619
+ ]:
620
+ r"""Return a callable for the update stream method over gRPC.
621
+
622
+ Use this method to update the configuration of a
623
+ stream.
624
+
625
+ Returns:
626
+ Callable[[~.UpdateStreamRequest],
627
+ Awaitable[~.Operation]]:
628
+ A function that, when called, will call the underlying RPC
629
+ on the server.
630
+ """
631
+ # Generate a "stub function" on-the-fly which will actually make
632
+ # the request.
633
+ # gRPC handles serialization and deserialization, so we just need
634
+ # to pass in the functions for each.
635
+ if "update_stream" not in self._stubs:
636
+ self._stubs["update_stream"] = self._logged_channel.unary_unary(
637
+ "/google.cloud.datastream.v1alpha1.Datastream/UpdateStream",
638
+ request_serializer=datastream.UpdateStreamRequest.serialize,
639
+ response_deserializer=operations_pb2.Operation.FromString,
640
+ )
641
+ return self._stubs["update_stream"]
642
+
643
+ @property
644
+ def delete_stream(
645
+ self,
646
+ ) -> Callable[
647
+ [datastream.DeleteStreamRequest], Awaitable[operations_pb2.Operation]
648
+ ]:
649
+ r"""Return a callable for the delete stream method over gRPC.
650
+
651
+ Use this method to delete a stream.
652
+
653
+ Returns:
654
+ Callable[[~.DeleteStreamRequest],
655
+ Awaitable[~.Operation]]:
656
+ A function that, when called, will call the underlying RPC
657
+ on the server.
658
+ """
659
+ # Generate a "stub function" on-the-fly which will actually make
660
+ # the request.
661
+ # gRPC handles serialization and deserialization, so we just need
662
+ # to pass in the functions for each.
663
+ if "delete_stream" not in self._stubs:
664
+ self._stubs["delete_stream"] = self._logged_channel.unary_unary(
665
+ "/google.cloud.datastream.v1alpha1.Datastream/DeleteStream",
666
+ request_serializer=datastream.DeleteStreamRequest.serialize,
667
+ response_deserializer=operations_pb2.Operation.FromString,
668
+ )
669
+ return self._stubs["delete_stream"]
670
+
671
+ @property
672
+ def fetch_errors(
673
+ self,
674
+ ) -> Callable[[datastream.FetchErrorsRequest], Awaitable[operations_pb2.Operation]]:
675
+ r"""Return a callable for the fetch errors method over gRPC.
676
+
677
+ Use this method to fetch any errors associated with a
678
+ stream.
679
+
680
+ Returns:
681
+ Callable[[~.FetchErrorsRequest],
682
+ Awaitable[~.Operation]]:
683
+ A function that, when called, will call the underlying RPC
684
+ on the server.
685
+ """
686
+ # Generate a "stub function" on-the-fly which will actually make
687
+ # the request.
688
+ # gRPC handles serialization and deserialization, so we just need
689
+ # to pass in the functions for each.
690
+ if "fetch_errors" not in self._stubs:
691
+ self._stubs["fetch_errors"] = self._logged_channel.unary_unary(
692
+ "/google.cloud.datastream.v1alpha1.Datastream/FetchErrors",
693
+ request_serializer=datastream.FetchErrorsRequest.serialize,
694
+ response_deserializer=operations_pb2.Operation.FromString,
695
+ )
696
+ return self._stubs["fetch_errors"]
697
+
698
+ @property
699
+ def fetch_static_ips(
700
+ self,
701
+ ) -> Callable[
702
+ [datastream.FetchStaticIpsRequest], Awaitable[datastream.FetchStaticIpsResponse]
703
+ ]:
704
+ r"""Return a callable for the fetch static ips method over gRPC.
705
+
706
+ The FetchStaticIps API call exposes the static ips
707
+ used by Datastream. Typically, a request returns
708
+ children data objects under a parent data object that's
709
+ optionally supplied in the request.
710
+
711
+ Returns:
712
+ Callable[[~.FetchStaticIpsRequest],
713
+ Awaitable[~.FetchStaticIpsResponse]]:
714
+ A function that, when called, will call the underlying RPC
715
+ on the server.
716
+ """
717
+ # Generate a "stub function" on-the-fly which will actually make
718
+ # the request.
719
+ # gRPC handles serialization and deserialization, so we just need
720
+ # to pass in the functions for each.
721
+ if "fetch_static_ips" not in self._stubs:
722
+ self._stubs["fetch_static_ips"] = self._logged_channel.unary_unary(
723
+ "/google.cloud.datastream.v1alpha1.Datastream/FetchStaticIps",
724
+ request_serializer=datastream.FetchStaticIpsRequest.serialize,
725
+ response_deserializer=datastream.FetchStaticIpsResponse.deserialize,
726
+ )
727
+ return self._stubs["fetch_static_ips"]
728
+
729
+ @property
730
+ def create_private_connection(
731
+ self,
732
+ ) -> Callable[
733
+ [datastream.CreatePrivateConnectionRequest], Awaitable[operations_pb2.Operation]
734
+ ]:
735
+ r"""Return a callable for the create private connection method over gRPC.
736
+
737
+ Use this method to create a private connectivity
738
+ configuration.
739
+
740
+ Returns:
741
+ Callable[[~.CreatePrivateConnectionRequest],
742
+ Awaitable[~.Operation]]:
743
+ A function that, when called, will call the underlying RPC
744
+ on the server.
745
+ """
746
+ # Generate a "stub function" on-the-fly which will actually make
747
+ # the request.
748
+ # gRPC handles serialization and deserialization, so we just need
749
+ # to pass in the functions for each.
750
+ if "create_private_connection" not in self._stubs:
751
+ self._stubs["create_private_connection"] = self._logged_channel.unary_unary(
752
+ "/google.cloud.datastream.v1alpha1.Datastream/CreatePrivateConnection",
753
+ request_serializer=datastream.CreatePrivateConnectionRequest.serialize,
754
+ response_deserializer=operations_pb2.Operation.FromString,
755
+ )
756
+ return self._stubs["create_private_connection"]
757
+
758
+ @property
759
+ def get_private_connection(
760
+ self,
761
+ ) -> Callable[
762
+ [datastream.GetPrivateConnectionRequest],
763
+ Awaitable[datastream_resources.PrivateConnection],
764
+ ]:
765
+ r"""Return a callable for the get private connection method over gRPC.
766
+
767
+ Use this method to get details about a private
768
+ connectivity configuration.
769
+
770
+ Returns:
771
+ Callable[[~.GetPrivateConnectionRequest],
772
+ Awaitable[~.PrivateConnection]]:
773
+ A function that, when called, will call the underlying RPC
774
+ on the server.
775
+ """
776
+ # Generate a "stub function" on-the-fly which will actually make
777
+ # the request.
778
+ # gRPC handles serialization and deserialization, so we just need
779
+ # to pass in the functions for each.
780
+ if "get_private_connection" not in self._stubs:
781
+ self._stubs["get_private_connection"] = self._logged_channel.unary_unary(
782
+ "/google.cloud.datastream.v1alpha1.Datastream/GetPrivateConnection",
783
+ request_serializer=datastream.GetPrivateConnectionRequest.serialize,
784
+ response_deserializer=datastream_resources.PrivateConnection.deserialize,
785
+ )
786
+ return self._stubs["get_private_connection"]
787
+
788
+ @property
789
+ def list_private_connections(
790
+ self,
791
+ ) -> Callable[
792
+ [datastream.ListPrivateConnectionsRequest],
793
+ Awaitable[datastream.ListPrivateConnectionsResponse],
794
+ ]:
795
+ r"""Return a callable for the list private connections method over gRPC.
796
+
797
+ Use this method to list private connectivity
798
+ configurations in a project and location.
799
+
800
+ Returns:
801
+ Callable[[~.ListPrivateConnectionsRequest],
802
+ Awaitable[~.ListPrivateConnectionsResponse]]:
803
+ A function that, when called, will call the underlying RPC
804
+ on the server.
805
+ """
806
+ # Generate a "stub function" on-the-fly which will actually make
807
+ # the request.
808
+ # gRPC handles serialization and deserialization, so we just need
809
+ # to pass in the functions for each.
810
+ if "list_private_connections" not in self._stubs:
811
+ self._stubs["list_private_connections"] = self._logged_channel.unary_unary(
812
+ "/google.cloud.datastream.v1alpha1.Datastream/ListPrivateConnections",
813
+ request_serializer=datastream.ListPrivateConnectionsRequest.serialize,
814
+ response_deserializer=datastream.ListPrivateConnectionsResponse.deserialize,
815
+ )
816
+ return self._stubs["list_private_connections"]
817
+
818
+ @property
819
+ def delete_private_connection(
820
+ self,
821
+ ) -> Callable[
822
+ [datastream.DeletePrivateConnectionRequest], Awaitable[operations_pb2.Operation]
823
+ ]:
824
+ r"""Return a callable for the delete private connection method over gRPC.
825
+
826
+ Use this method to delete a private connectivity
827
+ configuration.
828
+
829
+ Returns:
830
+ Callable[[~.DeletePrivateConnectionRequest],
831
+ Awaitable[~.Operation]]:
832
+ A function that, when called, will call the underlying RPC
833
+ on the server.
834
+ """
835
+ # Generate a "stub function" on-the-fly which will actually make
836
+ # the request.
837
+ # gRPC handles serialization and deserialization, so we just need
838
+ # to pass in the functions for each.
839
+ if "delete_private_connection" not in self._stubs:
840
+ self._stubs["delete_private_connection"] = self._logged_channel.unary_unary(
841
+ "/google.cloud.datastream.v1alpha1.Datastream/DeletePrivateConnection",
842
+ request_serializer=datastream.DeletePrivateConnectionRequest.serialize,
843
+ response_deserializer=operations_pb2.Operation.FromString,
844
+ )
845
+ return self._stubs["delete_private_connection"]
846
+
847
+ @property
848
+ def create_route(
849
+ self,
850
+ ) -> Callable[[datastream.CreateRouteRequest], Awaitable[operations_pb2.Operation]]:
851
+ r"""Return a callable for the create route method over gRPC.
852
+
853
+ Use this method to create a route for a private
854
+ connectivity in a project and location.
855
+
856
+ Returns:
857
+ Callable[[~.CreateRouteRequest],
858
+ Awaitable[~.Operation]]:
859
+ A function that, when called, will call the underlying RPC
860
+ on the server.
861
+ """
862
+ # Generate a "stub function" on-the-fly which will actually make
863
+ # the request.
864
+ # gRPC handles serialization and deserialization, so we just need
865
+ # to pass in the functions for each.
866
+ if "create_route" not in self._stubs:
867
+ self._stubs["create_route"] = self._logged_channel.unary_unary(
868
+ "/google.cloud.datastream.v1alpha1.Datastream/CreateRoute",
869
+ request_serializer=datastream.CreateRouteRequest.serialize,
870
+ response_deserializer=operations_pb2.Operation.FromString,
871
+ )
872
+ return self._stubs["create_route"]
873
+
874
+ @property
875
+ def get_route(
876
+ self,
877
+ ) -> Callable[[datastream.GetRouteRequest], Awaitable[datastream_resources.Route]]:
878
+ r"""Return a callable for the get route method over gRPC.
879
+
880
+ Use this method to get details about a route.
881
+
882
+ Returns:
883
+ Callable[[~.GetRouteRequest],
884
+ Awaitable[~.Route]]:
885
+ A function that, when called, will call the underlying RPC
886
+ on the server.
887
+ """
888
+ # Generate a "stub function" on-the-fly which will actually make
889
+ # the request.
890
+ # gRPC handles serialization and deserialization, so we just need
891
+ # to pass in the functions for each.
892
+ if "get_route" not in self._stubs:
893
+ self._stubs["get_route"] = self._logged_channel.unary_unary(
894
+ "/google.cloud.datastream.v1alpha1.Datastream/GetRoute",
895
+ request_serializer=datastream.GetRouteRequest.serialize,
896
+ response_deserializer=datastream_resources.Route.deserialize,
897
+ )
898
+ return self._stubs["get_route"]
899
+
900
+ @property
901
+ def list_routes(
902
+ self,
903
+ ) -> Callable[
904
+ [datastream.ListRoutesRequest], Awaitable[datastream.ListRoutesResponse]
905
+ ]:
906
+ r"""Return a callable for the list routes method over gRPC.
907
+
908
+ Use this method to list routes created for a private
909
+ connectivity in a project and location.
910
+
911
+ Returns:
912
+ Callable[[~.ListRoutesRequest],
913
+ Awaitable[~.ListRoutesResponse]]:
914
+ A function that, when called, will call the underlying RPC
915
+ on the server.
916
+ """
917
+ # Generate a "stub function" on-the-fly which will actually make
918
+ # the request.
919
+ # gRPC handles serialization and deserialization, so we just need
920
+ # to pass in the functions for each.
921
+ if "list_routes" not in self._stubs:
922
+ self._stubs["list_routes"] = self._logged_channel.unary_unary(
923
+ "/google.cloud.datastream.v1alpha1.Datastream/ListRoutes",
924
+ request_serializer=datastream.ListRoutesRequest.serialize,
925
+ response_deserializer=datastream.ListRoutesResponse.deserialize,
926
+ )
927
+ return self._stubs["list_routes"]
928
+
929
+ @property
930
+ def delete_route(
931
+ self,
932
+ ) -> Callable[[datastream.DeleteRouteRequest], Awaitable[operations_pb2.Operation]]:
933
+ r"""Return a callable for the delete route method over gRPC.
934
+
935
+ Use this method to delete a route.
936
+
937
+ Returns:
938
+ Callable[[~.DeleteRouteRequest],
939
+ Awaitable[~.Operation]]:
940
+ A function that, when called, will call the underlying RPC
941
+ on the server.
942
+ """
943
+ # Generate a "stub function" on-the-fly which will actually make
944
+ # the request.
945
+ # gRPC handles serialization and deserialization, so we just need
946
+ # to pass in the functions for each.
947
+ if "delete_route" not in self._stubs:
948
+ self._stubs["delete_route"] = self._logged_channel.unary_unary(
949
+ "/google.cloud.datastream.v1alpha1.Datastream/DeleteRoute",
950
+ request_serializer=datastream.DeleteRouteRequest.serialize,
951
+ response_deserializer=operations_pb2.Operation.FromString,
952
+ )
953
+ return self._stubs["delete_route"]
954
+
955
+ def _prep_wrapped_messages(self, client_info):
956
+ """Precompute the wrapped methods, overriding the base class method to use async wrappers."""
957
+ self._wrapped_methods = {
958
+ self.list_connection_profiles: self._wrap_method(
959
+ self.list_connection_profiles,
960
+ default_timeout=None,
961
+ client_info=client_info,
962
+ ),
963
+ self.get_connection_profile: self._wrap_method(
964
+ self.get_connection_profile,
965
+ default_timeout=None,
966
+ client_info=client_info,
967
+ ),
968
+ self.create_connection_profile: self._wrap_method(
969
+ self.create_connection_profile,
970
+ default_timeout=60.0,
971
+ client_info=client_info,
972
+ ),
973
+ self.update_connection_profile: self._wrap_method(
974
+ self.update_connection_profile,
975
+ default_timeout=60.0,
976
+ client_info=client_info,
977
+ ),
978
+ self.delete_connection_profile: self._wrap_method(
979
+ self.delete_connection_profile,
980
+ default_timeout=60.0,
981
+ client_info=client_info,
982
+ ),
983
+ self.discover_connection_profile: self._wrap_method(
984
+ self.discover_connection_profile,
985
+ default_timeout=None,
986
+ client_info=client_info,
987
+ ),
988
+ self.list_streams: self._wrap_method(
989
+ self.list_streams,
990
+ default_timeout=None,
991
+ client_info=client_info,
992
+ ),
993
+ self.get_stream: self._wrap_method(
994
+ self.get_stream,
995
+ default_timeout=None,
996
+ client_info=client_info,
997
+ ),
998
+ self.create_stream: self._wrap_method(
999
+ self.create_stream,
1000
+ default_timeout=60.0,
1001
+ client_info=client_info,
1002
+ ),
1003
+ self.update_stream: self._wrap_method(
1004
+ self.update_stream,
1005
+ default_timeout=60.0,
1006
+ client_info=client_info,
1007
+ ),
1008
+ self.delete_stream: self._wrap_method(
1009
+ self.delete_stream,
1010
+ default_timeout=60.0,
1011
+ client_info=client_info,
1012
+ ),
1013
+ self.fetch_errors: self._wrap_method(
1014
+ self.fetch_errors,
1015
+ default_timeout=None,
1016
+ client_info=client_info,
1017
+ ),
1018
+ self.fetch_static_ips: self._wrap_method(
1019
+ self.fetch_static_ips,
1020
+ default_timeout=None,
1021
+ client_info=client_info,
1022
+ ),
1023
+ self.create_private_connection: self._wrap_method(
1024
+ self.create_private_connection,
1025
+ default_timeout=60.0,
1026
+ client_info=client_info,
1027
+ ),
1028
+ self.get_private_connection: self._wrap_method(
1029
+ self.get_private_connection,
1030
+ default_timeout=None,
1031
+ client_info=client_info,
1032
+ ),
1033
+ self.list_private_connections: self._wrap_method(
1034
+ self.list_private_connections,
1035
+ default_timeout=None,
1036
+ client_info=client_info,
1037
+ ),
1038
+ self.delete_private_connection: self._wrap_method(
1039
+ self.delete_private_connection,
1040
+ default_timeout=60.0,
1041
+ client_info=client_info,
1042
+ ),
1043
+ self.create_route: self._wrap_method(
1044
+ self.create_route,
1045
+ default_timeout=60.0,
1046
+ client_info=client_info,
1047
+ ),
1048
+ self.get_route: self._wrap_method(
1049
+ self.get_route,
1050
+ default_timeout=None,
1051
+ client_info=client_info,
1052
+ ),
1053
+ self.list_routes: self._wrap_method(
1054
+ self.list_routes,
1055
+ default_timeout=None,
1056
+ client_info=client_info,
1057
+ ),
1058
+ self.delete_route: self._wrap_method(
1059
+ self.delete_route,
1060
+ default_timeout=60.0,
1061
+ client_info=client_info,
1062
+ ),
1063
+ }
1064
+
1065
+ def _wrap_method(self, func, *args, **kwargs):
1066
+ if self._wrap_with_kind: # pragma: NO COVER
1067
+ kwargs["kind"] = self.kind
1068
+ return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
1069
+
1070
+ def close(self):
1071
+ return self._logged_channel.close()
1072
+
1073
+ @property
1074
+ def kind(self) -> str:
1075
+ return "grpc_asyncio"
1076
+
1077
+
1078
+ __all__ = ("DatastreamGrpcAsyncIOTransport",)