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,2753 @@
|
|
|
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 dataclasses
|
|
17
|
+
import json # type: ignore
|
|
18
|
+
import logging
|
|
19
|
+
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
|
|
20
|
+
import warnings
|
|
21
|
+
|
|
22
|
+
from google.api_core import gapic_v1, operations_v1, rest_helpers, rest_streaming
|
|
23
|
+
from google.api_core import exceptions as core_exceptions
|
|
24
|
+
from google.api_core import retry as retries
|
|
25
|
+
from google.auth import credentials as ga_credentials # type: ignore
|
|
26
|
+
from google.auth.transport.requests import AuthorizedSession # type: ignore
|
|
27
|
+
from google.iam.v1 import iam_policy_pb2 # type: ignore
|
|
28
|
+
from google.iam.v1 import policy_pb2 # type: ignore
|
|
29
|
+
from google.longrunning import operations_pb2 # type: ignore
|
|
30
|
+
from google.protobuf import empty_pb2 # type: ignore
|
|
31
|
+
from google.protobuf import json_format
|
|
32
|
+
from requests import __version__ as requests_version
|
|
33
|
+
|
|
34
|
+
from google.cloud.dataproc_v1.types import jobs
|
|
35
|
+
|
|
36
|
+
from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO
|
|
37
|
+
from .rest_base import _BaseJobControllerRestTransport
|
|
38
|
+
|
|
39
|
+
try:
|
|
40
|
+
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
|
|
41
|
+
except AttributeError: # pragma: NO COVER
|
|
42
|
+
OptionalRetry = Union[retries.Retry, object, None] # type: ignore
|
|
43
|
+
|
|
44
|
+
try:
|
|
45
|
+
from google.api_core import client_logging # type: ignore
|
|
46
|
+
|
|
47
|
+
CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
|
|
48
|
+
except ImportError: # pragma: NO COVER
|
|
49
|
+
CLIENT_LOGGING_SUPPORTED = False
|
|
50
|
+
|
|
51
|
+
_LOGGER = logging.getLogger(__name__)
|
|
52
|
+
|
|
53
|
+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
|
|
54
|
+
gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version,
|
|
55
|
+
grpc_version=None,
|
|
56
|
+
rest_version=f"requests@{requests_version}",
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class JobControllerRestInterceptor:
|
|
61
|
+
"""Interceptor for JobController.
|
|
62
|
+
|
|
63
|
+
Interceptors are used to manipulate requests, request metadata, and responses
|
|
64
|
+
in arbitrary ways.
|
|
65
|
+
Example use cases include:
|
|
66
|
+
* Logging
|
|
67
|
+
* Verifying requests according to service or custom semantics
|
|
68
|
+
* Stripping extraneous information from responses
|
|
69
|
+
|
|
70
|
+
These use cases and more can be enabled by injecting an
|
|
71
|
+
instance of a custom subclass when constructing the JobControllerRestTransport.
|
|
72
|
+
|
|
73
|
+
.. code-block:: python
|
|
74
|
+
class MyCustomJobControllerInterceptor(JobControllerRestInterceptor):
|
|
75
|
+
def pre_cancel_job(self, request, metadata):
|
|
76
|
+
logging.log(f"Received request: {request}")
|
|
77
|
+
return request, metadata
|
|
78
|
+
|
|
79
|
+
def post_cancel_job(self, response):
|
|
80
|
+
logging.log(f"Received response: {response}")
|
|
81
|
+
return response
|
|
82
|
+
|
|
83
|
+
def pre_delete_job(self, request, metadata):
|
|
84
|
+
logging.log(f"Received request: {request}")
|
|
85
|
+
return request, metadata
|
|
86
|
+
|
|
87
|
+
def pre_get_job(self, request, metadata):
|
|
88
|
+
logging.log(f"Received request: {request}")
|
|
89
|
+
return request, metadata
|
|
90
|
+
|
|
91
|
+
def post_get_job(self, response):
|
|
92
|
+
logging.log(f"Received response: {response}")
|
|
93
|
+
return response
|
|
94
|
+
|
|
95
|
+
def pre_list_jobs(self, request, metadata):
|
|
96
|
+
logging.log(f"Received request: {request}")
|
|
97
|
+
return request, metadata
|
|
98
|
+
|
|
99
|
+
def post_list_jobs(self, response):
|
|
100
|
+
logging.log(f"Received response: {response}")
|
|
101
|
+
return response
|
|
102
|
+
|
|
103
|
+
def pre_submit_job(self, request, metadata):
|
|
104
|
+
logging.log(f"Received request: {request}")
|
|
105
|
+
return request, metadata
|
|
106
|
+
|
|
107
|
+
def post_submit_job(self, response):
|
|
108
|
+
logging.log(f"Received response: {response}")
|
|
109
|
+
return response
|
|
110
|
+
|
|
111
|
+
def pre_submit_job_as_operation(self, request, metadata):
|
|
112
|
+
logging.log(f"Received request: {request}")
|
|
113
|
+
return request, metadata
|
|
114
|
+
|
|
115
|
+
def post_submit_job_as_operation(self, response):
|
|
116
|
+
logging.log(f"Received response: {response}")
|
|
117
|
+
return response
|
|
118
|
+
|
|
119
|
+
def pre_update_job(self, request, metadata):
|
|
120
|
+
logging.log(f"Received request: {request}")
|
|
121
|
+
return request, metadata
|
|
122
|
+
|
|
123
|
+
def post_update_job(self, response):
|
|
124
|
+
logging.log(f"Received response: {response}")
|
|
125
|
+
return response
|
|
126
|
+
|
|
127
|
+
transport = JobControllerRestTransport(interceptor=MyCustomJobControllerInterceptor())
|
|
128
|
+
client = JobControllerClient(transport=transport)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
"""
|
|
132
|
+
|
|
133
|
+
def pre_cancel_job(
|
|
134
|
+
self,
|
|
135
|
+
request: jobs.CancelJobRequest,
|
|
136
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]],
|
|
137
|
+
) -> Tuple[jobs.CancelJobRequest, Sequence[Tuple[str, Union[str, bytes]]]]:
|
|
138
|
+
"""Pre-rpc interceptor for cancel_job
|
|
139
|
+
|
|
140
|
+
Override in a subclass to manipulate the request or metadata
|
|
141
|
+
before they are sent to the JobController server.
|
|
142
|
+
"""
|
|
143
|
+
return request, metadata
|
|
144
|
+
|
|
145
|
+
def post_cancel_job(self, response: jobs.Job) -> jobs.Job:
|
|
146
|
+
"""Post-rpc interceptor for cancel_job
|
|
147
|
+
|
|
148
|
+
DEPRECATED. Please use the `post_cancel_job_with_metadata`
|
|
149
|
+
interceptor instead.
|
|
150
|
+
|
|
151
|
+
Override in a subclass to read or manipulate the response
|
|
152
|
+
after it is returned by the JobController server but before
|
|
153
|
+
it is returned to user code. This `post_cancel_job` interceptor runs
|
|
154
|
+
before the `post_cancel_job_with_metadata` interceptor.
|
|
155
|
+
"""
|
|
156
|
+
return response
|
|
157
|
+
|
|
158
|
+
def post_cancel_job_with_metadata(
|
|
159
|
+
self, response: jobs.Job, metadata: Sequence[Tuple[str, Union[str, bytes]]]
|
|
160
|
+
) -> Tuple[jobs.Job, Sequence[Tuple[str, Union[str, bytes]]]]:
|
|
161
|
+
"""Post-rpc interceptor for cancel_job
|
|
162
|
+
|
|
163
|
+
Override in a subclass to read or manipulate the response or metadata after it
|
|
164
|
+
is returned by the JobController server but before it is returned to user code.
|
|
165
|
+
|
|
166
|
+
We recommend only using this `post_cancel_job_with_metadata`
|
|
167
|
+
interceptor in new development instead of the `post_cancel_job` interceptor.
|
|
168
|
+
When both interceptors are used, this `post_cancel_job_with_metadata` interceptor runs after the
|
|
169
|
+
`post_cancel_job` interceptor. The (possibly modified) response returned by
|
|
170
|
+
`post_cancel_job` will be passed to
|
|
171
|
+
`post_cancel_job_with_metadata`.
|
|
172
|
+
"""
|
|
173
|
+
return response, metadata
|
|
174
|
+
|
|
175
|
+
def pre_delete_job(
|
|
176
|
+
self,
|
|
177
|
+
request: jobs.DeleteJobRequest,
|
|
178
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]],
|
|
179
|
+
) -> Tuple[jobs.DeleteJobRequest, Sequence[Tuple[str, Union[str, bytes]]]]:
|
|
180
|
+
"""Pre-rpc interceptor for delete_job
|
|
181
|
+
|
|
182
|
+
Override in a subclass to manipulate the request or metadata
|
|
183
|
+
before they are sent to the JobController server.
|
|
184
|
+
"""
|
|
185
|
+
return request, metadata
|
|
186
|
+
|
|
187
|
+
def pre_get_job(
|
|
188
|
+
self,
|
|
189
|
+
request: jobs.GetJobRequest,
|
|
190
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]],
|
|
191
|
+
) -> Tuple[jobs.GetJobRequest, Sequence[Tuple[str, Union[str, bytes]]]]:
|
|
192
|
+
"""Pre-rpc interceptor for get_job
|
|
193
|
+
|
|
194
|
+
Override in a subclass to manipulate the request or metadata
|
|
195
|
+
before they are sent to the JobController server.
|
|
196
|
+
"""
|
|
197
|
+
return request, metadata
|
|
198
|
+
|
|
199
|
+
def post_get_job(self, response: jobs.Job) -> jobs.Job:
|
|
200
|
+
"""Post-rpc interceptor for get_job
|
|
201
|
+
|
|
202
|
+
DEPRECATED. Please use the `post_get_job_with_metadata`
|
|
203
|
+
interceptor instead.
|
|
204
|
+
|
|
205
|
+
Override in a subclass to read or manipulate the response
|
|
206
|
+
after it is returned by the JobController server but before
|
|
207
|
+
it is returned to user code. This `post_get_job` interceptor runs
|
|
208
|
+
before the `post_get_job_with_metadata` interceptor.
|
|
209
|
+
"""
|
|
210
|
+
return response
|
|
211
|
+
|
|
212
|
+
def post_get_job_with_metadata(
|
|
213
|
+
self, response: jobs.Job, metadata: Sequence[Tuple[str, Union[str, bytes]]]
|
|
214
|
+
) -> Tuple[jobs.Job, Sequence[Tuple[str, Union[str, bytes]]]]:
|
|
215
|
+
"""Post-rpc interceptor for get_job
|
|
216
|
+
|
|
217
|
+
Override in a subclass to read or manipulate the response or metadata after it
|
|
218
|
+
is returned by the JobController server but before it is returned to user code.
|
|
219
|
+
|
|
220
|
+
We recommend only using this `post_get_job_with_metadata`
|
|
221
|
+
interceptor in new development instead of the `post_get_job` interceptor.
|
|
222
|
+
When both interceptors are used, this `post_get_job_with_metadata` interceptor runs after the
|
|
223
|
+
`post_get_job` interceptor. The (possibly modified) response returned by
|
|
224
|
+
`post_get_job` will be passed to
|
|
225
|
+
`post_get_job_with_metadata`.
|
|
226
|
+
"""
|
|
227
|
+
return response, metadata
|
|
228
|
+
|
|
229
|
+
def pre_list_jobs(
|
|
230
|
+
self,
|
|
231
|
+
request: jobs.ListJobsRequest,
|
|
232
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]],
|
|
233
|
+
) -> Tuple[jobs.ListJobsRequest, Sequence[Tuple[str, Union[str, bytes]]]]:
|
|
234
|
+
"""Pre-rpc interceptor for list_jobs
|
|
235
|
+
|
|
236
|
+
Override in a subclass to manipulate the request or metadata
|
|
237
|
+
before they are sent to the JobController server.
|
|
238
|
+
"""
|
|
239
|
+
return request, metadata
|
|
240
|
+
|
|
241
|
+
def post_list_jobs(self, response: jobs.ListJobsResponse) -> jobs.ListJobsResponse:
|
|
242
|
+
"""Post-rpc interceptor for list_jobs
|
|
243
|
+
|
|
244
|
+
DEPRECATED. Please use the `post_list_jobs_with_metadata`
|
|
245
|
+
interceptor instead.
|
|
246
|
+
|
|
247
|
+
Override in a subclass to read or manipulate the response
|
|
248
|
+
after it is returned by the JobController server but before
|
|
249
|
+
it is returned to user code. This `post_list_jobs` interceptor runs
|
|
250
|
+
before the `post_list_jobs_with_metadata` interceptor.
|
|
251
|
+
"""
|
|
252
|
+
return response
|
|
253
|
+
|
|
254
|
+
def post_list_jobs_with_metadata(
|
|
255
|
+
self,
|
|
256
|
+
response: jobs.ListJobsResponse,
|
|
257
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]],
|
|
258
|
+
) -> Tuple[jobs.ListJobsResponse, Sequence[Tuple[str, Union[str, bytes]]]]:
|
|
259
|
+
"""Post-rpc interceptor for list_jobs
|
|
260
|
+
|
|
261
|
+
Override in a subclass to read or manipulate the response or metadata after it
|
|
262
|
+
is returned by the JobController server but before it is returned to user code.
|
|
263
|
+
|
|
264
|
+
We recommend only using this `post_list_jobs_with_metadata`
|
|
265
|
+
interceptor in new development instead of the `post_list_jobs` interceptor.
|
|
266
|
+
When both interceptors are used, this `post_list_jobs_with_metadata` interceptor runs after the
|
|
267
|
+
`post_list_jobs` interceptor. The (possibly modified) response returned by
|
|
268
|
+
`post_list_jobs` will be passed to
|
|
269
|
+
`post_list_jobs_with_metadata`.
|
|
270
|
+
"""
|
|
271
|
+
return response, metadata
|
|
272
|
+
|
|
273
|
+
def pre_submit_job(
|
|
274
|
+
self,
|
|
275
|
+
request: jobs.SubmitJobRequest,
|
|
276
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]],
|
|
277
|
+
) -> Tuple[jobs.SubmitJobRequest, Sequence[Tuple[str, Union[str, bytes]]]]:
|
|
278
|
+
"""Pre-rpc interceptor for submit_job
|
|
279
|
+
|
|
280
|
+
Override in a subclass to manipulate the request or metadata
|
|
281
|
+
before they are sent to the JobController server.
|
|
282
|
+
"""
|
|
283
|
+
return request, metadata
|
|
284
|
+
|
|
285
|
+
def post_submit_job(self, response: jobs.Job) -> jobs.Job:
|
|
286
|
+
"""Post-rpc interceptor for submit_job
|
|
287
|
+
|
|
288
|
+
DEPRECATED. Please use the `post_submit_job_with_metadata`
|
|
289
|
+
interceptor instead.
|
|
290
|
+
|
|
291
|
+
Override in a subclass to read or manipulate the response
|
|
292
|
+
after it is returned by the JobController server but before
|
|
293
|
+
it is returned to user code. This `post_submit_job` interceptor runs
|
|
294
|
+
before the `post_submit_job_with_metadata` interceptor.
|
|
295
|
+
"""
|
|
296
|
+
return response
|
|
297
|
+
|
|
298
|
+
def post_submit_job_with_metadata(
|
|
299
|
+
self, response: jobs.Job, metadata: Sequence[Tuple[str, Union[str, bytes]]]
|
|
300
|
+
) -> Tuple[jobs.Job, Sequence[Tuple[str, Union[str, bytes]]]]:
|
|
301
|
+
"""Post-rpc interceptor for submit_job
|
|
302
|
+
|
|
303
|
+
Override in a subclass to read or manipulate the response or metadata after it
|
|
304
|
+
is returned by the JobController server but before it is returned to user code.
|
|
305
|
+
|
|
306
|
+
We recommend only using this `post_submit_job_with_metadata`
|
|
307
|
+
interceptor in new development instead of the `post_submit_job` interceptor.
|
|
308
|
+
When both interceptors are used, this `post_submit_job_with_metadata` interceptor runs after the
|
|
309
|
+
`post_submit_job` interceptor. The (possibly modified) response returned by
|
|
310
|
+
`post_submit_job` will be passed to
|
|
311
|
+
`post_submit_job_with_metadata`.
|
|
312
|
+
"""
|
|
313
|
+
return response, metadata
|
|
314
|
+
|
|
315
|
+
def pre_submit_job_as_operation(
|
|
316
|
+
self,
|
|
317
|
+
request: jobs.SubmitJobRequest,
|
|
318
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]],
|
|
319
|
+
) -> Tuple[jobs.SubmitJobRequest, Sequence[Tuple[str, Union[str, bytes]]]]:
|
|
320
|
+
"""Pre-rpc interceptor for submit_job_as_operation
|
|
321
|
+
|
|
322
|
+
Override in a subclass to manipulate the request or metadata
|
|
323
|
+
before they are sent to the JobController server.
|
|
324
|
+
"""
|
|
325
|
+
return request, metadata
|
|
326
|
+
|
|
327
|
+
def post_submit_job_as_operation(
|
|
328
|
+
self, response: operations_pb2.Operation
|
|
329
|
+
) -> operations_pb2.Operation:
|
|
330
|
+
"""Post-rpc interceptor for submit_job_as_operation
|
|
331
|
+
|
|
332
|
+
DEPRECATED. Please use the `post_submit_job_as_operation_with_metadata`
|
|
333
|
+
interceptor instead.
|
|
334
|
+
|
|
335
|
+
Override in a subclass to read or manipulate the response
|
|
336
|
+
after it is returned by the JobController server but before
|
|
337
|
+
it is returned to user code. This `post_submit_job_as_operation` interceptor runs
|
|
338
|
+
before the `post_submit_job_as_operation_with_metadata` interceptor.
|
|
339
|
+
"""
|
|
340
|
+
return response
|
|
341
|
+
|
|
342
|
+
def post_submit_job_as_operation_with_metadata(
|
|
343
|
+
self,
|
|
344
|
+
response: operations_pb2.Operation,
|
|
345
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]],
|
|
346
|
+
) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
|
|
347
|
+
"""Post-rpc interceptor for submit_job_as_operation
|
|
348
|
+
|
|
349
|
+
Override in a subclass to read or manipulate the response or metadata after it
|
|
350
|
+
is returned by the JobController server but before it is returned to user code.
|
|
351
|
+
|
|
352
|
+
We recommend only using this `post_submit_job_as_operation_with_metadata`
|
|
353
|
+
interceptor in new development instead of the `post_submit_job_as_operation` interceptor.
|
|
354
|
+
When both interceptors are used, this `post_submit_job_as_operation_with_metadata` interceptor runs after the
|
|
355
|
+
`post_submit_job_as_operation` interceptor. The (possibly modified) response returned by
|
|
356
|
+
`post_submit_job_as_operation` will be passed to
|
|
357
|
+
`post_submit_job_as_operation_with_metadata`.
|
|
358
|
+
"""
|
|
359
|
+
return response, metadata
|
|
360
|
+
|
|
361
|
+
def pre_update_job(
|
|
362
|
+
self,
|
|
363
|
+
request: jobs.UpdateJobRequest,
|
|
364
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]],
|
|
365
|
+
) -> Tuple[jobs.UpdateJobRequest, Sequence[Tuple[str, Union[str, bytes]]]]:
|
|
366
|
+
"""Pre-rpc interceptor for update_job
|
|
367
|
+
|
|
368
|
+
Override in a subclass to manipulate the request or metadata
|
|
369
|
+
before they are sent to the JobController server.
|
|
370
|
+
"""
|
|
371
|
+
return request, metadata
|
|
372
|
+
|
|
373
|
+
def post_update_job(self, response: jobs.Job) -> jobs.Job:
|
|
374
|
+
"""Post-rpc interceptor for update_job
|
|
375
|
+
|
|
376
|
+
DEPRECATED. Please use the `post_update_job_with_metadata`
|
|
377
|
+
interceptor instead.
|
|
378
|
+
|
|
379
|
+
Override in a subclass to read or manipulate the response
|
|
380
|
+
after it is returned by the JobController server but before
|
|
381
|
+
it is returned to user code. This `post_update_job` interceptor runs
|
|
382
|
+
before the `post_update_job_with_metadata` interceptor.
|
|
383
|
+
"""
|
|
384
|
+
return response
|
|
385
|
+
|
|
386
|
+
def post_update_job_with_metadata(
|
|
387
|
+
self, response: jobs.Job, metadata: Sequence[Tuple[str, Union[str, bytes]]]
|
|
388
|
+
) -> Tuple[jobs.Job, Sequence[Tuple[str, Union[str, bytes]]]]:
|
|
389
|
+
"""Post-rpc interceptor for update_job
|
|
390
|
+
|
|
391
|
+
Override in a subclass to read or manipulate the response or metadata after it
|
|
392
|
+
is returned by the JobController server but before it is returned to user code.
|
|
393
|
+
|
|
394
|
+
We recommend only using this `post_update_job_with_metadata`
|
|
395
|
+
interceptor in new development instead of the `post_update_job` interceptor.
|
|
396
|
+
When both interceptors are used, this `post_update_job_with_metadata` interceptor runs after the
|
|
397
|
+
`post_update_job` interceptor. The (possibly modified) response returned by
|
|
398
|
+
`post_update_job` will be passed to
|
|
399
|
+
`post_update_job_with_metadata`.
|
|
400
|
+
"""
|
|
401
|
+
return response, metadata
|
|
402
|
+
|
|
403
|
+
def pre_get_iam_policy(
|
|
404
|
+
self,
|
|
405
|
+
request: iam_policy_pb2.GetIamPolicyRequest,
|
|
406
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]],
|
|
407
|
+
) -> Tuple[
|
|
408
|
+
iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]
|
|
409
|
+
]:
|
|
410
|
+
"""Pre-rpc interceptor for get_iam_policy
|
|
411
|
+
|
|
412
|
+
Override in a subclass to manipulate the request or metadata
|
|
413
|
+
before they are sent to the JobController server.
|
|
414
|
+
"""
|
|
415
|
+
return request, metadata
|
|
416
|
+
|
|
417
|
+
def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy:
|
|
418
|
+
"""Post-rpc interceptor for get_iam_policy
|
|
419
|
+
|
|
420
|
+
Override in a subclass to manipulate the response
|
|
421
|
+
after it is returned by the JobController server but before
|
|
422
|
+
it is returned to user code.
|
|
423
|
+
"""
|
|
424
|
+
return response
|
|
425
|
+
|
|
426
|
+
def pre_set_iam_policy(
|
|
427
|
+
self,
|
|
428
|
+
request: iam_policy_pb2.SetIamPolicyRequest,
|
|
429
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]],
|
|
430
|
+
) -> Tuple[
|
|
431
|
+
iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]
|
|
432
|
+
]:
|
|
433
|
+
"""Pre-rpc interceptor for set_iam_policy
|
|
434
|
+
|
|
435
|
+
Override in a subclass to manipulate the request or metadata
|
|
436
|
+
before they are sent to the JobController server.
|
|
437
|
+
"""
|
|
438
|
+
return request, metadata
|
|
439
|
+
|
|
440
|
+
def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy:
|
|
441
|
+
"""Post-rpc interceptor for set_iam_policy
|
|
442
|
+
|
|
443
|
+
Override in a subclass to manipulate the response
|
|
444
|
+
after it is returned by the JobController server but before
|
|
445
|
+
it is returned to user code.
|
|
446
|
+
"""
|
|
447
|
+
return response
|
|
448
|
+
|
|
449
|
+
def pre_test_iam_permissions(
|
|
450
|
+
self,
|
|
451
|
+
request: iam_policy_pb2.TestIamPermissionsRequest,
|
|
452
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]],
|
|
453
|
+
) -> Tuple[
|
|
454
|
+
iam_policy_pb2.TestIamPermissionsRequest,
|
|
455
|
+
Sequence[Tuple[str, Union[str, bytes]]],
|
|
456
|
+
]:
|
|
457
|
+
"""Pre-rpc interceptor for test_iam_permissions
|
|
458
|
+
|
|
459
|
+
Override in a subclass to manipulate the request or metadata
|
|
460
|
+
before they are sent to the JobController server.
|
|
461
|
+
"""
|
|
462
|
+
return request, metadata
|
|
463
|
+
|
|
464
|
+
def post_test_iam_permissions(
|
|
465
|
+
self, response: iam_policy_pb2.TestIamPermissionsResponse
|
|
466
|
+
) -> iam_policy_pb2.TestIamPermissionsResponse:
|
|
467
|
+
"""Post-rpc interceptor for test_iam_permissions
|
|
468
|
+
|
|
469
|
+
Override in a subclass to manipulate the response
|
|
470
|
+
after it is returned by the JobController server but before
|
|
471
|
+
it is returned to user code.
|
|
472
|
+
"""
|
|
473
|
+
return response
|
|
474
|
+
|
|
475
|
+
def pre_cancel_operation(
|
|
476
|
+
self,
|
|
477
|
+
request: operations_pb2.CancelOperationRequest,
|
|
478
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]],
|
|
479
|
+
) -> Tuple[
|
|
480
|
+
operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
|
|
481
|
+
]:
|
|
482
|
+
"""Pre-rpc interceptor for cancel_operation
|
|
483
|
+
|
|
484
|
+
Override in a subclass to manipulate the request or metadata
|
|
485
|
+
before they are sent to the JobController server.
|
|
486
|
+
"""
|
|
487
|
+
return request, metadata
|
|
488
|
+
|
|
489
|
+
def post_cancel_operation(self, response: None) -> None:
|
|
490
|
+
"""Post-rpc interceptor for cancel_operation
|
|
491
|
+
|
|
492
|
+
Override in a subclass to manipulate the response
|
|
493
|
+
after it is returned by the JobController server but before
|
|
494
|
+
it is returned to user code.
|
|
495
|
+
"""
|
|
496
|
+
return response
|
|
497
|
+
|
|
498
|
+
def pre_delete_operation(
|
|
499
|
+
self,
|
|
500
|
+
request: operations_pb2.DeleteOperationRequest,
|
|
501
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]],
|
|
502
|
+
) -> Tuple[
|
|
503
|
+
operations_pb2.DeleteOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
|
|
504
|
+
]:
|
|
505
|
+
"""Pre-rpc interceptor for delete_operation
|
|
506
|
+
|
|
507
|
+
Override in a subclass to manipulate the request or metadata
|
|
508
|
+
before they are sent to the JobController server.
|
|
509
|
+
"""
|
|
510
|
+
return request, metadata
|
|
511
|
+
|
|
512
|
+
def post_delete_operation(self, response: None) -> None:
|
|
513
|
+
"""Post-rpc interceptor for delete_operation
|
|
514
|
+
|
|
515
|
+
Override in a subclass to manipulate the response
|
|
516
|
+
after it is returned by the JobController server but before
|
|
517
|
+
it is returned to user code.
|
|
518
|
+
"""
|
|
519
|
+
return response
|
|
520
|
+
|
|
521
|
+
def pre_get_operation(
|
|
522
|
+
self,
|
|
523
|
+
request: operations_pb2.GetOperationRequest,
|
|
524
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]],
|
|
525
|
+
) -> Tuple[
|
|
526
|
+
operations_pb2.GetOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
|
|
527
|
+
]:
|
|
528
|
+
"""Pre-rpc interceptor for get_operation
|
|
529
|
+
|
|
530
|
+
Override in a subclass to manipulate the request or metadata
|
|
531
|
+
before they are sent to the JobController server.
|
|
532
|
+
"""
|
|
533
|
+
return request, metadata
|
|
534
|
+
|
|
535
|
+
def post_get_operation(
|
|
536
|
+
self, response: operations_pb2.Operation
|
|
537
|
+
) -> operations_pb2.Operation:
|
|
538
|
+
"""Post-rpc interceptor for get_operation
|
|
539
|
+
|
|
540
|
+
Override in a subclass to manipulate the response
|
|
541
|
+
after it is returned by the JobController server but before
|
|
542
|
+
it is returned to user code.
|
|
543
|
+
"""
|
|
544
|
+
return response
|
|
545
|
+
|
|
546
|
+
def pre_list_operations(
|
|
547
|
+
self,
|
|
548
|
+
request: operations_pb2.ListOperationsRequest,
|
|
549
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]],
|
|
550
|
+
) -> Tuple[
|
|
551
|
+
operations_pb2.ListOperationsRequest, Sequence[Tuple[str, Union[str, bytes]]]
|
|
552
|
+
]:
|
|
553
|
+
"""Pre-rpc interceptor for list_operations
|
|
554
|
+
|
|
555
|
+
Override in a subclass to manipulate the request or metadata
|
|
556
|
+
before they are sent to the JobController server.
|
|
557
|
+
"""
|
|
558
|
+
return request, metadata
|
|
559
|
+
|
|
560
|
+
def post_list_operations(
|
|
561
|
+
self, response: operations_pb2.ListOperationsResponse
|
|
562
|
+
) -> operations_pb2.ListOperationsResponse:
|
|
563
|
+
"""Post-rpc interceptor for list_operations
|
|
564
|
+
|
|
565
|
+
Override in a subclass to manipulate the response
|
|
566
|
+
after it is returned by the JobController server but before
|
|
567
|
+
it is returned to user code.
|
|
568
|
+
"""
|
|
569
|
+
return response
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
@dataclasses.dataclass
|
|
573
|
+
class JobControllerRestStub:
|
|
574
|
+
_session: AuthorizedSession
|
|
575
|
+
_host: str
|
|
576
|
+
_interceptor: JobControllerRestInterceptor
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
class JobControllerRestTransport(_BaseJobControllerRestTransport):
|
|
580
|
+
"""REST backend synchronous transport for JobController.
|
|
581
|
+
|
|
582
|
+
The JobController provides methods to manage jobs.
|
|
583
|
+
|
|
584
|
+
This class defines the same methods as the primary client, so the
|
|
585
|
+
primary client can load the underlying transport implementation
|
|
586
|
+
and call it.
|
|
587
|
+
|
|
588
|
+
It sends JSON representations of protocol buffers over HTTP/1.1
|
|
589
|
+
"""
|
|
590
|
+
|
|
591
|
+
def __init__(
|
|
592
|
+
self,
|
|
593
|
+
*,
|
|
594
|
+
host: str = "dataproc.googleapis.com",
|
|
595
|
+
credentials: Optional[ga_credentials.Credentials] = None,
|
|
596
|
+
credentials_file: Optional[str] = None,
|
|
597
|
+
scopes: Optional[Sequence[str]] = None,
|
|
598
|
+
client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
|
|
599
|
+
quota_project_id: Optional[str] = None,
|
|
600
|
+
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
|
|
601
|
+
always_use_jwt_access: Optional[bool] = False,
|
|
602
|
+
url_scheme: str = "https",
|
|
603
|
+
interceptor: Optional[JobControllerRestInterceptor] = None,
|
|
604
|
+
api_audience: Optional[str] = None,
|
|
605
|
+
) -> None:
|
|
606
|
+
"""Instantiate the transport.
|
|
607
|
+
|
|
608
|
+
Args:
|
|
609
|
+
host (Optional[str]):
|
|
610
|
+
The hostname to connect to (default: 'dataproc.googleapis.com').
|
|
611
|
+
credentials (Optional[google.auth.credentials.Credentials]): The
|
|
612
|
+
authorization credentials to attach to requests. These
|
|
613
|
+
credentials identify the application to the service; if none
|
|
614
|
+
are specified, the client will attempt to ascertain the
|
|
615
|
+
credentials from the environment.
|
|
616
|
+
|
|
617
|
+
credentials_file (Optional[str]): A file with credentials that can
|
|
618
|
+
be loaded with :func:`google.auth.load_credentials_from_file`.
|
|
619
|
+
This argument is ignored if ``channel`` is provided.
|
|
620
|
+
scopes (Optional(Sequence[str])): A list of scopes. This argument is
|
|
621
|
+
ignored if ``channel`` is provided.
|
|
622
|
+
client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client
|
|
623
|
+
certificate to configure mutual TLS HTTP channel. It is ignored
|
|
624
|
+
if ``channel`` is provided.
|
|
625
|
+
quota_project_id (Optional[str]): An optional project to use for billing
|
|
626
|
+
and quota.
|
|
627
|
+
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
|
|
628
|
+
The client info used to send a user-agent string along with
|
|
629
|
+
API requests. If ``None``, then default info will be used.
|
|
630
|
+
Generally, you only need to set this if you are developing
|
|
631
|
+
your own client library.
|
|
632
|
+
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
|
|
633
|
+
be used for service account credentials.
|
|
634
|
+
url_scheme: the protocol scheme for the API endpoint. Normally
|
|
635
|
+
"https", but for testing or local servers,
|
|
636
|
+
"http" can be specified.
|
|
637
|
+
"""
|
|
638
|
+
# Run the base constructor
|
|
639
|
+
# TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc.
|
|
640
|
+
# TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the
|
|
641
|
+
# credentials object
|
|
642
|
+
super().__init__(
|
|
643
|
+
host=host,
|
|
644
|
+
credentials=credentials,
|
|
645
|
+
client_info=client_info,
|
|
646
|
+
always_use_jwt_access=always_use_jwt_access,
|
|
647
|
+
url_scheme=url_scheme,
|
|
648
|
+
api_audience=api_audience,
|
|
649
|
+
)
|
|
650
|
+
self._session = AuthorizedSession(
|
|
651
|
+
self._credentials, default_host=self.DEFAULT_HOST
|
|
652
|
+
)
|
|
653
|
+
self._operations_client: Optional[operations_v1.AbstractOperationsClient] = None
|
|
654
|
+
if client_cert_source_for_mtls:
|
|
655
|
+
self._session.configure_mtls_channel(client_cert_source_for_mtls)
|
|
656
|
+
self._interceptor = interceptor or JobControllerRestInterceptor()
|
|
657
|
+
self._prep_wrapped_messages(client_info)
|
|
658
|
+
|
|
659
|
+
@property
|
|
660
|
+
def operations_client(self) -> operations_v1.AbstractOperationsClient:
|
|
661
|
+
"""Create the client designed to process long-running operations.
|
|
662
|
+
|
|
663
|
+
This property caches on the instance; repeated calls return the same
|
|
664
|
+
client.
|
|
665
|
+
"""
|
|
666
|
+
# Only create a new client if we do not already have one.
|
|
667
|
+
if self._operations_client is None:
|
|
668
|
+
http_options: Dict[str, List[Dict[str, str]]] = {
|
|
669
|
+
"google.longrunning.Operations.CancelOperation": [
|
|
670
|
+
{
|
|
671
|
+
"method": "post",
|
|
672
|
+
"uri": "/v1/{name=projects/*/regions/*/operations/*}:cancel",
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
"method": "post",
|
|
676
|
+
"uri": "/v1/{name=projects/*/locations/*/operations/*}:cancel",
|
|
677
|
+
},
|
|
678
|
+
],
|
|
679
|
+
"google.longrunning.Operations.DeleteOperation": [
|
|
680
|
+
{
|
|
681
|
+
"method": "delete",
|
|
682
|
+
"uri": "/v1/{name=projects/*/regions/*/operations/*}",
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
"method": "delete",
|
|
686
|
+
"uri": "/v1/{name=projects/*/locations/*/operations/*}",
|
|
687
|
+
},
|
|
688
|
+
],
|
|
689
|
+
"google.longrunning.Operations.GetOperation": [
|
|
690
|
+
{
|
|
691
|
+
"method": "get",
|
|
692
|
+
"uri": "/v1/{name=projects/*/regions/*/operations/*}",
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
"method": "get",
|
|
696
|
+
"uri": "/v1/{name=projects/*/locations/*/operations/*}",
|
|
697
|
+
},
|
|
698
|
+
],
|
|
699
|
+
"google.longrunning.Operations.ListOperations": [
|
|
700
|
+
{
|
|
701
|
+
"method": "get",
|
|
702
|
+
"uri": "/v1/{name=projects/*/regions/*/operations}",
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
"method": "get",
|
|
706
|
+
"uri": "/v1/{name=projects/*/locations/*/operations}",
|
|
707
|
+
},
|
|
708
|
+
],
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
rest_transport = operations_v1.OperationsRestTransport(
|
|
712
|
+
host=self._host,
|
|
713
|
+
# use the credentials which are saved
|
|
714
|
+
credentials=self._credentials,
|
|
715
|
+
scopes=self._scopes,
|
|
716
|
+
http_options=http_options,
|
|
717
|
+
path_prefix="v1",
|
|
718
|
+
)
|
|
719
|
+
|
|
720
|
+
self._operations_client = operations_v1.AbstractOperationsClient(
|
|
721
|
+
transport=rest_transport
|
|
722
|
+
)
|
|
723
|
+
|
|
724
|
+
# Return the client from cache.
|
|
725
|
+
return self._operations_client
|
|
726
|
+
|
|
727
|
+
class _CancelJob(
|
|
728
|
+
_BaseJobControllerRestTransport._BaseCancelJob, JobControllerRestStub
|
|
729
|
+
):
|
|
730
|
+
def __hash__(self):
|
|
731
|
+
return hash("JobControllerRestTransport.CancelJob")
|
|
732
|
+
|
|
733
|
+
@staticmethod
|
|
734
|
+
def _get_response(
|
|
735
|
+
host,
|
|
736
|
+
metadata,
|
|
737
|
+
query_params,
|
|
738
|
+
session,
|
|
739
|
+
timeout,
|
|
740
|
+
transcoded_request,
|
|
741
|
+
body=None,
|
|
742
|
+
):
|
|
743
|
+
uri = transcoded_request["uri"]
|
|
744
|
+
method = transcoded_request["method"]
|
|
745
|
+
headers = dict(metadata)
|
|
746
|
+
headers["Content-Type"] = "application/json"
|
|
747
|
+
response = getattr(session, method)(
|
|
748
|
+
"{host}{uri}".format(host=host, uri=uri),
|
|
749
|
+
timeout=timeout,
|
|
750
|
+
headers=headers,
|
|
751
|
+
params=rest_helpers.flatten_query_params(query_params, strict=True),
|
|
752
|
+
data=body,
|
|
753
|
+
)
|
|
754
|
+
return response
|
|
755
|
+
|
|
756
|
+
def __call__(
|
|
757
|
+
self,
|
|
758
|
+
request: jobs.CancelJobRequest,
|
|
759
|
+
*,
|
|
760
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
761
|
+
timeout: Optional[float] = None,
|
|
762
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
763
|
+
) -> jobs.Job:
|
|
764
|
+
r"""Call the cancel job method over HTTP.
|
|
765
|
+
|
|
766
|
+
Args:
|
|
767
|
+
request (~.jobs.CancelJobRequest):
|
|
768
|
+
The request object. A request to cancel a job.
|
|
769
|
+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
|
|
770
|
+
should be retried.
|
|
771
|
+
timeout (float): The timeout for this request.
|
|
772
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
773
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
774
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
775
|
+
be of type `bytes`.
|
|
776
|
+
|
|
777
|
+
Returns:
|
|
778
|
+
~.jobs.Job:
|
|
779
|
+
A Dataproc job resource.
|
|
780
|
+
"""
|
|
781
|
+
|
|
782
|
+
http_options = (
|
|
783
|
+
_BaseJobControllerRestTransport._BaseCancelJob._get_http_options()
|
|
784
|
+
)
|
|
785
|
+
|
|
786
|
+
request, metadata = self._interceptor.pre_cancel_job(request, metadata)
|
|
787
|
+
transcoded_request = (
|
|
788
|
+
_BaseJobControllerRestTransport._BaseCancelJob._get_transcoded_request(
|
|
789
|
+
http_options, request
|
|
790
|
+
)
|
|
791
|
+
)
|
|
792
|
+
|
|
793
|
+
body = (
|
|
794
|
+
_BaseJobControllerRestTransport._BaseCancelJob._get_request_body_json(
|
|
795
|
+
transcoded_request
|
|
796
|
+
)
|
|
797
|
+
)
|
|
798
|
+
|
|
799
|
+
# Jsonify the query params
|
|
800
|
+
query_params = (
|
|
801
|
+
_BaseJobControllerRestTransport._BaseCancelJob._get_query_params_json(
|
|
802
|
+
transcoded_request
|
|
803
|
+
)
|
|
804
|
+
)
|
|
805
|
+
|
|
806
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
807
|
+
logging.DEBUG
|
|
808
|
+
): # pragma: NO COVER
|
|
809
|
+
request_url = "{host}{uri}".format(
|
|
810
|
+
host=self._host, uri=transcoded_request["uri"]
|
|
811
|
+
)
|
|
812
|
+
method = transcoded_request["method"]
|
|
813
|
+
try:
|
|
814
|
+
request_payload = type(request).to_json(request)
|
|
815
|
+
except:
|
|
816
|
+
request_payload = None
|
|
817
|
+
http_request = {
|
|
818
|
+
"payload": request_payload,
|
|
819
|
+
"requestMethod": method,
|
|
820
|
+
"requestUrl": request_url,
|
|
821
|
+
"headers": dict(metadata),
|
|
822
|
+
}
|
|
823
|
+
_LOGGER.debug(
|
|
824
|
+
f"Sending request for google.cloud.dataproc_v1.JobControllerClient.CancelJob",
|
|
825
|
+
extra={
|
|
826
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
827
|
+
"rpcName": "CancelJob",
|
|
828
|
+
"httpRequest": http_request,
|
|
829
|
+
"metadata": http_request["headers"],
|
|
830
|
+
},
|
|
831
|
+
)
|
|
832
|
+
|
|
833
|
+
# Send the request
|
|
834
|
+
response = JobControllerRestTransport._CancelJob._get_response(
|
|
835
|
+
self._host,
|
|
836
|
+
metadata,
|
|
837
|
+
query_params,
|
|
838
|
+
self._session,
|
|
839
|
+
timeout,
|
|
840
|
+
transcoded_request,
|
|
841
|
+
body,
|
|
842
|
+
)
|
|
843
|
+
|
|
844
|
+
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
|
|
845
|
+
# subclass.
|
|
846
|
+
if response.status_code >= 400:
|
|
847
|
+
raise core_exceptions.from_http_response(response)
|
|
848
|
+
|
|
849
|
+
# Return the response
|
|
850
|
+
resp = jobs.Job()
|
|
851
|
+
pb_resp = jobs.Job.pb(resp)
|
|
852
|
+
|
|
853
|
+
json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
|
|
854
|
+
|
|
855
|
+
resp = self._interceptor.post_cancel_job(resp)
|
|
856
|
+
response_metadata = [(k, str(v)) for k, v in response.headers.items()]
|
|
857
|
+
resp, _ = self._interceptor.post_cancel_job_with_metadata(
|
|
858
|
+
resp, response_metadata
|
|
859
|
+
)
|
|
860
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
861
|
+
logging.DEBUG
|
|
862
|
+
): # pragma: NO COVER
|
|
863
|
+
try:
|
|
864
|
+
response_payload = jobs.Job.to_json(response)
|
|
865
|
+
except:
|
|
866
|
+
response_payload = None
|
|
867
|
+
http_response = {
|
|
868
|
+
"payload": response_payload,
|
|
869
|
+
"headers": dict(response.headers),
|
|
870
|
+
"status": response.status_code,
|
|
871
|
+
}
|
|
872
|
+
_LOGGER.debug(
|
|
873
|
+
"Received response for google.cloud.dataproc_v1.JobControllerClient.cancel_job",
|
|
874
|
+
extra={
|
|
875
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
876
|
+
"rpcName": "CancelJob",
|
|
877
|
+
"metadata": http_response["headers"],
|
|
878
|
+
"httpResponse": http_response,
|
|
879
|
+
},
|
|
880
|
+
)
|
|
881
|
+
return resp
|
|
882
|
+
|
|
883
|
+
class _DeleteJob(
|
|
884
|
+
_BaseJobControllerRestTransport._BaseDeleteJob, JobControllerRestStub
|
|
885
|
+
):
|
|
886
|
+
def __hash__(self):
|
|
887
|
+
return hash("JobControllerRestTransport.DeleteJob")
|
|
888
|
+
|
|
889
|
+
@staticmethod
|
|
890
|
+
def _get_response(
|
|
891
|
+
host,
|
|
892
|
+
metadata,
|
|
893
|
+
query_params,
|
|
894
|
+
session,
|
|
895
|
+
timeout,
|
|
896
|
+
transcoded_request,
|
|
897
|
+
body=None,
|
|
898
|
+
):
|
|
899
|
+
uri = transcoded_request["uri"]
|
|
900
|
+
method = transcoded_request["method"]
|
|
901
|
+
headers = dict(metadata)
|
|
902
|
+
headers["Content-Type"] = "application/json"
|
|
903
|
+
response = getattr(session, method)(
|
|
904
|
+
"{host}{uri}".format(host=host, uri=uri),
|
|
905
|
+
timeout=timeout,
|
|
906
|
+
headers=headers,
|
|
907
|
+
params=rest_helpers.flatten_query_params(query_params, strict=True),
|
|
908
|
+
)
|
|
909
|
+
return response
|
|
910
|
+
|
|
911
|
+
def __call__(
|
|
912
|
+
self,
|
|
913
|
+
request: jobs.DeleteJobRequest,
|
|
914
|
+
*,
|
|
915
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
916
|
+
timeout: Optional[float] = None,
|
|
917
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
918
|
+
):
|
|
919
|
+
r"""Call the delete job method over HTTP.
|
|
920
|
+
|
|
921
|
+
Args:
|
|
922
|
+
request (~.jobs.DeleteJobRequest):
|
|
923
|
+
The request object. A request to delete a job.
|
|
924
|
+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
|
|
925
|
+
should be retried.
|
|
926
|
+
timeout (float): The timeout for this request.
|
|
927
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
928
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
929
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
930
|
+
be of type `bytes`.
|
|
931
|
+
"""
|
|
932
|
+
|
|
933
|
+
http_options = (
|
|
934
|
+
_BaseJobControllerRestTransport._BaseDeleteJob._get_http_options()
|
|
935
|
+
)
|
|
936
|
+
|
|
937
|
+
request, metadata = self._interceptor.pre_delete_job(request, metadata)
|
|
938
|
+
transcoded_request = (
|
|
939
|
+
_BaseJobControllerRestTransport._BaseDeleteJob._get_transcoded_request(
|
|
940
|
+
http_options, request
|
|
941
|
+
)
|
|
942
|
+
)
|
|
943
|
+
|
|
944
|
+
# Jsonify the query params
|
|
945
|
+
query_params = (
|
|
946
|
+
_BaseJobControllerRestTransport._BaseDeleteJob._get_query_params_json(
|
|
947
|
+
transcoded_request
|
|
948
|
+
)
|
|
949
|
+
)
|
|
950
|
+
|
|
951
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
952
|
+
logging.DEBUG
|
|
953
|
+
): # pragma: NO COVER
|
|
954
|
+
request_url = "{host}{uri}".format(
|
|
955
|
+
host=self._host, uri=transcoded_request["uri"]
|
|
956
|
+
)
|
|
957
|
+
method = transcoded_request["method"]
|
|
958
|
+
try:
|
|
959
|
+
request_payload = json_format.MessageToJson(request)
|
|
960
|
+
except:
|
|
961
|
+
request_payload = None
|
|
962
|
+
http_request = {
|
|
963
|
+
"payload": request_payload,
|
|
964
|
+
"requestMethod": method,
|
|
965
|
+
"requestUrl": request_url,
|
|
966
|
+
"headers": dict(metadata),
|
|
967
|
+
}
|
|
968
|
+
_LOGGER.debug(
|
|
969
|
+
f"Sending request for google.cloud.dataproc_v1.JobControllerClient.DeleteJob",
|
|
970
|
+
extra={
|
|
971
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
972
|
+
"rpcName": "DeleteJob",
|
|
973
|
+
"httpRequest": http_request,
|
|
974
|
+
"metadata": http_request["headers"],
|
|
975
|
+
},
|
|
976
|
+
)
|
|
977
|
+
|
|
978
|
+
# Send the request
|
|
979
|
+
response = JobControllerRestTransport._DeleteJob._get_response(
|
|
980
|
+
self._host,
|
|
981
|
+
metadata,
|
|
982
|
+
query_params,
|
|
983
|
+
self._session,
|
|
984
|
+
timeout,
|
|
985
|
+
transcoded_request,
|
|
986
|
+
)
|
|
987
|
+
|
|
988
|
+
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
|
|
989
|
+
# subclass.
|
|
990
|
+
if response.status_code >= 400:
|
|
991
|
+
raise core_exceptions.from_http_response(response)
|
|
992
|
+
|
|
993
|
+
class _GetJob(_BaseJobControllerRestTransport._BaseGetJob, JobControllerRestStub):
|
|
994
|
+
def __hash__(self):
|
|
995
|
+
return hash("JobControllerRestTransport.GetJob")
|
|
996
|
+
|
|
997
|
+
@staticmethod
|
|
998
|
+
def _get_response(
|
|
999
|
+
host,
|
|
1000
|
+
metadata,
|
|
1001
|
+
query_params,
|
|
1002
|
+
session,
|
|
1003
|
+
timeout,
|
|
1004
|
+
transcoded_request,
|
|
1005
|
+
body=None,
|
|
1006
|
+
):
|
|
1007
|
+
uri = transcoded_request["uri"]
|
|
1008
|
+
method = transcoded_request["method"]
|
|
1009
|
+
headers = dict(metadata)
|
|
1010
|
+
headers["Content-Type"] = "application/json"
|
|
1011
|
+
response = getattr(session, method)(
|
|
1012
|
+
"{host}{uri}".format(host=host, uri=uri),
|
|
1013
|
+
timeout=timeout,
|
|
1014
|
+
headers=headers,
|
|
1015
|
+
params=rest_helpers.flatten_query_params(query_params, strict=True),
|
|
1016
|
+
)
|
|
1017
|
+
return response
|
|
1018
|
+
|
|
1019
|
+
def __call__(
|
|
1020
|
+
self,
|
|
1021
|
+
request: jobs.GetJobRequest,
|
|
1022
|
+
*,
|
|
1023
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1024
|
+
timeout: Optional[float] = None,
|
|
1025
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1026
|
+
) -> jobs.Job:
|
|
1027
|
+
r"""Call the get job method over HTTP.
|
|
1028
|
+
|
|
1029
|
+
Args:
|
|
1030
|
+
request (~.jobs.GetJobRequest):
|
|
1031
|
+
The request object. A request to get the resource
|
|
1032
|
+
representation for a job in a project.
|
|
1033
|
+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
|
|
1034
|
+
should be retried.
|
|
1035
|
+
timeout (float): The timeout for this request.
|
|
1036
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1037
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1038
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1039
|
+
be of type `bytes`.
|
|
1040
|
+
|
|
1041
|
+
Returns:
|
|
1042
|
+
~.jobs.Job:
|
|
1043
|
+
A Dataproc job resource.
|
|
1044
|
+
"""
|
|
1045
|
+
|
|
1046
|
+
http_options = (
|
|
1047
|
+
_BaseJobControllerRestTransport._BaseGetJob._get_http_options()
|
|
1048
|
+
)
|
|
1049
|
+
|
|
1050
|
+
request, metadata = self._interceptor.pre_get_job(request, metadata)
|
|
1051
|
+
transcoded_request = (
|
|
1052
|
+
_BaseJobControllerRestTransport._BaseGetJob._get_transcoded_request(
|
|
1053
|
+
http_options, request
|
|
1054
|
+
)
|
|
1055
|
+
)
|
|
1056
|
+
|
|
1057
|
+
# Jsonify the query params
|
|
1058
|
+
query_params = (
|
|
1059
|
+
_BaseJobControllerRestTransport._BaseGetJob._get_query_params_json(
|
|
1060
|
+
transcoded_request
|
|
1061
|
+
)
|
|
1062
|
+
)
|
|
1063
|
+
|
|
1064
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
1065
|
+
logging.DEBUG
|
|
1066
|
+
): # pragma: NO COVER
|
|
1067
|
+
request_url = "{host}{uri}".format(
|
|
1068
|
+
host=self._host, uri=transcoded_request["uri"]
|
|
1069
|
+
)
|
|
1070
|
+
method = transcoded_request["method"]
|
|
1071
|
+
try:
|
|
1072
|
+
request_payload = type(request).to_json(request)
|
|
1073
|
+
except:
|
|
1074
|
+
request_payload = None
|
|
1075
|
+
http_request = {
|
|
1076
|
+
"payload": request_payload,
|
|
1077
|
+
"requestMethod": method,
|
|
1078
|
+
"requestUrl": request_url,
|
|
1079
|
+
"headers": dict(metadata),
|
|
1080
|
+
}
|
|
1081
|
+
_LOGGER.debug(
|
|
1082
|
+
f"Sending request for google.cloud.dataproc_v1.JobControllerClient.GetJob",
|
|
1083
|
+
extra={
|
|
1084
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
1085
|
+
"rpcName": "GetJob",
|
|
1086
|
+
"httpRequest": http_request,
|
|
1087
|
+
"metadata": http_request["headers"],
|
|
1088
|
+
},
|
|
1089
|
+
)
|
|
1090
|
+
|
|
1091
|
+
# Send the request
|
|
1092
|
+
response = JobControllerRestTransport._GetJob._get_response(
|
|
1093
|
+
self._host,
|
|
1094
|
+
metadata,
|
|
1095
|
+
query_params,
|
|
1096
|
+
self._session,
|
|
1097
|
+
timeout,
|
|
1098
|
+
transcoded_request,
|
|
1099
|
+
)
|
|
1100
|
+
|
|
1101
|
+
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
|
|
1102
|
+
# subclass.
|
|
1103
|
+
if response.status_code >= 400:
|
|
1104
|
+
raise core_exceptions.from_http_response(response)
|
|
1105
|
+
|
|
1106
|
+
# Return the response
|
|
1107
|
+
resp = jobs.Job()
|
|
1108
|
+
pb_resp = jobs.Job.pb(resp)
|
|
1109
|
+
|
|
1110
|
+
json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
|
|
1111
|
+
|
|
1112
|
+
resp = self._interceptor.post_get_job(resp)
|
|
1113
|
+
response_metadata = [(k, str(v)) for k, v in response.headers.items()]
|
|
1114
|
+
resp, _ = self._interceptor.post_get_job_with_metadata(
|
|
1115
|
+
resp, response_metadata
|
|
1116
|
+
)
|
|
1117
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
1118
|
+
logging.DEBUG
|
|
1119
|
+
): # pragma: NO COVER
|
|
1120
|
+
try:
|
|
1121
|
+
response_payload = jobs.Job.to_json(response)
|
|
1122
|
+
except:
|
|
1123
|
+
response_payload = None
|
|
1124
|
+
http_response = {
|
|
1125
|
+
"payload": response_payload,
|
|
1126
|
+
"headers": dict(response.headers),
|
|
1127
|
+
"status": response.status_code,
|
|
1128
|
+
}
|
|
1129
|
+
_LOGGER.debug(
|
|
1130
|
+
"Received response for google.cloud.dataproc_v1.JobControllerClient.get_job",
|
|
1131
|
+
extra={
|
|
1132
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
1133
|
+
"rpcName": "GetJob",
|
|
1134
|
+
"metadata": http_response["headers"],
|
|
1135
|
+
"httpResponse": http_response,
|
|
1136
|
+
},
|
|
1137
|
+
)
|
|
1138
|
+
return resp
|
|
1139
|
+
|
|
1140
|
+
class _ListJobs(
|
|
1141
|
+
_BaseJobControllerRestTransport._BaseListJobs, JobControllerRestStub
|
|
1142
|
+
):
|
|
1143
|
+
def __hash__(self):
|
|
1144
|
+
return hash("JobControllerRestTransport.ListJobs")
|
|
1145
|
+
|
|
1146
|
+
@staticmethod
|
|
1147
|
+
def _get_response(
|
|
1148
|
+
host,
|
|
1149
|
+
metadata,
|
|
1150
|
+
query_params,
|
|
1151
|
+
session,
|
|
1152
|
+
timeout,
|
|
1153
|
+
transcoded_request,
|
|
1154
|
+
body=None,
|
|
1155
|
+
):
|
|
1156
|
+
uri = transcoded_request["uri"]
|
|
1157
|
+
method = transcoded_request["method"]
|
|
1158
|
+
headers = dict(metadata)
|
|
1159
|
+
headers["Content-Type"] = "application/json"
|
|
1160
|
+
response = getattr(session, method)(
|
|
1161
|
+
"{host}{uri}".format(host=host, uri=uri),
|
|
1162
|
+
timeout=timeout,
|
|
1163
|
+
headers=headers,
|
|
1164
|
+
params=rest_helpers.flatten_query_params(query_params, strict=True),
|
|
1165
|
+
)
|
|
1166
|
+
return response
|
|
1167
|
+
|
|
1168
|
+
def __call__(
|
|
1169
|
+
self,
|
|
1170
|
+
request: jobs.ListJobsRequest,
|
|
1171
|
+
*,
|
|
1172
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1173
|
+
timeout: Optional[float] = None,
|
|
1174
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1175
|
+
) -> jobs.ListJobsResponse:
|
|
1176
|
+
r"""Call the list jobs method over HTTP.
|
|
1177
|
+
|
|
1178
|
+
Args:
|
|
1179
|
+
request (~.jobs.ListJobsRequest):
|
|
1180
|
+
The request object. A request to list jobs in a project.
|
|
1181
|
+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
|
|
1182
|
+
should be retried.
|
|
1183
|
+
timeout (float): The timeout for this request.
|
|
1184
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1185
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1186
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1187
|
+
be of type `bytes`.
|
|
1188
|
+
|
|
1189
|
+
Returns:
|
|
1190
|
+
~.jobs.ListJobsResponse:
|
|
1191
|
+
A list of jobs in a project.
|
|
1192
|
+
"""
|
|
1193
|
+
|
|
1194
|
+
http_options = (
|
|
1195
|
+
_BaseJobControllerRestTransport._BaseListJobs._get_http_options()
|
|
1196
|
+
)
|
|
1197
|
+
|
|
1198
|
+
request, metadata = self._interceptor.pre_list_jobs(request, metadata)
|
|
1199
|
+
transcoded_request = (
|
|
1200
|
+
_BaseJobControllerRestTransport._BaseListJobs._get_transcoded_request(
|
|
1201
|
+
http_options, request
|
|
1202
|
+
)
|
|
1203
|
+
)
|
|
1204
|
+
|
|
1205
|
+
# Jsonify the query params
|
|
1206
|
+
query_params = (
|
|
1207
|
+
_BaseJobControllerRestTransport._BaseListJobs._get_query_params_json(
|
|
1208
|
+
transcoded_request
|
|
1209
|
+
)
|
|
1210
|
+
)
|
|
1211
|
+
|
|
1212
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
1213
|
+
logging.DEBUG
|
|
1214
|
+
): # pragma: NO COVER
|
|
1215
|
+
request_url = "{host}{uri}".format(
|
|
1216
|
+
host=self._host, uri=transcoded_request["uri"]
|
|
1217
|
+
)
|
|
1218
|
+
method = transcoded_request["method"]
|
|
1219
|
+
try:
|
|
1220
|
+
request_payload = type(request).to_json(request)
|
|
1221
|
+
except:
|
|
1222
|
+
request_payload = None
|
|
1223
|
+
http_request = {
|
|
1224
|
+
"payload": request_payload,
|
|
1225
|
+
"requestMethod": method,
|
|
1226
|
+
"requestUrl": request_url,
|
|
1227
|
+
"headers": dict(metadata),
|
|
1228
|
+
}
|
|
1229
|
+
_LOGGER.debug(
|
|
1230
|
+
f"Sending request for google.cloud.dataproc_v1.JobControllerClient.ListJobs",
|
|
1231
|
+
extra={
|
|
1232
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
1233
|
+
"rpcName": "ListJobs",
|
|
1234
|
+
"httpRequest": http_request,
|
|
1235
|
+
"metadata": http_request["headers"],
|
|
1236
|
+
},
|
|
1237
|
+
)
|
|
1238
|
+
|
|
1239
|
+
# Send the request
|
|
1240
|
+
response = JobControllerRestTransport._ListJobs._get_response(
|
|
1241
|
+
self._host,
|
|
1242
|
+
metadata,
|
|
1243
|
+
query_params,
|
|
1244
|
+
self._session,
|
|
1245
|
+
timeout,
|
|
1246
|
+
transcoded_request,
|
|
1247
|
+
)
|
|
1248
|
+
|
|
1249
|
+
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
|
|
1250
|
+
# subclass.
|
|
1251
|
+
if response.status_code >= 400:
|
|
1252
|
+
raise core_exceptions.from_http_response(response)
|
|
1253
|
+
|
|
1254
|
+
# Return the response
|
|
1255
|
+
resp = jobs.ListJobsResponse()
|
|
1256
|
+
pb_resp = jobs.ListJobsResponse.pb(resp)
|
|
1257
|
+
|
|
1258
|
+
json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
|
|
1259
|
+
|
|
1260
|
+
resp = self._interceptor.post_list_jobs(resp)
|
|
1261
|
+
response_metadata = [(k, str(v)) for k, v in response.headers.items()]
|
|
1262
|
+
resp, _ = self._interceptor.post_list_jobs_with_metadata(
|
|
1263
|
+
resp, response_metadata
|
|
1264
|
+
)
|
|
1265
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
1266
|
+
logging.DEBUG
|
|
1267
|
+
): # pragma: NO COVER
|
|
1268
|
+
try:
|
|
1269
|
+
response_payload = jobs.ListJobsResponse.to_json(response)
|
|
1270
|
+
except:
|
|
1271
|
+
response_payload = None
|
|
1272
|
+
http_response = {
|
|
1273
|
+
"payload": response_payload,
|
|
1274
|
+
"headers": dict(response.headers),
|
|
1275
|
+
"status": response.status_code,
|
|
1276
|
+
}
|
|
1277
|
+
_LOGGER.debug(
|
|
1278
|
+
"Received response for google.cloud.dataproc_v1.JobControllerClient.list_jobs",
|
|
1279
|
+
extra={
|
|
1280
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
1281
|
+
"rpcName": "ListJobs",
|
|
1282
|
+
"metadata": http_response["headers"],
|
|
1283
|
+
"httpResponse": http_response,
|
|
1284
|
+
},
|
|
1285
|
+
)
|
|
1286
|
+
return resp
|
|
1287
|
+
|
|
1288
|
+
class _SubmitJob(
|
|
1289
|
+
_BaseJobControllerRestTransport._BaseSubmitJob, JobControllerRestStub
|
|
1290
|
+
):
|
|
1291
|
+
def __hash__(self):
|
|
1292
|
+
return hash("JobControllerRestTransport.SubmitJob")
|
|
1293
|
+
|
|
1294
|
+
@staticmethod
|
|
1295
|
+
def _get_response(
|
|
1296
|
+
host,
|
|
1297
|
+
metadata,
|
|
1298
|
+
query_params,
|
|
1299
|
+
session,
|
|
1300
|
+
timeout,
|
|
1301
|
+
transcoded_request,
|
|
1302
|
+
body=None,
|
|
1303
|
+
):
|
|
1304
|
+
uri = transcoded_request["uri"]
|
|
1305
|
+
method = transcoded_request["method"]
|
|
1306
|
+
headers = dict(metadata)
|
|
1307
|
+
headers["Content-Type"] = "application/json"
|
|
1308
|
+
response = getattr(session, method)(
|
|
1309
|
+
"{host}{uri}".format(host=host, uri=uri),
|
|
1310
|
+
timeout=timeout,
|
|
1311
|
+
headers=headers,
|
|
1312
|
+
params=rest_helpers.flatten_query_params(query_params, strict=True),
|
|
1313
|
+
data=body,
|
|
1314
|
+
)
|
|
1315
|
+
return response
|
|
1316
|
+
|
|
1317
|
+
def __call__(
|
|
1318
|
+
self,
|
|
1319
|
+
request: jobs.SubmitJobRequest,
|
|
1320
|
+
*,
|
|
1321
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1322
|
+
timeout: Optional[float] = None,
|
|
1323
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1324
|
+
) -> jobs.Job:
|
|
1325
|
+
r"""Call the submit job method over HTTP.
|
|
1326
|
+
|
|
1327
|
+
Args:
|
|
1328
|
+
request (~.jobs.SubmitJobRequest):
|
|
1329
|
+
The request object. A request to submit a job.
|
|
1330
|
+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
|
|
1331
|
+
should be retried.
|
|
1332
|
+
timeout (float): The timeout for this request.
|
|
1333
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1334
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1335
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1336
|
+
be of type `bytes`.
|
|
1337
|
+
|
|
1338
|
+
Returns:
|
|
1339
|
+
~.jobs.Job:
|
|
1340
|
+
A Dataproc job resource.
|
|
1341
|
+
"""
|
|
1342
|
+
|
|
1343
|
+
http_options = (
|
|
1344
|
+
_BaseJobControllerRestTransport._BaseSubmitJob._get_http_options()
|
|
1345
|
+
)
|
|
1346
|
+
|
|
1347
|
+
request, metadata = self._interceptor.pre_submit_job(request, metadata)
|
|
1348
|
+
transcoded_request = (
|
|
1349
|
+
_BaseJobControllerRestTransport._BaseSubmitJob._get_transcoded_request(
|
|
1350
|
+
http_options, request
|
|
1351
|
+
)
|
|
1352
|
+
)
|
|
1353
|
+
|
|
1354
|
+
body = (
|
|
1355
|
+
_BaseJobControllerRestTransport._BaseSubmitJob._get_request_body_json(
|
|
1356
|
+
transcoded_request
|
|
1357
|
+
)
|
|
1358
|
+
)
|
|
1359
|
+
|
|
1360
|
+
# Jsonify the query params
|
|
1361
|
+
query_params = (
|
|
1362
|
+
_BaseJobControllerRestTransport._BaseSubmitJob._get_query_params_json(
|
|
1363
|
+
transcoded_request
|
|
1364
|
+
)
|
|
1365
|
+
)
|
|
1366
|
+
|
|
1367
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
1368
|
+
logging.DEBUG
|
|
1369
|
+
): # pragma: NO COVER
|
|
1370
|
+
request_url = "{host}{uri}".format(
|
|
1371
|
+
host=self._host, uri=transcoded_request["uri"]
|
|
1372
|
+
)
|
|
1373
|
+
method = transcoded_request["method"]
|
|
1374
|
+
try:
|
|
1375
|
+
request_payload = type(request).to_json(request)
|
|
1376
|
+
except:
|
|
1377
|
+
request_payload = None
|
|
1378
|
+
http_request = {
|
|
1379
|
+
"payload": request_payload,
|
|
1380
|
+
"requestMethod": method,
|
|
1381
|
+
"requestUrl": request_url,
|
|
1382
|
+
"headers": dict(metadata),
|
|
1383
|
+
}
|
|
1384
|
+
_LOGGER.debug(
|
|
1385
|
+
f"Sending request for google.cloud.dataproc_v1.JobControllerClient.SubmitJob",
|
|
1386
|
+
extra={
|
|
1387
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
1388
|
+
"rpcName": "SubmitJob",
|
|
1389
|
+
"httpRequest": http_request,
|
|
1390
|
+
"metadata": http_request["headers"],
|
|
1391
|
+
},
|
|
1392
|
+
)
|
|
1393
|
+
|
|
1394
|
+
# Send the request
|
|
1395
|
+
response = JobControllerRestTransport._SubmitJob._get_response(
|
|
1396
|
+
self._host,
|
|
1397
|
+
metadata,
|
|
1398
|
+
query_params,
|
|
1399
|
+
self._session,
|
|
1400
|
+
timeout,
|
|
1401
|
+
transcoded_request,
|
|
1402
|
+
body,
|
|
1403
|
+
)
|
|
1404
|
+
|
|
1405
|
+
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
|
|
1406
|
+
# subclass.
|
|
1407
|
+
if response.status_code >= 400:
|
|
1408
|
+
raise core_exceptions.from_http_response(response)
|
|
1409
|
+
|
|
1410
|
+
# Return the response
|
|
1411
|
+
resp = jobs.Job()
|
|
1412
|
+
pb_resp = jobs.Job.pb(resp)
|
|
1413
|
+
|
|
1414
|
+
json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
|
|
1415
|
+
|
|
1416
|
+
resp = self._interceptor.post_submit_job(resp)
|
|
1417
|
+
response_metadata = [(k, str(v)) for k, v in response.headers.items()]
|
|
1418
|
+
resp, _ = self._interceptor.post_submit_job_with_metadata(
|
|
1419
|
+
resp, response_metadata
|
|
1420
|
+
)
|
|
1421
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
1422
|
+
logging.DEBUG
|
|
1423
|
+
): # pragma: NO COVER
|
|
1424
|
+
try:
|
|
1425
|
+
response_payload = jobs.Job.to_json(response)
|
|
1426
|
+
except:
|
|
1427
|
+
response_payload = None
|
|
1428
|
+
http_response = {
|
|
1429
|
+
"payload": response_payload,
|
|
1430
|
+
"headers": dict(response.headers),
|
|
1431
|
+
"status": response.status_code,
|
|
1432
|
+
}
|
|
1433
|
+
_LOGGER.debug(
|
|
1434
|
+
"Received response for google.cloud.dataproc_v1.JobControllerClient.submit_job",
|
|
1435
|
+
extra={
|
|
1436
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
1437
|
+
"rpcName": "SubmitJob",
|
|
1438
|
+
"metadata": http_response["headers"],
|
|
1439
|
+
"httpResponse": http_response,
|
|
1440
|
+
},
|
|
1441
|
+
)
|
|
1442
|
+
return resp
|
|
1443
|
+
|
|
1444
|
+
class _SubmitJobAsOperation(
|
|
1445
|
+
_BaseJobControllerRestTransport._BaseSubmitJobAsOperation, JobControllerRestStub
|
|
1446
|
+
):
|
|
1447
|
+
def __hash__(self):
|
|
1448
|
+
return hash("JobControllerRestTransport.SubmitJobAsOperation")
|
|
1449
|
+
|
|
1450
|
+
@staticmethod
|
|
1451
|
+
def _get_response(
|
|
1452
|
+
host,
|
|
1453
|
+
metadata,
|
|
1454
|
+
query_params,
|
|
1455
|
+
session,
|
|
1456
|
+
timeout,
|
|
1457
|
+
transcoded_request,
|
|
1458
|
+
body=None,
|
|
1459
|
+
):
|
|
1460
|
+
uri = transcoded_request["uri"]
|
|
1461
|
+
method = transcoded_request["method"]
|
|
1462
|
+
headers = dict(metadata)
|
|
1463
|
+
headers["Content-Type"] = "application/json"
|
|
1464
|
+
response = getattr(session, method)(
|
|
1465
|
+
"{host}{uri}".format(host=host, uri=uri),
|
|
1466
|
+
timeout=timeout,
|
|
1467
|
+
headers=headers,
|
|
1468
|
+
params=rest_helpers.flatten_query_params(query_params, strict=True),
|
|
1469
|
+
data=body,
|
|
1470
|
+
)
|
|
1471
|
+
return response
|
|
1472
|
+
|
|
1473
|
+
def __call__(
|
|
1474
|
+
self,
|
|
1475
|
+
request: jobs.SubmitJobRequest,
|
|
1476
|
+
*,
|
|
1477
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1478
|
+
timeout: Optional[float] = None,
|
|
1479
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1480
|
+
) -> operations_pb2.Operation:
|
|
1481
|
+
r"""Call the submit job as operation method over HTTP.
|
|
1482
|
+
|
|
1483
|
+
Args:
|
|
1484
|
+
request (~.jobs.SubmitJobRequest):
|
|
1485
|
+
The request object. A request to submit a job.
|
|
1486
|
+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
|
|
1487
|
+
should be retried.
|
|
1488
|
+
timeout (float): The timeout for this request.
|
|
1489
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1490
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1491
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1492
|
+
be of type `bytes`.
|
|
1493
|
+
|
|
1494
|
+
Returns:
|
|
1495
|
+
~.operations_pb2.Operation:
|
|
1496
|
+
This resource represents a
|
|
1497
|
+
long-running operation that is the
|
|
1498
|
+
result of a network API call.
|
|
1499
|
+
|
|
1500
|
+
"""
|
|
1501
|
+
|
|
1502
|
+
http_options = (
|
|
1503
|
+
_BaseJobControllerRestTransport._BaseSubmitJobAsOperation._get_http_options()
|
|
1504
|
+
)
|
|
1505
|
+
|
|
1506
|
+
request, metadata = self._interceptor.pre_submit_job_as_operation(
|
|
1507
|
+
request, metadata
|
|
1508
|
+
)
|
|
1509
|
+
transcoded_request = _BaseJobControllerRestTransport._BaseSubmitJobAsOperation._get_transcoded_request(
|
|
1510
|
+
http_options, request
|
|
1511
|
+
)
|
|
1512
|
+
|
|
1513
|
+
body = _BaseJobControllerRestTransport._BaseSubmitJobAsOperation._get_request_body_json(
|
|
1514
|
+
transcoded_request
|
|
1515
|
+
)
|
|
1516
|
+
|
|
1517
|
+
# Jsonify the query params
|
|
1518
|
+
query_params = _BaseJobControllerRestTransport._BaseSubmitJobAsOperation._get_query_params_json(
|
|
1519
|
+
transcoded_request
|
|
1520
|
+
)
|
|
1521
|
+
|
|
1522
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
1523
|
+
logging.DEBUG
|
|
1524
|
+
): # pragma: NO COVER
|
|
1525
|
+
request_url = "{host}{uri}".format(
|
|
1526
|
+
host=self._host, uri=transcoded_request["uri"]
|
|
1527
|
+
)
|
|
1528
|
+
method = transcoded_request["method"]
|
|
1529
|
+
try:
|
|
1530
|
+
request_payload = json_format.MessageToJson(request)
|
|
1531
|
+
except:
|
|
1532
|
+
request_payload = None
|
|
1533
|
+
http_request = {
|
|
1534
|
+
"payload": request_payload,
|
|
1535
|
+
"requestMethod": method,
|
|
1536
|
+
"requestUrl": request_url,
|
|
1537
|
+
"headers": dict(metadata),
|
|
1538
|
+
}
|
|
1539
|
+
_LOGGER.debug(
|
|
1540
|
+
f"Sending request for google.cloud.dataproc_v1.JobControllerClient.SubmitJobAsOperation",
|
|
1541
|
+
extra={
|
|
1542
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
1543
|
+
"rpcName": "SubmitJobAsOperation",
|
|
1544
|
+
"httpRequest": http_request,
|
|
1545
|
+
"metadata": http_request["headers"],
|
|
1546
|
+
},
|
|
1547
|
+
)
|
|
1548
|
+
|
|
1549
|
+
# Send the request
|
|
1550
|
+
response = JobControllerRestTransport._SubmitJobAsOperation._get_response(
|
|
1551
|
+
self._host,
|
|
1552
|
+
metadata,
|
|
1553
|
+
query_params,
|
|
1554
|
+
self._session,
|
|
1555
|
+
timeout,
|
|
1556
|
+
transcoded_request,
|
|
1557
|
+
body,
|
|
1558
|
+
)
|
|
1559
|
+
|
|
1560
|
+
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
|
|
1561
|
+
# subclass.
|
|
1562
|
+
if response.status_code >= 400:
|
|
1563
|
+
raise core_exceptions.from_http_response(response)
|
|
1564
|
+
|
|
1565
|
+
# Return the response
|
|
1566
|
+
resp = operations_pb2.Operation()
|
|
1567
|
+
json_format.Parse(response.content, resp, ignore_unknown_fields=True)
|
|
1568
|
+
|
|
1569
|
+
resp = self._interceptor.post_submit_job_as_operation(resp)
|
|
1570
|
+
response_metadata = [(k, str(v)) for k, v in response.headers.items()]
|
|
1571
|
+
resp, _ = self._interceptor.post_submit_job_as_operation_with_metadata(
|
|
1572
|
+
resp, response_metadata
|
|
1573
|
+
)
|
|
1574
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
1575
|
+
logging.DEBUG
|
|
1576
|
+
): # pragma: NO COVER
|
|
1577
|
+
try:
|
|
1578
|
+
response_payload = json_format.MessageToJson(resp)
|
|
1579
|
+
except:
|
|
1580
|
+
response_payload = None
|
|
1581
|
+
http_response = {
|
|
1582
|
+
"payload": response_payload,
|
|
1583
|
+
"headers": dict(response.headers),
|
|
1584
|
+
"status": response.status_code,
|
|
1585
|
+
}
|
|
1586
|
+
_LOGGER.debug(
|
|
1587
|
+
"Received response for google.cloud.dataproc_v1.JobControllerClient.submit_job_as_operation",
|
|
1588
|
+
extra={
|
|
1589
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
1590
|
+
"rpcName": "SubmitJobAsOperation",
|
|
1591
|
+
"metadata": http_response["headers"],
|
|
1592
|
+
"httpResponse": http_response,
|
|
1593
|
+
},
|
|
1594
|
+
)
|
|
1595
|
+
return resp
|
|
1596
|
+
|
|
1597
|
+
class _UpdateJob(
|
|
1598
|
+
_BaseJobControllerRestTransport._BaseUpdateJob, JobControllerRestStub
|
|
1599
|
+
):
|
|
1600
|
+
def __hash__(self):
|
|
1601
|
+
return hash("JobControllerRestTransport.UpdateJob")
|
|
1602
|
+
|
|
1603
|
+
@staticmethod
|
|
1604
|
+
def _get_response(
|
|
1605
|
+
host,
|
|
1606
|
+
metadata,
|
|
1607
|
+
query_params,
|
|
1608
|
+
session,
|
|
1609
|
+
timeout,
|
|
1610
|
+
transcoded_request,
|
|
1611
|
+
body=None,
|
|
1612
|
+
):
|
|
1613
|
+
uri = transcoded_request["uri"]
|
|
1614
|
+
method = transcoded_request["method"]
|
|
1615
|
+
headers = dict(metadata)
|
|
1616
|
+
headers["Content-Type"] = "application/json"
|
|
1617
|
+
response = getattr(session, method)(
|
|
1618
|
+
"{host}{uri}".format(host=host, uri=uri),
|
|
1619
|
+
timeout=timeout,
|
|
1620
|
+
headers=headers,
|
|
1621
|
+
params=rest_helpers.flatten_query_params(query_params, strict=True),
|
|
1622
|
+
data=body,
|
|
1623
|
+
)
|
|
1624
|
+
return response
|
|
1625
|
+
|
|
1626
|
+
def __call__(
|
|
1627
|
+
self,
|
|
1628
|
+
request: jobs.UpdateJobRequest,
|
|
1629
|
+
*,
|
|
1630
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1631
|
+
timeout: Optional[float] = None,
|
|
1632
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1633
|
+
) -> jobs.Job:
|
|
1634
|
+
r"""Call the update job method over HTTP.
|
|
1635
|
+
|
|
1636
|
+
Args:
|
|
1637
|
+
request (~.jobs.UpdateJobRequest):
|
|
1638
|
+
The request object. A request to update a job.
|
|
1639
|
+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
|
|
1640
|
+
should be retried.
|
|
1641
|
+
timeout (float): The timeout for this request.
|
|
1642
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1643
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1644
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1645
|
+
be of type `bytes`.
|
|
1646
|
+
|
|
1647
|
+
Returns:
|
|
1648
|
+
~.jobs.Job:
|
|
1649
|
+
A Dataproc job resource.
|
|
1650
|
+
"""
|
|
1651
|
+
|
|
1652
|
+
http_options = (
|
|
1653
|
+
_BaseJobControllerRestTransport._BaseUpdateJob._get_http_options()
|
|
1654
|
+
)
|
|
1655
|
+
|
|
1656
|
+
request, metadata = self._interceptor.pre_update_job(request, metadata)
|
|
1657
|
+
transcoded_request = (
|
|
1658
|
+
_BaseJobControllerRestTransport._BaseUpdateJob._get_transcoded_request(
|
|
1659
|
+
http_options, request
|
|
1660
|
+
)
|
|
1661
|
+
)
|
|
1662
|
+
|
|
1663
|
+
body = (
|
|
1664
|
+
_BaseJobControllerRestTransport._BaseUpdateJob._get_request_body_json(
|
|
1665
|
+
transcoded_request
|
|
1666
|
+
)
|
|
1667
|
+
)
|
|
1668
|
+
|
|
1669
|
+
# Jsonify the query params
|
|
1670
|
+
query_params = (
|
|
1671
|
+
_BaseJobControllerRestTransport._BaseUpdateJob._get_query_params_json(
|
|
1672
|
+
transcoded_request
|
|
1673
|
+
)
|
|
1674
|
+
)
|
|
1675
|
+
|
|
1676
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
1677
|
+
logging.DEBUG
|
|
1678
|
+
): # pragma: NO COVER
|
|
1679
|
+
request_url = "{host}{uri}".format(
|
|
1680
|
+
host=self._host, uri=transcoded_request["uri"]
|
|
1681
|
+
)
|
|
1682
|
+
method = transcoded_request["method"]
|
|
1683
|
+
try:
|
|
1684
|
+
request_payload = type(request).to_json(request)
|
|
1685
|
+
except:
|
|
1686
|
+
request_payload = None
|
|
1687
|
+
http_request = {
|
|
1688
|
+
"payload": request_payload,
|
|
1689
|
+
"requestMethod": method,
|
|
1690
|
+
"requestUrl": request_url,
|
|
1691
|
+
"headers": dict(metadata),
|
|
1692
|
+
}
|
|
1693
|
+
_LOGGER.debug(
|
|
1694
|
+
f"Sending request for google.cloud.dataproc_v1.JobControllerClient.UpdateJob",
|
|
1695
|
+
extra={
|
|
1696
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
1697
|
+
"rpcName": "UpdateJob",
|
|
1698
|
+
"httpRequest": http_request,
|
|
1699
|
+
"metadata": http_request["headers"],
|
|
1700
|
+
},
|
|
1701
|
+
)
|
|
1702
|
+
|
|
1703
|
+
# Send the request
|
|
1704
|
+
response = JobControllerRestTransport._UpdateJob._get_response(
|
|
1705
|
+
self._host,
|
|
1706
|
+
metadata,
|
|
1707
|
+
query_params,
|
|
1708
|
+
self._session,
|
|
1709
|
+
timeout,
|
|
1710
|
+
transcoded_request,
|
|
1711
|
+
body,
|
|
1712
|
+
)
|
|
1713
|
+
|
|
1714
|
+
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
|
|
1715
|
+
# subclass.
|
|
1716
|
+
if response.status_code >= 400:
|
|
1717
|
+
raise core_exceptions.from_http_response(response)
|
|
1718
|
+
|
|
1719
|
+
# Return the response
|
|
1720
|
+
resp = jobs.Job()
|
|
1721
|
+
pb_resp = jobs.Job.pb(resp)
|
|
1722
|
+
|
|
1723
|
+
json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
|
|
1724
|
+
|
|
1725
|
+
resp = self._interceptor.post_update_job(resp)
|
|
1726
|
+
response_metadata = [(k, str(v)) for k, v in response.headers.items()]
|
|
1727
|
+
resp, _ = self._interceptor.post_update_job_with_metadata(
|
|
1728
|
+
resp, response_metadata
|
|
1729
|
+
)
|
|
1730
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
1731
|
+
logging.DEBUG
|
|
1732
|
+
): # pragma: NO COVER
|
|
1733
|
+
try:
|
|
1734
|
+
response_payload = jobs.Job.to_json(response)
|
|
1735
|
+
except:
|
|
1736
|
+
response_payload = None
|
|
1737
|
+
http_response = {
|
|
1738
|
+
"payload": response_payload,
|
|
1739
|
+
"headers": dict(response.headers),
|
|
1740
|
+
"status": response.status_code,
|
|
1741
|
+
}
|
|
1742
|
+
_LOGGER.debug(
|
|
1743
|
+
"Received response for google.cloud.dataproc_v1.JobControllerClient.update_job",
|
|
1744
|
+
extra={
|
|
1745
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
1746
|
+
"rpcName": "UpdateJob",
|
|
1747
|
+
"metadata": http_response["headers"],
|
|
1748
|
+
"httpResponse": http_response,
|
|
1749
|
+
},
|
|
1750
|
+
)
|
|
1751
|
+
return resp
|
|
1752
|
+
|
|
1753
|
+
@property
|
|
1754
|
+
def cancel_job(self) -> Callable[[jobs.CancelJobRequest], jobs.Job]:
|
|
1755
|
+
# The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
|
|
1756
|
+
# In C++ this would require a dynamic_cast
|
|
1757
|
+
return self._CancelJob(self._session, self._host, self._interceptor) # type: ignore
|
|
1758
|
+
|
|
1759
|
+
@property
|
|
1760
|
+
def delete_job(self) -> Callable[[jobs.DeleteJobRequest], empty_pb2.Empty]:
|
|
1761
|
+
# The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
|
|
1762
|
+
# In C++ this would require a dynamic_cast
|
|
1763
|
+
return self._DeleteJob(self._session, self._host, self._interceptor) # type: ignore
|
|
1764
|
+
|
|
1765
|
+
@property
|
|
1766
|
+
def get_job(self) -> Callable[[jobs.GetJobRequest], jobs.Job]:
|
|
1767
|
+
# The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
|
|
1768
|
+
# In C++ this would require a dynamic_cast
|
|
1769
|
+
return self._GetJob(self._session, self._host, self._interceptor) # type: ignore
|
|
1770
|
+
|
|
1771
|
+
@property
|
|
1772
|
+
def list_jobs(self) -> Callable[[jobs.ListJobsRequest], jobs.ListJobsResponse]:
|
|
1773
|
+
# The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
|
|
1774
|
+
# In C++ this would require a dynamic_cast
|
|
1775
|
+
return self._ListJobs(self._session, self._host, self._interceptor) # type: ignore
|
|
1776
|
+
|
|
1777
|
+
@property
|
|
1778
|
+
def submit_job(self) -> Callable[[jobs.SubmitJobRequest], jobs.Job]:
|
|
1779
|
+
# The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
|
|
1780
|
+
# In C++ this would require a dynamic_cast
|
|
1781
|
+
return self._SubmitJob(self._session, self._host, self._interceptor) # type: ignore
|
|
1782
|
+
|
|
1783
|
+
@property
|
|
1784
|
+
def submit_job_as_operation(
|
|
1785
|
+
self,
|
|
1786
|
+
) -> Callable[[jobs.SubmitJobRequest], operations_pb2.Operation]:
|
|
1787
|
+
# The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
|
|
1788
|
+
# In C++ this would require a dynamic_cast
|
|
1789
|
+
return self._SubmitJobAsOperation(self._session, self._host, self._interceptor) # type: ignore
|
|
1790
|
+
|
|
1791
|
+
@property
|
|
1792
|
+
def update_job(self) -> Callable[[jobs.UpdateJobRequest], jobs.Job]:
|
|
1793
|
+
# The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
|
|
1794
|
+
# In C++ this would require a dynamic_cast
|
|
1795
|
+
return self._UpdateJob(self._session, self._host, self._interceptor) # type: ignore
|
|
1796
|
+
|
|
1797
|
+
@property
|
|
1798
|
+
def get_iam_policy(self):
|
|
1799
|
+
return self._GetIamPolicy(self._session, self._host, self._interceptor) # type: ignore
|
|
1800
|
+
|
|
1801
|
+
class _GetIamPolicy(
|
|
1802
|
+
_BaseJobControllerRestTransport._BaseGetIamPolicy, JobControllerRestStub
|
|
1803
|
+
):
|
|
1804
|
+
def __hash__(self):
|
|
1805
|
+
return hash("JobControllerRestTransport.GetIamPolicy")
|
|
1806
|
+
|
|
1807
|
+
@staticmethod
|
|
1808
|
+
def _get_response(
|
|
1809
|
+
host,
|
|
1810
|
+
metadata,
|
|
1811
|
+
query_params,
|
|
1812
|
+
session,
|
|
1813
|
+
timeout,
|
|
1814
|
+
transcoded_request,
|
|
1815
|
+
body=None,
|
|
1816
|
+
):
|
|
1817
|
+
uri = transcoded_request["uri"]
|
|
1818
|
+
method = transcoded_request["method"]
|
|
1819
|
+
headers = dict(metadata)
|
|
1820
|
+
headers["Content-Type"] = "application/json"
|
|
1821
|
+
response = getattr(session, method)(
|
|
1822
|
+
"{host}{uri}".format(host=host, uri=uri),
|
|
1823
|
+
timeout=timeout,
|
|
1824
|
+
headers=headers,
|
|
1825
|
+
params=rest_helpers.flatten_query_params(query_params, strict=True),
|
|
1826
|
+
data=body,
|
|
1827
|
+
)
|
|
1828
|
+
return response
|
|
1829
|
+
|
|
1830
|
+
def __call__(
|
|
1831
|
+
self,
|
|
1832
|
+
request: iam_policy_pb2.GetIamPolicyRequest,
|
|
1833
|
+
*,
|
|
1834
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1835
|
+
timeout: Optional[float] = None,
|
|
1836
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1837
|
+
) -> policy_pb2.Policy:
|
|
1838
|
+
r"""Call the get iam policy method over HTTP.
|
|
1839
|
+
|
|
1840
|
+
Args:
|
|
1841
|
+
request (iam_policy_pb2.GetIamPolicyRequest):
|
|
1842
|
+
The request object for GetIamPolicy method.
|
|
1843
|
+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
|
|
1844
|
+
should be retried.
|
|
1845
|
+
timeout (float): The timeout for this request.
|
|
1846
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1847
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1848
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1849
|
+
be of type `bytes`.
|
|
1850
|
+
|
|
1851
|
+
Returns:
|
|
1852
|
+
policy_pb2.Policy: Response from GetIamPolicy method.
|
|
1853
|
+
"""
|
|
1854
|
+
|
|
1855
|
+
http_options = (
|
|
1856
|
+
_BaseJobControllerRestTransport._BaseGetIamPolicy._get_http_options()
|
|
1857
|
+
)
|
|
1858
|
+
|
|
1859
|
+
request, metadata = self._interceptor.pre_get_iam_policy(request, metadata)
|
|
1860
|
+
transcoded_request = _BaseJobControllerRestTransport._BaseGetIamPolicy._get_transcoded_request(
|
|
1861
|
+
http_options, request
|
|
1862
|
+
)
|
|
1863
|
+
|
|
1864
|
+
body = _BaseJobControllerRestTransport._BaseGetIamPolicy._get_request_body_json(
|
|
1865
|
+
transcoded_request
|
|
1866
|
+
)
|
|
1867
|
+
|
|
1868
|
+
# Jsonify the query params
|
|
1869
|
+
query_params = _BaseJobControllerRestTransport._BaseGetIamPolicy._get_query_params_json(
|
|
1870
|
+
transcoded_request
|
|
1871
|
+
)
|
|
1872
|
+
|
|
1873
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
1874
|
+
logging.DEBUG
|
|
1875
|
+
): # pragma: NO COVER
|
|
1876
|
+
request_url = "{host}{uri}".format(
|
|
1877
|
+
host=self._host, uri=transcoded_request["uri"]
|
|
1878
|
+
)
|
|
1879
|
+
method = transcoded_request["method"]
|
|
1880
|
+
try:
|
|
1881
|
+
request_payload = json_format.MessageToJson(request)
|
|
1882
|
+
except:
|
|
1883
|
+
request_payload = None
|
|
1884
|
+
http_request = {
|
|
1885
|
+
"payload": request_payload,
|
|
1886
|
+
"requestMethod": method,
|
|
1887
|
+
"requestUrl": request_url,
|
|
1888
|
+
"headers": dict(metadata),
|
|
1889
|
+
}
|
|
1890
|
+
_LOGGER.debug(
|
|
1891
|
+
f"Sending request for google.cloud.dataproc_v1.JobControllerClient.GetIamPolicy",
|
|
1892
|
+
extra={
|
|
1893
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
1894
|
+
"rpcName": "GetIamPolicy",
|
|
1895
|
+
"httpRequest": http_request,
|
|
1896
|
+
"metadata": http_request["headers"],
|
|
1897
|
+
},
|
|
1898
|
+
)
|
|
1899
|
+
|
|
1900
|
+
# Send the request
|
|
1901
|
+
response = JobControllerRestTransport._GetIamPolicy._get_response(
|
|
1902
|
+
self._host,
|
|
1903
|
+
metadata,
|
|
1904
|
+
query_params,
|
|
1905
|
+
self._session,
|
|
1906
|
+
timeout,
|
|
1907
|
+
transcoded_request,
|
|
1908
|
+
body,
|
|
1909
|
+
)
|
|
1910
|
+
|
|
1911
|
+
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
|
|
1912
|
+
# subclass.
|
|
1913
|
+
if response.status_code >= 400:
|
|
1914
|
+
raise core_exceptions.from_http_response(response)
|
|
1915
|
+
|
|
1916
|
+
content = response.content.decode("utf-8")
|
|
1917
|
+
resp = policy_pb2.Policy()
|
|
1918
|
+
resp = json_format.Parse(content, resp)
|
|
1919
|
+
resp = self._interceptor.post_get_iam_policy(resp)
|
|
1920
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
1921
|
+
logging.DEBUG
|
|
1922
|
+
): # pragma: NO COVER
|
|
1923
|
+
try:
|
|
1924
|
+
response_payload = json_format.MessageToJson(resp)
|
|
1925
|
+
except:
|
|
1926
|
+
response_payload = None
|
|
1927
|
+
http_response = {
|
|
1928
|
+
"payload": response_payload,
|
|
1929
|
+
"headers": dict(response.headers),
|
|
1930
|
+
"status": response.status_code,
|
|
1931
|
+
}
|
|
1932
|
+
_LOGGER.debug(
|
|
1933
|
+
"Received response for google.cloud.dataproc_v1.JobControllerAsyncClient.GetIamPolicy",
|
|
1934
|
+
extra={
|
|
1935
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
1936
|
+
"rpcName": "GetIamPolicy",
|
|
1937
|
+
"httpResponse": http_response,
|
|
1938
|
+
"metadata": http_response["headers"],
|
|
1939
|
+
},
|
|
1940
|
+
)
|
|
1941
|
+
return resp
|
|
1942
|
+
|
|
1943
|
+
@property
|
|
1944
|
+
def set_iam_policy(self):
|
|
1945
|
+
return self._SetIamPolicy(self._session, self._host, self._interceptor) # type: ignore
|
|
1946
|
+
|
|
1947
|
+
class _SetIamPolicy(
|
|
1948
|
+
_BaseJobControllerRestTransport._BaseSetIamPolicy, JobControllerRestStub
|
|
1949
|
+
):
|
|
1950
|
+
def __hash__(self):
|
|
1951
|
+
return hash("JobControllerRestTransport.SetIamPolicy")
|
|
1952
|
+
|
|
1953
|
+
@staticmethod
|
|
1954
|
+
def _get_response(
|
|
1955
|
+
host,
|
|
1956
|
+
metadata,
|
|
1957
|
+
query_params,
|
|
1958
|
+
session,
|
|
1959
|
+
timeout,
|
|
1960
|
+
transcoded_request,
|
|
1961
|
+
body=None,
|
|
1962
|
+
):
|
|
1963
|
+
uri = transcoded_request["uri"]
|
|
1964
|
+
method = transcoded_request["method"]
|
|
1965
|
+
headers = dict(metadata)
|
|
1966
|
+
headers["Content-Type"] = "application/json"
|
|
1967
|
+
response = getattr(session, method)(
|
|
1968
|
+
"{host}{uri}".format(host=host, uri=uri),
|
|
1969
|
+
timeout=timeout,
|
|
1970
|
+
headers=headers,
|
|
1971
|
+
params=rest_helpers.flatten_query_params(query_params, strict=True),
|
|
1972
|
+
data=body,
|
|
1973
|
+
)
|
|
1974
|
+
return response
|
|
1975
|
+
|
|
1976
|
+
def __call__(
|
|
1977
|
+
self,
|
|
1978
|
+
request: iam_policy_pb2.SetIamPolicyRequest,
|
|
1979
|
+
*,
|
|
1980
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1981
|
+
timeout: Optional[float] = None,
|
|
1982
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1983
|
+
) -> policy_pb2.Policy:
|
|
1984
|
+
r"""Call the set iam policy method over HTTP.
|
|
1985
|
+
|
|
1986
|
+
Args:
|
|
1987
|
+
request (iam_policy_pb2.SetIamPolicyRequest):
|
|
1988
|
+
The request object for SetIamPolicy method.
|
|
1989
|
+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
|
|
1990
|
+
should be retried.
|
|
1991
|
+
timeout (float): The timeout for this request.
|
|
1992
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1993
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1994
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1995
|
+
be of type `bytes`.
|
|
1996
|
+
|
|
1997
|
+
Returns:
|
|
1998
|
+
policy_pb2.Policy: Response from SetIamPolicy method.
|
|
1999
|
+
"""
|
|
2000
|
+
|
|
2001
|
+
http_options = (
|
|
2002
|
+
_BaseJobControllerRestTransport._BaseSetIamPolicy._get_http_options()
|
|
2003
|
+
)
|
|
2004
|
+
|
|
2005
|
+
request, metadata = self._interceptor.pre_set_iam_policy(request, metadata)
|
|
2006
|
+
transcoded_request = _BaseJobControllerRestTransport._BaseSetIamPolicy._get_transcoded_request(
|
|
2007
|
+
http_options, request
|
|
2008
|
+
)
|
|
2009
|
+
|
|
2010
|
+
body = _BaseJobControllerRestTransport._BaseSetIamPolicy._get_request_body_json(
|
|
2011
|
+
transcoded_request
|
|
2012
|
+
)
|
|
2013
|
+
|
|
2014
|
+
# Jsonify the query params
|
|
2015
|
+
query_params = _BaseJobControllerRestTransport._BaseSetIamPolicy._get_query_params_json(
|
|
2016
|
+
transcoded_request
|
|
2017
|
+
)
|
|
2018
|
+
|
|
2019
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
2020
|
+
logging.DEBUG
|
|
2021
|
+
): # pragma: NO COVER
|
|
2022
|
+
request_url = "{host}{uri}".format(
|
|
2023
|
+
host=self._host, uri=transcoded_request["uri"]
|
|
2024
|
+
)
|
|
2025
|
+
method = transcoded_request["method"]
|
|
2026
|
+
try:
|
|
2027
|
+
request_payload = json_format.MessageToJson(request)
|
|
2028
|
+
except:
|
|
2029
|
+
request_payload = None
|
|
2030
|
+
http_request = {
|
|
2031
|
+
"payload": request_payload,
|
|
2032
|
+
"requestMethod": method,
|
|
2033
|
+
"requestUrl": request_url,
|
|
2034
|
+
"headers": dict(metadata),
|
|
2035
|
+
}
|
|
2036
|
+
_LOGGER.debug(
|
|
2037
|
+
f"Sending request for google.cloud.dataproc_v1.JobControllerClient.SetIamPolicy",
|
|
2038
|
+
extra={
|
|
2039
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
2040
|
+
"rpcName": "SetIamPolicy",
|
|
2041
|
+
"httpRequest": http_request,
|
|
2042
|
+
"metadata": http_request["headers"],
|
|
2043
|
+
},
|
|
2044
|
+
)
|
|
2045
|
+
|
|
2046
|
+
# Send the request
|
|
2047
|
+
response = JobControllerRestTransport._SetIamPolicy._get_response(
|
|
2048
|
+
self._host,
|
|
2049
|
+
metadata,
|
|
2050
|
+
query_params,
|
|
2051
|
+
self._session,
|
|
2052
|
+
timeout,
|
|
2053
|
+
transcoded_request,
|
|
2054
|
+
body,
|
|
2055
|
+
)
|
|
2056
|
+
|
|
2057
|
+
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
|
|
2058
|
+
# subclass.
|
|
2059
|
+
if response.status_code >= 400:
|
|
2060
|
+
raise core_exceptions.from_http_response(response)
|
|
2061
|
+
|
|
2062
|
+
content = response.content.decode("utf-8")
|
|
2063
|
+
resp = policy_pb2.Policy()
|
|
2064
|
+
resp = json_format.Parse(content, resp)
|
|
2065
|
+
resp = self._interceptor.post_set_iam_policy(resp)
|
|
2066
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
2067
|
+
logging.DEBUG
|
|
2068
|
+
): # pragma: NO COVER
|
|
2069
|
+
try:
|
|
2070
|
+
response_payload = json_format.MessageToJson(resp)
|
|
2071
|
+
except:
|
|
2072
|
+
response_payload = None
|
|
2073
|
+
http_response = {
|
|
2074
|
+
"payload": response_payload,
|
|
2075
|
+
"headers": dict(response.headers),
|
|
2076
|
+
"status": response.status_code,
|
|
2077
|
+
}
|
|
2078
|
+
_LOGGER.debug(
|
|
2079
|
+
"Received response for google.cloud.dataproc_v1.JobControllerAsyncClient.SetIamPolicy",
|
|
2080
|
+
extra={
|
|
2081
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
2082
|
+
"rpcName": "SetIamPolicy",
|
|
2083
|
+
"httpResponse": http_response,
|
|
2084
|
+
"metadata": http_response["headers"],
|
|
2085
|
+
},
|
|
2086
|
+
)
|
|
2087
|
+
return resp
|
|
2088
|
+
|
|
2089
|
+
@property
|
|
2090
|
+
def test_iam_permissions(self):
|
|
2091
|
+
return self._TestIamPermissions(self._session, self._host, self._interceptor) # type: ignore
|
|
2092
|
+
|
|
2093
|
+
class _TestIamPermissions(
|
|
2094
|
+
_BaseJobControllerRestTransport._BaseTestIamPermissions, JobControllerRestStub
|
|
2095
|
+
):
|
|
2096
|
+
def __hash__(self):
|
|
2097
|
+
return hash("JobControllerRestTransport.TestIamPermissions")
|
|
2098
|
+
|
|
2099
|
+
@staticmethod
|
|
2100
|
+
def _get_response(
|
|
2101
|
+
host,
|
|
2102
|
+
metadata,
|
|
2103
|
+
query_params,
|
|
2104
|
+
session,
|
|
2105
|
+
timeout,
|
|
2106
|
+
transcoded_request,
|
|
2107
|
+
body=None,
|
|
2108
|
+
):
|
|
2109
|
+
uri = transcoded_request["uri"]
|
|
2110
|
+
method = transcoded_request["method"]
|
|
2111
|
+
headers = dict(metadata)
|
|
2112
|
+
headers["Content-Type"] = "application/json"
|
|
2113
|
+
response = getattr(session, method)(
|
|
2114
|
+
"{host}{uri}".format(host=host, uri=uri),
|
|
2115
|
+
timeout=timeout,
|
|
2116
|
+
headers=headers,
|
|
2117
|
+
params=rest_helpers.flatten_query_params(query_params, strict=True),
|
|
2118
|
+
data=body,
|
|
2119
|
+
)
|
|
2120
|
+
return response
|
|
2121
|
+
|
|
2122
|
+
def __call__(
|
|
2123
|
+
self,
|
|
2124
|
+
request: iam_policy_pb2.TestIamPermissionsRequest,
|
|
2125
|
+
*,
|
|
2126
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
2127
|
+
timeout: Optional[float] = None,
|
|
2128
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
2129
|
+
) -> iam_policy_pb2.TestIamPermissionsResponse:
|
|
2130
|
+
r"""Call the test iam permissions method over HTTP.
|
|
2131
|
+
|
|
2132
|
+
Args:
|
|
2133
|
+
request (iam_policy_pb2.TestIamPermissionsRequest):
|
|
2134
|
+
The request object for TestIamPermissions method.
|
|
2135
|
+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
|
|
2136
|
+
should be retried.
|
|
2137
|
+
timeout (float): The timeout for this request.
|
|
2138
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
2139
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
2140
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
2141
|
+
be of type `bytes`.
|
|
2142
|
+
|
|
2143
|
+
Returns:
|
|
2144
|
+
iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method.
|
|
2145
|
+
"""
|
|
2146
|
+
|
|
2147
|
+
http_options = (
|
|
2148
|
+
_BaseJobControllerRestTransport._BaseTestIamPermissions._get_http_options()
|
|
2149
|
+
)
|
|
2150
|
+
|
|
2151
|
+
request, metadata = self._interceptor.pre_test_iam_permissions(
|
|
2152
|
+
request, metadata
|
|
2153
|
+
)
|
|
2154
|
+
transcoded_request = _BaseJobControllerRestTransport._BaseTestIamPermissions._get_transcoded_request(
|
|
2155
|
+
http_options, request
|
|
2156
|
+
)
|
|
2157
|
+
|
|
2158
|
+
body = _BaseJobControllerRestTransport._BaseTestIamPermissions._get_request_body_json(
|
|
2159
|
+
transcoded_request
|
|
2160
|
+
)
|
|
2161
|
+
|
|
2162
|
+
# Jsonify the query params
|
|
2163
|
+
query_params = _BaseJobControllerRestTransport._BaseTestIamPermissions._get_query_params_json(
|
|
2164
|
+
transcoded_request
|
|
2165
|
+
)
|
|
2166
|
+
|
|
2167
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
2168
|
+
logging.DEBUG
|
|
2169
|
+
): # pragma: NO COVER
|
|
2170
|
+
request_url = "{host}{uri}".format(
|
|
2171
|
+
host=self._host, uri=transcoded_request["uri"]
|
|
2172
|
+
)
|
|
2173
|
+
method = transcoded_request["method"]
|
|
2174
|
+
try:
|
|
2175
|
+
request_payload = json_format.MessageToJson(request)
|
|
2176
|
+
except:
|
|
2177
|
+
request_payload = None
|
|
2178
|
+
http_request = {
|
|
2179
|
+
"payload": request_payload,
|
|
2180
|
+
"requestMethod": method,
|
|
2181
|
+
"requestUrl": request_url,
|
|
2182
|
+
"headers": dict(metadata),
|
|
2183
|
+
}
|
|
2184
|
+
_LOGGER.debug(
|
|
2185
|
+
f"Sending request for google.cloud.dataproc_v1.JobControllerClient.TestIamPermissions",
|
|
2186
|
+
extra={
|
|
2187
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
2188
|
+
"rpcName": "TestIamPermissions",
|
|
2189
|
+
"httpRequest": http_request,
|
|
2190
|
+
"metadata": http_request["headers"],
|
|
2191
|
+
},
|
|
2192
|
+
)
|
|
2193
|
+
|
|
2194
|
+
# Send the request
|
|
2195
|
+
response = JobControllerRestTransport._TestIamPermissions._get_response(
|
|
2196
|
+
self._host,
|
|
2197
|
+
metadata,
|
|
2198
|
+
query_params,
|
|
2199
|
+
self._session,
|
|
2200
|
+
timeout,
|
|
2201
|
+
transcoded_request,
|
|
2202
|
+
body,
|
|
2203
|
+
)
|
|
2204
|
+
|
|
2205
|
+
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
|
|
2206
|
+
# subclass.
|
|
2207
|
+
if response.status_code >= 400:
|
|
2208
|
+
raise core_exceptions.from_http_response(response)
|
|
2209
|
+
|
|
2210
|
+
content = response.content.decode("utf-8")
|
|
2211
|
+
resp = iam_policy_pb2.TestIamPermissionsResponse()
|
|
2212
|
+
resp = json_format.Parse(content, resp)
|
|
2213
|
+
resp = self._interceptor.post_test_iam_permissions(resp)
|
|
2214
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
2215
|
+
logging.DEBUG
|
|
2216
|
+
): # pragma: NO COVER
|
|
2217
|
+
try:
|
|
2218
|
+
response_payload = json_format.MessageToJson(resp)
|
|
2219
|
+
except:
|
|
2220
|
+
response_payload = None
|
|
2221
|
+
http_response = {
|
|
2222
|
+
"payload": response_payload,
|
|
2223
|
+
"headers": dict(response.headers),
|
|
2224
|
+
"status": response.status_code,
|
|
2225
|
+
}
|
|
2226
|
+
_LOGGER.debug(
|
|
2227
|
+
"Received response for google.cloud.dataproc_v1.JobControllerAsyncClient.TestIamPermissions",
|
|
2228
|
+
extra={
|
|
2229
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
2230
|
+
"rpcName": "TestIamPermissions",
|
|
2231
|
+
"httpResponse": http_response,
|
|
2232
|
+
"metadata": http_response["headers"],
|
|
2233
|
+
},
|
|
2234
|
+
)
|
|
2235
|
+
return resp
|
|
2236
|
+
|
|
2237
|
+
@property
|
|
2238
|
+
def cancel_operation(self):
|
|
2239
|
+
return self._CancelOperation(self._session, self._host, self._interceptor) # type: ignore
|
|
2240
|
+
|
|
2241
|
+
class _CancelOperation(
|
|
2242
|
+
_BaseJobControllerRestTransport._BaseCancelOperation, JobControllerRestStub
|
|
2243
|
+
):
|
|
2244
|
+
def __hash__(self):
|
|
2245
|
+
return hash("JobControllerRestTransport.CancelOperation")
|
|
2246
|
+
|
|
2247
|
+
@staticmethod
|
|
2248
|
+
def _get_response(
|
|
2249
|
+
host,
|
|
2250
|
+
metadata,
|
|
2251
|
+
query_params,
|
|
2252
|
+
session,
|
|
2253
|
+
timeout,
|
|
2254
|
+
transcoded_request,
|
|
2255
|
+
body=None,
|
|
2256
|
+
):
|
|
2257
|
+
uri = transcoded_request["uri"]
|
|
2258
|
+
method = transcoded_request["method"]
|
|
2259
|
+
headers = dict(metadata)
|
|
2260
|
+
headers["Content-Type"] = "application/json"
|
|
2261
|
+
response = getattr(session, method)(
|
|
2262
|
+
"{host}{uri}".format(host=host, uri=uri),
|
|
2263
|
+
timeout=timeout,
|
|
2264
|
+
headers=headers,
|
|
2265
|
+
params=rest_helpers.flatten_query_params(query_params, strict=True),
|
|
2266
|
+
)
|
|
2267
|
+
return response
|
|
2268
|
+
|
|
2269
|
+
def __call__(
|
|
2270
|
+
self,
|
|
2271
|
+
request: operations_pb2.CancelOperationRequest,
|
|
2272
|
+
*,
|
|
2273
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
2274
|
+
timeout: Optional[float] = None,
|
|
2275
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
2276
|
+
) -> None:
|
|
2277
|
+
r"""Call the cancel operation method over HTTP.
|
|
2278
|
+
|
|
2279
|
+
Args:
|
|
2280
|
+
request (operations_pb2.CancelOperationRequest):
|
|
2281
|
+
The request object for CancelOperation method.
|
|
2282
|
+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
|
|
2283
|
+
should be retried.
|
|
2284
|
+
timeout (float): The timeout for this request.
|
|
2285
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
2286
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
2287
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
2288
|
+
be of type `bytes`.
|
|
2289
|
+
"""
|
|
2290
|
+
|
|
2291
|
+
http_options = (
|
|
2292
|
+
_BaseJobControllerRestTransport._BaseCancelOperation._get_http_options()
|
|
2293
|
+
)
|
|
2294
|
+
|
|
2295
|
+
request, metadata = self._interceptor.pre_cancel_operation(
|
|
2296
|
+
request, metadata
|
|
2297
|
+
)
|
|
2298
|
+
transcoded_request = _BaseJobControllerRestTransport._BaseCancelOperation._get_transcoded_request(
|
|
2299
|
+
http_options, request
|
|
2300
|
+
)
|
|
2301
|
+
|
|
2302
|
+
# Jsonify the query params
|
|
2303
|
+
query_params = _BaseJobControllerRestTransport._BaseCancelOperation._get_query_params_json(
|
|
2304
|
+
transcoded_request
|
|
2305
|
+
)
|
|
2306
|
+
|
|
2307
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
2308
|
+
logging.DEBUG
|
|
2309
|
+
): # pragma: NO COVER
|
|
2310
|
+
request_url = "{host}{uri}".format(
|
|
2311
|
+
host=self._host, uri=transcoded_request["uri"]
|
|
2312
|
+
)
|
|
2313
|
+
method = transcoded_request["method"]
|
|
2314
|
+
try:
|
|
2315
|
+
request_payload = json_format.MessageToJson(request)
|
|
2316
|
+
except:
|
|
2317
|
+
request_payload = None
|
|
2318
|
+
http_request = {
|
|
2319
|
+
"payload": request_payload,
|
|
2320
|
+
"requestMethod": method,
|
|
2321
|
+
"requestUrl": request_url,
|
|
2322
|
+
"headers": dict(metadata),
|
|
2323
|
+
}
|
|
2324
|
+
_LOGGER.debug(
|
|
2325
|
+
f"Sending request for google.cloud.dataproc_v1.JobControllerClient.CancelOperation",
|
|
2326
|
+
extra={
|
|
2327
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
2328
|
+
"rpcName": "CancelOperation",
|
|
2329
|
+
"httpRequest": http_request,
|
|
2330
|
+
"metadata": http_request["headers"],
|
|
2331
|
+
},
|
|
2332
|
+
)
|
|
2333
|
+
|
|
2334
|
+
# Send the request
|
|
2335
|
+
response = JobControllerRestTransport._CancelOperation._get_response(
|
|
2336
|
+
self._host,
|
|
2337
|
+
metadata,
|
|
2338
|
+
query_params,
|
|
2339
|
+
self._session,
|
|
2340
|
+
timeout,
|
|
2341
|
+
transcoded_request,
|
|
2342
|
+
)
|
|
2343
|
+
|
|
2344
|
+
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
|
|
2345
|
+
# subclass.
|
|
2346
|
+
if response.status_code >= 400:
|
|
2347
|
+
raise core_exceptions.from_http_response(response)
|
|
2348
|
+
|
|
2349
|
+
return self._interceptor.post_cancel_operation(None)
|
|
2350
|
+
|
|
2351
|
+
@property
|
|
2352
|
+
def delete_operation(self):
|
|
2353
|
+
return self._DeleteOperation(self._session, self._host, self._interceptor) # type: ignore
|
|
2354
|
+
|
|
2355
|
+
class _DeleteOperation(
|
|
2356
|
+
_BaseJobControllerRestTransport._BaseDeleteOperation, JobControllerRestStub
|
|
2357
|
+
):
|
|
2358
|
+
def __hash__(self):
|
|
2359
|
+
return hash("JobControllerRestTransport.DeleteOperation")
|
|
2360
|
+
|
|
2361
|
+
@staticmethod
|
|
2362
|
+
def _get_response(
|
|
2363
|
+
host,
|
|
2364
|
+
metadata,
|
|
2365
|
+
query_params,
|
|
2366
|
+
session,
|
|
2367
|
+
timeout,
|
|
2368
|
+
transcoded_request,
|
|
2369
|
+
body=None,
|
|
2370
|
+
):
|
|
2371
|
+
uri = transcoded_request["uri"]
|
|
2372
|
+
method = transcoded_request["method"]
|
|
2373
|
+
headers = dict(metadata)
|
|
2374
|
+
headers["Content-Type"] = "application/json"
|
|
2375
|
+
response = getattr(session, method)(
|
|
2376
|
+
"{host}{uri}".format(host=host, uri=uri),
|
|
2377
|
+
timeout=timeout,
|
|
2378
|
+
headers=headers,
|
|
2379
|
+
params=rest_helpers.flatten_query_params(query_params, strict=True),
|
|
2380
|
+
)
|
|
2381
|
+
return response
|
|
2382
|
+
|
|
2383
|
+
def __call__(
|
|
2384
|
+
self,
|
|
2385
|
+
request: operations_pb2.DeleteOperationRequest,
|
|
2386
|
+
*,
|
|
2387
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
2388
|
+
timeout: Optional[float] = None,
|
|
2389
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
2390
|
+
) -> None:
|
|
2391
|
+
r"""Call the delete operation method over HTTP.
|
|
2392
|
+
|
|
2393
|
+
Args:
|
|
2394
|
+
request (operations_pb2.DeleteOperationRequest):
|
|
2395
|
+
The request object for DeleteOperation method.
|
|
2396
|
+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
|
|
2397
|
+
should be retried.
|
|
2398
|
+
timeout (float): The timeout for this request.
|
|
2399
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
2400
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
2401
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
2402
|
+
be of type `bytes`.
|
|
2403
|
+
"""
|
|
2404
|
+
|
|
2405
|
+
http_options = (
|
|
2406
|
+
_BaseJobControllerRestTransport._BaseDeleteOperation._get_http_options()
|
|
2407
|
+
)
|
|
2408
|
+
|
|
2409
|
+
request, metadata = self._interceptor.pre_delete_operation(
|
|
2410
|
+
request, metadata
|
|
2411
|
+
)
|
|
2412
|
+
transcoded_request = _BaseJobControllerRestTransport._BaseDeleteOperation._get_transcoded_request(
|
|
2413
|
+
http_options, request
|
|
2414
|
+
)
|
|
2415
|
+
|
|
2416
|
+
# Jsonify the query params
|
|
2417
|
+
query_params = _BaseJobControllerRestTransport._BaseDeleteOperation._get_query_params_json(
|
|
2418
|
+
transcoded_request
|
|
2419
|
+
)
|
|
2420
|
+
|
|
2421
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
2422
|
+
logging.DEBUG
|
|
2423
|
+
): # pragma: NO COVER
|
|
2424
|
+
request_url = "{host}{uri}".format(
|
|
2425
|
+
host=self._host, uri=transcoded_request["uri"]
|
|
2426
|
+
)
|
|
2427
|
+
method = transcoded_request["method"]
|
|
2428
|
+
try:
|
|
2429
|
+
request_payload = json_format.MessageToJson(request)
|
|
2430
|
+
except:
|
|
2431
|
+
request_payload = None
|
|
2432
|
+
http_request = {
|
|
2433
|
+
"payload": request_payload,
|
|
2434
|
+
"requestMethod": method,
|
|
2435
|
+
"requestUrl": request_url,
|
|
2436
|
+
"headers": dict(metadata),
|
|
2437
|
+
}
|
|
2438
|
+
_LOGGER.debug(
|
|
2439
|
+
f"Sending request for google.cloud.dataproc_v1.JobControllerClient.DeleteOperation",
|
|
2440
|
+
extra={
|
|
2441
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
2442
|
+
"rpcName": "DeleteOperation",
|
|
2443
|
+
"httpRequest": http_request,
|
|
2444
|
+
"metadata": http_request["headers"],
|
|
2445
|
+
},
|
|
2446
|
+
)
|
|
2447
|
+
|
|
2448
|
+
# Send the request
|
|
2449
|
+
response = JobControllerRestTransport._DeleteOperation._get_response(
|
|
2450
|
+
self._host,
|
|
2451
|
+
metadata,
|
|
2452
|
+
query_params,
|
|
2453
|
+
self._session,
|
|
2454
|
+
timeout,
|
|
2455
|
+
transcoded_request,
|
|
2456
|
+
)
|
|
2457
|
+
|
|
2458
|
+
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
|
|
2459
|
+
# subclass.
|
|
2460
|
+
if response.status_code >= 400:
|
|
2461
|
+
raise core_exceptions.from_http_response(response)
|
|
2462
|
+
|
|
2463
|
+
return self._interceptor.post_delete_operation(None)
|
|
2464
|
+
|
|
2465
|
+
@property
|
|
2466
|
+
def get_operation(self):
|
|
2467
|
+
return self._GetOperation(self._session, self._host, self._interceptor) # type: ignore
|
|
2468
|
+
|
|
2469
|
+
class _GetOperation(
|
|
2470
|
+
_BaseJobControllerRestTransport._BaseGetOperation, JobControllerRestStub
|
|
2471
|
+
):
|
|
2472
|
+
def __hash__(self):
|
|
2473
|
+
return hash("JobControllerRestTransport.GetOperation")
|
|
2474
|
+
|
|
2475
|
+
@staticmethod
|
|
2476
|
+
def _get_response(
|
|
2477
|
+
host,
|
|
2478
|
+
metadata,
|
|
2479
|
+
query_params,
|
|
2480
|
+
session,
|
|
2481
|
+
timeout,
|
|
2482
|
+
transcoded_request,
|
|
2483
|
+
body=None,
|
|
2484
|
+
):
|
|
2485
|
+
uri = transcoded_request["uri"]
|
|
2486
|
+
method = transcoded_request["method"]
|
|
2487
|
+
headers = dict(metadata)
|
|
2488
|
+
headers["Content-Type"] = "application/json"
|
|
2489
|
+
response = getattr(session, method)(
|
|
2490
|
+
"{host}{uri}".format(host=host, uri=uri),
|
|
2491
|
+
timeout=timeout,
|
|
2492
|
+
headers=headers,
|
|
2493
|
+
params=rest_helpers.flatten_query_params(query_params, strict=True),
|
|
2494
|
+
)
|
|
2495
|
+
return response
|
|
2496
|
+
|
|
2497
|
+
def __call__(
|
|
2498
|
+
self,
|
|
2499
|
+
request: operations_pb2.GetOperationRequest,
|
|
2500
|
+
*,
|
|
2501
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
2502
|
+
timeout: Optional[float] = None,
|
|
2503
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
2504
|
+
) -> operations_pb2.Operation:
|
|
2505
|
+
r"""Call the get operation method over HTTP.
|
|
2506
|
+
|
|
2507
|
+
Args:
|
|
2508
|
+
request (operations_pb2.GetOperationRequest):
|
|
2509
|
+
The request object for GetOperation method.
|
|
2510
|
+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
|
|
2511
|
+
should be retried.
|
|
2512
|
+
timeout (float): The timeout for this request.
|
|
2513
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
2514
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
2515
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
2516
|
+
be of type `bytes`.
|
|
2517
|
+
|
|
2518
|
+
Returns:
|
|
2519
|
+
operations_pb2.Operation: Response from GetOperation method.
|
|
2520
|
+
"""
|
|
2521
|
+
|
|
2522
|
+
http_options = (
|
|
2523
|
+
_BaseJobControllerRestTransport._BaseGetOperation._get_http_options()
|
|
2524
|
+
)
|
|
2525
|
+
|
|
2526
|
+
request, metadata = self._interceptor.pre_get_operation(request, metadata)
|
|
2527
|
+
transcoded_request = _BaseJobControllerRestTransport._BaseGetOperation._get_transcoded_request(
|
|
2528
|
+
http_options, request
|
|
2529
|
+
)
|
|
2530
|
+
|
|
2531
|
+
# Jsonify the query params
|
|
2532
|
+
query_params = _BaseJobControllerRestTransport._BaseGetOperation._get_query_params_json(
|
|
2533
|
+
transcoded_request
|
|
2534
|
+
)
|
|
2535
|
+
|
|
2536
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
2537
|
+
logging.DEBUG
|
|
2538
|
+
): # pragma: NO COVER
|
|
2539
|
+
request_url = "{host}{uri}".format(
|
|
2540
|
+
host=self._host, uri=transcoded_request["uri"]
|
|
2541
|
+
)
|
|
2542
|
+
method = transcoded_request["method"]
|
|
2543
|
+
try:
|
|
2544
|
+
request_payload = json_format.MessageToJson(request)
|
|
2545
|
+
except:
|
|
2546
|
+
request_payload = None
|
|
2547
|
+
http_request = {
|
|
2548
|
+
"payload": request_payload,
|
|
2549
|
+
"requestMethod": method,
|
|
2550
|
+
"requestUrl": request_url,
|
|
2551
|
+
"headers": dict(metadata),
|
|
2552
|
+
}
|
|
2553
|
+
_LOGGER.debug(
|
|
2554
|
+
f"Sending request for google.cloud.dataproc_v1.JobControllerClient.GetOperation",
|
|
2555
|
+
extra={
|
|
2556
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
2557
|
+
"rpcName": "GetOperation",
|
|
2558
|
+
"httpRequest": http_request,
|
|
2559
|
+
"metadata": http_request["headers"],
|
|
2560
|
+
},
|
|
2561
|
+
)
|
|
2562
|
+
|
|
2563
|
+
# Send the request
|
|
2564
|
+
response = JobControllerRestTransport._GetOperation._get_response(
|
|
2565
|
+
self._host,
|
|
2566
|
+
metadata,
|
|
2567
|
+
query_params,
|
|
2568
|
+
self._session,
|
|
2569
|
+
timeout,
|
|
2570
|
+
transcoded_request,
|
|
2571
|
+
)
|
|
2572
|
+
|
|
2573
|
+
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
|
|
2574
|
+
# subclass.
|
|
2575
|
+
if response.status_code >= 400:
|
|
2576
|
+
raise core_exceptions.from_http_response(response)
|
|
2577
|
+
|
|
2578
|
+
content = response.content.decode("utf-8")
|
|
2579
|
+
resp = operations_pb2.Operation()
|
|
2580
|
+
resp = json_format.Parse(content, resp)
|
|
2581
|
+
resp = self._interceptor.post_get_operation(resp)
|
|
2582
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
2583
|
+
logging.DEBUG
|
|
2584
|
+
): # pragma: NO COVER
|
|
2585
|
+
try:
|
|
2586
|
+
response_payload = json_format.MessageToJson(resp)
|
|
2587
|
+
except:
|
|
2588
|
+
response_payload = None
|
|
2589
|
+
http_response = {
|
|
2590
|
+
"payload": response_payload,
|
|
2591
|
+
"headers": dict(response.headers),
|
|
2592
|
+
"status": response.status_code,
|
|
2593
|
+
}
|
|
2594
|
+
_LOGGER.debug(
|
|
2595
|
+
"Received response for google.cloud.dataproc_v1.JobControllerAsyncClient.GetOperation",
|
|
2596
|
+
extra={
|
|
2597
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
2598
|
+
"rpcName": "GetOperation",
|
|
2599
|
+
"httpResponse": http_response,
|
|
2600
|
+
"metadata": http_response["headers"],
|
|
2601
|
+
},
|
|
2602
|
+
)
|
|
2603
|
+
return resp
|
|
2604
|
+
|
|
2605
|
+
@property
|
|
2606
|
+
def list_operations(self):
|
|
2607
|
+
return self._ListOperations(self._session, self._host, self._interceptor) # type: ignore
|
|
2608
|
+
|
|
2609
|
+
class _ListOperations(
|
|
2610
|
+
_BaseJobControllerRestTransport._BaseListOperations, JobControllerRestStub
|
|
2611
|
+
):
|
|
2612
|
+
def __hash__(self):
|
|
2613
|
+
return hash("JobControllerRestTransport.ListOperations")
|
|
2614
|
+
|
|
2615
|
+
@staticmethod
|
|
2616
|
+
def _get_response(
|
|
2617
|
+
host,
|
|
2618
|
+
metadata,
|
|
2619
|
+
query_params,
|
|
2620
|
+
session,
|
|
2621
|
+
timeout,
|
|
2622
|
+
transcoded_request,
|
|
2623
|
+
body=None,
|
|
2624
|
+
):
|
|
2625
|
+
uri = transcoded_request["uri"]
|
|
2626
|
+
method = transcoded_request["method"]
|
|
2627
|
+
headers = dict(metadata)
|
|
2628
|
+
headers["Content-Type"] = "application/json"
|
|
2629
|
+
response = getattr(session, method)(
|
|
2630
|
+
"{host}{uri}".format(host=host, uri=uri),
|
|
2631
|
+
timeout=timeout,
|
|
2632
|
+
headers=headers,
|
|
2633
|
+
params=rest_helpers.flatten_query_params(query_params, strict=True),
|
|
2634
|
+
)
|
|
2635
|
+
return response
|
|
2636
|
+
|
|
2637
|
+
def __call__(
|
|
2638
|
+
self,
|
|
2639
|
+
request: operations_pb2.ListOperationsRequest,
|
|
2640
|
+
*,
|
|
2641
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
2642
|
+
timeout: Optional[float] = None,
|
|
2643
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
2644
|
+
) -> operations_pb2.ListOperationsResponse:
|
|
2645
|
+
r"""Call the list operations method over HTTP.
|
|
2646
|
+
|
|
2647
|
+
Args:
|
|
2648
|
+
request (operations_pb2.ListOperationsRequest):
|
|
2649
|
+
The request object for ListOperations method.
|
|
2650
|
+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
|
|
2651
|
+
should be retried.
|
|
2652
|
+
timeout (float): The timeout for this request.
|
|
2653
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
2654
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
2655
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
2656
|
+
be of type `bytes`.
|
|
2657
|
+
|
|
2658
|
+
Returns:
|
|
2659
|
+
operations_pb2.ListOperationsResponse: Response from ListOperations method.
|
|
2660
|
+
"""
|
|
2661
|
+
|
|
2662
|
+
http_options = (
|
|
2663
|
+
_BaseJobControllerRestTransport._BaseListOperations._get_http_options()
|
|
2664
|
+
)
|
|
2665
|
+
|
|
2666
|
+
request, metadata = self._interceptor.pre_list_operations(request, metadata)
|
|
2667
|
+
transcoded_request = _BaseJobControllerRestTransport._BaseListOperations._get_transcoded_request(
|
|
2668
|
+
http_options, request
|
|
2669
|
+
)
|
|
2670
|
+
|
|
2671
|
+
# Jsonify the query params
|
|
2672
|
+
query_params = _BaseJobControllerRestTransport._BaseListOperations._get_query_params_json(
|
|
2673
|
+
transcoded_request
|
|
2674
|
+
)
|
|
2675
|
+
|
|
2676
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
2677
|
+
logging.DEBUG
|
|
2678
|
+
): # pragma: NO COVER
|
|
2679
|
+
request_url = "{host}{uri}".format(
|
|
2680
|
+
host=self._host, uri=transcoded_request["uri"]
|
|
2681
|
+
)
|
|
2682
|
+
method = transcoded_request["method"]
|
|
2683
|
+
try:
|
|
2684
|
+
request_payload = json_format.MessageToJson(request)
|
|
2685
|
+
except:
|
|
2686
|
+
request_payload = None
|
|
2687
|
+
http_request = {
|
|
2688
|
+
"payload": request_payload,
|
|
2689
|
+
"requestMethod": method,
|
|
2690
|
+
"requestUrl": request_url,
|
|
2691
|
+
"headers": dict(metadata),
|
|
2692
|
+
}
|
|
2693
|
+
_LOGGER.debug(
|
|
2694
|
+
f"Sending request for google.cloud.dataproc_v1.JobControllerClient.ListOperations",
|
|
2695
|
+
extra={
|
|
2696
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
2697
|
+
"rpcName": "ListOperations",
|
|
2698
|
+
"httpRequest": http_request,
|
|
2699
|
+
"metadata": http_request["headers"],
|
|
2700
|
+
},
|
|
2701
|
+
)
|
|
2702
|
+
|
|
2703
|
+
# Send the request
|
|
2704
|
+
response = JobControllerRestTransport._ListOperations._get_response(
|
|
2705
|
+
self._host,
|
|
2706
|
+
metadata,
|
|
2707
|
+
query_params,
|
|
2708
|
+
self._session,
|
|
2709
|
+
timeout,
|
|
2710
|
+
transcoded_request,
|
|
2711
|
+
)
|
|
2712
|
+
|
|
2713
|
+
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
|
|
2714
|
+
# subclass.
|
|
2715
|
+
if response.status_code >= 400:
|
|
2716
|
+
raise core_exceptions.from_http_response(response)
|
|
2717
|
+
|
|
2718
|
+
content = response.content.decode("utf-8")
|
|
2719
|
+
resp = operations_pb2.ListOperationsResponse()
|
|
2720
|
+
resp = json_format.Parse(content, resp)
|
|
2721
|
+
resp = self._interceptor.post_list_operations(resp)
|
|
2722
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
2723
|
+
logging.DEBUG
|
|
2724
|
+
): # pragma: NO COVER
|
|
2725
|
+
try:
|
|
2726
|
+
response_payload = json_format.MessageToJson(resp)
|
|
2727
|
+
except:
|
|
2728
|
+
response_payload = None
|
|
2729
|
+
http_response = {
|
|
2730
|
+
"payload": response_payload,
|
|
2731
|
+
"headers": dict(response.headers),
|
|
2732
|
+
"status": response.status_code,
|
|
2733
|
+
}
|
|
2734
|
+
_LOGGER.debug(
|
|
2735
|
+
"Received response for google.cloud.dataproc_v1.JobControllerAsyncClient.ListOperations",
|
|
2736
|
+
extra={
|
|
2737
|
+
"serviceName": "google.cloud.dataproc.v1.JobController",
|
|
2738
|
+
"rpcName": "ListOperations",
|
|
2739
|
+
"httpResponse": http_response,
|
|
2740
|
+
"metadata": http_response["headers"],
|
|
2741
|
+
},
|
|
2742
|
+
)
|
|
2743
|
+
return resp
|
|
2744
|
+
|
|
2745
|
+
@property
|
|
2746
|
+
def kind(self) -> str:
|
|
2747
|
+
return "rest"
|
|
2748
|
+
|
|
2749
|
+
def close(self):
|
|
2750
|
+
self._session.close()
|
|
2751
|
+
|
|
2752
|
+
|
|
2753
|
+
__all__ = ("JobControllerRestTransport",)
|