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