google-cloud-dataproc 5.18.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. google/cloud/dataproc/__init__.py +409 -0
  2. google/cloud/dataproc/gapic_version.py +16 -0
  3. google/cloud/dataproc/py.typed +2 -0
  4. google/cloud/dataproc_v1/__init__.py +389 -0
  5. google/cloud/dataproc_v1/gapic_metadata.json +821 -0
  6. google/cloud/dataproc_v1/gapic_version.py +16 -0
  7. google/cloud/dataproc_v1/py.typed +2 -0
  8. google/cloud/dataproc_v1/services/__init__.py +15 -0
  9. google/cloud/dataproc_v1/services/autoscaling_policy_service/__init__.py +22 -0
  10. google/cloud/dataproc_v1/services/autoscaling_policy_service/async_client.py +1488 -0
  11. google/cloud/dataproc_v1/services/autoscaling_policy_service/client.py +1924 -0
  12. google/cloud/dataproc_v1/services/autoscaling_policy_service/pagers.py +201 -0
  13. google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/__init__.py +41 -0
  14. google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/base.py +361 -0
  15. google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/grpc.py +635 -0
  16. google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/grpc_asyncio.py +743 -0
  17. google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/rest.py +2358 -0
  18. google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/rest_base.py +671 -0
  19. google/cloud/dataproc_v1/services/batch_controller/__init__.py +22 -0
  20. google/cloud/dataproc_v1/services/batch_controller/async_client.py +1330 -0
  21. google/cloud/dataproc_v1/services/batch_controller/client.py +1786 -0
  22. google/cloud/dataproc_v1/services/batch_controller/pagers.py +197 -0
  23. google/cloud/dataproc_v1/services/batch_controller/transports/__init__.py +36 -0
  24. google/cloud/dataproc_v1/services/batch_controller/transports/base.py +308 -0
  25. google/cloud/dataproc_v1/services/batch_controller/transports/grpc.py +606 -0
  26. google/cloud/dataproc_v1/services/batch_controller/transports/grpc_asyncio.py +682 -0
  27. google/cloud/dataproc_v1/services/batch_controller/transports/rest.py +2118 -0
  28. google/cloud/dataproc_v1/services/batch_controller/transports/rest_base.py +592 -0
  29. google/cloud/dataproc_v1/services/cluster_controller/__init__.py +22 -0
  30. google/cloud/dataproc_v1/services/cluster_controller/async_client.py +2096 -0
  31. google/cloud/dataproc_v1/services/cluster_controller/client.py +2587 -0
  32. google/cloud/dataproc_v1/services/cluster_controller/pagers.py +197 -0
  33. google/cloud/dataproc_v1/services/cluster_controller/transports/__init__.py +36 -0
  34. google/cloud/dataproc_v1/services/cluster_controller/transports/base.py +423 -0
  35. google/cloud/dataproc_v1/services/cluster_controller/transports/grpc.py +729 -0
  36. google/cloud/dataproc_v1/services/cluster_controller/transports/grpc_asyncio.py +885 -0
  37. google/cloud/dataproc_v1/services/cluster_controller/transports/rest.py +3062 -0
  38. google/cloud/dataproc_v1/services/cluster_controller/transports/rest_base.py +821 -0
  39. google/cloud/dataproc_v1/services/job_controller/__init__.py +22 -0
  40. google/cloud/dataproc_v1/services/job_controller/async_client.py +1787 -0
  41. google/cloud/dataproc_v1/services/job_controller/client.py +2195 -0
  42. google/cloud/dataproc_v1/services/job_controller/pagers.py +197 -0
  43. google/cloud/dataproc_v1/services/job_controller/transports/__init__.py +36 -0
  44. google/cloud/dataproc_v1/services/job_controller/transports/base.py +408 -0
  45. google/cloud/dataproc_v1/services/job_controller/transports/grpc.py +678 -0
  46. google/cloud/dataproc_v1/services/job_controller/transports/grpc_asyncio.py +838 -0
  47. google/cloud/dataproc_v1/services/job_controller/transports/rest.py +2753 -0
  48. google/cloud/dataproc_v1/services/job_controller/transports/rest_base.py +765 -0
  49. google/cloud/dataproc_v1/services/node_group_controller/__init__.py +22 -0
  50. google/cloud/dataproc_v1/services/node_group_controller/async_client.py +1255 -0
  51. google/cloud/dataproc_v1/services/node_group_controller/client.py +1695 -0
  52. google/cloud/dataproc_v1/services/node_group_controller/transports/__init__.py +38 -0
  53. google/cloud/dataproc_v1/services/node_group_controller/transports/base.py +295 -0
  54. google/cloud/dataproc_v1/services/node_group_controller/transports/grpc.py +585 -0
  55. google/cloud/dataproc_v1/services/node_group_controller/transports/grpc_asyncio.py +656 -0
  56. google/cloud/dataproc_v1/services/node_group_controller/transports/rest.py +2017 -0
  57. google/cloud/dataproc_v1/services/node_group_controller/transports/rest_base.py +554 -0
  58. google/cloud/dataproc_v1/services/session_controller/__init__.py +22 -0
  59. google/cloud/dataproc_v1/services/session_controller/async_client.py +1488 -0
  60. google/cloud/dataproc_v1/services/session_controller/client.py +1960 -0
  61. google/cloud/dataproc_v1/services/session_controller/pagers.py +197 -0
  62. google/cloud/dataproc_v1/services/session_controller/transports/__init__.py +36 -0
  63. google/cloud/dataproc_v1/services/session_controller/transports/base.py +323 -0
  64. google/cloud/dataproc_v1/services/session_controller/transports/grpc.py +633 -0
  65. google/cloud/dataproc_v1/services/session_controller/transports/grpc_asyncio.py +716 -0
  66. google/cloud/dataproc_v1/services/session_controller/transports/rest.py +2416 -0
  67. google/cloud/dataproc_v1/services/session_controller/transports/rest_base.py +650 -0
  68. google/cloud/dataproc_v1/services/session_template_controller/__init__.py +22 -0
  69. google/cloud/dataproc_v1/services/session_template_controller/async_client.py +1442 -0
  70. google/cloud/dataproc_v1/services/session_template_controller/client.py +1886 -0
  71. google/cloud/dataproc_v1/services/session_template_controller/pagers.py +201 -0
  72. google/cloud/dataproc_v1/services/session_template_controller/transports/__init__.py +41 -0
  73. google/cloud/dataproc_v1/services/session_template_controller/transports/base.py +331 -0
  74. google/cloud/dataproc_v1/services/session_template_controller/transports/grpc.py +628 -0
  75. google/cloud/dataproc_v1/services/session_template_controller/transports/grpc_asyncio.py +708 -0
  76. google/cloud/dataproc_v1/services/session_template_controller/transports/rest.py +2349 -0
  77. google/cloud/dataproc_v1/services/session_template_controller/transports/rest_base.py +649 -0
  78. google/cloud/dataproc_v1/services/workflow_template_service/__init__.py +22 -0
  79. google/cloud/dataproc_v1/services/workflow_template_service/async_client.py +1885 -0
  80. google/cloud/dataproc_v1/services/workflow_template_service/client.py +2370 -0
  81. google/cloud/dataproc_v1/services/workflow_template_service/pagers.py +201 -0
  82. google/cloud/dataproc_v1/services/workflow_template_service/transports/__init__.py +41 -0
  83. google/cloud/dataproc_v1/services/workflow_template_service/transports/base.py +431 -0
  84. google/cloud/dataproc_v1/services/workflow_template_service/transports/grpc.py +760 -0
  85. google/cloud/dataproc_v1/services/workflow_template_service/transports/grpc_asyncio.py +916 -0
  86. google/cloud/dataproc_v1/services/workflow_template_service/transports/rest.py +2882 -0
  87. google/cloud/dataproc_v1/services/workflow_template_service/transports/rest_base.py +799 -0
  88. google/cloud/dataproc_v1/types/__init__.py +342 -0
  89. google/cloud/dataproc_v1/types/autoscaling_policies.py +448 -0
  90. google/cloud/dataproc_v1/types/batches.py +642 -0
  91. google/cloud/dataproc_v1/types/clusters.py +2671 -0
  92. google/cloud/dataproc_v1/types/jobs.py +1822 -0
  93. google/cloud/dataproc_v1/types/node_groups.py +166 -0
  94. google/cloud/dataproc_v1/types/operations.py +395 -0
  95. google/cloud/dataproc_v1/types/session_templates.py +284 -0
  96. google/cloud/dataproc_v1/types/sessions.py +504 -0
  97. google/cloud/dataproc_v1/types/shared.py +1010 -0
  98. google/cloud/dataproc_v1/types/workflow_templates.py +1229 -0
  99. google_cloud_dataproc-5.18.1.dist-info/LICENSE +202 -0
  100. google_cloud_dataproc-5.18.1.dist-info/METADATA +229 -0
  101. google_cloud_dataproc-5.18.1.dist-info/RECORD +103 -0
  102. google_cloud_dataproc-5.18.1.dist-info/WHEEL +5 -0
  103. google_cloud_dataproc-5.18.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,656 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2024 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import inspect
