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.
- google/cloud/datastream/__init__.py +219 -0
- google/cloud/datastream/gapic_version.py +16 -0
- google/cloud/datastream/py.typed +2 -0
- google/cloud/datastream_v1/__init__.py +216 -0
- google/cloud/datastream_v1/gapic_metadata.json +418 -0
- google/cloud/datastream_v1/gapic_version.py +16 -0
- google/cloud/datastream_v1/py.typed +2 -0
- google/cloud/datastream_v1/services/__init__.py +15 -0
- google/cloud/datastream_v1/services/datastream/__init__.py +22 -0
- google/cloud/datastream_v1/services/datastream/async_client.py +3939 -0
- google/cloud/datastream_v1/services/datastream/client.py +4420 -0
- google/cloud/datastream_v1/services/datastream/pagers.py +977 -0
- google/cloud/datastream_v1/services/datastream/transports/__init__.py +36 -0
- google/cloud/datastream_v1/services/datastream/transports/base.py +639 -0
- google/cloud/datastream_v1/services/datastream/transports/grpc.py +1193 -0
- google/cloud/datastream_v1/services/datastream/transports/grpc_asyncio.py +1389 -0
- google/cloud/datastream_v1/services/datastream/transports/rest.py +6861 -0
- google/cloud/datastream_v1/services/datastream/transports/rest_base.py +1591 -0
- google/cloud/datastream_v1/types/__init__.py +208 -0
- google/cloud/datastream_v1/types/datastream.py +1491 -0
- google/cloud/datastream_v1/types/datastream_resources.py +2986 -0
- google/cloud/datastream_v1alpha1/__init__.py +156 -0
- google/cloud/datastream_v1alpha1/gapic_metadata.json +343 -0
- google/cloud/datastream_v1alpha1/gapic_version.py +16 -0
- google/cloud/datastream_v1alpha1/py.typed +2 -0
- google/cloud/datastream_v1alpha1/services/__init__.py +15 -0
- google/cloud/datastream_v1alpha1/services/datastream/__init__.py +22 -0
- google/cloud/datastream_v1alpha1/services/datastream/async_client.py +3018 -0
- google/cloud/datastream_v1alpha1/services/datastream/client.py +3458 -0
- google/cloud/datastream_v1alpha1/services/datastream/pagers.py +821 -0
- google/cloud/datastream_v1alpha1/services/datastream/transports/__init__.py +36 -0
- google/cloud/datastream_v1alpha1/services/datastream/transports/base.py +467 -0
- google/cloud/datastream_v1alpha1/services/datastream/transports/grpc.py +942 -0
- google/cloud/datastream_v1alpha1/services/datastream/transports/grpc_asyncio.py +1078 -0
- google/cloud/datastream_v1alpha1/services/datastream/transports/rest.py +4770 -0
- google/cloud/datastream_v1alpha1/services/datastream/transports/rest_base.py +1152 -0
- google/cloud/datastream_v1alpha1/types/__init__.py +148 -0
- google/cloud/datastream_v1alpha1/types/datastream.py +1230 -0
- google/cloud/datastream_v1alpha1/types/datastream_resources.py +1416 -0
- google_cloud_datastream-1.13.2.dist-info/LICENSE +202 -0
- google_cloud_datastream-1.13.2.dist-info/METADATA +229 -0
- google_cloud_datastream-1.13.2.dist-info/RECORD +44 -0
- google_cloud_datastream-1.13.2.dist-info/WHEEL +5 -0
- google_cloud_datastream-1.13.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,3939 @@
|
|
|
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
|
+
from collections import OrderedDict
|
|
17
|
+
import logging as std_logging
|
|
18
|
+
import re
|
|
19
|
+
from typing import (
|
|
20
|
+
Callable,
|
|
21
|
+
Dict,
|
|
22
|
+
Mapping,
|
|
23
|
+
MutableMapping,
|
|
24
|
+
MutableSequence,
|
|
25
|
+
Optional,
|
|
26
|
+
Sequence,
|
|
27
|
+
Tuple,
|
|
28
|
+
Type,
|
|
29
|
+
Union,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
from google.api_core import exceptions as core_exceptions
|
|
33
|
+
from google.api_core import gapic_v1
|
|
34
|
+
from google.api_core import retry_async as retries
|
|
35
|
+
from google.api_core.client_options import ClientOptions
|
|
36
|
+
from google.auth import credentials as ga_credentials # type: ignore
|
|
37
|
+
from google.oauth2 import service_account # type: ignore
|
|
38
|
+
|
|
39
|
+
from google.cloud.datastream_v1 import gapic_version as package_version
|
|
40
|
+
|
|
41
|
+
try:
|
|
42
|
+
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
|
|
43
|
+
except AttributeError: # pragma: NO COVER
|
|
44
|
+
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
|
|
45
|
+
|
|
46
|
+
from google.api_core import operation # type: ignore
|
|
47
|
+
from google.api_core import operation_async # type: ignore
|
|
48
|
+
from google.cloud.location import locations_pb2 # type: ignore
|
|
49
|
+
from google.iam.v1 import iam_policy_pb2 # type: ignore
|
|
50
|
+
from google.iam.v1 import policy_pb2 # type: ignore
|
|
51
|
+
from google.longrunning import operations_pb2 # type: ignore
|
|
52
|
+
from google.protobuf import empty_pb2 # type: ignore
|
|
53
|
+
from google.protobuf import field_mask_pb2 # type: ignore
|
|
54
|
+
from google.protobuf import timestamp_pb2 # type: ignore
|
|
55
|
+
|
|
56
|
+
from google.cloud.datastream_v1.services.datastream import pagers
|
|
57
|
+
from google.cloud.datastream_v1.types import datastream, datastream_resources
|
|
58
|
+
|
|
59
|
+
from .client import DatastreamClient
|
|
60
|
+
from .transports.base import DEFAULT_CLIENT_INFO, DatastreamTransport
|
|
61
|
+
from .transports.grpc_asyncio import DatastreamGrpcAsyncIOTransport
|
|
62
|
+
|
|
63
|
+
try:
|
|
64
|
+
from google.api_core import client_logging # type: ignore
|
|
65
|
+
|
|
66
|
+
CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
|
|
67
|
+
except ImportError: # pragma: NO COVER
|
|
68
|
+
CLIENT_LOGGING_SUPPORTED = False
|
|
69
|
+
|
|
70
|
+
_LOGGER = std_logging.getLogger(__name__)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class DatastreamAsyncClient:
|
|
74
|
+
"""Datastream service"""
|
|
75
|
+
|
|
76
|
+
_client: DatastreamClient
|
|
77
|
+
|
|
78
|
+
# Copy defaults from the synchronous client for use here.
|
|
79
|
+
# Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
|
|
80
|
+
DEFAULT_ENDPOINT = DatastreamClient.DEFAULT_ENDPOINT
|
|
81
|
+
DEFAULT_MTLS_ENDPOINT = DatastreamClient.DEFAULT_MTLS_ENDPOINT
|
|
82
|
+
_DEFAULT_ENDPOINT_TEMPLATE = DatastreamClient._DEFAULT_ENDPOINT_TEMPLATE
|
|
83
|
+
_DEFAULT_UNIVERSE = DatastreamClient._DEFAULT_UNIVERSE
|
|
84
|
+
|
|
85
|
+
connection_profile_path = staticmethod(DatastreamClient.connection_profile_path)
|
|
86
|
+
parse_connection_profile_path = staticmethod(
|
|
87
|
+
DatastreamClient.parse_connection_profile_path
|
|
88
|
+
)
|
|
89
|
+
networks_path = staticmethod(DatastreamClient.networks_path)
|
|
90
|
+
parse_networks_path = staticmethod(DatastreamClient.parse_networks_path)
|
|
91
|
+
private_connection_path = staticmethod(DatastreamClient.private_connection_path)
|
|
92
|
+
parse_private_connection_path = staticmethod(
|
|
93
|
+
DatastreamClient.parse_private_connection_path
|
|
94
|
+
)
|
|
95
|
+
route_path = staticmethod(DatastreamClient.route_path)
|
|
96
|
+
parse_route_path = staticmethod(DatastreamClient.parse_route_path)
|
|
97
|
+
stream_path = staticmethod(DatastreamClient.stream_path)
|
|
98
|
+
parse_stream_path = staticmethod(DatastreamClient.parse_stream_path)
|
|
99
|
+
stream_object_path = staticmethod(DatastreamClient.stream_object_path)
|
|
100
|
+
parse_stream_object_path = staticmethod(DatastreamClient.parse_stream_object_path)
|
|
101
|
+
common_billing_account_path = staticmethod(
|
|
102
|
+
DatastreamClient.common_billing_account_path
|
|
103
|
+
)
|
|
104
|
+
parse_common_billing_account_path = staticmethod(
|
|
105
|
+
DatastreamClient.parse_common_billing_account_path
|
|
106
|
+
)
|
|
107
|
+
common_folder_path = staticmethod(DatastreamClient.common_folder_path)
|
|
108
|
+
parse_common_folder_path = staticmethod(DatastreamClient.parse_common_folder_path)
|
|
109
|
+
common_organization_path = staticmethod(DatastreamClient.common_organization_path)
|
|
110
|
+
parse_common_organization_path = staticmethod(
|
|
111
|
+
DatastreamClient.parse_common_organization_path
|
|
112
|
+
)
|
|
113
|
+
common_project_path = staticmethod(DatastreamClient.common_project_path)
|
|
114
|
+
parse_common_project_path = staticmethod(DatastreamClient.parse_common_project_path)
|
|
115
|
+
common_location_path = staticmethod(DatastreamClient.common_location_path)
|
|
116
|
+
parse_common_location_path = staticmethod(
|
|
117
|
+
DatastreamClient.parse_common_location_path
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
@classmethod
|
|
121
|
+
def from_service_account_info(cls, info: dict, *args, **kwargs):
|
|
122
|
+
"""Creates an instance of this client using the provided credentials
|
|
123
|
+
info.
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
info (dict): The service account private key info.
|
|
127
|
+
args: Additional arguments to pass to the constructor.
|
|
128
|
+
kwargs: Additional arguments to pass to the constructor.
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
DatastreamAsyncClient: The constructed client.
|
|
132
|
+
"""
|
|
133
|
+
return DatastreamClient.from_service_account_info.__func__(DatastreamAsyncClient, info, *args, **kwargs) # type: ignore
|
|
134
|
+
|
|
135
|
+
@classmethod
|
|
136
|
+
def from_service_account_file(cls, filename: str, *args, **kwargs):
|
|
137
|
+
"""Creates an instance of this client using the provided credentials
|
|
138
|
+
file.
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
filename (str): The path to the service account private key json
|
|
142
|
+
file.
|
|
143
|
+
args: Additional arguments to pass to the constructor.
|
|
144
|
+
kwargs: Additional arguments to pass to the constructor.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
DatastreamAsyncClient: The constructed client.
|
|
148
|
+
"""
|
|
149
|
+
return DatastreamClient.from_service_account_file.__func__(DatastreamAsyncClient, filename, *args, **kwargs) # type: ignore
|
|
150
|
+
|
|
151
|
+
from_service_account_json = from_service_account_file
|
|
152
|
+
|
|
153
|
+
@classmethod
|
|
154
|
+
def get_mtls_endpoint_and_cert_source(
|
|
155
|
+
cls, client_options: Optional[ClientOptions] = None
|
|
156
|
+
):
|
|
157
|
+
"""Return the API endpoint and client cert source for mutual TLS.
|
|
158
|
+
|
|
159
|
+
The client cert source is determined in the following order:
|
|
160
|
+
(1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
|
|
161
|
+
client cert source is None.
|
|
162
|
+
(2) if `client_options.client_cert_source` is provided, use the provided one; if the
|
|
163
|
+
default client cert source exists, use the default one; otherwise the client cert
|
|
164
|
+
source is None.
|
|
165
|
+
|
|
166
|
+
The API endpoint is determined in the following order:
|
|
167
|
+
(1) if `client_options.api_endpoint` if provided, use the provided one.
|
|
168
|
+
(2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
|
|
169
|
+
default mTLS endpoint; if the environment variable is "never", use the default API
|
|
170
|
+
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
|
|
171
|
+
use the default API endpoint.
|
|
172
|
+
|
|
173
|
+
More details can be found at https://google.aip.dev/auth/4114.
|
|
174
|
+
|
|
175
|
+
Args:
|
|
176
|
+
client_options (google.api_core.client_options.ClientOptions): Custom options for the
|
|
177
|
+
client. Only the `api_endpoint` and `client_cert_source` properties may be used
|
|
178
|
+
in this method.
|
|
179
|
+
|
|
180
|
+
Returns:
|
|
181
|
+
Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
|
|
182
|
+
client cert source to use.
|
|
183
|
+
|
|
184
|
+
Raises:
|
|
185
|
+
google.auth.exceptions.MutualTLSChannelError: If any errors happen.
|
|
186
|
+
"""
|
|
187
|
+
return DatastreamClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
|
|
188
|
+
|
|
189
|
+
@property
|
|
190
|
+
def transport(self) -> DatastreamTransport:
|
|
191
|
+
"""Returns the transport used by the client instance.
|
|
192
|
+
|
|
193
|
+
Returns:
|
|
194
|
+
DatastreamTransport: The transport used by the client instance.
|
|
195
|
+
"""
|
|
196
|
+
return self._client.transport
|
|
197
|
+
|
|
198
|
+
@property
|
|
199
|
+
def api_endpoint(self):
|
|
200
|
+
"""Return the API endpoint used by the client instance.
|
|
201
|
+
|
|
202
|
+
Returns:
|
|
203
|
+
str: The API endpoint used by the client instance.
|
|
204
|
+
"""
|
|
205
|
+
return self._client._api_endpoint
|
|
206
|
+
|
|
207
|
+
@property
|
|
208
|
+
def universe_domain(self) -> str:
|
|
209
|
+
"""Return the universe domain used by the client instance.
|
|
210
|
+
|
|
211
|
+
Returns:
|
|
212
|
+
str: The universe domain used
|
|
213
|
+
by the client instance.
|
|
214
|
+
"""
|
|
215
|
+
return self._client._universe_domain
|
|
216
|
+
|
|
217
|
+
get_transport_class = DatastreamClient.get_transport_class
|
|
218
|
+
|
|
219
|
+
def __init__(
|
|
220
|
+
self,
|
|
221
|
+
*,
|
|
222
|
+
credentials: Optional[ga_credentials.Credentials] = None,
|
|
223
|
+
transport: Optional[
|
|
224
|
+
Union[str, DatastreamTransport, Callable[..., DatastreamTransport]]
|
|
225
|
+
] = "grpc_asyncio",
|
|
226
|
+
client_options: Optional[ClientOptions] = None,
|
|
227
|
+
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
|
|
228
|
+
) -> None:
|
|
229
|
+
"""Instantiates the datastream async client.
|
|
230
|
+
|
|
231
|
+
Args:
|
|
232
|
+
credentials (Optional[google.auth.credentials.Credentials]): The
|
|
233
|
+
authorization credentials to attach to requests. These
|
|
234
|
+
credentials identify the application to the service; if none
|
|
235
|
+
are specified, the client will attempt to ascertain the
|
|
236
|
+
credentials from the environment.
|
|
237
|
+
transport (Optional[Union[str,DatastreamTransport,Callable[..., DatastreamTransport]]]):
|
|
238
|
+
The transport to use, or a Callable that constructs and returns a new transport to use.
|
|
239
|
+
If a Callable is given, it will be called with the same set of initialization
|
|
240
|
+
arguments as used in the DatastreamTransport constructor.
|
|
241
|
+
If set to None, a transport is chosen automatically.
|
|
242
|
+
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
|
|
243
|
+
Custom options for the client.
|
|
244
|
+
|
|
245
|
+
1. The ``api_endpoint`` property can be used to override the
|
|
246
|
+
default endpoint provided by the client when ``transport`` is
|
|
247
|
+
not explicitly provided. Only if this property is not set and
|
|
248
|
+
``transport`` was not explicitly provided, the endpoint is
|
|
249
|
+
determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
|
|
250
|
+
variable, which have one of the following values:
|
|
251
|
+
"always" (always use the default mTLS endpoint), "never" (always
|
|
252
|
+
use the default regular endpoint) and "auto" (auto-switch to the
|
|
253
|
+
default mTLS endpoint if client certificate is present; this is
|
|
254
|
+
the default value).
|
|
255
|
+
|
|
256
|
+
2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
|
|
257
|
+
is "true", then the ``client_cert_source`` property can be used
|
|
258
|
+
to provide a client certificate for mTLS transport. If
|
|
259
|
+
not provided, the default SSL client certificate will be used if
|
|
260
|
+
present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
|
|
261
|
+
set, no client certificate will be used.
|
|
262
|
+
|
|
263
|
+
3. The ``universe_domain`` property can be used to override the
|
|
264
|
+
default "googleapis.com" universe. Note that ``api_endpoint``
|
|
265
|
+
property still takes precedence; and ``universe_domain`` is
|
|
266
|
+
currently not supported for mTLS.
|
|
267
|
+
|
|
268
|
+
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
|
|
269
|
+
The client info used to send a user-agent string along with
|
|
270
|
+
API requests. If ``None``, then default info will be used.
|
|
271
|
+
Generally, you only need to set this if you're developing
|
|
272
|
+
your own client library.
|
|
273
|
+
|
|
274
|
+
Raises:
|
|
275
|
+
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
|
|
276
|
+
creation failed for any reason.
|
|
277
|
+
"""
|
|
278
|
+
self._client = DatastreamClient(
|
|
279
|
+
credentials=credentials,
|
|
280
|
+
transport=transport,
|
|
281
|
+
client_options=client_options,
|
|
282
|
+
client_info=client_info,
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
286
|
+
std_logging.DEBUG
|
|
287
|
+
): # pragma: NO COVER
|
|
288
|
+
_LOGGER.debug(
|
|
289
|
+
"Created client `google.cloud.datastream_v1.DatastreamAsyncClient`.",
|
|
290
|
+
extra={
|
|
291
|
+
"serviceName": "google.cloud.datastream.v1.Datastream",
|
|
292
|
+
"universeDomain": getattr(
|
|
293
|
+
self._client._transport._credentials, "universe_domain", ""
|
|
294
|
+
),
|
|
295
|
+
"credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
|
|
296
|
+
"credentialsInfo": getattr(
|
|
297
|
+
self.transport._credentials, "get_cred_info", lambda: None
|
|
298
|
+
)(),
|
|
299
|
+
}
|
|
300
|
+
if hasattr(self._client._transport, "_credentials")
|
|
301
|
+
else {
|
|
302
|
+
"serviceName": "google.cloud.datastream.v1.Datastream",
|
|
303
|
+
"credentialsType": None,
|
|
304
|
+
},
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
async def list_connection_profiles(
|
|
308
|
+
self,
|
|
309
|
+
request: Optional[Union[datastream.ListConnectionProfilesRequest, dict]] = None,
|
|
310
|
+
*,
|
|
311
|
+
parent: Optional[str] = None,
|
|
312
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
313
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
314
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
315
|
+
) -> pagers.ListConnectionProfilesAsyncPager:
|
|
316
|
+
r"""Use this method to list connection profiles created
|
|
317
|
+
in a project and location.
|
|
318
|
+
|
|
319
|
+
.. code-block:: python
|
|
320
|
+
|
|
321
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
322
|
+
# code template only.
|
|
323
|
+
# It will require modifications to work:
|
|
324
|
+
# - It may require correct/in-range values for request initialization.
|
|
325
|
+
# - It may require specifying regional endpoints when creating the service
|
|
326
|
+
# client as shown in:
|
|
327
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
328
|
+
from google.cloud import datastream_v1
|
|
329
|
+
|
|
330
|
+
async def sample_list_connection_profiles():
|
|
331
|
+
# Create a client
|
|
332
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
333
|
+
|
|
334
|
+
# Initialize request argument(s)
|
|
335
|
+
request = datastream_v1.ListConnectionProfilesRequest(
|
|
336
|
+
parent="parent_value",
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
# Make the request
|
|
340
|
+
page_result = client.list_connection_profiles(request=request)
|
|
341
|
+
|
|
342
|
+
# Handle the response
|
|
343
|
+
async for response in page_result:
|
|
344
|
+
print(response)
|
|
345
|
+
|
|
346
|
+
Args:
|
|
347
|
+
request (Optional[Union[google.cloud.datastream_v1.types.ListConnectionProfilesRequest, dict]]):
|
|
348
|
+
The request object. Request message for listing
|
|
349
|
+
connection profiles.
|
|
350
|
+
parent (:class:`str`):
|
|
351
|
+
Required. The parent that owns the
|
|
352
|
+
collection of connection profiles.
|
|
353
|
+
|
|
354
|
+
This corresponds to the ``parent`` field
|
|
355
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
356
|
+
should not be set.
|
|
357
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
358
|
+
should be retried.
|
|
359
|
+
timeout (float): The timeout for this request.
|
|
360
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
361
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
362
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
363
|
+
be of type `bytes`.
|
|
364
|
+
|
|
365
|
+
Returns:
|
|
366
|
+
google.cloud.datastream_v1.services.datastream.pagers.ListConnectionProfilesAsyncPager:
|
|
367
|
+
Response message for listing
|
|
368
|
+
connection profiles.
|
|
369
|
+
Iterating over this object will yield
|
|
370
|
+
results and resolve additional pages
|
|
371
|
+
automatically.
|
|
372
|
+
|
|
373
|
+
"""
|
|
374
|
+
# Create or coerce a protobuf request object.
|
|
375
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
376
|
+
# gotten any keyword arguments that map to the request.
|
|
377
|
+
flattened_params = [parent]
|
|
378
|
+
has_flattened_params = (
|
|
379
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
380
|
+
)
|
|
381
|
+
if request is not None and has_flattened_params:
|
|
382
|
+
raise ValueError(
|
|
383
|
+
"If the `request` argument is set, then none of "
|
|
384
|
+
"the individual field arguments should be set."
|
|
385
|
+
)
|
|
386
|
+
|
|
387
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
388
|
+
# there are no flattened fields), or create one.
|
|
389
|
+
if not isinstance(request, datastream.ListConnectionProfilesRequest):
|
|
390
|
+
request = datastream.ListConnectionProfilesRequest(request)
|
|
391
|
+
|
|
392
|
+
# If we have keyword arguments corresponding to fields on the
|
|
393
|
+
# request, apply these.
|
|
394
|
+
if parent is not None:
|
|
395
|
+
request.parent = parent
|
|
396
|
+
|
|
397
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
398
|
+
# and friendly error handling.
|
|
399
|
+
rpc = self._client._transport._wrapped_methods[
|
|
400
|
+
self._client._transport.list_connection_profiles
|
|
401
|
+
]
|
|
402
|
+
|
|
403
|
+
# Certain fields should be provided within the metadata header;
|
|
404
|
+
# add these here.
|
|
405
|
+
metadata = tuple(metadata) + (
|
|
406
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
407
|
+
)
|
|
408
|
+
|
|
409
|
+
# Validate the universe domain.
|
|
410
|
+
self._client._validate_universe_domain()
|
|
411
|
+
|
|
412
|
+
# Send the request.
|
|
413
|
+
response = await rpc(
|
|
414
|
+
request,
|
|
415
|
+
retry=retry,
|
|
416
|
+
timeout=timeout,
|
|
417
|
+
metadata=metadata,
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
# This method is paged; wrap the response in a pager, which provides
|
|
421
|
+
# an `__aiter__` convenience method.
|
|
422
|
+
response = pagers.ListConnectionProfilesAsyncPager(
|
|
423
|
+
method=rpc,
|
|
424
|
+
request=request,
|
|
425
|
+
response=response,
|
|
426
|
+
retry=retry,
|
|
427
|
+
timeout=timeout,
|
|
428
|
+
metadata=metadata,
|
|
429
|
+
)
|
|
430
|
+
|
|
431
|
+
# Done; return the response.
|
|
432
|
+
return response
|
|
433
|
+
|
|
434
|
+
async def get_connection_profile(
|
|
435
|
+
self,
|
|
436
|
+
request: Optional[Union[datastream.GetConnectionProfileRequest, dict]] = None,
|
|
437
|
+
*,
|
|
438
|
+
name: Optional[str] = None,
|
|
439
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
440
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
441
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
442
|
+
) -> datastream_resources.ConnectionProfile:
|
|
443
|
+
r"""Use this method to get details about a connection
|
|
444
|
+
profile.
|
|
445
|
+
|
|
446
|
+
.. code-block:: python
|
|
447
|
+
|
|
448
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
449
|
+
# code template only.
|
|
450
|
+
# It will require modifications to work:
|
|
451
|
+
# - It may require correct/in-range values for request initialization.
|
|
452
|
+
# - It may require specifying regional endpoints when creating the service
|
|
453
|
+
# client as shown in:
|
|
454
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
455
|
+
from google.cloud import datastream_v1
|
|
456
|
+
|
|
457
|
+
async def sample_get_connection_profile():
|
|
458
|
+
# Create a client
|
|
459
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
460
|
+
|
|
461
|
+
# Initialize request argument(s)
|
|
462
|
+
request = datastream_v1.GetConnectionProfileRequest(
|
|
463
|
+
name="name_value",
|
|
464
|
+
)
|
|
465
|
+
|
|
466
|
+
# Make the request
|
|
467
|
+
response = await client.get_connection_profile(request=request)
|
|
468
|
+
|
|
469
|
+
# Handle the response
|
|
470
|
+
print(response)
|
|
471
|
+
|
|
472
|
+
Args:
|
|
473
|
+
request (Optional[Union[google.cloud.datastream_v1.types.GetConnectionProfileRequest, dict]]):
|
|
474
|
+
The request object. Request message for getting a
|
|
475
|
+
connection profile.
|
|
476
|
+
name (:class:`str`):
|
|
477
|
+
Required. The name of the connection
|
|
478
|
+
profile resource to get.
|
|
479
|
+
|
|
480
|
+
This corresponds to the ``name`` field
|
|
481
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
482
|
+
should not be set.
|
|
483
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
484
|
+
should be retried.
|
|
485
|
+
timeout (float): The timeout for this request.
|
|
486
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
487
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
488
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
489
|
+
be of type `bytes`.
|
|
490
|
+
|
|
491
|
+
Returns:
|
|
492
|
+
google.cloud.datastream_v1.types.ConnectionProfile:
|
|
493
|
+
A set of reusable connection
|
|
494
|
+
configurations to be used as a source or
|
|
495
|
+
destination for a stream.
|
|
496
|
+
|
|
497
|
+
"""
|
|
498
|
+
# Create or coerce a protobuf request object.
|
|
499
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
500
|
+
# gotten any keyword arguments that map to the request.
|
|
501
|
+
flattened_params = [name]
|
|
502
|
+
has_flattened_params = (
|
|
503
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
504
|
+
)
|
|
505
|
+
if request is not None and has_flattened_params:
|
|
506
|
+
raise ValueError(
|
|
507
|
+
"If the `request` argument is set, then none of "
|
|
508
|
+
"the individual field arguments should be set."
|
|
509
|
+
)
|
|
510
|
+
|
|
511
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
512
|
+
# there are no flattened fields), or create one.
|
|
513
|
+
if not isinstance(request, datastream.GetConnectionProfileRequest):
|
|
514
|
+
request = datastream.GetConnectionProfileRequest(request)
|
|
515
|
+
|
|
516
|
+
# If we have keyword arguments corresponding to fields on the
|
|
517
|
+
# request, apply these.
|
|
518
|
+
if name is not None:
|
|
519
|
+
request.name = name
|
|
520
|
+
|
|
521
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
522
|
+
# and friendly error handling.
|
|
523
|
+
rpc = self._client._transport._wrapped_methods[
|
|
524
|
+
self._client._transport.get_connection_profile
|
|
525
|
+
]
|
|
526
|
+
|
|
527
|
+
# Certain fields should be provided within the metadata header;
|
|
528
|
+
# add these here.
|
|
529
|
+
metadata = tuple(metadata) + (
|
|
530
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
531
|
+
)
|
|
532
|
+
|
|
533
|
+
# Validate the universe domain.
|
|
534
|
+
self._client._validate_universe_domain()
|
|
535
|
+
|
|
536
|
+
# Send the request.
|
|
537
|
+
response = await rpc(
|
|
538
|
+
request,
|
|
539
|
+
retry=retry,
|
|
540
|
+
timeout=timeout,
|
|
541
|
+
metadata=metadata,
|
|
542
|
+
)
|
|
543
|
+
|
|
544
|
+
# Done; return the response.
|
|
545
|
+
return response
|
|
546
|
+
|
|
547
|
+
async def create_connection_profile(
|
|
548
|
+
self,
|
|
549
|
+
request: Optional[
|
|
550
|
+
Union[datastream.CreateConnectionProfileRequest, dict]
|
|
551
|
+
] = None,
|
|
552
|
+
*,
|
|
553
|
+
parent: Optional[str] = None,
|
|
554
|
+
connection_profile: Optional[datastream_resources.ConnectionProfile] = None,
|
|
555
|
+
connection_profile_id: Optional[str] = None,
|
|
556
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
557
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
558
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
559
|
+
) -> operation_async.AsyncOperation:
|
|
560
|
+
r"""Use this method to create a connection profile in a
|
|
561
|
+
project and location.
|
|
562
|
+
|
|
563
|
+
.. code-block:: python
|
|
564
|
+
|
|
565
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
566
|
+
# code template only.
|
|
567
|
+
# It will require modifications to work:
|
|
568
|
+
# - It may require correct/in-range values for request initialization.
|
|
569
|
+
# - It may require specifying regional endpoints when creating the service
|
|
570
|
+
# client as shown in:
|
|
571
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
572
|
+
from google.cloud import datastream_v1
|
|
573
|
+
|
|
574
|
+
async def sample_create_connection_profile():
|
|
575
|
+
# Create a client
|
|
576
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
577
|
+
|
|
578
|
+
# Initialize request argument(s)
|
|
579
|
+
connection_profile = datastream_v1.ConnectionProfile()
|
|
580
|
+
connection_profile.oracle_profile.hostname = "hostname_value"
|
|
581
|
+
connection_profile.oracle_profile.username = "username_value"
|
|
582
|
+
connection_profile.oracle_profile.database_service = "database_service_value"
|
|
583
|
+
connection_profile.display_name = "display_name_value"
|
|
584
|
+
|
|
585
|
+
request = datastream_v1.CreateConnectionProfileRequest(
|
|
586
|
+
parent="parent_value",
|
|
587
|
+
connection_profile_id="connection_profile_id_value",
|
|
588
|
+
connection_profile=connection_profile,
|
|
589
|
+
)
|
|
590
|
+
|
|
591
|
+
# Make the request
|
|
592
|
+
operation = client.create_connection_profile(request=request)
|
|
593
|
+
|
|
594
|
+
print("Waiting for operation to complete...")
|
|
595
|
+
|
|
596
|
+
response = (await operation).result()
|
|
597
|
+
|
|
598
|
+
# Handle the response
|
|
599
|
+
print(response)
|
|
600
|
+
|
|
601
|
+
Args:
|
|
602
|
+
request (Optional[Union[google.cloud.datastream_v1.types.CreateConnectionProfileRequest, dict]]):
|
|
603
|
+
The request object. Request message for creating a
|
|
604
|
+
connection profile.
|
|
605
|
+
parent (:class:`str`):
|
|
606
|
+
Required. The parent that owns the
|
|
607
|
+
collection of ConnectionProfiles.
|
|
608
|
+
|
|
609
|
+
This corresponds to the ``parent`` field
|
|
610
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
611
|
+
should not be set.
|
|
612
|
+
connection_profile (:class:`google.cloud.datastream_v1.types.ConnectionProfile`):
|
|
613
|
+
Required. The connection profile
|
|
614
|
+
resource to create.
|
|
615
|
+
|
|
616
|
+
This corresponds to the ``connection_profile`` field
|
|
617
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
618
|
+
should not be set.
|
|
619
|
+
connection_profile_id (:class:`str`):
|
|
620
|
+
Required. The connection profile
|
|
621
|
+
identifier.
|
|
622
|
+
|
|
623
|
+
This corresponds to the ``connection_profile_id`` field
|
|
624
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
625
|
+
should not be set.
|
|
626
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
627
|
+
should be retried.
|
|
628
|
+
timeout (float): The timeout for this request.
|
|
629
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
630
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
631
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
632
|
+
be of type `bytes`.
|
|
633
|
+
|
|
634
|
+
Returns:
|
|
635
|
+
google.api_core.operation_async.AsyncOperation:
|
|
636
|
+
An object representing a long-running operation.
|
|
637
|
+
|
|
638
|
+
The result type for the operation will be :class:`google.cloud.datastream_v1.types.ConnectionProfile` A set of reusable connection configurations to be used as a source or
|
|
639
|
+
destination for a stream.
|
|
640
|
+
|
|
641
|
+
"""
|
|
642
|
+
# Create or coerce a protobuf request object.
|
|
643
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
644
|
+
# gotten any keyword arguments that map to the request.
|
|
645
|
+
flattened_params = [parent, connection_profile, connection_profile_id]
|
|
646
|
+
has_flattened_params = (
|
|
647
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
648
|
+
)
|
|
649
|
+
if request is not None and has_flattened_params:
|
|
650
|
+
raise ValueError(
|
|
651
|
+
"If the `request` argument is set, then none of "
|
|
652
|
+
"the individual field arguments should be set."
|
|
653
|
+
)
|
|
654
|
+
|
|
655
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
656
|
+
# there are no flattened fields), or create one.
|
|
657
|
+
if not isinstance(request, datastream.CreateConnectionProfileRequest):
|
|
658
|
+
request = datastream.CreateConnectionProfileRequest(request)
|
|
659
|
+
|
|
660
|
+
# If we have keyword arguments corresponding to fields on the
|
|
661
|
+
# request, apply these.
|
|
662
|
+
if parent is not None:
|
|
663
|
+
request.parent = parent
|
|
664
|
+
if connection_profile is not None:
|
|
665
|
+
request.connection_profile = connection_profile
|
|
666
|
+
if connection_profile_id is not None:
|
|
667
|
+
request.connection_profile_id = connection_profile_id
|
|
668
|
+
|
|
669
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
670
|
+
# and friendly error handling.
|
|
671
|
+
rpc = self._client._transport._wrapped_methods[
|
|
672
|
+
self._client._transport.create_connection_profile
|
|
673
|
+
]
|
|
674
|
+
|
|
675
|
+
# Certain fields should be provided within the metadata header;
|
|
676
|
+
# add these here.
|
|
677
|
+
metadata = tuple(metadata) + (
|
|
678
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
679
|
+
)
|
|
680
|
+
|
|
681
|
+
# Validate the universe domain.
|
|
682
|
+
self._client._validate_universe_domain()
|
|
683
|
+
|
|
684
|
+
# Send the request.
|
|
685
|
+
response = await rpc(
|
|
686
|
+
request,
|
|
687
|
+
retry=retry,
|
|
688
|
+
timeout=timeout,
|
|
689
|
+
metadata=metadata,
|
|
690
|
+
)
|
|
691
|
+
|
|
692
|
+
# Wrap the response in an operation future.
|
|
693
|
+
response = operation_async.from_gapic(
|
|
694
|
+
response,
|
|
695
|
+
self._client._transport.operations_client,
|
|
696
|
+
datastream_resources.ConnectionProfile,
|
|
697
|
+
metadata_type=datastream.OperationMetadata,
|
|
698
|
+
)
|
|
699
|
+
|
|
700
|
+
# Done; return the response.
|
|
701
|
+
return response
|
|
702
|
+
|
|
703
|
+
async def update_connection_profile(
|
|
704
|
+
self,
|
|
705
|
+
request: Optional[
|
|
706
|
+
Union[datastream.UpdateConnectionProfileRequest, dict]
|
|
707
|
+
] = None,
|
|
708
|
+
*,
|
|
709
|
+
connection_profile: Optional[datastream_resources.ConnectionProfile] = None,
|
|
710
|
+
update_mask: Optional[field_mask_pb2.FieldMask] = None,
|
|
711
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
712
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
713
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
714
|
+
) -> operation_async.AsyncOperation:
|
|
715
|
+
r"""Use this method to update the parameters of a
|
|
716
|
+
connection profile.
|
|
717
|
+
|
|
718
|
+
.. code-block:: python
|
|
719
|
+
|
|
720
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
721
|
+
# code template only.
|
|
722
|
+
# It will require modifications to work:
|
|
723
|
+
# - It may require correct/in-range values for request initialization.
|
|
724
|
+
# - It may require specifying regional endpoints when creating the service
|
|
725
|
+
# client as shown in:
|
|
726
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
727
|
+
from google.cloud import datastream_v1
|
|
728
|
+
|
|
729
|
+
async def sample_update_connection_profile():
|
|
730
|
+
# Create a client
|
|
731
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
732
|
+
|
|
733
|
+
# Initialize request argument(s)
|
|
734
|
+
connection_profile = datastream_v1.ConnectionProfile()
|
|
735
|
+
connection_profile.oracle_profile.hostname = "hostname_value"
|
|
736
|
+
connection_profile.oracle_profile.username = "username_value"
|
|
737
|
+
connection_profile.oracle_profile.database_service = "database_service_value"
|
|
738
|
+
connection_profile.display_name = "display_name_value"
|
|
739
|
+
|
|
740
|
+
request = datastream_v1.UpdateConnectionProfileRequest(
|
|
741
|
+
connection_profile=connection_profile,
|
|
742
|
+
)
|
|
743
|
+
|
|
744
|
+
# Make the request
|
|
745
|
+
operation = client.update_connection_profile(request=request)
|
|
746
|
+
|
|
747
|
+
print("Waiting for operation to complete...")
|
|
748
|
+
|
|
749
|
+
response = (await operation).result()
|
|
750
|
+
|
|
751
|
+
# Handle the response
|
|
752
|
+
print(response)
|
|
753
|
+
|
|
754
|
+
Args:
|
|
755
|
+
request (Optional[Union[google.cloud.datastream_v1.types.UpdateConnectionProfileRequest, dict]]):
|
|
756
|
+
The request object. Connection profile update message.
|
|
757
|
+
connection_profile (:class:`google.cloud.datastream_v1.types.ConnectionProfile`):
|
|
758
|
+
Required. The connection profile to
|
|
759
|
+
update.
|
|
760
|
+
|
|
761
|
+
This corresponds to the ``connection_profile`` field
|
|
762
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
763
|
+
should not be set.
|
|
764
|
+
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
|
|
765
|
+
Optional. Field mask is used to specify the fields to be
|
|
766
|
+
overwritten in the ConnectionProfile resource by the
|
|
767
|
+
update. The fields specified in the update_mask are
|
|
768
|
+
relative to the resource, not the full request. A field
|
|
769
|
+
will be overwritten if it is in the mask. If the user
|
|
770
|
+
does not provide a mask then all fields will be
|
|
771
|
+
overwritten.
|
|
772
|
+
|
|
773
|
+
This corresponds to the ``update_mask`` field
|
|
774
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
775
|
+
should not be set.
|
|
776
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
777
|
+
should be retried.
|
|
778
|
+
timeout (float): The timeout for this request.
|
|
779
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
780
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
781
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
782
|
+
be of type `bytes`.
|
|
783
|
+
|
|
784
|
+
Returns:
|
|
785
|
+
google.api_core.operation_async.AsyncOperation:
|
|
786
|
+
An object representing a long-running operation.
|
|
787
|
+
|
|
788
|
+
The result type for the operation will be :class:`google.cloud.datastream_v1.types.ConnectionProfile` A set of reusable connection configurations to be used as a source or
|
|
789
|
+
destination for a stream.
|
|
790
|
+
|
|
791
|
+
"""
|
|
792
|
+
# Create or coerce a protobuf request object.
|
|
793
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
794
|
+
# gotten any keyword arguments that map to the request.
|
|
795
|
+
flattened_params = [connection_profile, update_mask]
|
|
796
|
+
has_flattened_params = (
|
|
797
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
798
|
+
)
|
|
799
|
+
if request is not None and has_flattened_params:
|
|
800
|
+
raise ValueError(
|
|
801
|
+
"If the `request` argument is set, then none of "
|
|
802
|
+
"the individual field arguments should be set."
|
|
803
|
+
)
|
|
804
|
+
|
|
805
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
806
|
+
# there are no flattened fields), or create one.
|
|
807
|
+
if not isinstance(request, datastream.UpdateConnectionProfileRequest):
|
|
808
|
+
request = datastream.UpdateConnectionProfileRequest(request)
|
|
809
|
+
|
|
810
|
+
# If we have keyword arguments corresponding to fields on the
|
|
811
|
+
# request, apply these.
|
|
812
|
+
if connection_profile is not None:
|
|
813
|
+
request.connection_profile = connection_profile
|
|
814
|
+
if update_mask is not None:
|
|
815
|
+
request.update_mask = update_mask
|
|
816
|
+
|
|
817
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
818
|
+
# and friendly error handling.
|
|
819
|
+
rpc = self._client._transport._wrapped_methods[
|
|
820
|
+
self._client._transport.update_connection_profile
|
|
821
|
+
]
|
|
822
|
+
|
|
823
|
+
# Certain fields should be provided within the metadata header;
|
|
824
|
+
# add these here.
|
|
825
|
+
metadata = tuple(metadata) + (
|
|
826
|
+
gapic_v1.routing_header.to_grpc_metadata(
|
|
827
|
+
(("connection_profile.name", request.connection_profile.name),)
|
|
828
|
+
),
|
|
829
|
+
)
|
|
830
|
+
|
|
831
|
+
# Validate the universe domain.
|
|
832
|
+
self._client._validate_universe_domain()
|
|
833
|
+
|
|
834
|
+
# Send the request.
|
|
835
|
+
response = await rpc(
|
|
836
|
+
request,
|
|
837
|
+
retry=retry,
|
|
838
|
+
timeout=timeout,
|
|
839
|
+
metadata=metadata,
|
|
840
|
+
)
|
|
841
|
+
|
|
842
|
+
# Wrap the response in an operation future.
|
|
843
|
+
response = operation_async.from_gapic(
|
|
844
|
+
response,
|
|
845
|
+
self._client._transport.operations_client,
|
|
846
|
+
datastream_resources.ConnectionProfile,
|
|
847
|
+
metadata_type=datastream.OperationMetadata,
|
|
848
|
+
)
|
|
849
|
+
|
|
850
|
+
# Done; return the response.
|
|
851
|
+
return response
|
|
852
|
+
|
|
853
|
+
async def delete_connection_profile(
|
|
854
|
+
self,
|
|
855
|
+
request: Optional[
|
|
856
|
+
Union[datastream.DeleteConnectionProfileRequest, dict]
|
|
857
|
+
] = None,
|
|
858
|
+
*,
|
|
859
|
+
name: Optional[str] = None,
|
|
860
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
861
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
862
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
863
|
+
) -> operation_async.AsyncOperation:
|
|
864
|
+
r"""Use this method to delete a connection profile.
|
|
865
|
+
|
|
866
|
+
.. code-block:: python
|
|
867
|
+
|
|
868
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
869
|
+
# code template only.
|
|
870
|
+
# It will require modifications to work:
|
|
871
|
+
# - It may require correct/in-range values for request initialization.
|
|
872
|
+
# - It may require specifying regional endpoints when creating the service
|
|
873
|
+
# client as shown in:
|
|
874
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
875
|
+
from google.cloud import datastream_v1
|
|
876
|
+
|
|
877
|
+
async def sample_delete_connection_profile():
|
|
878
|
+
# Create a client
|
|
879
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
880
|
+
|
|
881
|
+
# Initialize request argument(s)
|
|
882
|
+
request = datastream_v1.DeleteConnectionProfileRequest(
|
|
883
|
+
name="name_value",
|
|
884
|
+
)
|
|
885
|
+
|
|
886
|
+
# Make the request
|
|
887
|
+
operation = client.delete_connection_profile(request=request)
|
|
888
|
+
|
|
889
|
+
print("Waiting for operation to complete...")
|
|
890
|
+
|
|
891
|
+
response = (await operation).result()
|
|
892
|
+
|
|
893
|
+
# Handle the response
|
|
894
|
+
print(response)
|
|
895
|
+
|
|
896
|
+
Args:
|
|
897
|
+
request (Optional[Union[google.cloud.datastream_v1.types.DeleteConnectionProfileRequest, dict]]):
|
|
898
|
+
The request object. Request message for deleting a
|
|
899
|
+
connection profile.
|
|
900
|
+
name (:class:`str`):
|
|
901
|
+
Required. The name of the connection
|
|
902
|
+
profile resource to delete.
|
|
903
|
+
|
|
904
|
+
This corresponds to the ``name`` field
|
|
905
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
906
|
+
should not be set.
|
|
907
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
908
|
+
should be retried.
|
|
909
|
+
timeout (float): The timeout for this request.
|
|
910
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
911
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
912
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
913
|
+
be of type `bytes`.
|
|
914
|
+
|
|
915
|
+
Returns:
|
|
916
|
+
google.api_core.operation_async.AsyncOperation:
|
|
917
|
+
An object representing a long-running operation.
|
|
918
|
+
|
|
919
|
+
The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated
|
|
920
|
+
empty messages in your APIs. A typical example is to
|
|
921
|
+
use it as the request or the response type of an API
|
|
922
|
+
method. For instance:
|
|
923
|
+
|
|
924
|
+
service Foo {
|
|
925
|
+
rpc Bar(google.protobuf.Empty) returns
|
|
926
|
+
(google.protobuf.Empty);
|
|
927
|
+
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
"""
|
|
931
|
+
# Create or coerce a protobuf request object.
|
|
932
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
933
|
+
# gotten any keyword arguments that map to the request.
|
|
934
|
+
flattened_params = [name]
|
|
935
|
+
has_flattened_params = (
|
|
936
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
937
|
+
)
|
|
938
|
+
if request is not None and has_flattened_params:
|
|
939
|
+
raise ValueError(
|
|
940
|
+
"If the `request` argument is set, then none of "
|
|
941
|
+
"the individual field arguments should be set."
|
|
942
|
+
)
|
|
943
|
+
|
|
944
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
945
|
+
# there are no flattened fields), or create one.
|
|
946
|
+
if not isinstance(request, datastream.DeleteConnectionProfileRequest):
|
|
947
|
+
request = datastream.DeleteConnectionProfileRequest(request)
|
|
948
|
+
|
|
949
|
+
# If we have keyword arguments corresponding to fields on the
|
|
950
|
+
# request, apply these.
|
|
951
|
+
if name is not None:
|
|
952
|
+
request.name = name
|
|
953
|
+
|
|
954
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
955
|
+
# and friendly error handling.
|
|
956
|
+
rpc = self._client._transport._wrapped_methods[
|
|
957
|
+
self._client._transport.delete_connection_profile
|
|
958
|
+
]
|
|
959
|
+
|
|
960
|
+
# Certain fields should be provided within the metadata header;
|
|
961
|
+
# add these here.
|
|
962
|
+
metadata = tuple(metadata) + (
|
|
963
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
964
|
+
)
|
|
965
|
+
|
|
966
|
+
# Validate the universe domain.
|
|
967
|
+
self._client._validate_universe_domain()
|
|
968
|
+
|
|
969
|
+
# Send the request.
|
|
970
|
+
response = await rpc(
|
|
971
|
+
request,
|
|
972
|
+
retry=retry,
|
|
973
|
+
timeout=timeout,
|
|
974
|
+
metadata=metadata,
|
|
975
|
+
)
|
|
976
|
+
|
|
977
|
+
# Wrap the response in an operation future.
|
|
978
|
+
response = operation_async.from_gapic(
|
|
979
|
+
response,
|
|
980
|
+
self._client._transport.operations_client,
|
|
981
|
+
empty_pb2.Empty,
|
|
982
|
+
metadata_type=datastream.OperationMetadata,
|
|
983
|
+
)
|
|
984
|
+
|
|
985
|
+
# Done; return the response.
|
|
986
|
+
return response
|
|
987
|
+
|
|
988
|
+
async def discover_connection_profile(
|
|
989
|
+
self,
|
|
990
|
+
request: Optional[
|
|
991
|
+
Union[datastream.DiscoverConnectionProfileRequest, dict]
|
|
992
|
+
] = None,
|
|
993
|
+
*,
|
|
994
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
995
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
996
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
997
|
+
) -> datastream.DiscoverConnectionProfileResponse:
|
|
998
|
+
r"""Use this method to discover a connection profile.
|
|
999
|
+
The discover API call exposes the data objects and
|
|
1000
|
+
metadata belonging to the profile. Typically, a request
|
|
1001
|
+
returns children data objects of a parent data object
|
|
1002
|
+
that's optionally supplied in the request.
|
|
1003
|
+
|
|
1004
|
+
.. code-block:: python
|
|
1005
|
+
|
|
1006
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
1007
|
+
# code template only.
|
|
1008
|
+
# It will require modifications to work:
|
|
1009
|
+
# - It may require correct/in-range values for request initialization.
|
|
1010
|
+
# - It may require specifying regional endpoints when creating the service
|
|
1011
|
+
# client as shown in:
|
|
1012
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
1013
|
+
from google.cloud import datastream_v1
|
|
1014
|
+
|
|
1015
|
+
async def sample_discover_connection_profile():
|
|
1016
|
+
# Create a client
|
|
1017
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
1018
|
+
|
|
1019
|
+
# Initialize request argument(s)
|
|
1020
|
+
connection_profile = datastream_v1.ConnectionProfile()
|
|
1021
|
+
connection_profile.oracle_profile.hostname = "hostname_value"
|
|
1022
|
+
connection_profile.oracle_profile.username = "username_value"
|
|
1023
|
+
connection_profile.oracle_profile.database_service = "database_service_value"
|
|
1024
|
+
connection_profile.display_name = "display_name_value"
|
|
1025
|
+
|
|
1026
|
+
request = datastream_v1.DiscoverConnectionProfileRequest(
|
|
1027
|
+
connection_profile=connection_profile,
|
|
1028
|
+
full_hierarchy=True,
|
|
1029
|
+
parent="parent_value",
|
|
1030
|
+
)
|
|
1031
|
+
|
|
1032
|
+
# Make the request
|
|
1033
|
+
response = await client.discover_connection_profile(request=request)
|
|
1034
|
+
|
|
1035
|
+
# Handle the response
|
|
1036
|
+
print(response)
|
|
1037
|
+
|
|
1038
|
+
Args:
|
|
1039
|
+
request (Optional[Union[google.cloud.datastream_v1.types.DiscoverConnectionProfileRequest, dict]]):
|
|
1040
|
+
The request object. Request message for 'discover'
|
|
1041
|
+
ConnectionProfile request.
|
|
1042
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
1043
|
+
should be retried.
|
|
1044
|
+
timeout (float): The timeout for this request.
|
|
1045
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1046
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1047
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1048
|
+
be of type `bytes`.
|
|
1049
|
+
|
|
1050
|
+
Returns:
|
|
1051
|
+
google.cloud.datastream_v1.types.DiscoverConnectionProfileResponse:
|
|
1052
|
+
Response from a discover request.
|
|
1053
|
+
"""
|
|
1054
|
+
# Create or coerce a protobuf request object.
|
|
1055
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
1056
|
+
# there are no flattened fields), or create one.
|
|
1057
|
+
if not isinstance(request, datastream.DiscoverConnectionProfileRequest):
|
|
1058
|
+
request = datastream.DiscoverConnectionProfileRequest(request)
|
|
1059
|
+
|
|
1060
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
1061
|
+
# and friendly error handling.
|
|
1062
|
+
rpc = self._client._transport._wrapped_methods[
|
|
1063
|
+
self._client._transport.discover_connection_profile
|
|
1064
|
+
]
|
|
1065
|
+
|
|
1066
|
+
# Certain fields should be provided within the metadata header;
|
|
1067
|
+
# add these here.
|
|
1068
|
+
metadata = tuple(metadata) + (
|
|
1069
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
1070
|
+
)
|
|
1071
|
+
|
|
1072
|
+
# Validate the universe domain.
|
|
1073
|
+
self._client._validate_universe_domain()
|
|
1074
|
+
|
|
1075
|
+
# Send the request.
|
|
1076
|
+
response = await rpc(
|
|
1077
|
+
request,
|
|
1078
|
+
retry=retry,
|
|
1079
|
+
timeout=timeout,
|
|
1080
|
+
metadata=metadata,
|
|
1081
|
+
)
|
|
1082
|
+
|
|
1083
|
+
# Done; return the response.
|
|
1084
|
+
return response
|
|
1085
|
+
|
|
1086
|
+
async def list_streams(
|
|
1087
|
+
self,
|
|
1088
|
+
request: Optional[Union[datastream.ListStreamsRequest, dict]] = None,
|
|
1089
|
+
*,
|
|
1090
|
+
parent: Optional[str] = None,
|
|
1091
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1092
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
1093
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1094
|
+
) -> pagers.ListStreamsAsyncPager:
|
|
1095
|
+
r"""Use this method to list streams in a project and
|
|
1096
|
+
location.
|
|
1097
|
+
|
|
1098
|
+
.. code-block:: python
|
|
1099
|
+
|
|
1100
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
1101
|
+
# code template only.
|
|
1102
|
+
# It will require modifications to work:
|
|
1103
|
+
# - It may require correct/in-range values for request initialization.
|
|
1104
|
+
# - It may require specifying regional endpoints when creating the service
|
|
1105
|
+
# client as shown in:
|
|
1106
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
1107
|
+
from google.cloud import datastream_v1
|
|
1108
|
+
|
|
1109
|
+
async def sample_list_streams():
|
|
1110
|
+
# Create a client
|
|
1111
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
1112
|
+
|
|
1113
|
+
# Initialize request argument(s)
|
|
1114
|
+
request = datastream_v1.ListStreamsRequest(
|
|
1115
|
+
parent="parent_value",
|
|
1116
|
+
)
|
|
1117
|
+
|
|
1118
|
+
# Make the request
|
|
1119
|
+
page_result = client.list_streams(request=request)
|
|
1120
|
+
|
|
1121
|
+
# Handle the response
|
|
1122
|
+
async for response in page_result:
|
|
1123
|
+
print(response)
|
|
1124
|
+
|
|
1125
|
+
Args:
|
|
1126
|
+
request (Optional[Union[google.cloud.datastream_v1.types.ListStreamsRequest, dict]]):
|
|
1127
|
+
The request object. Request message for listing streams.
|
|
1128
|
+
parent (:class:`str`):
|
|
1129
|
+
Required. The parent that owns the
|
|
1130
|
+
collection of streams.
|
|
1131
|
+
|
|
1132
|
+
This corresponds to the ``parent`` field
|
|
1133
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
1134
|
+
should not be set.
|
|
1135
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
1136
|
+
should be retried.
|
|
1137
|
+
timeout (float): The timeout for this request.
|
|
1138
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1139
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1140
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1141
|
+
be of type `bytes`.
|
|
1142
|
+
|
|
1143
|
+
Returns:
|
|
1144
|
+
google.cloud.datastream_v1.services.datastream.pagers.ListStreamsAsyncPager:
|
|
1145
|
+
Response message for listing streams.
|
|
1146
|
+
|
|
1147
|
+
Iterating over this object will yield
|
|
1148
|
+
results and resolve additional pages
|
|
1149
|
+
automatically.
|
|
1150
|
+
|
|
1151
|
+
"""
|
|
1152
|
+
# Create or coerce a protobuf request object.
|
|
1153
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
1154
|
+
# gotten any keyword arguments that map to the request.
|
|
1155
|
+
flattened_params = [parent]
|
|
1156
|
+
has_flattened_params = (
|
|
1157
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
1158
|
+
)
|
|
1159
|
+
if request is not None and has_flattened_params:
|
|
1160
|
+
raise ValueError(
|
|
1161
|
+
"If the `request` argument is set, then none of "
|
|
1162
|
+
"the individual field arguments should be set."
|
|
1163
|
+
)
|
|
1164
|
+
|
|
1165
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
1166
|
+
# there are no flattened fields), or create one.
|
|
1167
|
+
if not isinstance(request, datastream.ListStreamsRequest):
|
|
1168
|
+
request = datastream.ListStreamsRequest(request)
|
|
1169
|
+
|
|
1170
|
+
# If we have keyword arguments corresponding to fields on the
|
|
1171
|
+
# request, apply these.
|
|
1172
|
+
if parent is not None:
|
|
1173
|
+
request.parent = parent
|
|
1174
|
+
|
|
1175
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
1176
|
+
# and friendly error handling.
|
|
1177
|
+
rpc = self._client._transport._wrapped_methods[
|
|
1178
|
+
self._client._transport.list_streams
|
|
1179
|
+
]
|
|
1180
|
+
|
|
1181
|
+
# Certain fields should be provided within the metadata header;
|
|
1182
|
+
# add these here.
|
|
1183
|
+
metadata = tuple(metadata) + (
|
|
1184
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
1185
|
+
)
|
|
1186
|
+
|
|
1187
|
+
# Validate the universe domain.
|
|
1188
|
+
self._client._validate_universe_domain()
|
|
1189
|
+
|
|
1190
|
+
# Send the request.
|
|
1191
|
+
response = await rpc(
|
|
1192
|
+
request,
|
|
1193
|
+
retry=retry,
|
|
1194
|
+
timeout=timeout,
|
|
1195
|
+
metadata=metadata,
|
|
1196
|
+
)
|
|
1197
|
+
|
|
1198
|
+
# This method is paged; wrap the response in a pager, which provides
|
|
1199
|
+
# an `__aiter__` convenience method.
|
|
1200
|
+
response = pagers.ListStreamsAsyncPager(
|
|
1201
|
+
method=rpc,
|
|
1202
|
+
request=request,
|
|
1203
|
+
response=response,
|
|
1204
|
+
retry=retry,
|
|
1205
|
+
timeout=timeout,
|
|
1206
|
+
metadata=metadata,
|
|
1207
|
+
)
|
|
1208
|
+
|
|
1209
|
+
# Done; return the response.
|
|
1210
|
+
return response
|
|
1211
|
+
|
|
1212
|
+
async def get_stream(
|
|
1213
|
+
self,
|
|
1214
|
+
request: Optional[Union[datastream.GetStreamRequest, dict]] = None,
|
|
1215
|
+
*,
|
|
1216
|
+
name: Optional[str] = None,
|
|
1217
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1218
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
1219
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1220
|
+
) -> datastream_resources.Stream:
|
|
1221
|
+
r"""Use this method to get details about a stream.
|
|
1222
|
+
|
|
1223
|
+
.. code-block:: python
|
|
1224
|
+
|
|
1225
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
1226
|
+
# code template only.
|
|
1227
|
+
# It will require modifications to work:
|
|
1228
|
+
# - It may require correct/in-range values for request initialization.
|
|
1229
|
+
# - It may require specifying regional endpoints when creating the service
|
|
1230
|
+
# client as shown in:
|
|
1231
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
1232
|
+
from google.cloud import datastream_v1
|
|
1233
|
+
|
|
1234
|
+
async def sample_get_stream():
|
|
1235
|
+
# Create a client
|
|
1236
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
1237
|
+
|
|
1238
|
+
# Initialize request argument(s)
|
|
1239
|
+
request = datastream_v1.GetStreamRequest(
|
|
1240
|
+
name="name_value",
|
|
1241
|
+
)
|
|
1242
|
+
|
|
1243
|
+
# Make the request
|
|
1244
|
+
response = await client.get_stream(request=request)
|
|
1245
|
+
|
|
1246
|
+
# Handle the response
|
|
1247
|
+
print(response)
|
|
1248
|
+
|
|
1249
|
+
Args:
|
|
1250
|
+
request (Optional[Union[google.cloud.datastream_v1.types.GetStreamRequest, dict]]):
|
|
1251
|
+
The request object. Request message for getting a stream.
|
|
1252
|
+
name (:class:`str`):
|
|
1253
|
+
Required. The name of the stream
|
|
1254
|
+
resource to get.
|
|
1255
|
+
|
|
1256
|
+
This corresponds to the ``name`` field
|
|
1257
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
1258
|
+
should not be set.
|
|
1259
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
1260
|
+
should be retried.
|
|
1261
|
+
timeout (float): The timeout for this request.
|
|
1262
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1263
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1264
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1265
|
+
be of type `bytes`.
|
|
1266
|
+
|
|
1267
|
+
Returns:
|
|
1268
|
+
google.cloud.datastream_v1.types.Stream:
|
|
1269
|
+
A resource representing streaming
|
|
1270
|
+
data from a source to a destination.
|
|
1271
|
+
|
|
1272
|
+
"""
|
|
1273
|
+
# Create or coerce a protobuf request object.
|
|
1274
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
1275
|
+
# gotten any keyword arguments that map to the request.
|
|
1276
|
+
flattened_params = [name]
|
|
1277
|
+
has_flattened_params = (
|
|
1278
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
1279
|
+
)
|
|
1280
|
+
if request is not None and has_flattened_params:
|
|
1281
|
+
raise ValueError(
|
|
1282
|
+
"If the `request` argument is set, then none of "
|
|
1283
|
+
"the individual field arguments should be set."
|
|
1284
|
+
)
|
|
1285
|
+
|
|
1286
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
1287
|
+
# there are no flattened fields), or create one.
|
|
1288
|
+
if not isinstance(request, datastream.GetStreamRequest):
|
|
1289
|
+
request = datastream.GetStreamRequest(request)
|
|
1290
|
+
|
|
1291
|
+
# If we have keyword arguments corresponding to fields on the
|
|
1292
|
+
# request, apply these.
|
|
1293
|
+
if name is not None:
|
|
1294
|
+
request.name = name
|
|
1295
|
+
|
|
1296
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
1297
|
+
# and friendly error handling.
|
|
1298
|
+
rpc = self._client._transport._wrapped_methods[
|
|
1299
|
+
self._client._transport.get_stream
|
|
1300
|
+
]
|
|
1301
|
+
|
|
1302
|
+
# Certain fields should be provided within the metadata header;
|
|
1303
|
+
# add these here.
|
|
1304
|
+
metadata = tuple(metadata) + (
|
|
1305
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
1306
|
+
)
|
|
1307
|
+
|
|
1308
|
+
# Validate the universe domain.
|
|
1309
|
+
self._client._validate_universe_domain()
|
|
1310
|
+
|
|
1311
|
+
# Send the request.
|
|
1312
|
+
response = await rpc(
|
|
1313
|
+
request,
|
|
1314
|
+
retry=retry,
|
|
1315
|
+
timeout=timeout,
|
|
1316
|
+
metadata=metadata,
|
|
1317
|
+
)
|
|
1318
|
+
|
|
1319
|
+
# Done; return the response.
|
|
1320
|
+
return response
|
|
1321
|
+
|
|
1322
|
+
async def create_stream(
|
|
1323
|
+
self,
|
|
1324
|
+
request: Optional[Union[datastream.CreateStreamRequest, dict]] = None,
|
|
1325
|
+
*,
|
|
1326
|
+
parent: Optional[str] = None,
|
|
1327
|
+
stream: Optional[datastream_resources.Stream] = None,
|
|
1328
|
+
stream_id: Optional[str] = None,
|
|
1329
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1330
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
1331
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1332
|
+
) -> operation_async.AsyncOperation:
|
|
1333
|
+
r"""Use this method to create a stream.
|
|
1334
|
+
|
|
1335
|
+
.. code-block:: python
|
|
1336
|
+
|
|
1337
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
1338
|
+
# code template only.
|
|
1339
|
+
# It will require modifications to work:
|
|
1340
|
+
# - It may require correct/in-range values for request initialization.
|
|
1341
|
+
# - It may require specifying regional endpoints when creating the service
|
|
1342
|
+
# client as shown in:
|
|
1343
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
1344
|
+
from google.cloud import datastream_v1
|
|
1345
|
+
|
|
1346
|
+
async def sample_create_stream():
|
|
1347
|
+
# Create a client
|
|
1348
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
1349
|
+
|
|
1350
|
+
# Initialize request argument(s)
|
|
1351
|
+
stream = datastream_v1.Stream()
|
|
1352
|
+
stream.display_name = "display_name_value"
|
|
1353
|
+
stream.source_config.source_connection_profile = "source_connection_profile_value"
|
|
1354
|
+
stream.destination_config.destination_connection_profile = "destination_connection_profile_value"
|
|
1355
|
+
|
|
1356
|
+
request = datastream_v1.CreateStreamRequest(
|
|
1357
|
+
parent="parent_value",
|
|
1358
|
+
stream_id="stream_id_value",
|
|
1359
|
+
stream=stream,
|
|
1360
|
+
)
|
|
1361
|
+
|
|
1362
|
+
# Make the request
|
|
1363
|
+
operation = client.create_stream(request=request)
|
|
1364
|
+
|
|
1365
|
+
print("Waiting for operation to complete...")
|
|
1366
|
+
|
|
1367
|
+
response = (await operation).result()
|
|
1368
|
+
|
|
1369
|
+
# Handle the response
|
|
1370
|
+
print(response)
|
|
1371
|
+
|
|
1372
|
+
Args:
|
|
1373
|
+
request (Optional[Union[google.cloud.datastream_v1.types.CreateStreamRequest, dict]]):
|
|
1374
|
+
The request object. Request message for creating a
|
|
1375
|
+
stream.
|
|
1376
|
+
parent (:class:`str`):
|
|
1377
|
+
Required. The parent that owns the
|
|
1378
|
+
collection of streams.
|
|
1379
|
+
|
|
1380
|
+
This corresponds to the ``parent`` field
|
|
1381
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
1382
|
+
should not be set.
|
|
1383
|
+
stream (:class:`google.cloud.datastream_v1.types.Stream`):
|
|
1384
|
+
Required. The stream resource to
|
|
1385
|
+
create.
|
|
1386
|
+
|
|
1387
|
+
This corresponds to the ``stream`` field
|
|
1388
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
1389
|
+
should not be set.
|
|
1390
|
+
stream_id (:class:`str`):
|
|
1391
|
+
Required. The stream identifier.
|
|
1392
|
+
This corresponds to the ``stream_id`` field
|
|
1393
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
1394
|
+
should not be set.
|
|
1395
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
1396
|
+
should be retried.
|
|
1397
|
+
timeout (float): The timeout for this request.
|
|
1398
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1399
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1400
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1401
|
+
be of type `bytes`.
|
|
1402
|
+
|
|
1403
|
+
Returns:
|
|
1404
|
+
google.api_core.operation_async.AsyncOperation:
|
|
1405
|
+
An object representing a long-running operation.
|
|
1406
|
+
|
|
1407
|
+
The result type for the operation will be
|
|
1408
|
+
:class:`google.cloud.datastream_v1.types.Stream` A
|
|
1409
|
+
resource representing streaming data from a source to a
|
|
1410
|
+
destination.
|
|
1411
|
+
|
|
1412
|
+
"""
|
|
1413
|
+
# Create or coerce a protobuf request object.
|
|
1414
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
1415
|
+
# gotten any keyword arguments that map to the request.
|
|
1416
|
+
flattened_params = [parent, stream, stream_id]
|
|
1417
|
+
has_flattened_params = (
|
|
1418
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
1419
|
+
)
|
|
1420
|
+
if request is not None and has_flattened_params:
|
|
1421
|
+
raise ValueError(
|
|
1422
|
+
"If the `request` argument is set, then none of "
|
|
1423
|
+
"the individual field arguments should be set."
|
|
1424
|
+
)
|
|
1425
|
+
|
|
1426
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
1427
|
+
# there are no flattened fields), or create one.
|
|
1428
|
+
if not isinstance(request, datastream.CreateStreamRequest):
|
|
1429
|
+
request = datastream.CreateStreamRequest(request)
|
|
1430
|
+
|
|
1431
|
+
# If we have keyword arguments corresponding to fields on the
|
|
1432
|
+
# request, apply these.
|
|
1433
|
+
if parent is not None:
|
|
1434
|
+
request.parent = parent
|
|
1435
|
+
if stream is not None:
|
|
1436
|
+
request.stream = stream
|
|
1437
|
+
if stream_id is not None:
|
|
1438
|
+
request.stream_id = stream_id
|
|
1439
|
+
|
|
1440
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
1441
|
+
# and friendly error handling.
|
|
1442
|
+
rpc = self._client._transport._wrapped_methods[
|
|
1443
|
+
self._client._transport.create_stream
|
|
1444
|
+
]
|
|
1445
|
+
|
|
1446
|
+
# Certain fields should be provided within the metadata header;
|
|
1447
|
+
# add these here.
|
|
1448
|
+
metadata = tuple(metadata) + (
|
|
1449
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
1450
|
+
)
|
|
1451
|
+
|
|
1452
|
+
# Validate the universe domain.
|
|
1453
|
+
self._client._validate_universe_domain()
|
|
1454
|
+
|
|
1455
|
+
# Send the request.
|
|
1456
|
+
response = await rpc(
|
|
1457
|
+
request,
|
|
1458
|
+
retry=retry,
|
|
1459
|
+
timeout=timeout,
|
|
1460
|
+
metadata=metadata,
|
|
1461
|
+
)
|
|
1462
|
+
|
|
1463
|
+
# Wrap the response in an operation future.
|
|
1464
|
+
response = operation_async.from_gapic(
|
|
1465
|
+
response,
|
|
1466
|
+
self._client._transport.operations_client,
|
|
1467
|
+
datastream_resources.Stream,
|
|
1468
|
+
metadata_type=datastream.OperationMetadata,
|
|
1469
|
+
)
|
|
1470
|
+
|
|
1471
|
+
# Done; return the response.
|
|
1472
|
+
return response
|
|
1473
|
+
|
|
1474
|
+
async def update_stream(
|
|
1475
|
+
self,
|
|
1476
|
+
request: Optional[Union[datastream.UpdateStreamRequest, dict]] = None,
|
|
1477
|
+
*,
|
|
1478
|
+
stream: Optional[datastream_resources.Stream] = None,
|
|
1479
|
+
update_mask: Optional[field_mask_pb2.FieldMask] = None,
|
|
1480
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1481
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
1482
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1483
|
+
) -> operation_async.AsyncOperation:
|
|
1484
|
+
r"""Use this method to update the configuration of a
|
|
1485
|
+
stream.
|
|
1486
|
+
|
|
1487
|
+
.. code-block:: python
|
|
1488
|
+
|
|
1489
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
1490
|
+
# code template only.
|
|
1491
|
+
# It will require modifications to work:
|
|
1492
|
+
# - It may require correct/in-range values for request initialization.
|
|
1493
|
+
# - It may require specifying regional endpoints when creating the service
|
|
1494
|
+
# client as shown in:
|
|
1495
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
1496
|
+
from google.cloud import datastream_v1
|
|
1497
|
+
|
|
1498
|
+
async def sample_update_stream():
|
|
1499
|
+
# Create a client
|
|
1500
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
1501
|
+
|
|
1502
|
+
# Initialize request argument(s)
|
|
1503
|
+
stream = datastream_v1.Stream()
|
|
1504
|
+
stream.display_name = "display_name_value"
|
|
1505
|
+
stream.source_config.source_connection_profile = "source_connection_profile_value"
|
|
1506
|
+
stream.destination_config.destination_connection_profile = "destination_connection_profile_value"
|
|
1507
|
+
|
|
1508
|
+
request = datastream_v1.UpdateStreamRequest(
|
|
1509
|
+
stream=stream,
|
|
1510
|
+
)
|
|
1511
|
+
|
|
1512
|
+
# Make the request
|
|
1513
|
+
operation = client.update_stream(request=request)
|
|
1514
|
+
|
|
1515
|
+
print("Waiting for operation to complete...")
|
|
1516
|
+
|
|
1517
|
+
response = (await operation).result()
|
|
1518
|
+
|
|
1519
|
+
# Handle the response
|
|
1520
|
+
print(response)
|
|
1521
|
+
|
|
1522
|
+
Args:
|
|
1523
|
+
request (Optional[Union[google.cloud.datastream_v1.types.UpdateStreamRequest, dict]]):
|
|
1524
|
+
The request object. Request message for updating a
|
|
1525
|
+
stream.
|
|
1526
|
+
stream (:class:`google.cloud.datastream_v1.types.Stream`):
|
|
1527
|
+
Required. The stream resource to
|
|
1528
|
+
update.
|
|
1529
|
+
|
|
1530
|
+
This corresponds to the ``stream`` field
|
|
1531
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
1532
|
+
should not be set.
|
|
1533
|
+
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
|
|
1534
|
+
Optional. Field mask is used to specify the fields to be
|
|
1535
|
+
overwritten in the stream resource by the update. The
|
|
1536
|
+
fields specified in the update_mask are relative to the
|
|
1537
|
+
resource, not the full request. A field will be
|
|
1538
|
+
overwritten if it is in the mask. If the user does not
|
|
1539
|
+
provide a mask then all fields will be overwritten.
|
|
1540
|
+
|
|
1541
|
+
This corresponds to the ``update_mask`` field
|
|
1542
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
1543
|
+
should not be set.
|
|
1544
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
1545
|
+
should be retried.
|
|
1546
|
+
timeout (float): The timeout for this request.
|
|
1547
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1548
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1549
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1550
|
+
be of type `bytes`.
|
|
1551
|
+
|
|
1552
|
+
Returns:
|
|
1553
|
+
google.api_core.operation_async.AsyncOperation:
|
|
1554
|
+
An object representing a long-running operation.
|
|
1555
|
+
|
|
1556
|
+
The result type for the operation will be
|
|
1557
|
+
:class:`google.cloud.datastream_v1.types.Stream` A
|
|
1558
|
+
resource representing streaming data from a source to a
|
|
1559
|
+
destination.
|
|
1560
|
+
|
|
1561
|
+
"""
|
|
1562
|
+
# Create or coerce a protobuf request object.
|
|
1563
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
1564
|
+
# gotten any keyword arguments that map to the request.
|
|
1565
|
+
flattened_params = [stream, update_mask]
|
|
1566
|
+
has_flattened_params = (
|
|
1567
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
1568
|
+
)
|
|
1569
|
+
if request is not None and has_flattened_params:
|
|
1570
|
+
raise ValueError(
|
|
1571
|
+
"If the `request` argument is set, then none of "
|
|
1572
|
+
"the individual field arguments should be set."
|
|
1573
|
+
)
|
|
1574
|
+
|
|
1575
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
1576
|
+
# there are no flattened fields), or create one.
|
|
1577
|
+
if not isinstance(request, datastream.UpdateStreamRequest):
|
|
1578
|
+
request = datastream.UpdateStreamRequest(request)
|
|
1579
|
+
|
|
1580
|
+
# If we have keyword arguments corresponding to fields on the
|
|
1581
|
+
# request, apply these.
|
|
1582
|
+
if stream is not None:
|
|
1583
|
+
request.stream = stream
|
|
1584
|
+
if update_mask is not None:
|
|
1585
|
+
request.update_mask = update_mask
|
|
1586
|
+
|
|
1587
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
1588
|
+
# and friendly error handling.
|
|
1589
|
+
rpc = self._client._transport._wrapped_methods[
|
|
1590
|
+
self._client._transport.update_stream
|
|
1591
|
+
]
|
|
1592
|
+
|
|
1593
|
+
# Certain fields should be provided within the metadata header;
|
|
1594
|
+
# add these here.
|
|
1595
|
+
metadata = tuple(metadata) + (
|
|
1596
|
+
gapic_v1.routing_header.to_grpc_metadata(
|
|
1597
|
+
(("stream.name", request.stream.name),)
|
|
1598
|
+
),
|
|
1599
|
+
)
|
|
1600
|
+
|
|
1601
|
+
# Validate the universe domain.
|
|
1602
|
+
self._client._validate_universe_domain()
|
|
1603
|
+
|
|
1604
|
+
# Send the request.
|
|
1605
|
+
response = await rpc(
|
|
1606
|
+
request,
|
|
1607
|
+
retry=retry,
|
|
1608
|
+
timeout=timeout,
|
|
1609
|
+
metadata=metadata,
|
|
1610
|
+
)
|
|
1611
|
+
|
|
1612
|
+
# Wrap the response in an operation future.
|
|
1613
|
+
response = operation_async.from_gapic(
|
|
1614
|
+
response,
|
|
1615
|
+
self._client._transport.operations_client,
|
|
1616
|
+
datastream_resources.Stream,
|
|
1617
|
+
metadata_type=datastream.OperationMetadata,
|
|
1618
|
+
)
|
|
1619
|
+
|
|
1620
|
+
# Done; return the response.
|
|
1621
|
+
return response
|
|
1622
|
+
|
|
1623
|
+
async def delete_stream(
|
|
1624
|
+
self,
|
|
1625
|
+
request: Optional[Union[datastream.DeleteStreamRequest, dict]] = None,
|
|
1626
|
+
*,
|
|
1627
|
+
name: Optional[str] = None,
|
|
1628
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1629
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
1630
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1631
|
+
) -> operation_async.AsyncOperation:
|
|
1632
|
+
r"""Use this method to delete a stream.
|
|
1633
|
+
|
|
1634
|
+
.. code-block:: python
|
|
1635
|
+
|
|
1636
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
1637
|
+
# code template only.
|
|
1638
|
+
# It will require modifications to work:
|
|
1639
|
+
# - It may require correct/in-range values for request initialization.
|
|
1640
|
+
# - It may require specifying regional endpoints when creating the service
|
|
1641
|
+
# client as shown in:
|
|
1642
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
1643
|
+
from google.cloud import datastream_v1
|
|
1644
|
+
|
|
1645
|
+
async def sample_delete_stream():
|
|
1646
|
+
# Create a client
|
|
1647
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
1648
|
+
|
|
1649
|
+
# Initialize request argument(s)
|
|
1650
|
+
request = datastream_v1.DeleteStreamRequest(
|
|
1651
|
+
name="name_value",
|
|
1652
|
+
)
|
|
1653
|
+
|
|
1654
|
+
# Make the request
|
|
1655
|
+
operation = client.delete_stream(request=request)
|
|
1656
|
+
|
|
1657
|
+
print("Waiting for operation to complete...")
|
|
1658
|
+
|
|
1659
|
+
response = (await operation).result()
|
|
1660
|
+
|
|
1661
|
+
# Handle the response
|
|
1662
|
+
print(response)
|
|
1663
|
+
|
|
1664
|
+
Args:
|
|
1665
|
+
request (Optional[Union[google.cloud.datastream_v1.types.DeleteStreamRequest, dict]]):
|
|
1666
|
+
The request object. Request message for deleting a
|
|
1667
|
+
stream.
|
|
1668
|
+
name (:class:`str`):
|
|
1669
|
+
Required. The name of the stream
|
|
1670
|
+
resource to delete.
|
|
1671
|
+
|
|
1672
|
+
This corresponds to the ``name`` field
|
|
1673
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
1674
|
+
should not be set.
|
|
1675
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
1676
|
+
should be retried.
|
|
1677
|
+
timeout (float): The timeout for this request.
|
|
1678
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1679
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1680
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1681
|
+
be of type `bytes`.
|
|
1682
|
+
|
|
1683
|
+
Returns:
|
|
1684
|
+
google.api_core.operation_async.AsyncOperation:
|
|
1685
|
+
An object representing a long-running operation.
|
|
1686
|
+
|
|
1687
|
+
The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated
|
|
1688
|
+
empty messages in your APIs. A typical example is to
|
|
1689
|
+
use it as the request or the response type of an API
|
|
1690
|
+
method. For instance:
|
|
1691
|
+
|
|
1692
|
+
service Foo {
|
|
1693
|
+
rpc Bar(google.protobuf.Empty) returns
|
|
1694
|
+
(google.protobuf.Empty);
|
|
1695
|
+
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
"""
|
|
1699
|
+
# Create or coerce a protobuf request object.
|
|
1700
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
1701
|
+
# gotten any keyword arguments that map to the request.
|
|
1702
|
+
flattened_params = [name]
|
|
1703
|
+
has_flattened_params = (
|
|
1704
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
1705
|
+
)
|
|
1706
|
+
if request is not None and has_flattened_params:
|
|
1707
|
+
raise ValueError(
|
|
1708
|
+
"If the `request` argument is set, then none of "
|
|
1709
|
+
"the individual field arguments should be set."
|
|
1710
|
+
)
|
|
1711
|
+
|
|
1712
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
1713
|
+
# there are no flattened fields), or create one.
|
|
1714
|
+
if not isinstance(request, datastream.DeleteStreamRequest):
|
|
1715
|
+
request = datastream.DeleteStreamRequest(request)
|
|
1716
|
+
|
|
1717
|
+
# If we have keyword arguments corresponding to fields on the
|
|
1718
|
+
# request, apply these.
|
|
1719
|
+
if name is not None:
|
|
1720
|
+
request.name = name
|
|
1721
|
+
|
|
1722
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
1723
|
+
# and friendly error handling.
|
|
1724
|
+
rpc = self._client._transport._wrapped_methods[
|
|
1725
|
+
self._client._transport.delete_stream
|
|
1726
|
+
]
|
|
1727
|
+
|
|
1728
|
+
# Certain fields should be provided within the metadata header;
|
|
1729
|
+
# add these here.
|
|
1730
|
+
metadata = tuple(metadata) + (
|
|
1731
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
1732
|
+
)
|
|
1733
|
+
|
|
1734
|
+
# Validate the universe domain.
|
|
1735
|
+
self._client._validate_universe_domain()
|
|
1736
|
+
|
|
1737
|
+
# Send the request.
|
|
1738
|
+
response = await rpc(
|
|
1739
|
+
request,
|
|
1740
|
+
retry=retry,
|
|
1741
|
+
timeout=timeout,
|
|
1742
|
+
metadata=metadata,
|
|
1743
|
+
)
|
|
1744
|
+
|
|
1745
|
+
# Wrap the response in an operation future.
|
|
1746
|
+
response = operation_async.from_gapic(
|
|
1747
|
+
response,
|
|
1748
|
+
self._client._transport.operations_client,
|
|
1749
|
+
empty_pb2.Empty,
|
|
1750
|
+
metadata_type=datastream.OperationMetadata,
|
|
1751
|
+
)
|
|
1752
|
+
|
|
1753
|
+
# Done; return the response.
|
|
1754
|
+
return response
|
|
1755
|
+
|
|
1756
|
+
async def run_stream(
|
|
1757
|
+
self,
|
|
1758
|
+
request: Optional[Union[datastream.RunStreamRequest, dict]] = None,
|
|
1759
|
+
*,
|
|
1760
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1761
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
1762
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1763
|
+
) -> operation_async.AsyncOperation:
|
|
1764
|
+
r"""Use this method to start, resume or recover a stream
|
|
1765
|
+
with a non default CDC strategy.
|
|
1766
|
+
|
|
1767
|
+
.. code-block:: python
|
|
1768
|
+
|
|
1769
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
1770
|
+
# code template only.
|
|
1771
|
+
# It will require modifications to work:
|
|
1772
|
+
# - It may require correct/in-range values for request initialization.
|
|
1773
|
+
# - It may require specifying regional endpoints when creating the service
|
|
1774
|
+
# client as shown in:
|
|
1775
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
1776
|
+
from google.cloud import datastream_v1
|
|
1777
|
+
|
|
1778
|
+
async def sample_run_stream():
|
|
1779
|
+
# Create a client
|
|
1780
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
1781
|
+
|
|
1782
|
+
# Initialize request argument(s)
|
|
1783
|
+
request = datastream_v1.RunStreamRequest(
|
|
1784
|
+
name="name_value",
|
|
1785
|
+
)
|
|
1786
|
+
|
|
1787
|
+
# Make the request
|
|
1788
|
+
operation = client.run_stream(request=request)
|
|
1789
|
+
|
|
1790
|
+
print("Waiting for operation to complete...")
|
|
1791
|
+
|
|
1792
|
+
response = (await operation).result()
|
|
1793
|
+
|
|
1794
|
+
# Handle the response
|
|
1795
|
+
print(response)
|
|
1796
|
+
|
|
1797
|
+
Args:
|
|
1798
|
+
request (Optional[Union[google.cloud.datastream_v1.types.RunStreamRequest, dict]]):
|
|
1799
|
+
The request object. Request message for running a stream.
|
|
1800
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
1801
|
+
should be retried.
|
|
1802
|
+
timeout (float): The timeout for this request.
|
|
1803
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1804
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1805
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1806
|
+
be of type `bytes`.
|
|
1807
|
+
|
|
1808
|
+
Returns:
|
|
1809
|
+
google.api_core.operation_async.AsyncOperation:
|
|
1810
|
+
An object representing a long-running operation.
|
|
1811
|
+
|
|
1812
|
+
The result type for the operation will be
|
|
1813
|
+
:class:`google.cloud.datastream_v1.types.Stream` A
|
|
1814
|
+
resource representing streaming data from a source to a
|
|
1815
|
+
destination.
|
|
1816
|
+
|
|
1817
|
+
"""
|
|
1818
|
+
# Create or coerce a protobuf request object.
|
|
1819
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
1820
|
+
# there are no flattened fields), or create one.
|
|
1821
|
+
if not isinstance(request, datastream.RunStreamRequest):
|
|
1822
|
+
request = datastream.RunStreamRequest(request)
|
|
1823
|
+
|
|
1824
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
1825
|
+
# and friendly error handling.
|
|
1826
|
+
rpc = self._client._transport._wrapped_methods[
|
|
1827
|
+
self._client._transport.run_stream
|
|
1828
|
+
]
|
|
1829
|
+
|
|
1830
|
+
# Certain fields should be provided within the metadata header;
|
|
1831
|
+
# add these here.
|
|
1832
|
+
metadata = tuple(metadata) + (
|
|
1833
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
1834
|
+
)
|
|
1835
|
+
|
|
1836
|
+
# Validate the universe domain.
|
|
1837
|
+
self._client._validate_universe_domain()
|
|
1838
|
+
|
|
1839
|
+
# Send the request.
|
|
1840
|
+
response = await rpc(
|
|
1841
|
+
request,
|
|
1842
|
+
retry=retry,
|
|
1843
|
+
timeout=timeout,
|
|
1844
|
+
metadata=metadata,
|
|
1845
|
+
)
|
|
1846
|
+
|
|
1847
|
+
# Wrap the response in an operation future.
|
|
1848
|
+
response = operation_async.from_gapic(
|
|
1849
|
+
response,
|
|
1850
|
+
self._client._transport.operations_client,
|
|
1851
|
+
datastream_resources.Stream,
|
|
1852
|
+
metadata_type=datastream.OperationMetadata,
|
|
1853
|
+
)
|
|
1854
|
+
|
|
1855
|
+
# Done; return the response.
|
|
1856
|
+
return response
|
|
1857
|
+
|
|
1858
|
+
async def get_stream_object(
|
|
1859
|
+
self,
|
|
1860
|
+
request: Optional[Union[datastream.GetStreamObjectRequest, dict]] = None,
|
|
1861
|
+
*,
|
|
1862
|
+
name: Optional[str] = None,
|
|
1863
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1864
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
1865
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1866
|
+
) -> datastream_resources.StreamObject:
|
|
1867
|
+
r"""Use this method to get details about a stream object.
|
|
1868
|
+
|
|
1869
|
+
.. code-block:: python
|
|
1870
|
+
|
|
1871
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
1872
|
+
# code template only.
|
|
1873
|
+
# It will require modifications to work:
|
|
1874
|
+
# - It may require correct/in-range values for request initialization.
|
|
1875
|
+
# - It may require specifying regional endpoints when creating the service
|
|
1876
|
+
# client as shown in:
|
|
1877
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
1878
|
+
from google.cloud import datastream_v1
|
|
1879
|
+
|
|
1880
|
+
async def sample_get_stream_object():
|
|
1881
|
+
# Create a client
|
|
1882
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
1883
|
+
|
|
1884
|
+
# Initialize request argument(s)
|
|
1885
|
+
request = datastream_v1.GetStreamObjectRequest(
|
|
1886
|
+
name="name_value",
|
|
1887
|
+
)
|
|
1888
|
+
|
|
1889
|
+
# Make the request
|
|
1890
|
+
response = await client.get_stream_object(request=request)
|
|
1891
|
+
|
|
1892
|
+
# Handle the response
|
|
1893
|
+
print(response)
|
|
1894
|
+
|
|
1895
|
+
Args:
|
|
1896
|
+
request (Optional[Union[google.cloud.datastream_v1.types.GetStreamObjectRequest, dict]]):
|
|
1897
|
+
The request object. Request for fetching a specific
|
|
1898
|
+
stream object.
|
|
1899
|
+
name (:class:`str`):
|
|
1900
|
+
Required. The name of the stream
|
|
1901
|
+
object resource to get.
|
|
1902
|
+
|
|
1903
|
+
This corresponds to the ``name`` field
|
|
1904
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
1905
|
+
should not be set.
|
|
1906
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
1907
|
+
should be retried.
|
|
1908
|
+
timeout (float): The timeout for this request.
|
|
1909
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1910
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1911
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1912
|
+
be of type `bytes`.
|
|
1913
|
+
|
|
1914
|
+
Returns:
|
|
1915
|
+
google.cloud.datastream_v1.types.StreamObject:
|
|
1916
|
+
A specific stream object (e.g a
|
|
1917
|
+
specific DB table).
|
|
1918
|
+
|
|
1919
|
+
"""
|
|
1920
|
+
# Create or coerce a protobuf request object.
|
|
1921
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
1922
|
+
# gotten any keyword arguments that map to the request.
|
|
1923
|
+
flattened_params = [name]
|
|
1924
|
+
has_flattened_params = (
|
|
1925
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
1926
|
+
)
|
|
1927
|
+
if request is not None and has_flattened_params:
|
|
1928
|
+
raise ValueError(
|
|
1929
|
+
"If the `request` argument is set, then none of "
|
|
1930
|
+
"the individual field arguments should be set."
|
|
1931
|
+
)
|
|
1932
|
+
|
|
1933
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
1934
|
+
# there are no flattened fields), or create one.
|
|
1935
|
+
if not isinstance(request, datastream.GetStreamObjectRequest):
|
|
1936
|
+
request = datastream.GetStreamObjectRequest(request)
|
|
1937
|
+
|
|
1938
|
+
# If we have keyword arguments corresponding to fields on the
|
|
1939
|
+
# request, apply these.
|
|
1940
|
+
if name is not None:
|
|
1941
|
+
request.name = name
|
|
1942
|
+
|
|
1943
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
1944
|
+
# and friendly error handling.
|
|
1945
|
+
rpc = self._client._transport._wrapped_methods[
|
|
1946
|
+
self._client._transport.get_stream_object
|
|
1947
|
+
]
|
|
1948
|
+
|
|
1949
|
+
# Certain fields should be provided within the metadata header;
|
|
1950
|
+
# add these here.
|
|
1951
|
+
metadata = tuple(metadata) + (
|
|
1952
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
1953
|
+
)
|
|
1954
|
+
|
|
1955
|
+
# Validate the universe domain.
|
|
1956
|
+
self._client._validate_universe_domain()
|
|
1957
|
+
|
|
1958
|
+
# Send the request.
|
|
1959
|
+
response = await rpc(
|
|
1960
|
+
request,
|
|
1961
|
+
retry=retry,
|
|
1962
|
+
timeout=timeout,
|
|
1963
|
+
metadata=metadata,
|
|
1964
|
+
)
|
|
1965
|
+
|
|
1966
|
+
# Done; return the response.
|
|
1967
|
+
return response
|
|
1968
|
+
|
|
1969
|
+
async def lookup_stream_object(
|
|
1970
|
+
self,
|
|
1971
|
+
request: Optional[Union[datastream.LookupStreamObjectRequest, dict]] = None,
|
|
1972
|
+
*,
|
|
1973
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1974
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
1975
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1976
|
+
) -> datastream_resources.StreamObject:
|
|
1977
|
+
r"""Use this method to look up a stream object by its
|
|
1978
|
+
source object identifier.
|
|
1979
|
+
|
|
1980
|
+
.. code-block:: python
|
|
1981
|
+
|
|
1982
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
1983
|
+
# code template only.
|
|
1984
|
+
# It will require modifications to work:
|
|
1985
|
+
# - It may require correct/in-range values for request initialization.
|
|
1986
|
+
# - It may require specifying regional endpoints when creating the service
|
|
1987
|
+
# client as shown in:
|
|
1988
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
1989
|
+
from google.cloud import datastream_v1
|
|
1990
|
+
|
|
1991
|
+
async def sample_lookup_stream_object():
|
|
1992
|
+
# Create a client
|
|
1993
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
1994
|
+
|
|
1995
|
+
# Initialize request argument(s)
|
|
1996
|
+
source_object_identifier = datastream_v1.SourceObjectIdentifier()
|
|
1997
|
+
source_object_identifier.oracle_identifier.schema = "schema_value"
|
|
1998
|
+
source_object_identifier.oracle_identifier.table = "table_value"
|
|
1999
|
+
|
|
2000
|
+
request = datastream_v1.LookupStreamObjectRequest(
|
|
2001
|
+
parent="parent_value",
|
|
2002
|
+
source_object_identifier=source_object_identifier,
|
|
2003
|
+
)
|
|
2004
|
+
|
|
2005
|
+
# Make the request
|
|
2006
|
+
response = await client.lookup_stream_object(request=request)
|
|
2007
|
+
|
|
2008
|
+
# Handle the response
|
|
2009
|
+
print(response)
|
|
2010
|
+
|
|
2011
|
+
Args:
|
|
2012
|
+
request (Optional[Union[google.cloud.datastream_v1.types.LookupStreamObjectRequest, dict]]):
|
|
2013
|
+
The request object. Request for looking up a specific
|
|
2014
|
+
stream object by its source object
|
|
2015
|
+
identifier.
|
|
2016
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
2017
|
+
should be retried.
|
|
2018
|
+
timeout (float): The timeout for this request.
|
|
2019
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
2020
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
2021
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
2022
|
+
be of type `bytes`.
|
|
2023
|
+
|
|
2024
|
+
Returns:
|
|
2025
|
+
google.cloud.datastream_v1.types.StreamObject:
|
|
2026
|
+
A specific stream object (e.g a
|
|
2027
|
+
specific DB table).
|
|
2028
|
+
|
|
2029
|
+
"""
|
|
2030
|
+
# Create or coerce a protobuf request object.
|
|
2031
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
2032
|
+
# there are no flattened fields), or create one.
|
|
2033
|
+
if not isinstance(request, datastream.LookupStreamObjectRequest):
|
|
2034
|
+
request = datastream.LookupStreamObjectRequest(request)
|
|
2035
|
+
|
|
2036
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
2037
|
+
# and friendly error handling.
|
|
2038
|
+
rpc = self._client._transport._wrapped_methods[
|
|
2039
|
+
self._client._transport.lookup_stream_object
|
|
2040
|
+
]
|
|
2041
|
+
|
|
2042
|
+
# Certain fields should be provided within the metadata header;
|
|
2043
|
+
# add these here.
|
|
2044
|
+
metadata = tuple(metadata) + (
|
|
2045
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
2046
|
+
)
|
|
2047
|
+
|
|
2048
|
+
# Validate the universe domain.
|
|
2049
|
+
self._client._validate_universe_domain()
|
|
2050
|
+
|
|
2051
|
+
# Send the request.
|
|
2052
|
+
response = await rpc(
|
|
2053
|
+
request,
|
|
2054
|
+
retry=retry,
|
|
2055
|
+
timeout=timeout,
|
|
2056
|
+
metadata=metadata,
|
|
2057
|
+
)
|
|
2058
|
+
|
|
2059
|
+
# Done; return the response.
|
|
2060
|
+
return response
|
|
2061
|
+
|
|
2062
|
+
async def list_stream_objects(
|
|
2063
|
+
self,
|
|
2064
|
+
request: Optional[Union[datastream.ListStreamObjectsRequest, dict]] = None,
|
|
2065
|
+
*,
|
|
2066
|
+
parent: Optional[str] = None,
|
|
2067
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
2068
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
2069
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
2070
|
+
) -> pagers.ListStreamObjectsAsyncPager:
|
|
2071
|
+
r"""Use this method to list the objects of a specific
|
|
2072
|
+
stream.
|
|
2073
|
+
|
|
2074
|
+
.. code-block:: python
|
|
2075
|
+
|
|
2076
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
2077
|
+
# code template only.
|
|
2078
|
+
# It will require modifications to work:
|
|
2079
|
+
# - It may require correct/in-range values for request initialization.
|
|
2080
|
+
# - It may require specifying regional endpoints when creating the service
|
|
2081
|
+
# client as shown in:
|
|
2082
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
2083
|
+
from google.cloud import datastream_v1
|
|
2084
|
+
|
|
2085
|
+
async def sample_list_stream_objects():
|
|
2086
|
+
# Create a client
|
|
2087
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
2088
|
+
|
|
2089
|
+
# Initialize request argument(s)
|
|
2090
|
+
request = datastream_v1.ListStreamObjectsRequest(
|
|
2091
|
+
parent="parent_value",
|
|
2092
|
+
)
|
|
2093
|
+
|
|
2094
|
+
# Make the request
|
|
2095
|
+
page_result = client.list_stream_objects(request=request)
|
|
2096
|
+
|
|
2097
|
+
# Handle the response
|
|
2098
|
+
async for response in page_result:
|
|
2099
|
+
print(response)
|
|
2100
|
+
|
|
2101
|
+
Args:
|
|
2102
|
+
request (Optional[Union[google.cloud.datastream_v1.types.ListStreamObjectsRequest, dict]]):
|
|
2103
|
+
The request object. Request for listing all objects for a
|
|
2104
|
+
specific stream.
|
|
2105
|
+
parent (:class:`str`):
|
|
2106
|
+
Required. The parent stream that owns
|
|
2107
|
+
the collection of objects.
|
|
2108
|
+
|
|
2109
|
+
This corresponds to the ``parent`` field
|
|
2110
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
2111
|
+
should not be set.
|
|
2112
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
2113
|
+
should be retried.
|
|
2114
|
+
timeout (float): The timeout for this request.
|
|
2115
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
2116
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
2117
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
2118
|
+
be of type `bytes`.
|
|
2119
|
+
|
|
2120
|
+
Returns:
|
|
2121
|
+
google.cloud.datastream_v1.services.datastream.pagers.ListStreamObjectsAsyncPager:
|
|
2122
|
+
Response containing the objects for a
|
|
2123
|
+
stream.
|
|
2124
|
+
Iterating over this object will yield
|
|
2125
|
+
results and resolve additional pages
|
|
2126
|
+
automatically.
|
|
2127
|
+
|
|
2128
|
+
"""
|
|
2129
|
+
# Create or coerce a protobuf request object.
|
|
2130
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
2131
|
+
# gotten any keyword arguments that map to the request.
|
|
2132
|
+
flattened_params = [parent]
|
|
2133
|
+
has_flattened_params = (
|
|
2134
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
2135
|
+
)
|
|
2136
|
+
if request is not None and has_flattened_params:
|
|
2137
|
+
raise ValueError(
|
|
2138
|
+
"If the `request` argument is set, then none of "
|
|
2139
|
+
"the individual field arguments should be set."
|
|
2140
|
+
)
|
|
2141
|
+
|
|
2142
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
2143
|
+
# there are no flattened fields), or create one.
|
|
2144
|
+
if not isinstance(request, datastream.ListStreamObjectsRequest):
|
|
2145
|
+
request = datastream.ListStreamObjectsRequest(request)
|
|
2146
|
+
|
|
2147
|
+
# If we have keyword arguments corresponding to fields on the
|
|
2148
|
+
# request, apply these.
|
|
2149
|
+
if parent is not None:
|
|
2150
|
+
request.parent = parent
|
|
2151
|
+
|
|
2152
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
2153
|
+
# and friendly error handling.
|
|
2154
|
+
rpc = self._client._transport._wrapped_methods[
|
|
2155
|
+
self._client._transport.list_stream_objects
|
|
2156
|
+
]
|
|
2157
|
+
|
|
2158
|
+
# Certain fields should be provided within the metadata header;
|
|
2159
|
+
# add these here.
|
|
2160
|
+
metadata = tuple(metadata) + (
|
|
2161
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
2162
|
+
)
|
|
2163
|
+
|
|
2164
|
+
# Validate the universe domain.
|
|
2165
|
+
self._client._validate_universe_domain()
|
|
2166
|
+
|
|
2167
|
+
# Send the request.
|
|
2168
|
+
response = await rpc(
|
|
2169
|
+
request,
|
|
2170
|
+
retry=retry,
|
|
2171
|
+
timeout=timeout,
|
|
2172
|
+
metadata=metadata,
|
|
2173
|
+
)
|
|
2174
|
+
|
|
2175
|
+
# This method is paged; wrap the response in a pager, which provides
|
|
2176
|
+
# an `__aiter__` convenience method.
|
|
2177
|
+
response = pagers.ListStreamObjectsAsyncPager(
|
|
2178
|
+
method=rpc,
|
|
2179
|
+
request=request,
|
|
2180
|
+
response=response,
|
|
2181
|
+
retry=retry,
|
|
2182
|
+
timeout=timeout,
|
|
2183
|
+
metadata=metadata,
|
|
2184
|
+
)
|
|
2185
|
+
|
|
2186
|
+
# Done; return the response.
|
|
2187
|
+
return response
|
|
2188
|
+
|
|
2189
|
+
async def start_backfill_job(
|
|
2190
|
+
self,
|
|
2191
|
+
request: Optional[Union[datastream.StartBackfillJobRequest, dict]] = None,
|
|
2192
|
+
*,
|
|
2193
|
+
object_: Optional[str] = None,
|
|
2194
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
2195
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
2196
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
2197
|
+
) -> datastream.StartBackfillJobResponse:
|
|
2198
|
+
r"""Use this method to start a backfill job for the
|
|
2199
|
+
specified stream object.
|
|
2200
|
+
|
|
2201
|
+
.. code-block:: python
|
|
2202
|
+
|
|
2203
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
2204
|
+
# code template only.
|
|
2205
|
+
# It will require modifications to work:
|
|
2206
|
+
# - It may require correct/in-range values for request initialization.
|
|
2207
|
+
# - It may require specifying regional endpoints when creating the service
|
|
2208
|
+
# client as shown in:
|
|
2209
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
2210
|
+
from google.cloud import datastream_v1
|
|
2211
|
+
|
|
2212
|
+
async def sample_start_backfill_job():
|
|
2213
|
+
# Create a client
|
|
2214
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
2215
|
+
|
|
2216
|
+
# Initialize request argument(s)
|
|
2217
|
+
request = datastream_v1.StartBackfillJobRequest(
|
|
2218
|
+
object_="object__value",
|
|
2219
|
+
)
|
|
2220
|
+
|
|
2221
|
+
# Make the request
|
|
2222
|
+
response = await client.start_backfill_job(request=request)
|
|
2223
|
+
|
|
2224
|
+
# Handle the response
|
|
2225
|
+
print(response)
|
|
2226
|
+
|
|
2227
|
+
Args:
|
|
2228
|
+
request (Optional[Union[google.cloud.datastream_v1.types.StartBackfillJobRequest, dict]]):
|
|
2229
|
+
The request object. Request for manually initiating a
|
|
2230
|
+
backfill job for a specific stream
|
|
2231
|
+
object.
|
|
2232
|
+
object_ (:class:`str`):
|
|
2233
|
+
Required. The name of the stream
|
|
2234
|
+
object resource to start a backfill job
|
|
2235
|
+
for.
|
|
2236
|
+
|
|
2237
|
+
This corresponds to the ``object_`` field
|
|
2238
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
2239
|
+
should not be set.
|
|
2240
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
2241
|
+
should be retried.
|
|
2242
|
+
timeout (float): The timeout for this request.
|
|
2243
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
2244
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
2245
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
2246
|
+
be of type `bytes`.
|
|
2247
|
+
|
|
2248
|
+
Returns:
|
|
2249
|
+
google.cloud.datastream_v1.types.StartBackfillJobResponse:
|
|
2250
|
+
Response for manually initiating a
|
|
2251
|
+
backfill job for a specific stream
|
|
2252
|
+
object.
|
|
2253
|
+
|
|
2254
|
+
"""
|
|
2255
|
+
# Create or coerce a protobuf request object.
|
|
2256
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
2257
|
+
# gotten any keyword arguments that map to the request.
|
|
2258
|
+
flattened_params = [object_]
|
|
2259
|
+
has_flattened_params = (
|
|
2260
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
2261
|
+
)
|
|
2262
|
+
if request is not None and has_flattened_params:
|
|
2263
|
+
raise ValueError(
|
|
2264
|
+
"If the `request` argument is set, then none of "
|
|
2265
|
+
"the individual field arguments should be set."
|
|
2266
|
+
)
|
|
2267
|
+
|
|
2268
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
2269
|
+
# there are no flattened fields), or create one.
|
|
2270
|
+
if not isinstance(request, datastream.StartBackfillJobRequest):
|
|
2271
|
+
request = datastream.StartBackfillJobRequest(request)
|
|
2272
|
+
|
|
2273
|
+
# If we have keyword arguments corresponding to fields on the
|
|
2274
|
+
# request, apply these.
|
|
2275
|
+
if object_ is not None:
|
|
2276
|
+
request.object_ = object_
|
|
2277
|
+
|
|
2278
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
2279
|
+
# and friendly error handling.
|
|
2280
|
+
rpc = self._client._transport._wrapped_methods[
|
|
2281
|
+
self._client._transport.start_backfill_job
|
|
2282
|
+
]
|
|
2283
|
+
|
|
2284
|
+
# Certain fields should be provided within the metadata header;
|
|
2285
|
+
# add these here.
|
|
2286
|
+
metadata = tuple(metadata) + (
|
|
2287
|
+
gapic_v1.routing_header.to_grpc_metadata((("object", request.object_),)),
|
|
2288
|
+
)
|
|
2289
|
+
|
|
2290
|
+
# Validate the universe domain.
|
|
2291
|
+
self._client._validate_universe_domain()
|
|
2292
|
+
|
|
2293
|
+
# Send the request.
|
|
2294
|
+
response = await rpc(
|
|
2295
|
+
request,
|
|
2296
|
+
retry=retry,
|
|
2297
|
+
timeout=timeout,
|
|
2298
|
+
metadata=metadata,
|
|
2299
|
+
)
|
|
2300
|
+
|
|
2301
|
+
# Done; return the response.
|
|
2302
|
+
return response
|
|
2303
|
+
|
|
2304
|
+
async def stop_backfill_job(
|
|
2305
|
+
self,
|
|
2306
|
+
request: Optional[Union[datastream.StopBackfillJobRequest, dict]] = None,
|
|
2307
|
+
*,
|
|
2308
|
+
object_: Optional[str] = None,
|
|
2309
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
2310
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
2311
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
2312
|
+
) -> datastream.StopBackfillJobResponse:
|
|
2313
|
+
r"""Use this method to stop a backfill job for the
|
|
2314
|
+
specified stream object.
|
|
2315
|
+
|
|
2316
|
+
.. code-block:: python
|
|
2317
|
+
|
|
2318
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
2319
|
+
# code template only.
|
|
2320
|
+
# It will require modifications to work:
|
|
2321
|
+
# - It may require correct/in-range values for request initialization.
|
|
2322
|
+
# - It may require specifying regional endpoints when creating the service
|
|
2323
|
+
# client as shown in:
|
|
2324
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
2325
|
+
from google.cloud import datastream_v1
|
|
2326
|
+
|
|
2327
|
+
async def sample_stop_backfill_job():
|
|
2328
|
+
# Create a client
|
|
2329
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
2330
|
+
|
|
2331
|
+
# Initialize request argument(s)
|
|
2332
|
+
request = datastream_v1.StopBackfillJobRequest(
|
|
2333
|
+
object_="object__value",
|
|
2334
|
+
)
|
|
2335
|
+
|
|
2336
|
+
# Make the request
|
|
2337
|
+
response = await client.stop_backfill_job(request=request)
|
|
2338
|
+
|
|
2339
|
+
# Handle the response
|
|
2340
|
+
print(response)
|
|
2341
|
+
|
|
2342
|
+
Args:
|
|
2343
|
+
request (Optional[Union[google.cloud.datastream_v1.types.StopBackfillJobRequest, dict]]):
|
|
2344
|
+
The request object. Request for manually stopping a
|
|
2345
|
+
running backfill job for a specific
|
|
2346
|
+
stream object.
|
|
2347
|
+
object_ (:class:`str`):
|
|
2348
|
+
Required. The name of the stream
|
|
2349
|
+
object resource to stop the backfill job
|
|
2350
|
+
for.
|
|
2351
|
+
|
|
2352
|
+
This corresponds to the ``object_`` field
|
|
2353
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
2354
|
+
should not be set.
|
|
2355
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
2356
|
+
should be retried.
|
|
2357
|
+
timeout (float): The timeout for this request.
|
|
2358
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
2359
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
2360
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
2361
|
+
be of type `bytes`.
|
|
2362
|
+
|
|
2363
|
+
Returns:
|
|
2364
|
+
google.cloud.datastream_v1.types.StopBackfillJobResponse:
|
|
2365
|
+
Response for manually stop a backfill
|
|
2366
|
+
job for a specific stream object.
|
|
2367
|
+
|
|
2368
|
+
"""
|
|
2369
|
+
# Create or coerce a protobuf request object.
|
|
2370
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
2371
|
+
# gotten any keyword arguments that map to the request.
|
|
2372
|
+
flattened_params = [object_]
|
|
2373
|
+
has_flattened_params = (
|
|
2374
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
2375
|
+
)
|
|
2376
|
+
if request is not None and has_flattened_params:
|
|
2377
|
+
raise ValueError(
|
|
2378
|
+
"If the `request` argument is set, then none of "
|
|
2379
|
+
"the individual field arguments should be set."
|
|
2380
|
+
)
|
|
2381
|
+
|
|
2382
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
2383
|
+
# there are no flattened fields), or create one.
|
|
2384
|
+
if not isinstance(request, datastream.StopBackfillJobRequest):
|
|
2385
|
+
request = datastream.StopBackfillJobRequest(request)
|
|
2386
|
+
|
|
2387
|
+
# If we have keyword arguments corresponding to fields on the
|
|
2388
|
+
# request, apply these.
|
|
2389
|
+
if object_ is not None:
|
|
2390
|
+
request.object_ = object_
|
|
2391
|
+
|
|
2392
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
2393
|
+
# and friendly error handling.
|
|
2394
|
+
rpc = self._client._transport._wrapped_methods[
|
|
2395
|
+
self._client._transport.stop_backfill_job
|
|
2396
|
+
]
|
|
2397
|
+
|
|
2398
|
+
# Certain fields should be provided within the metadata header;
|
|
2399
|
+
# add these here.
|
|
2400
|
+
metadata = tuple(metadata) + (
|
|
2401
|
+
gapic_v1.routing_header.to_grpc_metadata((("object", request.object_),)),
|
|
2402
|
+
)
|
|
2403
|
+
|
|
2404
|
+
# Validate the universe domain.
|
|
2405
|
+
self._client._validate_universe_domain()
|
|
2406
|
+
|
|
2407
|
+
# Send the request.
|
|
2408
|
+
response = await rpc(
|
|
2409
|
+
request,
|
|
2410
|
+
retry=retry,
|
|
2411
|
+
timeout=timeout,
|
|
2412
|
+
metadata=metadata,
|
|
2413
|
+
)
|
|
2414
|
+
|
|
2415
|
+
# Done; return the response.
|
|
2416
|
+
return response
|
|
2417
|
+
|
|
2418
|
+
async def fetch_static_ips(
|
|
2419
|
+
self,
|
|
2420
|
+
request: Optional[Union[datastream.FetchStaticIpsRequest, dict]] = None,
|
|
2421
|
+
*,
|
|
2422
|
+
name: Optional[str] = None,
|
|
2423
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
2424
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
2425
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
2426
|
+
) -> pagers.FetchStaticIpsAsyncPager:
|
|
2427
|
+
r"""The FetchStaticIps API call exposes the static IP
|
|
2428
|
+
addresses used by Datastream.
|
|
2429
|
+
|
|
2430
|
+
.. code-block:: python
|
|
2431
|
+
|
|
2432
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
2433
|
+
# code template only.
|
|
2434
|
+
# It will require modifications to work:
|
|
2435
|
+
# - It may require correct/in-range values for request initialization.
|
|
2436
|
+
# - It may require specifying regional endpoints when creating the service
|
|
2437
|
+
# client as shown in:
|
|
2438
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
2439
|
+
from google.cloud import datastream_v1
|
|
2440
|
+
|
|
2441
|
+
async def sample_fetch_static_ips():
|
|
2442
|
+
# Create a client
|
|
2443
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
2444
|
+
|
|
2445
|
+
# Initialize request argument(s)
|
|
2446
|
+
request = datastream_v1.FetchStaticIpsRequest(
|
|
2447
|
+
name="name_value",
|
|
2448
|
+
)
|
|
2449
|
+
|
|
2450
|
+
# Make the request
|
|
2451
|
+
page_result = client.fetch_static_ips(request=request)
|
|
2452
|
+
|
|
2453
|
+
# Handle the response
|
|
2454
|
+
async for response in page_result:
|
|
2455
|
+
print(response)
|
|
2456
|
+
|
|
2457
|
+
Args:
|
|
2458
|
+
request (Optional[Union[google.cloud.datastream_v1.types.FetchStaticIpsRequest, dict]]):
|
|
2459
|
+
The request object. Request message for 'FetchStaticIps'
|
|
2460
|
+
request.
|
|
2461
|
+
name (:class:`str`):
|
|
2462
|
+
Required. The resource name for the location for which
|
|
2463
|
+
static IPs should be returned. Must be in the format
|
|
2464
|
+
``projects/*/locations/*``.
|
|
2465
|
+
|
|
2466
|
+
This corresponds to the ``name`` field
|
|
2467
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
2468
|
+
should not be set.
|
|
2469
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
2470
|
+
should be retried.
|
|
2471
|
+
timeout (float): The timeout for this request.
|
|
2472
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
2473
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
2474
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
2475
|
+
be of type `bytes`.
|
|
2476
|
+
|
|
2477
|
+
Returns:
|
|
2478
|
+
google.cloud.datastream_v1.services.datastream.pagers.FetchStaticIpsAsyncPager:
|
|
2479
|
+
Response message for a
|
|
2480
|
+
'FetchStaticIps' response.
|
|
2481
|
+
Iterating over this object will yield
|
|
2482
|
+
results and resolve additional pages
|
|
2483
|
+
automatically.
|
|
2484
|
+
|
|
2485
|
+
"""
|
|
2486
|
+
# Create or coerce a protobuf request object.
|
|
2487
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
2488
|
+
# gotten any keyword arguments that map to the request.
|
|
2489
|
+
flattened_params = [name]
|
|
2490
|
+
has_flattened_params = (
|
|
2491
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
2492
|
+
)
|
|
2493
|
+
if request is not None and has_flattened_params:
|
|
2494
|
+
raise ValueError(
|
|
2495
|
+
"If the `request` argument is set, then none of "
|
|
2496
|
+
"the individual field arguments should be set."
|
|
2497
|
+
)
|
|
2498
|
+
|
|
2499
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
2500
|
+
# there are no flattened fields), or create one.
|
|
2501
|
+
if not isinstance(request, datastream.FetchStaticIpsRequest):
|
|
2502
|
+
request = datastream.FetchStaticIpsRequest(request)
|
|
2503
|
+
|
|
2504
|
+
# If we have keyword arguments corresponding to fields on the
|
|
2505
|
+
# request, apply these.
|
|
2506
|
+
if name is not None:
|
|
2507
|
+
request.name = name
|
|
2508
|
+
|
|
2509
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
2510
|
+
# and friendly error handling.
|
|
2511
|
+
rpc = self._client._transport._wrapped_methods[
|
|
2512
|
+
self._client._transport.fetch_static_ips
|
|
2513
|
+
]
|
|
2514
|
+
|
|
2515
|
+
# Certain fields should be provided within the metadata header;
|
|
2516
|
+
# add these here.
|
|
2517
|
+
metadata = tuple(metadata) + (
|
|
2518
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
2519
|
+
)
|
|
2520
|
+
|
|
2521
|
+
# Validate the universe domain.
|
|
2522
|
+
self._client._validate_universe_domain()
|
|
2523
|
+
|
|
2524
|
+
# Send the request.
|
|
2525
|
+
response = await rpc(
|
|
2526
|
+
request,
|
|
2527
|
+
retry=retry,
|
|
2528
|
+
timeout=timeout,
|
|
2529
|
+
metadata=metadata,
|
|
2530
|
+
)
|
|
2531
|
+
|
|
2532
|
+
# This method is paged; wrap the response in a pager, which provides
|
|
2533
|
+
# an `__aiter__` convenience method.
|
|
2534
|
+
response = pagers.FetchStaticIpsAsyncPager(
|
|
2535
|
+
method=rpc,
|
|
2536
|
+
request=request,
|
|
2537
|
+
response=response,
|
|
2538
|
+
retry=retry,
|
|
2539
|
+
timeout=timeout,
|
|
2540
|
+
metadata=metadata,
|
|
2541
|
+
)
|
|
2542
|
+
|
|
2543
|
+
# Done; return the response.
|
|
2544
|
+
return response
|
|
2545
|
+
|
|
2546
|
+
async def create_private_connection(
|
|
2547
|
+
self,
|
|
2548
|
+
request: Optional[
|
|
2549
|
+
Union[datastream.CreatePrivateConnectionRequest, dict]
|
|
2550
|
+
] = None,
|
|
2551
|
+
*,
|
|
2552
|
+
parent: Optional[str] = None,
|
|
2553
|
+
private_connection: Optional[datastream_resources.PrivateConnection] = None,
|
|
2554
|
+
private_connection_id: Optional[str] = None,
|
|
2555
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
2556
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
2557
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
2558
|
+
) -> operation_async.AsyncOperation:
|
|
2559
|
+
r"""Use this method to create a private connectivity
|
|
2560
|
+
configuration.
|
|
2561
|
+
|
|
2562
|
+
.. code-block:: python
|
|
2563
|
+
|
|
2564
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
2565
|
+
# code template only.
|
|
2566
|
+
# It will require modifications to work:
|
|
2567
|
+
# - It may require correct/in-range values for request initialization.
|
|
2568
|
+
# - It may require specifying regional endpoints when creating the service
|
|
2569
|
+
# client as shown in:
|
|
2570
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
2571
|
+
from google.cloud import datastream_v1
|
|
2572
|
+
|
|
2573
|
+
async def sample_create_private_connection():
|
|
2574
|
+
# Create a client
|
|
2575
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
2576
|
+
|
|
2577
|
+
# Initialize request argument(s)
|
|
2578
|
+
private_connection = datastream_v1.PrivateConnection()
|
|
2579
|
+
private_connection.display_name = "display_name_value"
|
|
2580
|
+
|
|
2581
|
+
request = datastream_v1.CreatePrivateConnectionRequest(
|
|
2582
|
+
parent="parent_value",
|
|
2583
|
+
private_connection_id="private_connection_id_value",
|
|
2584
|
+
private_connection=private_connection,
|
|
2585
|
+
)
|
|
2586
|
+
|
|
2587
|
+
# Make the request
|
|
2588
|
+
operation = client.create_private_connection(request=request)
|
|
2589
|
+
|
|
2590
|
+
print("Waiting for operation to complete...")
|
|
2591
|
+
|
|
2592
|
+
response = (await operation).result()
|
|
2593
|
+
|
|
2594
|
+
# Handle the response
|
|
2595
|
+
print(response)
|
|
2596
|
+
|
|
2597
|
+
Args:
|
|
2598
|
+
request (Optional[Union[google.cloud.datastream_v1.types.CreatePrivateConnectionRequest, dict]]):
|
|
2599
|
+
The request object. Request for creating a private
|
|
2600
|
+
connection.
|
|
2601
|
+
parent (:class:`str`):
|
|
2602
|
+
Required. The parent that owns the
|
|
2603
|
+
collection of PrivateConnections.
|
|
2604
|
+
|
|
2605
|
+
This corresponds to the ``parent`` field
|
|
2606
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
2607
|
+
should not be set.
|
|
2608
|
+
private_connection (:class:`google.cloud.datastream_v1.types.PrivateConnection`):
|
|
2609
|
+
Required. The Private Connectivity
|
|
2610
|
+
resource to create.
|
|
2611
|
+
|
|
2612
|
+
This corresponds to the ``private_connection`` field
|
|
2613
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
2614
|
+
should not be set.
|
|
2615
|
+
private_connection_id (:class:`str`):
|
|
2616
|
+
Required. The private connectivity
|
|
2617
|
+
identifier.
|
|
2618
|
+
|
|
2619
|
+
This corresponds to the ``private_connection_id`` field
|
|
2620
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
2621
|
+
should not be set.
|
|
2622
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
2623
|
+
should be retried.
|
|
2624
|
+
timeout (float): The timeout for this request.
|
|
2625
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
2626
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
2627
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
2628
|
+
be of type `bytes`.
|
|
2629
|
+
|
|
2630
|
+
Returns:
|
|
2631
|
+
google.api_core.operation_async.AsyncOperation:
|
|
2632
|
+
An object representing a long-running operation.
|
|
2633
|
+
|
|
2634
|
+
The result type for the operation will be :class:`google.cloud.datastream_v1.types.PrivateConnection` The PrivateConnection resource is used to establish private connectivity
|
|
2635
|
+
between Datastream and a customer's network.
|
|
2636
|
+
|
|
2637
|
+
"""
|
|
2638
|
+
# Create or coerce a protobuf request object.
|
|
2639
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
2640
|
+
# gotten any keyword arguments that map to the request.
|
|
2641
|
+
flattened_params = [parent, private_connection, private_connection_id]
|
|
2642
|
+
has_flattened_params = (
|
|
2643
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
2644
|
+
)
|
|
2645
|
+
if request is not None and has_flattened_params:
|
|
2646
|
+
raise ValueError(
|
|
2647
|
+
"If the `request` argument is set, then none of "
|
|
2648
|
+
"the individual field arguments should be set."
|
|
2649
|
+
)
|
|
2650
|
+
|
|
2651
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
2652
|
+
# there are no flattened fields), or create one.
|
|
2653
|
+
if not isinstance(request, datastream.CreatePrivateConnectionRequest):
|
|
2654
|
+
request = datastream.CreatePrivateConnectionRequest(request)
|
|
2655
|
+
|
|
2656
|
+
# If we have keyword arguments corresponding to fields on the
|
|
2657
|
+
# request, apply these.
|
|
2658
|
+
if parent is not None:
|
|
2659
|
+
request.parent = parent
|
|
2660
|
+
if private_connection is not None:
|
|
2661
|
+
request.private_connection = private_connection
|
|
2662
|
+
if private_connection_id is not None:
|
|
2663
|
+
request.private_connection_id = private_connection_id
|
|
2664
|
+
|
|
2665
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
2666
|
+
# and friendly error handling.
|
|
2667
|
+
rpc = self._client._transport._wrapped_methods[
|
|
2668
|
+
self._client._transport.create_private_connection
|
|
2669
|
+
]
|
|
2670
|
+
|
|
2671
|
+
# Certain fields should be provided within the metadata header;
|
|
2672
|
+
# add these here.
|
|
2673
|
+
metadata = tuple(metadata) + (
|
|
2674
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
2675
|
+
)
|
|
2676
|
+
|
|
2677
|
+
# Validate the universe domain.
|
|
2678
|
+
self._client._validate_universe_domain()
|
|
2679
|
+
|
|
2680
|
+
# Send the request.
|
|
2681
|
+
response = await rpc(
|
|
2682
|
+
request,
|
|
2683
|
+
retry=retry,
|
|
2684
|
+
timeout=timeout,
|
|
2685
|
+
metadata=metadata,
|
|
2686
|
+
)
|
|
2687
|
+
|
|
2688
|
+
# Wrap the response in an operation future.
|
|
2689
|
+
response = operation_async.from_gapic(
|
|
2690
|
+
response,
|
|
2691
|
+
self._client._transport.operations_client,
|
|
2692
|
+
datastream_resources.PrivateConnection,
|
|
2693
|
+
metadata_type=datastream.OperationMetadata,
|
|
2694
|
+
)
|
|
2695
|
+
|
|
2696
|
+
# Done; return the response.
|
|
2697
|
+
return response
|
|
2698
|
+
|
|
2699
|
+
async def get_private_connection(
|
|
2700
|
+
self,
|
|
2701
|
+
request: Optional[Union[datastream.GetPrivateConnectionRequest, dict]] = None,
|
|
2702
|
+
*,
|
|
2703
|
+
name: Optional[str] = None,
|
|
2704
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
2705
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
2706
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
2707
|
+
) -> datastream_resources.PrivateConnection:
|
|
2708
|
+
r"""Use this method to get details about a private
|
|
2709
|
+
connectivity configuration.
|
|
2710
|
+
|
|
2711
|
+
.. code-block:: python
|
|
2712
|
+
|
|
2713
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
2714
|
+
# code template only.
|
|
2715
|
+
# It will require modifications to work:
|
|
2716
|
+
# - It may require correct/in-range values for request initialization.
|
|
2717
|
+
# - It may require specifying regional endpoints when creating the service
|
|
2718
|
+
# client as shown in:
|
|
2719
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
2720
|
+
from google.cloud import datastream_v1
|
|
2721
|
+
|
|
2722
|
+
async def sample_get_private_connection():
|
|
2723
|
+
# Create a client
|
|
2724
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
2725
|
+
|
|
2726
|
+
# Initialize request argument(s)
|
|
2727
|
+
request = datastream_v1.GetPrivateConnectionRequest(
|
|
2728
|
+
name="name_value",
|
|
2729
|
+
)
|
|
2730
|
+
|
|
2731
|
+
# Make the request
|
|
2732
|
+
response = await client.get_private_connection(request=request)
|
|
2733
|
+
|
|
2734
|
+
# Handle the response
|
|
2735
|
+
print(response)
|
|
2736
|
+
|
|
2737
|
+
Args:
|
|
2738
|
+
request (Optional[Union[google.cloud.datastream_v1.types.GetPrivateConnectionRequest, dict]]):
|
|
2739
|
+
The request object. Request to get a private connection
|
|
2740
|
+
configuration.
|
|
2741
|
+
name (:class:`str`):
|
|
2742
|
+
Required. The name of the private
|
|
2743
|
+
connectivity configuration to get.
|
|
2744
|
+
|
|
2745
|
+
This corresponds to the ``name`` field
|
|
2746
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
2747
|
+
should not be set.
|
|
2748
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
2749
|
+
should be retried.
|
|
2750
|
+
timeout (float): The timeout for this request.
|
|
2751
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
2752
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
2753
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
2754
|
+
be of type `bytes`.
|
|
2755
|
+
|
|
2756
|
+
Returns:
|
|
2757
|
+
google.cloud.datastream_v1.types.PrivateConnection:
|
|
2758
|
+
The PrivateConnection resource is
|
|
2759
|
+
used to establish private connectivity
|
|
2760
|
+
between Datastream and a customer's
|
|
2761
|
+
network.
|
|
2762
|
+
|
|
2763
|
+
"""
|
|
2764
|
+
# Create or coerce a protobuf request object.
|
|
2765
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
2766
|
+
# gotten any keyword arguments that map to the request.
|
|
2767
|
+
flattened_params = [name]
|
|
2768
|
+
has_flattened_params = (
|
|
2769
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
2770
|
+
)
|
|
2771
|
+
if request is not None and has_flattened_params:
|
|
2772
|
+
raise ValueError(
|
|
2773
|
+
"If the `request` argument is set, then none of "
|
|
2774
|
+
"the individual field arguments should be set."
|
|
2775
|
+
)
|
|
2776
|
+
|
|
2777
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
2778
|
+
# there are no flattened fields), or create one.
|
|
2779
|
+
if not isinstance(request, datastream.GetPrivateConnectionRequest):
|
|
2780
|
+
request = datastream.GetPrivateConnectionRequest(request)
|
|
2781
|
+
|
|
2782
|
+
# If we have keyword arguments corresponding to fields on the
|
|
2783
|
+
# request, apply these.
|
|
2784
|
+
if name is not None:
|
|
2785
|
+
request.name = name
|
|
2786
|
+
|
|
2787
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
2788
|
+
# and friendly error handling.
|
|
2789
|
+
rpc = self._client._transport._wrapped_methods[
|
|
2790
|
+
self._client._transport.get_private_connection
|
|
2791
|
+
]
|
|
2792
|
+
|
|
2793
|
+
# Certain fields should be provided within the metadata header;
|
|
2794
|
+
# add these here.
|
|
2795
|
+
metadata = tuple(metadata) + (
|
|
2796
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
2797
|
+
)
|
|
2798
|
+
|
|
2799
|
+
# Validate the universe domain.
|
|
2800
|
+
self._client._validate_universe_domain()
|
|
2801
|
+
|
|
2802
|
+
# Send the request.
|
|
2803
|
+
response = await rpc(
|
|
2804
|
+
request,
|
|
2805
|
+
retry=retry,
|
|
2806
|
+
timeout=timeout,
|
|
2807
|
+
metadata=metadata,
|
|
2808
|
+
)
|
|
2809
|
+
|
|
2810
|
+
# Done; return the response.
|
|
2811
|
+
return response
|
|
2812
|
+
|
|
2813
|
+
async def list_private_connections(
|
|
2814
|
+
self,
|
|
2815
|
+
request: Optional[Union[datastream.ListPrivateConnectionsRequest, dict]] = None,
|
|
2816
|
+
*,
|
|
2817
|
+
parent: Optional[str] = None,
|
|
2818
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
2819
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
2820
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
2821
|
+
) -> pagers.ListPrivateConnectionsAsyncPager:
|
|
2822
|
+
r"""Use this method to list private connectivity
|
|
2823
|
+
configurations in a project and location.
|
|
2824
|
+
|
|
2825
|
+
.. code-block:: python
|
|
2826
|
+
|
|
2827
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
2828
|
+
# code template only.
|
|
2829
|
+
# It will require modifications to work:
|
|
2830
|
+
# - It may require correct/in-range values for request initialization.
|
|
2831
|
+
# - It may require specifying regional endpoints when creating the service
|
|
2832
|
+
# client as shown in:
|
|
2833
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
2834
|
+
from google.cloud import datastream_v1
|
|
2835
|
+
|
|
2836
|
+
async def sample_list_private_connections():
|
|
2837
|
+
# Create a client
|
|
2838
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
2839
|
+
|
|
2840
|
+
# Initialize request argument(s)
|
|
2841
|
+
request = datastream_v1.ListPrivateConnectionsRequest(
|
|
2842
|
+
parent="parent_value",
|
|
2843
|
+
)
|
|
2844
|
+
|
|
2845
|
+
# Make the request
|
|
2846
|
+
page_result = client.list_private_connections(request=request)
|
|
2847
|
+
|
|
2848
|
+
# Handle the response
|
|
2849
|
+
async for response in page_result:
|
|
2850
|
+
print(response)
|
|
2851
|
+
|
|
2852
|
+
Args:
|
|
2853
|
+
request (Optional[Union[google.cloud.datastream_v1.types.ListPrivateConnectionsRequest, dict]]):
|
|
2854
|
+
The request object. Request for listing private
|
|
2855
|
+
connections.
|
|
2856
|
+
parent (:class:`str`):
|
|
2857
|
+
Required. The parent that owns the
|
|
2858
|
+
collection of private connectivity
|
|
2859
|
+
configurations.
|
|
2860
|
+
|
|
2861
|
+
This corresponds to the ``parent`` field
|
|
2862
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
2863
|
+
should not be set.
|
|
2864
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
2865
|
+
should be retried.
|
|
2866
|
+
timeout (float): The timeout for this request.
|
|
2867
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
2868
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
2869
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
2870
|
+
be of type `bytes`.
|
|
2871
|
+
|
|
2872
|
+
Returns:
|
|
2873
|
+
google.cloud.datastream_v1.services.datastream.pagers.ListPrivateConnectionsAsyncPager:
|
|
2874
|
+
Response containing a list of private
|
|
2875
|
+
connection configurations.
|
|
2876
|
+
Iterating over this object will yield
|
|
2877
|
+
results and resolve additional pages
|
|
2878
|
+
automatically.
|
|
2879
|
+
|
|
2880
|
+
"""
|
|
2881
|
+
# Create or coerce a protobuf request object.
|
|
2882
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
2883
|
+
# gotten any keyword arguments that map to the request.
|
|
2884
|
+
flattened_params = [parent]
|
|
2885
|
+
has_flattened_params = (
|
|
2886
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
2887
|
+
)
|
|
2888
|
+
if request is not None and has_flattened_params:
|
|
2889
|
+
raise ValueError(
|
|
2890
|
+
"If the `request` argument is set, then none of "
|
|
2891
|
+
"the individual field arguments should be set."
|
|
2892
|
+
)
|
|
2893
|
+
|
|
2894
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
2895
|
+
# there are no flattened fields), or create one.
|
|
2896
|
+
if not isinstance(request, datastream.ListPrivateConnectionsRequest):
|
|
2897
|
+
request = datastream.ListPrivateConnectionsRequest(request)
|
|
2898
|
+
|
|
2899
|
+
# If we have keyword arguments corresponding to fields on the
|
|
2900
|
+
# request, apply these.
|
|
2901
|
+
if parent is not None:
|
|
2902
|
+
request.parent = parent
|
|
2903
|
+
|
|
2904
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
2905
|
+
# and friendly error handling.
|
|
2906
|
+
rpc = self._client._transport._wrapped_methods[
|
|
2907
|
+
self._client._transport.list_private_connections
|
|
2908
|
+
]
|
|
2909
|
+
|
|
2910
|
+
# Certain fields should be provided within the metadata header;
|
|
2911
|
+
# add these here.
|
|
2912
|
+
metadata = tuple(metadata) + (
|
|
2913
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
2914
|
+
)
|
|
2915
|
+
|
|
2916
|
+
# Validate the universe domain.
|
|
2917
|
+
self._client._validate_universe_domain()
|
|
2918
|
+
|
|
2919
|
+
# Send the request.
|
|
2920
|
+
response = await rpc(
|
|
2921
|
+
request,
|
|
2922
|
+
retry=retry,
|
|
2923
|
+
timeout=timeout,
|
|
2924
|
+
metadata=metadata,
|
|
2925
|
+
)
|
|
2926
|
+
|
|
2927
|
+
# This method is paged; wrap the response in a pager, which provides
|
|
2928
|
+
# an `__aiter__` convenience method.
|
|
2929
|
+
response = pagers.ListPrivateConnectionsAsyncPager(
|
|
2930
|
+
method=rpc,
|
|
2931
|
+
request=request,
|
|
2932
|
+
response=response,
|
|
2933
|
+
retry=retry,
|
|
2934
|
+
timeout=timeout,
|
|
2935
|
+
metadata=metadata,
|
|
2936
|
+
)
|
|
2937
|
+
|
|
2938
|
+
# Done; return the response.
|
|
2939
|
+
return response
|
|
2940
|
+
|
|
2941
|
+
async def delete_private_connection(
|
|
2942
|
+
self,
|
|
2943
|
+
request: Optional[
|
|
2944
|
+
Union[datastream.DeletePrivateConnectionRequest, dict]
|
|
2945
|
+
] = None,
|
|
2946
|
+
*,
|
|
2947
|
+
name: Optional[str] = None,
|
|
2948
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
2949
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
2950
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
2951
|
+
) -> operation_async.AsyncOperation:
|
|
2952
|
+
r"""Use this method to delete a private connectivity
|
|
2953
|
+
configuration.
|
|
2954
|
+
|
|
2955
|
+
.. code-block:: python
|
|
2956
|
+
|
|
2957
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
2958
|
+
# code template only.
|
|
2959
|
+
# It will require modifications to work:
|
|
2960
|
+
# - It may require correct/in-range values for request initialization.
|
|
2961
|
+
# - It may require specifying regional endpoints when creating the service
|
|
2962
|
+
# client as shown in:
|
|
2963
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
2964
|
+
from google.cloud import datastream_v1
|
|
2965
|
+
|
|
2966
|
+
async def sample_delete_private_connection():
|
|
2967
|
+
# Create a client
|
|
2968
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
2969
|
+
|
|
2970
|
+
# Initialize request argument(s)
|
|
2971
|
+
request = datastream_v1.DeletePrivateConnectionRequest(
|
|
2972
|
+
name="name_value",
|
|
2973
|
+
)
|
|
2974
|
+
|
|
2975
|
+
# Make the request
|
|
2976
|
+
operation = client.delete_private_connection(request=request)
|
|
2977
|
+
|
|
2978
|
+
print("Waiting for operation to complete...")
|
|
2979
|
+
|
|
2980
|
+
response = (await operation).result()
|
|
2981
|
+
|
|
2982
|
+
# Handle the response
|
|
2983
|
+
print(response)
|
|
2984
|
+
|
|
2985
|
+
Args:
|
|
2986
|
+
request (Optional[Union[google.cloud.datastream_v1.types.DeletePrivateConnectionRequest, dict]]):
|
|
2987
|
+
The request object. Request to delete a private
|
|
2988
|
+
connection.
|
|
2989
|
+
name (:class:`str`):
|
|
2990
|
+
Required. The name of the private
|
|
2991
|
+
connectivity configuration to delete.
|
|
2992
|
+
|
|
2993
|
+
This corresponds to the ``name`` field
|
|
2994
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
2995
|
+
should not be set.
|
|
2996
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
2997
|
+
should be retried.
|
|
2998
|
+
timeout (float): The timeout for this request.
|
|
2999
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
3000
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
3001
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
3002
|
+
be of type `bytes`.
|
|
3003
|
+
|
|
3004
|
+
Returns:
|
|
3005
|
+
google.api_core.operation_async.AsyncOperation:
|
|
3006
|
+
An object representing a long-running operation.
|
|
3007
|
+
|
|
3008
|
+
The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated
|
|
3009
|
+
empty messages in your APIs. A typical example is to
|
|
3010
|
+
use it as the request or the response type of an API
|
|
3011
|
+
method. For instance:
|
|
3012
|
+
|
|
3013
|
+
service Foo {
|
|
3014
|
+
rpc Bar(google.protobuf.Empty) returns
|
|
3015
|
+
(google.protobuf.Empty);
|
|
3016
|
+
|
|
3017
|
+
}
|
|
3018
|
+
|
|
3019
|
+
"""
|
|
3020
|
+
# Create or coerce a protobuf request object.
|
|
3021
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
3022
|
+
# gotten any keyword arguments that map to the request.
|
|
3023
|
+
flattened_params = [name]
|
|
3024
|
+
has_flattened_params = (
|
|
3025
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
3026
|
+
)
|
|
3027
|
+
if request is not None and has_flattened_params:
|
|
3028
|
+
raise ValueError(
|
|
3029
|
+
"If the `request` argument is set, then none of "
|
|
3030
|
+
"the individual field arguments should be set."
|
|
3031
|
+
)
|
|
3032
|
+
|
|
3033
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
3034
|
+
# there are no flattened fields), or create one.
|
|
3035
|
+
if not isinstance(request, datastream.DeletePrivateConnectionRequest):
|
|
3036
|
+
request = datastream.DeletePrivateConnectionRequest(request)
|
|
3037
|
+
|
|
3038
|
+
# If we have keyword arguments corresponding to fields on the
|
|
3039
|
+
# request, apply these.
|
|
3040
|
+
if name is not None:
|
|
3041
|
+
request.name = name
|
|
3042
|
+
|
|
3043
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
3044
|
+
# and friendly error handling.
|
|
3045
|
+
rpc = self._client._transport._wrapped_methods[
|
|
3046
|
+
self._client._transport.delete_private_connection
|
|
3047
|
+
]
|
|
3048
|
+
|
|
3049
|
+
# Certain fields should be provided within the metadata header;
|
|
3050
|
+
# add these here.
|
|
3051
|
+
metadata = tuple(metadata) + (
|
|
3052
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
3053
|
+
)
|
|
3054
|
+
|
|
3055
|
+
# Validate the universe domain.
|
|
3056
|
+
self._client._validate_universe_domain()
|
|
3057
|
+
|
|
3058
|
+
# Send the request.
|
|
3059
|
+
response = await rpc(
|
|
3060
|
+
request,
|
|
3061
|
+
retry=retry,
|
|
3062
|
+
timeout=timeout,
|
|
3063
|
+
metadata=metadata,
|
|
3064
|
+
)
|
|
3065
|
+
|
|
3066
|
+
# Wrap the response in an operation future.
|
|
3067
|
+
response = operation_async.from_gapic(
|
|
3068
|
+
response,
|
|
3069
|
+
self._client._transport.operations_client,
|
|
3070
|
+
empty_pb2.Empty,
|
|
3071
|
+
metadata_type=datastream.OperationMetadata,
|
|
3072
|
+
)
|
|
3073
|
+
|
|
3074
|
+
# Done; return the response.
|
|
3075
|
+
return response
|
|
3076
|
+
|
|
3077
|
+
async def create_route(
|
|
3078
|
+
self,
|
|
3079
|
+
request: Optional[Union[datastream.CreateRouteRequest, dict]] = None,
|
|
3080
|
+
*,
|
|
3081
|
+
parent: Optional[str] = None,
|
|
3082
|
+
route: Optional[datastream_resources.Route] = None,
|
|
3083
|
+
route_id: Optional[str] = None,
|
|
3084
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
3085
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
3086
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
3087
|
+
) -> operation_async.AsyncOperation:
|
|
3088
|
+
r"""Use this method to create a route for a private
|
|
3089
|
+
connectivity configuration in a project and location.
|
|
3090
|
+
|
|
3091
|
+
.. code-block:: python
|
|
3092
|
+
|
|
3093
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
3094
|
+
# code template only.
|
|
3095
|
+
# It will require modifications to work:
|
|
3096
|
+
# - It may require correct/in-range values for request initialization.
|
|
3097
|
+
# - It may require specifying regional endpoints when creating the service
|
|
3098
|
+
# client as shown in:
|
|
3099
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
3100
|
+
from google.cloud import datastream_v1
|
|
3101
|
+
|
|
3102
|
+
async def sample_create_route():
|
|
3103
|
+
# Create a client
|
|
3104
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
3105
|
+
|
|
3106
|
+
# Initialize request argument(s)
|
|
3107
|
+
route = datastream_v1.Route()
|
|
3108
|
+
route.display_name = "display_name_value"
|
|
3109
|
+
route.destination_address = "destination_address_value"
|
|
3110
|
+
|
|
3111
|
+
request = datastream_v1.CreateRouteRequest(
|
|
3112
|
+
parent="parent_value",
|
|
3113
|
+
route_id="route_id_value",
|
|
3114
|
+
route=route,
|
|
3115
|
+
)
|
|
3116
|
+
|
|
3117
|
+
# Make the request
|
|
3118
|
+
operation = client.create_route(request=request)
|
|
3119
|
+
|
|
3120
|
+
print("Waiting for operation to complete...")
|
|
3121
|
+
|
|
3122
|
+
response = (await operation).result()
|
|
3123
|
+
|
|
3124
|
+
# Handle the response
|
|
3125
|
+
print(response)
|
|
3126
|
+
|
|
3127
|
+
Args:
|
|
3128
|
+
request (Optional[Union[google.cloud.datastream_v1.types.CreateRouteRequest, dict]]):
|
|
3129
|
+
The request object. Route creation request.
|
|
3130
|
+
parent (:class:`str`):
|
|
3131
|
+
Required. The parent that owns the
|
|
3132
|
+
collection of Routes.
|
|
3133
|
+
|
|
3134
|
+
This corresponds to the ``parent`` field
|
|
3135
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
3136
|
+
should not be set.
|
|
3137
|
+
route (:class:`google.cloud.datastream_v1.types.Route`):
|
|
3138
|
+
Required. The Route resource to
|
|
3139
|
+
create.
|
|
3140
|
+
|
|
3141
|
+
This corresponds to the ``route`` field
|
|
3142
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
3143
|
+
should not be set.
|
|
3144
|
+
route_id (:class:`str`):
|
|
3145
|
+
Required. The Route identifier.
|
|
3146
|
+
This corresponds to the ``route_id`` field
|
|
3147
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
3148
|
+
should not be set.
|
|
3149
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
3150
|
+
should be retried.
|
|
3151
|
+
timeout (float): The timeout for this request.
|
|
3152
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
3153
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
3154
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
3155
|
+
be of type `bytes`.
|
|
3156
|
+
|
|
3157
|
+
Returns:
|
|
3158
|
+
google.api_core.operation_async.AsyncOperation:
|
|
3159
|
+
An object representing a long-running operation.
|
|
3160
|
+
|
|
3161
|
+
The result type for the operation will be :class:`google.cloud.datastream_v1.types.Route` The route resource is the child of the private connection resource,
|
|
3162
|
+
used for defining a route for a private connection.
|
|
3163
|
+
|
|
3164
|
+
"""
|
|
3165
|
+
# Create or coerce a protobuf request object.
|
|
3166
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
3167
|
+
# gotten any keyword arguments that map to the request.
|
|
3168
|
+
flattened_params = [parent, route, route_id]
|
|
3169
|
+
has_flattened_params = (
|
|
3170
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
3171
|
+
)
|
|
3172
|
+
if request is not None and has_flattened_params:
|
|
3173
|
+
raise ValueError(
|
|
3174
|
+
"If the `request` argument is set, then none of "
|
|
3175
|
+
"the individual field arguments should be set."
|
|
3176
|
+
)
|
|
3177
|
+
|
|
3178
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
3179
|
+
# there are no flattened fields), or create one.
|
|
3180
|
+
if not isinstance(request, datastream.CreateRouteRequest):
|
|
3181
|
+
request = datastream.CreateRouteRequest(request)
|
|
3182
|
+
|
|
3183
|
+
# If we have keyword arguments corresponding to fields on the
|
|
3184
|
+
# request, apply these.
|
|
3185
|
+
if parent is not None:
|
|
3186
|
+
request.parent = parent
|
|
3187
|
+
if route is not None:
|
|
3188
|
+
request.route = route
|
|
3189
|
+
if route_id is not None:
|
|
3190
|
+
request.route_id = route_id
|
|
3191
|
+
|
|
3192
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
3193
|
+
# and friendly error handling.
|
|
3194
|
+
rpc = self._client._transport._wrapped_methods[
|
|
3195
|
+
self._client._transport.create_route
|
|
3196
|
+
]
|
|
3197
|
+
|
|
3198
|
+
# Certain fields should be provided within the metadata header;
|
|
3199
|
+
# add these here.
|
|
3200
|
+
metadata = tuple(metadata) + (
|
|
3201
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
3202
|
+
)
|
|
3203
|
+
|
|
3204
|
+
# Validate the universe domain.
|
|
3205
|
+
self._client._validate_universe_domain()
|
|
3206
|
+
|
|
3207
|
+
# Send the request.
|
|
3208
|
+
response = await rpc(
|
|
3209
|
+
request,
|
|
3210
|
+
retry=retry,
|
|
3211
|
+
timeout=timeout,
|
|
3212
|
+
metadata=metadata,
|
|
3213
|
+
)
|
|
3214
|
+
|
|
3215
|
+
# Wrap the response in an operation future.
|
|
3216
|
+
response = operation_async.from_gapic(
|
|
3217
|
+
response,
|
|
3218
|
+
self._client._transport.operations_client,
|
|
3219
|
+
datastream_resources.Route,
|
|
3220
|
+
metadata_type=datastream.OperationMetadata,
|
|
3221
|
+
)
|
|
3222
|
+
|
|
3223
|
+
# Done; return the response.
|
|
3224
|
+
return response
|
|
3225
|
+
|
|
3226
|
+
async def get_route(
|
|
3227
|
+
self,
|
|
3228
|
+
request: Optional[Union[datastream.GetRouteRequest, dict]] = None,
|
|
3229
|
+
*,
|
|
3230
|
+
name: Optional[str] = None,
|
|
3231
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
3232
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
3233
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
3234
|
+
) -> datastream_resources.Route:
|
|
3235
|
+
r"""Use this method to get details about a route.
|
|
3236
|
+
|
|
3237
|
+
.. code-block:: python
|
|
3238
|
+
|
|
3239
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
3240
|
+
# code template only.
|
|
3241
|
+
# It will require modifications to work:
|
|
3242
|
+
# - It may require correct/in-range values for request initialization.
|
|
3243
|
+
# - It may require specifying regional endpoints when creating the service
|
|
3244
|
+
# client as shown in:
|
|
3245
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
3246
|
+
from google.cloud import datastream_v1
|
|
3247
|
+
|
|
3248
|
+
async def sample_get_route():
|
|
3249
|
+
# Create a client
|
|
3250
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
3251
|
+
|
|
3252
|
+
# Initialize request argument(s)
|
|
3253
|
+
request = datastream_v1.GetRouteRequest(
|
|
3254
|
+
name="name_value",
|
|
3255
|
+
)
|
|
3256
|
+
|
|
3257
|
+
# Make the request
|
|
3258
|
+
response = await client.get_route(request=request)
|
|
3259
|
+
|
|
3260
|
+
# Handle the response
|
|
3261
|
+
print(response)
|
|
3262
|
+
|
|
3263
|
+
Args:
|
|
3264
|
+
request (Optional[Union[google.cloud.datastream_v1.types.GetRouteRequest, dict]]):
|
|
3265
|
+
The request object. Route get request.
|
|
3266
|
+
name (:class:`str`):
|
|
3267
|
+
Required. The name of the Route
|
|
3268
|
+
resource to get.
|
|
3269
|
+
|
|
3270
|
+
This corresponds to the ``name`` field
|
|
3271
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
3272
|
+
should not be set.
|
|
3273
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
3274
|
+
should be retried.
|
|
3275
|
+
timeout (float): The timeout for this request.
|
|
3276
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
3277
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
3278
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
3279
|
+
be of type `bytes`.
|
|
3280
|
+
|
|
3281
|
+
Returns:
|
|
3282
|
+
google.cloud.datastream_v1.types.Route:
|
|
3283
|
+
The route resource is the child of
|
|
3284
|
+
the private connection resource, used
|
|
3285
|
+
for defining a route for a private
|
|
3286
|
+
connection.
|
|
3287
|
+
|
|
3288
|
+
"""
|
|
3289
|
+
# Create or coerce a protobuf request object.
|
|
3290
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
3291
|
+
# gotten any keyword arguments that map to the request.
|
|
3292
|
+
flattened_params = [name]
|
|
3293
|
+
has_flattened_params = (
|
|
3294
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
3295
|
+
)
|
|
3296
|
+
if request is not None and has_flattened_params:
|
|
3297
|
+
raise ValueError(
|
|
3298
|
+
"If the `request` argument is set, then none of "
|
|
3299
|
+
"the individual field arguments should be set."
|
|
3300
|
+
)
|
|
3301
|
+
|
|
3302
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
3303
|
+
# there are no flattened fields), or create one.
|
|
3304
|
+
if not isinstance(request, datastream.GetRouteRequest):
|
|
3305
|
+
request = datastream.GetRouteRequest(request)
|
|
3306
|
+
|
|
3307
|
+
# If we have keyword arguments corresponding to fields on the
|
|
3308
|
+
# request, apply these.
|
|
3309
|
+
if name is not None:
|
|
3310
|
+
request.name = name
|
|
3311
|
+
|
|
3312
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
3313
|
+
# and friendly error handling.
|
|
3314
|
+
rpc = self._client._transport._wrapped_methods[
|
|
3315
|
+
self._client._transport.get_route
|
|
3316
|
+
]
|
|
3317
|
+
|
|
3318
|
+
# Certain fields should be provided within the metadata header;
|
|
3319
|
+
# add these here.
|
|
3320
|
+
metadata = tuple(metadata) + (
|
|
3321
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
3322
|
+
)
|
|
3323
|
+
|
|
3324
|
+
# Validate the universe domain.
|
|
3325
|
+
self._client._validate_universe_domain()
|
|
3326
|
+
|
|
3327
|
+
# Send the request.
|
|
3328
|
+
response = await rpc(
|
|
3329
|
+
request,
|
|
3330
|
+
retry=retry,
|
|
3331
|
+
timeout=timeout,
|
|
3332
|
+
metadata=metadata,
|
|
3333
|
+
)
|
|
3334
|
+
|
|
3335
|
+
# Done; return the response.
|
|
3336
|
+
return response
|
|
3337
|
+
|
|
3338
|
+
async def list_routes(
|
|
3339
|
+
self,
|
|
3340
|
+
request: Optional[Union[datastream.ListRoutesRequest, dict]] = None,
|
|
3341
|
+
*,
|
|
3342
|
+
parent: Optional[str] = None,
|
|
3343
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
3344
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
3345
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
3346
|
+
) -> pagers.ListRoutesAsyncPager:
|
|
3347
|
+
r"""Use this method to list routes created for a private
|
|
3348
|
+
connectivity configuration in a project and location.
|
|
3349
|
+
|
|
3350
|
+
.. code-block:: python
|
|
3351
|
+
|
|
3352
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
3353
|
+
# code template only.
|
|
3354
|
+
# It will require modifications to work:
|
|
3355
|
+
# - It may require correct/in-range values for request initialization.
|
|
3356
|
+
# - It may require specifying regional endpoints when creating the service
|
|
3357
|
+
# client as shown in:
|
|
3358
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
3359
|
+
from google.cloud import datastream_v1
|
|
3360
|
+
|
|
3361
|
+
async def sample_list_routes():
|
|
3362
|
+
# Create a client
|
|
3363
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
3364
|
+
|
|
3365
|
+
# Initialize request argument(s)
|
|
3366
|
+
request = datastream_v1.ListRoutesRequest(
|
|
3367
|
+
parent="parent_value",
|
|
3368
|
+
)
|
|
3369
|
+
|
|
3370
|
+
# Make the request
|
|
3371
|
+
page_result = client.list_routes(request=request)
|
|
3372
|
+
|
|
3373
|
+
# Handle the response
|
|
3374
|
+
async for response in page_result:
|
|
3375
|
+
print(response)
|
|
3376
|
+
|
|
3377
|
+
Args:
|
|
3378
|
+
request (Optional[Union[google.cloud.datastream_v1.types.ListRoutesRequest, dict]]):
|
|
3379
|
+
The request object. Route list request.
|
|
3380
|
+
parent (:class:`str`):
|
|
3381
|
+
Required. The parent that owns the
|
|
3382
|
+
collection of Routess.
|
|
3383
|
+
|
|
3384
|
+
This corresponds to the ``parent`` field
|
|
3385
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
3386
|
+
should not be set.
|
|
3387
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
3388
|
+
should be retried.
|
|
3389
|
+
timeout (float): The timeout for this request.
|
|
3390
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
3391
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
3392
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
3393
|
+
be of type `bytes`.
|
|
3394
|
+
|
|
3395
|
+
Returns:
|
|
3396
|
+
google.cloud.datastream_v1.services.datastream.pagers.ListRoutesAsyncPager:
|
|
3397
|
+
Route list response.
|
|
3398
|
+
|
|
3399
|
+
Iterating over this object will yield
|
|
3400
|
+
results and resolve additional pages
|
|
3401
|
+
automatically.
|
|
3402
|
+
|
|
3403
|
+
"""
|
|
3404
|
+
# Create or coerce a protobuf request object.
|
|
3405
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
3406
|
+
# gotten any keyword arguments that map to the request.
|
|
3407
|
+
flattened_params = [parent]
|
|
3408
|
+
has_flattened_params = (
|
|
3409
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
3410
|
+
)
|
|
3411
|
+
if request is not None and has_flattened_params:
|
|
3412
|
+
raise ValueError(
|
|
3413
|
+
"If the `request` argument is set, then none of "
|
|
3414
|
+
"the individual field arguments should be set."
|
|
3415
|
+
)
|
|
3416
|
+
|
|
3417
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
3418
|
+
# there are no flattened fields), or create one.
|
|
3419
|
+
if not isinstance(request, datastream.ListRoutesRequest):
|
|
3420
|
+
request = datastream.ListRoutesRequest(request)
|
|
3421
|
+
|
|
3422
|
+
# If we have keyword arguments corresponding to fields on the
|
|
3423
|
+
# request, apply these.
|
|
3424
|
+
if parent is not None:
|
|
3425
|
+
request.parent = parent
|
|
3426
|
+
|
|
3427
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
3428
|
+
# and friendly error handling.
|
|
3429
|
+
rpc = self._client._transport._wrapped_methods[
|
|
3430
|
+
self._client._transport.list_routes
|
|
3431
|
+
]
|
|
3432
|
+
|
|
3433
|
+
# Certain fields should be provided within the metadata header;
|
|
3434
|
+
# add these here.
|
|
3435
|
+
metadata = tuple(metadata) + (
|
|
3436
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
3437
|
+
)
|
|
3438
|
+
|
|
3439
|
+
# Validate the universe domain.
|
|
3440
|
+
self._client._validate_universe_domain()
|
|
3441
|
+
|
|
3442
|
+
# Send the request.
|
|
3443
|
+
response = await rpc(
|
|
3444
|
+
request,
|
|
3445
|
+
retry=retry,
|
|
3446
|
+
timeout=timeout,
|
|
3447
|
+
metadata=metadata,
|
|
3448
|
+
)
|
|
3449
|
+
|
|
3450
|
+
# This method is paged; wrap the response in a pager, which provides
|
|
3451
|
+
# an `__aiter__` convenience method.
|
|
3452
|
+
response = pagers.ListRoutesAsyncPager(
|
|
3453
|
+
method=rpc,
|
|
3454
|
+
request=request,
|
|
3455
|
+
response=response,
|
|
3456
|
+
retry=retry,
|
|
3457
|
+
timeout=timeout,
|
|
3458
|
+
metadata=metadata,
|
|
3459
|
+
)
|
|
3460
|
+
|
|
3461
|
+
# Done; return the response.
|
|
3462
|
+
return response
|
|
3463
|
+
|
|
3464
|
+
async def delete_route(
|
|
3465
|
+
self,
|
|
3466
|
+
request: Optional[Union[datastream.DeleteRouteRequest, dict]] = None,
|
|
3467
|
+
*,
|
|
3468
|
+
name: Optional[str] = None,
|
|
3469
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
3470
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
3471
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
3472
|
+
) -> operation_async.AsyncOperation:
|
|
3473
|
+
r"""Use this method to delete a route.
|
|
3474
|
+
|
|
3475
|
+
.. code-block:: python
|
|
3476
|
+
|
|
3477
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
3478
|
+
# code template only.
|
|
3479
|
+
# It will require modifications to work:
|
|
3480
|
+
# - It may require correct/in-range values for request initialization.
|
|
3481
|
+
# - It may require specifying regional endpoints when creating the service
|
|
3482
|
+
# client as shown in:
|
|
3483
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
3484
|
+
from google.cloud import datastream_v1
|
|
3485
|
+
|
|
3486
|
+
async def sample_delete_route():
|
|
3487
|
+
# Create a client
|
|
3488
|
+
client = datastream_v1.DatastreamAsyncClient()
|
|
3489
|
+
|
|
3490
|
+
# Initialize request argument(s)
|
|
3491
|
+
request = datastream_v1.DeleteRouteRequest(
|
|
3492
|
+
name="name_value",
|
|
3493
|
+
)
|
|
3494
|
+
|
|
3495
|
+
# Make the request
|
|
3496
|
+
operation = client.delete_route(request=request)
|
|
3497
|
+
|
|
3498
|
+
print("Waiting for operation to complete...")
|
|
3499
|
+
|
|
3500
|
+
response = (await operation).result()
|
|
3501
|
+
|
|
3502
|
+
# Handle the response
|
|
3503
|
+
print(response)
|
|
3504
|
+
|
|
3505
|
+
Args:
|
|
3506
|
+
request (Optional[Union[google.cloud.datastream_v1.types.DeleteRouteRequest, dict]]):
|
|
3507
|
+
The request object. Route deletion request.
|
|
3508
|
+
name (:class:`str`):
|
|
3509
|
+
Required. The name of the Route
|
|
3510
|
+
resource to delete.
|
|
3511
|
+
|
|
3512
|
+
This corresponds to the ``name`` field
|
|
3513
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
3514
|
+
should not be set.
|
|
3515
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
3516
|
+
should be retried.
|
|
3517
|
+
timeout (float): The timeout for this request.
|
|
3518
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
3519
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
3520
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
3521
|
+
be of type `bytes`.
|
|
3522
|
+
|
|
3523
|
+
Returns:
|
|
3524
|
+
google.api_core.operation_async.AsyncOperation:
|
|
3525
|
+
An object representing a long-running operation.
|
|
3526
|
+
|
|
3527
|
+
The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated
|
|
3528
|
+
empty messages in your APIs. A typical example is to
|
|
3529
|
+
use it as the request or the response type of an API
|
|
3530
|
+
method. For instance:
|
|
3531
|
+
|
|
3532
|
+
service Foo {
|
|
3533
|
+
rpc Bar(google.protobuf.Empty) returns
|
|
3534
|
+
(google.protobuf.Empty);
|
|
3535
|
+
|
|
3536
|
+
}
|
|
3537
|
+
|
|
3538
|
+
"""
|
|
3539
|
+
# Create or coerce a protobuf request object.
|
|
3540
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
3541
|
+
# gotten any keyword arguments that map to the request.
|
|
3542
|
+
flattened_params = [name]
|
|
3543
|
+
has_flattened_params = (
|
|
3544
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
3545
|
+
)
|
|
3546
|
+
if request is not None and has_flattened_params:
|
|
3547
|
+
raise ValueError(
|
|
3548
|
+
"If the `request` argument is set, then none of "
|
|
3549
|
+
"the individual field arguments should be set."
|
|
3550
|
+
)
|
|
3551
|
+
|
|
3552
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
3553
|
+
# there are no flattened fields), or create one.
|
|
3554
|
+
if not isinstance(request, datastream.DeleteRouteRequest):
|
|
3555
|
+
request = datastream.DeleteRouteRequest(request)
|
|
3556
|
+
|
|
3557
|
+
# If we have keyword arguments corresponding to fields on the
|
|
3558
|
+
# request, apply these.
|
|
3559
|
+
if name is not None:
|
|
3560
|
+
request.name = name
|
|
3561
|
+
|
|
3562
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
3563
|
+
# and friendly error handling.
|
|
3564
|
+
rpc = self._client._transport._wrapped_methods[
|
|
3565
|
+
self._client._transport.delete_route
|
|
3566
|
+
]
|
|
3567
|
+
|
|
3568
|
+
# Certain fields should be provided within the metadata header;
|
|
3569
|
+
# add these here.
|
|
3570
|
+
metadata = tuple(metadata) + (
|
|
3571
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
3572
|
+
)
|
|
3573
|
+
|
|
3574
|
+
# Validate the universe domain.
|
|
3575
|
+
self._client._validate_universe_domain()
|
|
3576
|
+
|
|
3577
|
+
# Send the request.
|
|
3578
|
+
response = await rpc(
|
|
3579
|
+
request,
|
|
3580
|
+
retry=retry,
|
|
3581
|
+
timeout=timeout,
|
|
3582
|
+
metadata=metadata,
|
|
3583
|
+
)
|
|
3584
|
+
|
|
3585
|
+
# Wrap the response in an operation future.
|
|
3586
|
+
response = operation_async.from_gapic(
|
|
3587
|
+
response,
|
|
3588
|
+
self._client._transport.operations_client,
|
|
3589
|
+
empty_pb2.Empty,
|
|
3590
|
+
metadata_type=datastream.OperationMetadata,
|
|
3591
|
+
)
|
|
3592
|
+
|
|
3593
|
+
# Done; return the response.
|
|
3594
|
+
return response
|
|
3595
|
+
|
|
3596
|
+
async def list_operations(
|
|
3597
|
+
self,
|
|
3598
|
+
request: Optional[operations_pb2.ListOperationsRequest] = None,
|
|
3599
|
+
*,
|
|
3600
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
3601
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
3602
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
3603
|
+
) -> operations_pb2.ListOperationsResponse:
|
|
3604
|
+
r"""Lists operations that match the specified filter in the request.
|
|
3605
|
+
|
|
3606
|
+
Args:
|
|
3607
|
+
request (:class:`~.operations_pb2.ListOperationsRequest`):
|
|
3608
|
+
The request object. Request message for
|
|
3609
|
+
`ListOperations` method.
|
|
3610
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
|
|
3611
|
+
if any, should be retried.
|
|
3612
|
+
timeout (float): The timeout for this request.
|
|
3613
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
3614
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
3615
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
3616
|
+
be of type `bytes`.
|
|
3617
|
+
Returns:
|
|
3618
|
+
~.operations_pb2.ListOperationsResponse:
|
|
3619
|
+
Response message for ``ListOperations`` method.
|
|
3620
|
+
"""
|
|
3621
|
+
# Create or coerce a protobuf request object.
|
|
3622
|
+
# The request isn't a proto-plus wrapped type,
|
|
3623
|
+
# so it must be constructed via keyword expansion.
|
|
3624
|
+
if isinstance(request, dict):
|
|
3625
|
+
request = operations_pb2.ListOperationsRequest(**request)
|
|
3626
|
+
|
|
3627
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
3628
|
+
# and friendly error handling.
|
|
3629
|
+
rpc = self.transport._wrapped_methods[self._client._transport.list_operations]
|
|
3630
|
+
|
|
3631
|
+
# Certain fields should be provided within the metadata header;
|
|
3632
|
+
# add these here.
|
|
3633
|
+
metadata = tuple(metadata) + (
|
|
3634
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
3635
|
+
)
|
|
3636
|
+
|
|
3637
|
+
# Validate the universe domain.
|
|
3638
|
+
self._client._validate_universe_domain()
|
|
3639
|
+
|
|
3640
|
+
# Send the request.
|
|
3641
|
+
response = await rpc(
|
|
3642
|
+
request,
|
|
3643
|
+
retry=retry,
|
|
3644
|
+
timeout=timeout,
|
|
3645
|
+
metadata=metadata,
|
|
3646
|
+
)
|
|
3647
|
+
|
|
3648
|
+
# Done; return the response.
|
|
3649
|
+
return response
|
|
3650
|
+
|
|
3651
|
+
async def get_operation(
|
|
3652
|
+
self,
|
|
3653
|
+
request: Optional[operations_pb2.GetOperationRequest] = None,
|
|
3654
|
+
*,
|
|
3655
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
3656
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
3657
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
3658
|
+
) -> operations_pb2.Operation:
|
|
3659
|
+
r"""Gets the latest state of a long-running operation.
|
|
3660
|
+
|
|
3661
|
+
Args:
|
|
3662
|
+
request (:class:`~.operations_pb2.GetOperationRequest`):
|
|
3663
|
+
The request object. Request message for
|
|
3664
|
+
`GetOperation` method.
|
|
3665
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
|
|
3666
|
+
if any, should be retried.
|
|
3667
|
+
timeout (float): The timeout for this request.
|
|
3668
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
3669
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
3670
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
3671
|
+
be of type `bytes`.
|
|
3672
|
+
Returns:
|
|
3673
|
+
~.operations_pb2.Operation:
|
|
3674
|
+
An ``Operation`` object.
|
|
3675
|
+
"""
|
|
3676
|
+
# Create or coerce a protobuf request object.
|
|
3677
|
+
# The request isn't a proto-plus wrapped type,
|
|
3678
|
+
# so it must be constructed via keyword expansion.
|
|
3679
|
+
if isinstance(request, dict):
|
|
3680
|
+
request = operations_pb2.GetOperationRequest(**request)
|
|
3681
|
+
|
|
3682
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
3683
|
+
# and friendly error handling.
|
|
3684
|
+
rpc = self.transport._wrapped_methods[self._client._transport.get_operation]
|
|
3685
|
+
|
|
3686
|
+
# Certain fields should be provided within the metadata header;
|
|
3687
|
+
# add these here.
|
|
3688
|
+
metadata = tuple(metadata) + (
|
|
3689
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
3690
|
+
)
|
|
3691
|
+
|
|
3692
|
+
# Validate the universe domain.
|
|
3693
|
+
self._client._validate_universe_domain()
|
|
3694
|
+
|
|
3695
|
+
# Send the request.
|
|
3696
|
+
response = await rpc(
|
|
3697
|
+
request,
|
|
3698
|
+
retry=retry,
|
|
3699
|
+
timeout=timeout,
|
|
3700
|
+
metadata=metadata,
|
|
3701
|
+
)
|
|
3702
|
+
|
|
3703
|
+
# Done; return the response.
|
|
3704
|
+
return response
|
|
3705
|
+
|
|
3706
|
+
async def delete_operation(
|
|
3707
|
+
self,
|
|
3708
|
+
request: Optional[operations_pb2.DeleteOperationRequest] = None,
|
|
3709
|
+
*,
|
|
3710
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
3711
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
3712
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
3713
|
+
) -> None:
|
|
3714
|
+
r"""Deletes a long-running operation.
|
|
3715
|
+
|
|
3716
|
+
This method indicates that the client is no longer interested
|
|
3717
|
+
in the operation result. It does not cancel the operation.
|
|
3718
|
+
If the server doesn't support this method, it returns
|
|
3719
|
+
`google.rpc.Code.UNIMPLEMENTED`.
|
|
3720
|
+
|
|
3721
|
+
Args:
|
|
3722
|
+
request (:class:`~.operations_pb2.DeleteOperationRequest`):
|
|
3723
|
+
The request object. Request message for
|
|
3724
|
+
`DeleteOperation` method.
|
|
3725
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
|
|
3726
|
+
if any, should be retried.
|
|
3727
|
+
timeout (float): The timeout for this request.
|
|
3728
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
3729
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
3730
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
3731
|
+
be of type `bytes`.
|
|
3732
|
+
Returns:
|
|
3733
|
+
None
|
|
3734
|
+
"""
|
|
3735
|
+
# Create or coerce a protobuf request object.
|
|
3736
|
+
# The request isn't a proto-plus wrapped type,
|
|
3737
|
+
# so it must be constructed via keyword expansion.
|
|
3738
|
+
if isinstance(request, dict):
|
|
3739
|
+
request = operations_pb2.DeleteOperationRequest(**request)
|
|
3740
|
+
|
|
3741
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
3742
|
+
# and friendly error handling.
|
|
3743
|
+
rpc = self.transport._wrapped_methods[self._client._transport.delete_operation]
|
|
3744
|
+
|
|
3745
|
+
# Certain fields should be provided within the metadata header;
|
|
3746
|
+
# add these here.
|
|
3747
|
+
metadata = tuple(metadata) + (
|
|
3748
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
3749
|
+
)
|
|
3750
|
+
|
|
3751
|
+
# Validate the universe domain.
|
|
3752
|
+
self._client._validate_universe_domain()
|
|
3753
|
+
|
|
3754
|
+
# Send the request.
|
|
3755
|
+
await rpc(
|
|
3756
|
+
request,
|
|
3757
|
+
retry=retry,
|
|
3758
|
+
timeout=timeout,
|
|
3759
|
+
metadata=metadata,
|
|
3760
|
+
)
|
|
3761
|
+
|
|
3762
|
+
async def cancel_operation(
|
|
3763
|
+
self,
|
|
3764
|
+
request: Optional[operations_pb2.CancelOperationRequest] = None,
|
|
3765
|
+
*,
|
|
3766
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
3767
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
3768
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
3769
|
+
) -> None:
|
|
3770
|
+
r"""Starts asynchronous cancellation on a long-running operation.
|
|
3771
|
+
|
|
3772
|
+
The server makes a best effort to cancel the operation, but success
|
|
3773
|
+
is not guaranteed. If the server doesn't support this method, it returns
|
|
3774
|
+
`google.rpc.Code.UNIMPLEMENTED`.
|
|
3775
|
+
|
|
3776
|
+
Args:
|
|
3777
|
+
request (:class:`~.operations_pb2.CancelOperationRequest`):
|
|
3778
|
+
The request object. Request message for
|
|
3779
|
+
`CancelOperation` method.
|
|
3780
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
|
|
3781
|
+
if any, should be retried.
|
|
3782
|
+
timeout (float): The timeout for this request.
|
|
3783
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
3784
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
3785
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
3786
|
+
be of type `bytes`.
|
|
3787
|
+
Returns:
|
|
3788
|
+
None
|
|
3789
|
+
"""
|
|
3790
|
+
# Create or coerce a protobuf request object.
|
|
3791
|
+
# The request isn't a proto-plus wrapped type,
|
|
3792
|
+
# so it must be constructed via keyword expansion.
|
|
3793
|
+
if isinstance(request, dict):
|
|
3794
|
+
request = operations_pb2.CancelOperationRequest(**request)
|
|
3795
|
+
|
|
3796
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
3797
|
+
# and friendly error handling.
|
|
3798
|
+
rpc = self.transport._wrapped_methods[self._client._transport.cancel_operation]
|
|
3799
|
+
|
|
3800
|
+
# Certain fields should be provided within the metadata header;
|
|
3801
|
+
# add these here.
|
|
3802
|
+
metadata = tuple(metadata) + (
|
|
3803
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
3804
|
+
)
|
|
3805
|
+
|
|
3806
|
+
# Validate the universe domain.
|
|
3807
|
+
self._client._validate_universe_domain()
|
|
3808
|
+
|
|
3809
|
+
# Send the request.
|
|
3810
|
+
await rpc(
|
|
3811
|
+
request,
|
|
3812
|
+
retry=retry,
|
|
3813
|
+
timeout=timeout,
|
|
3814
|
+
metadata=metadata,
|
|
3815
|
+
)
|
|
3816
|
+
|
|
3817
|
+
async def get_location(
|
|
3818
|
+
self,
|
|
3819
|
+
request: Optional[locations_pb2.GetLocationRequest] = None,
|
|
3820
|
+
*,
|
|
3821
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
3822
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
3823
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
3824
|
+
) -> locations_pb2.Location:
|
|
3825
|
+
r"""Gets information about a location.
|
|
3826
|
+
|
|
3827
|
+
Args:
|
|
3828
|
+
request (:class:`~.location_pb2.GetLocationRequest`):
|
|
3829
|
+
The request object. Request message for
|
|
3830
|
+
`GetLocation` method.
|
|
3831
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
|
|
3832
|
+
if any, should be retried.
|
|
3833
|
+
timeout (float): The timeout for this request.
|
|
3834
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
3835
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
3836
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
3837
|
+
be of type `bytes`.
|
|
3838
|
+
Returns:
|
|
3839
|
+
~.location_pb2.Location:
|
|
3840
|
+
Location object.
|
|
3841
|
+
"""
|
|
3842
|
+
# Create or coerce a protobuf request object.
|
|
3843
|
+
# The request isn't a proto-plus wrapped type,
|
|
3844
|
+
# so it must be constructed via keyword expansion.
|
|
3845
|
+
if isinstance(request, dict):
|
|
3846
|
+
request = locations_pb2.GetLocationRequest(**request)
|
|
3847
|
+
|
|
3848
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
3849
|
+
# and friendly error handling.
|
|
3850
|
+
rpc = self.transport._wrapped_methods[self._client._transport.get_location]
|
|
3851
|
+
|
|
3852
|
+
# Certain fields should be provided within the metadata header;
|
|
3853
|
+
# add these here.
|
|
3854
|
+
metadata = tuple(metadata) + (
|
|
3855
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
3856
|
+
)
|
|
3857
|
+
|
|
3858
|
+
# Validate the universe domain.
|
|
3859
|
+
self._client._validate_universe_domain()
|
|
3860
|
+
|
|
3861
|
+
# Send the request.
|
|
3862
|
+
response = await rpc(
|
|
3863
|
+
request,
|
|
3864
|
+
retry=retry,
|
|
3865
|
+
timeout=timeout,
|
|
3866
|
+
metadata=metadata,
|
|
3867
|
+
)
|
|
3868
|
+
|
|
3869
|
+
# Done; return the response.
|
|
3870
|
+
return response
|
|
3871
|
+
|
|
3872
|
+
async def list_locations(
|
|
3873
|
+
self,
|
|
3874
|
+
request: Optional[locations_pb2.ListLocationsRequest] = None,
|
|
3875
|
+
*,
|
|
3876
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
3877
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
3878
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
3879
|
+
) -> locations_pb2.ListLocationsResponse:
|
|
3880
|
+
r"""Lists information about the supported locations for this service.
|
|
3881
|
+
|
|
3882
|
+
Args:
|
|
3883
|
+
request (:class:`~.location_pb2.ListLocationsRequest`):
|
|
3884
|
+
The request object. Request message for
|
|
3885
|
+
`ListLocations` method.
|
|
3886
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
|
|
3887
|
+
if any, should be retried.
|
|
3888
|
+
timeout (float): The timeout for this request.
|
|
3889
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
3890
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
3891
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
3892
|
+
be of type `bytes`.
|
|
3893
|
+
Returns:
|
|
3894
|
+
~.location_pb2.ListLocationsResponse:
|
|
3895
|
+
Response message for ``ListLocations`` method.
|
|
3896
|
+
"""
|
|
3897
|
+
# Create or coerce a protobuf request object.
|
|
3898
|
+
# The request isn't a proto-plus wrapped type,
|
|
3899
|
+
# so it must be constructed via keyword expansion.
|
|
3900
|
+
if isinstance(request, dict):
|
|
3901
|
+
request = locations_pb2.ListLocationsRequest(**request)
|
|
3902
|
+
|
|
3903
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
3904
|
+
# and friendly error handling.
|
|
3905
|
+
rpc = self.transport._wrapped_methods[self._client._transport.list_locations]
|
|
3906
|
+
|
|
3907
|
+
# Certain fields should be provided within the metadata header;
|
|
3908
|
+
# add these here.
|
|
3909
|
+
metadata = tuple(metadata) + (
|
|
3910
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
3911
|
+
)
|
|
3912
|
+
|
|
3913
|
+
# Validate the universe domain.
|
|
3914
|
+
self._client._validate_universe_domain()
|
|
3915
|
+
|
|
3916
|
+
# Send the request.
|
|
3917
|
+
response = await rpc(
|
|
3918
|
+
request,
|
|
3919
|
+
retry=retry,
|
|
3920
|
+
timeout=timeout,
|
|
3921
|
+
metadata=metadata,
|
|
3922
|
+
)
|
|
3923
|
+
|
|
3924
|
+
# Done; return the response.
|
|
3925
|
+
return response
|
|
3926
|
+
|
|
3927
|
+
async def __aenter__(self) -> "DatastreamAsyncClient":
|
|
3928
|
+
return self
|
|
3929
|
+
|
|
3930
|
+
async def __aexit__(self, exc_type, exc, tb):
|
|
3931
|
+
await self.transport.close()
|
|
3932
|
+
|
|
3933
|
+
|
|
3934
|
+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
|
|
3935
|
+
gapic_version=package_version.__version__
|
|
3936
|
+
)
|
|
3937
|
+
|
|
3938
|
+
|
|
3939
|
+
__all__ = ("DatastreamAsyncClient",)
|