17
+ import json
18
+ import logging as std_logging
19
+ import pickle
20
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
21
+ import warnings
22
+
23
+ from google.api_core import exceptions as core_exceptions
24
+ from google.api_core import gapic_v1, grpc_helpers_async, operations_v1
25
+ from google.api_core import retry_async as retries
26
+ from google.auth import credentials as ga_credentials # type: ignore
27
+ from google.auth.transport.grpc import SslCredentials # type: ignore
28
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
29
+ from google.iam.v1 import policy_pb2 # type: ignore
30
+ from google.longrunning import operations_pb2 # type: ignore
31
+ from google.protobuf.json_format import MessageToJson
32
+ import google.protobuf.message
33
+ import grpc # type: ignore
34
+ from grpc.experimental import aio # type: ignore
35
+ import proto # type: ignore
36
+
37
+ from google.cloud.dataproc_v1.types import clusters, node_groups
38
+
39
+ from .base import DEFAULT_CLIENT_INFO, NodeGroupControllerTransport
40
+ from .grpc import NodeGroupControllerGrpcTransport
41
+
42
+ try:
43
+ from google.api_core import client_logging # type: ignore
44
+
45
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
46
+ except ImportError: # pragma: NO COVER
47
+ CLIENT_LOGGING_SUPPORTED = False
48
+
49
+ _LOGGER = std_logging.getLogger(__name__)
50
+
51
+
52
+ class _LoggingClientAIOInterceptor(
53
+ grpc.aio.UnaryUnaryClientInterceptor
54
+ ): # pragma: NO COVER
55
+ async def intercept_unary_unary(self, continuation, client_call_details, request):
56
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
57
+ std_logging.DEBUG
58
+ )
59
+ if logging_enabled: # pragma: NO COVER
60
+ request_metadata = client_call_details.metadata
61
+ if isinstance(request, proto.Message):
62
+ request_payload = type(request).to_json(request)
63
+ elif isinstance(request, google.protobuf.message.Message):
64
+ request_payload = MessageToJson(request)
65
+ else:
66
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
67
+
68
+ request_metadata = {
69
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
70
+ for key, value in request_metadata
71
+ }
72
+ grpc_request = {
73
+ "payload": request_payload,
74
+ "requestMethod": "grpc",
75
+ "metadata": dict(request_metadata),
76
+ }
77
+ _LOGGER.debug(
78
+ f"Sending request for {client_call_details.method}",
79
+ extra={
80
+ "serviceName": "google.cloud.dataproc.v1.NodeGroupController",
81
+ "rpcName": str(client_call_details.method),
82
+ "request": grpc_request,
83
+ "metadata": grpc_request["metadata"],
84
+ },
85
+ )
86
+ response = await continuation(client_call_details, request)
87
+ if logging_enabled: # pragma: NO COVER
88
+ response_metadata = await response.trailing_metadata()
89
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
90
+ metadata = (
91
+ dict([(k, str(v)) for k, v in response_metadata])
92
+ if response_metadata
93
+ else None
94
+ )
95
+ result = await response
96
+ if isinstance(result, proto.Message):
97
+ response_payload = type(result).to_json(result)
98
+ elif isinstance(result, google.protobuf.message.Message):
99
+ response_payload = MessageToJson(result)
100
+ else:
101
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
102
+ grpc_response = {
103
+ "payload": response_payload,
104
+ "metadata": metadata,
105
+ "status": "OK",
106
+ }
107
+ _LOGGER.debug(
108
+ f"Received response to rpc {client_call_details.method}.",
109
+ extra={
110
+ "serviceName": "google.cloud.dataproc.v1.NodeGroupController",
111
+ "rpcName": str(client_call_details.method),
112
+ "response": grpc_response,
113
+ "metadata": grpc_response["metadata"],
114
+ },
115
+ )
116
+ return response
117
+
118
+
119
+ class NodeGroupControllerGrpcAsyncIOTransport(NodeGroupControllerTransport):
120
+ """gRPC AsyncIO backend transport for NodeGroupController.
121
+
122
+ The ``NodeGroupControllerService`` provides methods to manage node
123
+ groups of Compute Engine managed instances.
124
+
125
+ This class defines the same methods as the primary client, so the
126
+ primary client can load the underlying transport implementation
127
+ and call it.
128
+
129
+ It sends protocol buffers over the wire using gRPC (which is built on
130
+ top of HTTP/2); the ``grpcio`` package must be installed.
131
+ """
132
+
133
+ _grpc_channel: aio.Channel
134
+ _stubs: Dict[str, Callable] = {}
135
+
136
+ @classmethod
137
+ def create_channel(
138
+ cls,
139
+ host: str = "dataproc.googleapis.com",
140
+ credentials: Optional[ga_credentials.Credentials] = None,
141
+ credentials_file: Optional[str] = None,
142
+ scopes: Optional[Sequence[str]] = None,
143
+ quota_project_id: Optional[str] = None,
144
+ **kwargs,
145
+ ) -> aio.Channel:
146
+ """Create and return a gRPC AsyncIO channel object.
147
+ Args:
148
+ host (Optional[str]): The host for the channel to use.
149
+ credentials (Optional[~.Credentials]): The
150
+ authorization credentials to attach to requests. These
151
+ credentials identify this application to the service. If
152
+ none are specified, the client will attempt to ascertain
153
+ the credentials from the environment.
154
+ credentials_file (Optional[str]): A file with credentials that can
155
+ be loaded with :func:`google.auth.load_credentials_from_file`.
156
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
157
+ service. These are only used when credentials are not specified and
158
+ are passed to :func:`google.auth.default`.
159
+ quota_project_id (Optional[str]): An optional project to use for billing
160
+ and quota.
161
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
162
+ channel creation.
163
+ Returns:
164
+ aio.Channel: A gRPC AsyncIO channel object.
165
+ """
166
+
167
+ return grpc_helpers_async.create_channel(
168
+ host,
169
+ credentials=credentials,
170
+ credentials_file=credentials_file,
171
+ quota_project_id=quota_project_id,
172
+ default_scopes=cls.AUTH_SCOPES,
173
+ scopes=scopes,
174
+ default_host=cls.DEFAULT_HOST,
175
+ **kwargs,
176
+ )
177
+
178
+ def __init__(
179
+ self,
180
+ *,
181
+ host: str = "dataproc.googleapis.com",
182
+ credentials: Optional[ga_credentials.Credentials] = None,
183
+ credentials_file: Optional[str] = None,
184
+ scopes: Optional[Sequence[str]] = None,
185
+ channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
186
+ api_mtls_endpoint: Optional[str] = None,
187
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
188
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
189
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
190
+ quota_project_id: Optional[str] = None,
191
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
192
+ always_use_jwt_access: Optional[bool] = False,
193
+ api_audience: Optional[str] = None,
194
+ ) -> None:
195
+ """Instantiate the transport.
196
+
197
+ Args:
198
+ host (Optional[str]):
199
+ The hostname to connect to (default: 'dataproc.googleapis.com').
200
+ credentials (Optional[google.auth.credentials.Credentials]): The
201
+ authorization credentials to attach to requests. These
202
+ credentials identify the application to the service; if none
203
+ are specified, the client will attempt to ascertain the
204
+ credentials from the environment.
205
+ This argument is ignored if a ``channel`` instance is provided.
206
+ credentials_file (Optional[str]): A file with credentials that can
207
+ be loaded with :func:`google.auth.load_credentials_from_file`.
208
+ This argument is ignored if a ``channel`` instance is provided.
209
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
210
+ service. These are only used when credentials are not specified and
211
+ are passed to :func:`google.auth.default`.
212
+ channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
213
+ A ``Channel`` instance through which to make calls, or a Callable
214
+ that constructs and returns one. If set to None, ``self.create_channel``
215
+ is used to create the channel. If a Callable is given, it will be called
216
+ with the same arguments as used in ``self.create_channel``.
217
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
218
+ If provided, it overrides the ``host`` argument and tries to create
219
+ a mutual TLS channel with client SSL credentials from
220
+ ``client_cert_source`` or application default SSL credentials.
221
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
222
+ Deprecated. A callback to provide client SSL certificate bytes and
223
+ private key bytes, both in PEM format. It is ignored if
224
+ ``api_mtls_endpoint`` is None.
225
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
226
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
227
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
228
+ A callback to provide client certificate bytes and private key bytes,
229
+ both in PEM format. It is used to configure a mutual TLS channel. It is
230
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
231
+ quota_project_id (Optional[str]): An optional project to use for billing
232
+ and quota.
233
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
234
+ The client info used to send a user-agent string along with
235
+ API requests. If ``None``, then default info will be used.
236
+ Generally, you only need to set this if you're developing
237
+ your own client library.
238
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
239
+ be used for service account credentials.
240
+
241
+ Raises:
242
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
243
+ creation failed for any reason.
244
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
245
+ and ``credentials_file`` are passed.
246
+ """
247
+ self._grpc_channel = None
248
+ self._ssl_channel_credentials = ssl_channel_credentials
249
+ self._stubs: Dict[str, Callable] = {}
250
+ self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None
251
+
252
+ if api_mtls_endpoint:
253
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
254
+ if client_cert_source:
255
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
256
+
257
+ if isinstance(channel, aio.Channel):
258
+ # Ignore credentials if a channel was passed.
259
+ credentials = None
260
+ self._ignore_credentials = True
261
+ # If a channel was explicitly provided, set it.
262
+ self._grpc_channel = channel
263
+ self._ssl_channel_credentials = None
264
+ else:
265
+ if api_mtls_endpoint:
266
+ host = api_mtls_endpoint
267
+
268
+ # Create SSL credentials with client_cert_source or application
269
+ # default SSL credentials.
270
+ if client_cert_source:
271
+ cert, key = client_cert_source()
272
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
273
+ certificate_chain=cert, private_key=key
274
+ )
275
+ else:
276
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
277
+
278
+ else:
279
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
280
+ cert, key = client_cert_source_for_mtls()
281
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
282
+ certificate_chain=cert, private_key=key
283
+ )
284
+
285
+ # The base transport sets the host, credentials and scopes
286
+ super().__init__(
287
+ host=host,
288
+ credentials=credentials,
289
+ credentials_file=credentials_file,
290
+ scopes=scopes,
291
+ quota_project_id=quota_project_id,
292
+ client_info=client_info,
293
+ always_use_jwt_access=always_use_jwt_access,
294
+ api_audience=api_audience,
295
+ )
296
+
297
+ if not self._grpc_channel:
298
+ # initialize with the provided callable or the default channel
299
+ channel_init = channel or type(self).create_channel
300
+ self._grpc_channel = channel_init(
301
+ self._host,
302
+ # use the credentials which are saved
303
+ credentials=self._credentials,
304
+ # Set ``credentials_file`` to ``None`` here as
305
+ # the credentials that we saved earlier should be used.
306
+ credentials_file=None,
307
+ scopes=self._scopes,
308
+ ssl_credentials=self._ssl_channel_credentials,
309
+ quota_project_id=quota_project_id,
310
+ options=[
311
+ ("grpc.max_send_message_length", -1),
312
+ ("grpc.max_receive_message_length", -1),
313
+ ],
314
+ )
315
+
316
+ self._interceptor = _LoggingClientAIOInterceptor()
317
+ self._grpc_channel._unary_unary_interceptors.append(self._interceptor)
318
+ self._logged_channel = self._grpc_channel
319
+ self._wrap_with_kind = (
320
+ "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
321
+ )
322
+ # Wrap messages. This must be done after self._logged_channel exists
323
+ self._prep_wrapped_messages(client_info)
324
+
325
+ @property
326
+ def grpc_channel(self) -> aio.Channel:
327
+ """Create the channel designed to connect to this service.
328
+
329
+ This property caches on the instance; repeated calls return
330
+ the same channel.
331
+ """
332
+ # Return the channel from cache.
333
+ return self._grpc_channel
334
+
335
+ @property
336
+ def operations_client(self) -> operations_v1.OperationsAsyncClient:
337
+ """Create the client designed to process long-running operations.
338
+
339
+ This property caches on the instance; repeated calls return the same
340
+ client.
341
+ """
342
+ # Quick check: Only create a new client if we do not already have one.
343
+ if self._operations_client is None:
344
+ self._operations_client = operations_v1.OperationsAsyncClient(
345
+ self._logged_channel
346
+ )
347
+
348
+ # Return the client from cache.
349
+ return self._operations_client
350
+
351
+ @property
352
+ def create_node_group(
353
+ self,
354
+ ) -> Callable[
355
+ [node_groups.CreateNodeGroupRequest], Awaitable[operations_pb2.Operation]
356
+ ]:
357
+ r"""Return a callable for the create node group method over gRPC.
358
+
359
+ Creates a node group in a cluster. The returned
360
+ [Operation.metadata][google.longrunning.Operation.metadata] is
361
+ `NodeGroupOperationMetadata <https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata>`__.
362
+
363
+ Returns:
364
+ Callable[[~.CreateNodeGroupRequest],
365
+ Awaitable[~.Operation]]:
366
+ A function that, when called, will call the underlying RPC
367
+ on the server.
368
+ """
369
+ # Generate a "stub function" on-the-fly which will actually make
370
+ # the request.
371
+ # gRPC handles serialization and deserialization, so we just need
372
+ # to pass in the functions for each.
373
+ if "create_node_group" not in self._stubs:
374
+ self._stubs["create_node_group"] = self._logged_channel.unary_unary(
375
+ "/google.cloud.dataproc.v1.NodeGroupController/CreateNodeGroup",
376
+ request_serializer=node_groups.CreateNodeGroupRequest.serialize,
377
+ response_deserializer=operations_pb2.Operation.FromString,
378
+ )
379
+ return self._stubs["create_node_group"]
380
+
381
+ @property
382
+ def resize_node_group(
383
+ self,
384
+ ) -> Callable[
385
+ [node_groups.ResizeNodeGroupRequest], Awaitable[operations_pb2.Operation]
386
+ ]:
387
+ r"""Return a callable for the resize node group method over gRPC.
388
+
389
+ Resizes a node group in a cluster. The returned
390
+ [Operation.metadata][google.longrunning.Operation.metadata] is
391
+ `NodeGroupOperationMetadata <https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata>`__.
392
+
393
+ Returns:
394
+ Callable[[~.ResizeNodeGroupRequest],
395
+ Awaitable[~.Operation]]:
396
+ A function that, when called, will call the underlying RPC
397
+ on the server.
398
+ """
399
+ # Generate a "stub function" on-the-fly which will actually make
400
+ # the request.
401
+ # gRPC handles serialization and deserialization, so we just need
402
+ # to pass in the functions for each.
403
+ if "resize_node_group" not in self._stubs:
404
+ self._stubs["resize_node_group"] = self._logged_channel.unary_unary(
405
+ "/google.cloud.dataproc.v1.NodeGroupController/ResizeNodeGroup",
406
+ request_serializer=node_groups.ResizeNodeGroupRequest.serialize,
407
+ response_deserializer=operations_pb2.Operation.FromString,
408
+ )
409
+ return self._stubs["resize_node_group"]
410
+
411
+ @property
412
+ def get_node_group(
413
+ self,
414
+ ) -> Callable[[node_groups.GetNodeGroupRequest], Awaitable[clusters.NodeGroup]]:
415
+ r"""Return a callable for the get node group method over gRPC.
416
+
417
+ Gets the resource representation for a node group in
418
+ a cluster.
419
+
420
+ Returns:
421
+ Callable[[~.GetNodeGroupRequest],
422
+ Awaitable[~.NodeGroup]]:
423
+ A function that, when called, will call the underlying RPC
424
+ on the server.
425
+ """
426
+ # Generate a "stub function" on-the-fly which will actually make
427
+ # the request.
428
+ # gRPC handles serialization and deserialization, so we just need
429
+ # to pass in the functions for each.
430
+ if "get_node_group" not in self._stubs:
431
+ self._stubs["get_node_group"] = self._logged_channel.unary_unary(
432
+ "/google.cloud.dataproc.v1.NodeGroupController/GetNodeGroup",
433
+ request_serializer=node_groups.GetNodeGroupRequest.serialize,
434
+ response_deserializer=clusters.NodeGroup.deserialize,
435
+ )
436
+ return self._stubs["get_node_group"]
437
+
438
+ def _prep_wrapped_messages(self, client_info):
439
+ """Precompute the wrapped methods, overriding the base class method to use async wrappers."""
440
+ self._wrapped_methods = {
441
+ self.create_node_group: self._wrap_method(
442
+ self.create_node_group,
443
+ default_timeout=None,
444
+ client_info=client_info,
445
+ ),
446
+ self.resize_node_group: self._wrap_method(
447
+ self.resize_node_group,
448
+ default_timeout=None,
449
+ client_info=client_info,
450
+ ),
451
+ self.get_node_group: self._wrap_method(
452
+ self.get_node_group,
453
+ default_timeout=None,
454
+ client_info=client_info,
455
+ ),
456
+ self.get_iam_policy: self._wrap_method(
457
+ self.get_iam_policy,
458
+ default_timeout=None,
459
+ client_info=client_info,
460
+ ),
461
+ self.set_iam_policy: self._wrap_method(
462
+ self.set_iam_policy,
463
+ default_timeout=None,
464
+ client_info=client_info,
465
+ ),
466
+ self.test_iam_permissions: self._wrap_method(
467
+ self.test_iam_permissions,
468
+ default_timeout=None,
469
+ client_info=client_info,
470
+ ),
471
+ self.cancel_operation: self._wrap_method(
472
+ self.cancel_operation,
473
+ default_timeout=None,
474
+ client_info=client_info,
475
+ ),
476
+ self.delete_operation: self._wrap_method(
477
+ self.delete_operation,
478
+ default_timeout=None,
479
+ client_info=client_info,
480
+ ),
481
+ self.get_operation: self._wrap_method(
482
+ self.get_operation,
483
+ default_timeout=None,
484
+ client_info=client_info,
485
+ ),
486
+ self.list_operations: self._wrap_method(
487
+ self.list_operations,
488
+ default_timeout=None,
489
+ client_info=client_info,
490
+ ),
491
+ }
492
+
493
+ def _wrap_method(self, func, *args, **kwargs):
494
+ if self._wrap_with_kind: # pragma: NO COVER
495
+ kwargs["kind"] = self.kind
496
+ return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
497
+
498
+ def close(self):
499
+ return self._logged_channel.close()
500
+
501
+ @property
502
+ def kind(self) -> str:
503
+ return "grpc_asyncio"
504
+
505
+ @property
506
+ def delete_operation(
507
+ self,
508
+ ) -> Callable[[operations_pb2.DeleteOperationRequest], None]:
509
+ r"""Return a callable for the delete_operation method over gRPC."""
510
+ # Generate a "stub function" on-the-fly which will actually make
511
+ # the request.
512
+ # gRPC handles serialization and deserialization, so we just need
513
+ # to pass in the functions for each.
514
+ if "delete_operation" not in self._stubs:
515
+ self._stubs["delete_operation"] = self._logged_channel.unary_unary(
516
+ "/google.longrunning.Operations/DeleteOperation",
517
+ request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString,
518
+ response_deserializer=None,
519
+ )
520
+ return self._stubs["delete_operation"]
521
+
522
+ @property
523
+ def cancel_operation(
524
+ self,
525
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
526
+ r"""Return a callable for the cancel_operation method over gRPC."""
527
+ # Generate a "stub function" on-the-fly which will actually make
528
+ # the request.
529
+ # gRPC handles serialization and deserialization, so we just need
530
+ # to pass in the functions for each.
531
+ if "cancel_operation" not in self._stubs:
532
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
533
+ "/google.longrunning.Operations/CancelOperation",
534
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
535
+ response_deserializer=None,
536
+ )
537
+ return self._stubs["cancel_operation"]
538
+
539
+ @property
540
+ def get_operation(
541
+ self,
542
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
543
+ r"""Return a callable for the get_operation method over gRPC."""
544
+ # Generate a "stub function" on-the-fly which will actually make
545
+ # the request.
546
+ # gRPC handles serialization and deserialization, so we just need
547
+ # to pass in the functions for each.
548
+ if "get_operation" not in self._stubs:
549
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
550
+ "/google.longrunning.Operations/GetOperation",
551
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
552
+ response_deserializer=operations_pb2.Operation.FromString,
553
+ )
554
+ return self._stubs["get_operation"]
555
+
556
+ @property
557
+ def list_operations(
558
+ self,
559
+ ) -> Callable[
560
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
561
+ ]:
562
+ r"""Return a callable for the list_operations method over gRPC."""
563
+ # Generate a "stub function" on-the-fly which will actually make
564
+ # the request.
565
+ # gRPC handles serialization and deserialization, so we just need
566
+ # to pass in the functions for each.
567
+ if "list_operations" not in self._stubs:
568
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
569
+ "/google.longrunning.Operations/ListOperations",
570
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
571
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
572
+ )
573
+ return self._stubs["list_operations"]
574
+
575
+ @property
576
+ def set_iam_policy(
577
+ self,
578
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
579
+ r"""Return a callable for the set iam policy method over gRPC.
580
+ Sets the IAM access control policy on the specified
581
+ function. Replaces any existing policy.
582
+ Returns:
583
+ Callable[[~.SetIamPolicyRequest],
584
+ ~.Policy]:
585
+ A function that, when called, will call the underlying RPC
586
+ on the server.
587
+ """
588
+ # Generate a "stub function" on-the-fly which will actually make
589
+ # the request.
590
+ # gRPC handles serialization and deserialization, so we just need
591
+ # to pass in the functions for each.
592
+ if "set_iam_policy" not in self._stubs:
593
+ self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
594
+ "/google.iam.v1.IAMPolicy/SetIamPolicy",
595
+ request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
596
+ response_deserializer=policy_pb2.Policy.FromString,
597
+ )
598
+ return self._stubs["set_iam_policy"]
599
+
600
+ @property
601
+ def get_iam_policy(
602
+ self,
603
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
604
+ r"""Return a callable for the get iam policy method over gRPC.
605
+ Gets the IAM access control policy for a function.
606
+ Returns an empty policy if the function exists and does
607
+ not have a policy set.
608
+ Returns:
609
+ Callable[[~.GetIamPolicyRequest],
610
+ ~.Policy]:
611
+ A function that, when called, will call the underlying RPC
612
+ on the server.
613
+ """
614
+ # Generate a "stub function" on-the-fly which will actually make
615
+ # the request.
616
+ # gRPC handles serialization and deserialization, so we just need
617
+ # to pass in the functions for each.
618
+ if "get_iam_policy" not in self._stubs:
619
+ self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
620
+ "/google.iam.v1.IAMPolicy/GetIamPolicy",
621
+ request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
622
+ response_deserializer=policy_pb2.Policy.FromString,
623
+ )
624
+ return self._stubs["get_iam_policy"]
625
+
626
+ @property
627
+ def test_iam_permissions(
628
+ self,
629
+ ) -> Callable[
630
+ [iam_policy_pb2.TestIamPermissionsRequest],
631
+ iam_policy_pb2.TestIamPermissionsResponse,
632
+ ]:
633
+ r"""Return a callable for the test iam permissions method over gRPC.
634
+ Tests the specified permissions against the IAM access control
635
+ policy for a function. If the function does not exist, this will
636
+ return an empty set of permissions, not a NOT_FOUND error.
637
+ Returns:
638
+ Callable[[~.TestIamPermissionsRequest],
639
+ ~.TestIamPermissionsResponse]:
640
+ A function that, when called, will call the underlying RPC
641
+ on the server.
642
+ """
643
+ # Generate a "stub function" on-the-fly which will actually make
644
+ # the request.
645
+ # gRPC handles serialization and deserialization, so we just need
646
+ # to pass in the functions for each.
647
+ if "test_iam_permissions" not in self._stubs:
648
+ self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
649
+ "/google.iam.v1.IAMPolicy/TestIamPermissions",
650
+ request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
651
+ response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
652
+ )
653
+ return self._stubs["test_iam_permissions"]
654
+
655
+
656
+ __all__ = ("NodeGroupControllerGrpcAsyncIOTransport",)