1 | <?php
|
---|
2 | /*
|
---|
3 | * Copyright 2014 Google Inc.
|
---|
4 | *
|
---|
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
7 | * the License at
|
---|
8 | *
|
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 | *
|
---|
11 | * Unless required by applicable law or agreed to in writing, software
|
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
14 | * License for the specific language governing permissions and limitations under
|
---|
15 | * the License.
|
---|
16 | */
|
---|
17 |
|
---|
18 | namespace Google\Service\Dataproc\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Dataproc\Cluster;
|
---|
21 | use Google\Service\Dataproc\DiagnoseClusterRequest;
|
---|
22 | use Google\Service\Dataproc\GetIamPolicyRequest;
|
---|
23 | use Google\Service\Dataproc\InjectCredentialsRequest;
|
---|
24 | use Google\Service\Dataproc\ListClustersResponse;
|
---|
25 | use Google\Service\Dataproc\Operation;
|
---|
26 | use Google\Service\Dataproc\Policy;
|
---|
27 | use Google\Service\Dataproc\RepairClusterRequest;
|
---|
28 | use Google\Service\Dataproc\SetIamPolicyRequest;
|
---|
29 | use Google\Service\Dataproc\StartClusterRequest;
|
---|
30 | use Google\Service\Dataproc\StopClusterRequest;
|
---|
31 | use Google\Service\Dataproc\TestIamPermissionsRequest;
|
---|
32 | use Google\Service\Dataproc\TestIamPermissionsResponse;
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * The "clusters" collection of methods.
|
---|
36 | * Typical usage is:
|
---|
37 | * <code>
|
---|
38 | * $dataprocService = new Google\Service\Dataproc(...);
|
---|
39 | * $clusters = $dataprocService->projects_regions_clusters;
|
---|
40 | * </code>
|
---|
41 | */
|
---|
42 | class ProjectsRegionsClusters extends \Google\Service\Resource
|
---|
43 | {
|
---|
44 | /**
|
---|
45 | * Creates a cluster in a project. The returned Operation.metadata will be
|
---|
46 | * ClusterOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rp
|
---|
47 | * c/google.cloud.dataproc.v1#clusteroperationmetadata). (clusters.create)
|
---|
48 | *
|
---|
49 | * @param string $projectId Required. The ID of the Google Cloud Platform
|
---|
50 | * project that the cluster belongs to.
|
---|
51 | * @param string $region Required. The Dataproc region in which to handle the
|
---|
52 | * request.
|
---|
53 | * @param Cluster $postBody
|
---|
54 | * @param array $optParams Optional parameters.
|
---|
55 | *
|
---|
56 | * @opt_param string actionOnFailedPrimaryWorkers Optional. Failure action when
|
---|
57 | * primary worker creation fails.
|
---|
58 | * @opt_param string requestId Optional. A unique ID used to identify the
|
---|
59 | * request. If the server receives two CreateClusterRequest (https://cloud.googl
|
---|
60 | * e.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.datap
|
---|
61 | * roc.v1.CreateClusterRequest)s with the same id, then the second request will
|
---|
62 | * be ignored and the first google.longrunning.Operation created and stored in
|
---|
63 | * the backend is returned.It is recommended to always set this value to a UUID
|
---|
64 | * (https://en.wikipedia.org/wiki/Universally_unique_identifier).The ID must
|
---|
65 | * contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens
|
---|
66 | * (-). The maximum length is 40 characters.
|
---|
67 | * @return Operation
|
---|
68 | * @throws \Google\Service\Exception
|
---|
69 | */
|
---|
70 | public function create($projectId, $region, Cluster $postBody, $optParams = [])
|
---|
71 | {
|
---|
72 | $params = ['projectId' => $projectId, 'region' => $region, 'postBody' => $postBody];
|
---|
73 | $params = array_merge($params, $optParams);
|
---|
74 | return $this->call('create', [$params], Operation::class);
|
---|
75 | }
|
---|
76 | /**
|
---|
77 | * Deletes a cluster in a project. The returned Operation.metadata will be
|
---|
78 | * ClusterOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rp
|
---|
79 | * c/google.cloud.dataproc.v1#clusteroperationmetadata). (clusters.delete)
|
---|
80 | *
|
---|
81 | * @param string $projectId Required. The ID of the Google Cloud Platform
|
---|
82 | * project that the cluster belongs to.
|
---|
83 | * @param string $region Required. The Dataproc region in which to handle the
|
---|
84 | * request.
|
---|
85 | * @param string $clusterName Required. The cluster name.
|
---|
86 | * @param array $optParams Optional parameters.
|
---|
87 | *
|
---|
88 | * @opt_param string clusterUuid Optional. Specifying the cluster_uuid means the
|
---|
89 | * RPC should fail (with error NOT_FOUND) if cluster with specified UUID does
|
---|
90 | * not exist.
|
---|
91 | * @opt_param string gracefulTerminationTimeout Optional. The graceful
|
---|
92 | * termination timeout for the deletion of the cluster. Indicate the time the
|
---|
93 | * request will wait to complete the running jobs on the cluster before its
|
---|
94 | * forceful deletion. Default value is 0 indicating that the user has not
|
---|
95 | * enabled the graceful termination. Value can be between 60 second and 6 Hours,
|
---|
96 | * in case the graceful termination is enabled. (There is no separate flag to
|
---|
97 | * check the enabling or disabling of graceful termination, it can be checked by
|
---|
98 | * the values in the field).
|
---|
99 | * @opt_param string requestId Optional. A unique ID used to identify the
|
---|
100 | * request. If the server receives two DeleteClusterRequest (https://cloud.googl
|
---|
101 | * e.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.datap
|
---|
102 | * roc.v1.DeleteClusterRequest)s with the same id, then the second request will
|
---|
103 | * be ignored and the first google.longrunning.Operation created and stored in
|
---|
104 | * the backend is returned.It is recommended to always set this value to a UUID
|
---|
105 | * (https://en.wikipedia.org/wiki/Universally_unique_identifier).The ID must
|
---|
106 | * contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens
|
---|
107 | * (-). The maximum length is 40 characters.
|
---|
108 | * @return Operation
|
---|
109 | * @throws \Google\Service\Exception
|
---|
110 | */
|
---|
111 | public function delete($projectId, $region, $clusterName, $optParams = [])
|
---|
112 | {
|
---|
113 | $params = ['projectId' => $projectId, 'region' => $region, 'clusterName' => $clusterName];
|
---|
114 | $params = array_merge($params, $optParams);
|
---|
115 | return $this->call('delete', [$params], Operation::class);
|
---|
116 | }
|
---|
117 | /**
|
---|
118 | * Gets cluster diagnostic information. The returned Operation.metadata will be
|
---|
119 | * ClusterOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rp
|
---|
120 | * c/google.cloud.dataproc.v1#clusteroperationmetadata). After the operation
|
---|
121 | * completes, Operation.response contains DiagnoseClusterResults (https://cloud.
|
---|
122 | * google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclust
|
---|
123 | * erresults). (clusters.diagnose)
|
---|
124 | *
|
---|
125 | * @param string $projectId Required. The ID of the Google Cloud Platform
|
---|
126 | * project that the cluster belongs to.
|
---|
127 | * @param string $region Required. The Dataproc region in which to handle the
|
---|
128 | * request.
|
---|
129 | * @param string $clusterName Required. The cluster name.
|
---|
130 | * @param DiagnoseClusterRequest $postBody
|
---|
131 | * @param array $optParams Optional parameters.
|
---|
132 | * @return Operation
|
---|
133 | * @throws \Google\Service\Exception
|
---|
134 | */
|
---|
135 | public function diagnose($projectId, $region, $clusterName, DiagnoseClusterRequest $postBody, $optParams = [])
|
---|
136 | {
|
---|
137 | $params = ['projectId' => $projectId, 'region' => $region, 'clusterName' => $clusterName, 'postBody' => $postBody];
|
---|
138 | $params = array_merge($params, $optParams);
|
---|
139 | return $this->call('diagnose', [$params], Operation::class);
|
---|
140 | }
|
---|
141 | /**
|
---|
142 | * Gets the resource representation for a cluster in a project. (clusters.get)
|
---|
143 | *
|
---|
144 | * @param string $projectId Required. The ID of the Google Cloud Platform
|
---|
145 | * project that the cluster belongs to.
|
---|
146 | * @param string $region Required. The Dataproc region in which to handle the
|
---|
147 | * request.
|
---|
148 | * @param string $clusterName Required. The cluster name.
|
---|
149 | * @param array $optParams Optional parameters.
|
---|
150 | * @return Cluster
|
---|
151 | * @throws \Google\Service\Exception
|
---|
152 | */
|
---|
153 | public function get($projectId, $region, $clusterName, $optParams = [])
|
---|
154 | {
|
---|
155 | $params = ['projectId' => $projectId, 'region' => $region, 'clusterName' => $clusterName];
|
---|
156 | $params = array_merge($params, $optParams);
|
---|
157 | return $this->call('get', [$params], Cluster::class);
|
---|
158 | }
|
---|
159 | /**
|
---|
160 | * Gets the access control policy for a resource. Returns an empty policy if the
|
---|
161 | * resource exists and does not have a policy set. (clusters.getIamPolicy)
|
---|
162 | *
|
---|
163 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
164 | * requested. See Resource names
|
---|
165 | * (https://cloud.google.com/apis/design/resource_names) for the appropriate
|
---|
166 | * value for this field.
|
---|
167 | * @param GetIamPolicyRequest $postBody
|
---|
168 | * @param array $optParams Optional parameters.
|
---|
169 | * @return Policy
|
---|
170 | * @throws \Google\Service\Exception
|
---|
171 | */
|
---|
172 | public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
|
---|
173 | {
|
---|
174 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
175 | $params = array_merge($params, $optParams);
|
---|
176 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
177 | }
|
---|
178 | /**
|
---|
179 | * Inject encrypted credentials into all of the VMs in a cluster.The target
|
---|
180 | * cluster must be a personal auth cluster assigned to the user who is issuing
|
---|
181 | * the RPC. (clusters.injectCredentials)
|
---|
182 | *
|
---|
183 | * @param string $project Required. The ID of the Google Cloud Platform project
|
---|
184 | * the cluster belongs to, of the form projects/.
|
---|
185 | * @param string $region Required. The region containing the cluster, of the
|
---|
186 | * form regions/.
|
---|
187 | * @param string $cluster Required. The cluster, in the form clusters/.
|
---|
188 | * @param InjectCredentialsRequest $postBody
|
---|
189 | * @param array $optParams Optional parameters.
|
---|
190 | * @return Operation
|
---|
191 | * @throws \Google\Service\Exception
|
---|
192 | */
|
---|
193 | public function injectCredentials($project, $region, $cluster, InjectCredentialsRequest $postBody, $optParams = [])
|
---|
194 | {
|
---|
195 | $params = ['project' => $project, 'region' => $region, 'cluster' => $cluster, 'postBody' => $postBody];
|
---|
196 | $params = array_merge($params, $optParams);
|
---|
197 | return $this->call('injectCredentials', [$params], Operation::class);
|
---|
198 | }
|
---|
199 | /**
|
---|
200 | * Lists all regions/{region}/clusters in a project alphabetically.
|
---|
201 | * (clusters.listProjectsRegionsClusters)
|
---|
202 | *
|
---|
203 | * @param string $projectId Required. The ID of the Google Cloud Platform
|
---|
204 | * project that the cluster belongs to.
|
---|
205 | * @param string $region Required. The Dataproc region in which to handle the
|
---|
206 | * request.
|
---|
207 | * @param array $optParams Optional parameters.
|
---|
208 | *
|
---|
209 | * @opt_param string filter Optional. A filter constraining the clusters to
|
---|
210 | * list. Filters are case-sensitive and have the following syntax:field = value
|
---|
211 | * AND field = value ...where field is one of status.state, clusterName, or
|
---|
212 | * labels.[KEY], and [KEY] is a label key. value can be * to match all values.
|
---|
213 | * status.state can be one of the following: ACTIVE, INACTIVE, CREATING,
|
---|
214 | * RUNNING, ERROR, DELETING, UPDATING, STOPPING, or STOPPED. ACTIVE contains the
|
---|
215 | * CREATING, UPDATING, and RUNNING states. INACTIVE contains the DELETING,
|
---|
216 | * ERROR, STOPPING, and STOPPED states. clusterName is the name of the cluster
|
---|
217 | * provided at creation time. Only the logical AND operator is supported; space-
|
---|
218 | * separated items are treated as having an implicit AND operator.Example
|
---|
219 | * filter:status.state = ACTIVE AND clusterName = mycluster AND labels.env =
|
---|
220 | * staging AND labels.starred = *
|
---|
221 | * @opt_param int pageSize Optional. The standard List page size.
|
---|
222 | * @opt_param string pageToken Optional. The standard List page token.
|
---|
223 | * @return ListClustersResponse
|
---|
224 | * @throws \Google\Service\Exception
|
---|
225 | */
|
---|
226 | public function listProjectsRegionsClusters($projectId, $region, $optParams = [])
|
---|
227 | {
|
---|
228 | $params = ['projectId' => $projectId, 'region' => $region];
|
---|
229 | $params = array_merge($params, $optParams);
|
---|
230 | return $this->call('list', [$params], ListClustersResponse::class);
|
---|
231 | }
|
---|
232 | /**
|
---|
233 | * Updates a cluster in a project. The returned Operation.metadata will be
|
---|
234 | * ClusterOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rp
|
---|
235 | * c/google.cloud.dataproc.v1#clusteroperationmetadata). The cluster must be in
|
---|
236 | * a RUNNING state or an error is returned. (clusters.patch)
|
---|
237 | *
|
---|
238 | * @param string $projectId Required. The ID of the Google Cloud Platform
|
---|
239 | * project the cluster belongs to.
|
---|
240 | * @param string $region Required. The Dataproc region in which to handle the
|
---|
241 | * request.
|
---|
242 | * @param string $clusterName Required. The cluster name.
|
---|
243 | * @param Cluster $postBody
|
---|
244 | * @param array $optParams Optional parameters.
|
---|
245 | *
|
---|
246 | * @opt_param string gracefulDecommissionTimeout Optional. Timeout for graceful
|
---|
247 | * YARN decommissioning. Graceful decommissioning allows removing nodes from the
|
---|
248 | * cluster without interrupting jobs in progress. Timeout specifies how long to
|
---|
249 | * wait for jobs in progress to finish before forcefully removing nodes (and
|
---|
250 | * potentially interrupting jobs). Default timeout is 0 (for forceful
|
---|
251 | * decommission), and the maximum allowed timeout is 1 day. (see JSON
|
---|
252 | * representation of Duration (https://developers.google.com/protocol-
|
---|
253 | * buffers/docs/proto3#json)).Only supported on Dataproc image versions 1.2 and
|
---|
254 | * higher.
|
---|
255 | * @opt_param string requestId Optional. A unique ID used to identify the
|
---|
256 | * request. If the server receives two UpdateClusterRequest (https://cloud.googl
|
---|
257 | * e.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.datap
|
---|
258 | * roc.v1.UpdateClusterRequest)s with the same id, then the second request will
|
---|
259 | * be ignored and the first google.longrunning.Operation created and stored in
|
---|
260 | * the backend is returned.It is recommended to always set this value to a UUID
|
---|
261 | * (https://en.wikipedia.org/wiki/Universally_unique_identifier).The ID must
|
---|
262 | * contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens
|
---|
263 | * (-). The maximum length is 40 characters.
|
---|
264 | * @opt_param string updateMask Required. Specifies the path, relative to
|
---|
265 | * Cluster, of the field to update. For example, to change the number of workers
|
---|
266 | * in a cluster to 5, the update_mask parameter would be specified as
|
---|
267 | * config.worker_config.num_instances, and the PATCH request body would specify
|
---|
268 | * the new value, as follows: { "config":{ "workerConfig":{ "numInstances":"5" }
|
---|
269 | * } } Similarly, to change the number of preemptible workers in a cluster to 5,
|
---|
270 | * the update_mask parameter would be
|
---|
271 | * config.secondary_worker_config.num_instances, and the PATCH request body
|
---|
272 | * would be set as follows: { "config":{ "secondaryWorkerConfig":{
|
---|
273 | * "numInstances":"5" } } } *Note:* Currently, only the following fields can be
|
---|
274 | * updated: *Mask* *Purpose* *labels* Update labels
|
---|
275 | * *config.worker_config.num_instances* Resize primary worker group
|
---|
276 | * *config.secondary_worker_config.num_instances* Resize secondary worker group
|
---|
277 | * config.autoscaling_config.policy_uri Use, stop using, or change autoscaling
|
---|
278 | * policies
|
---|
279 | * @return Operation
|
---|
280 | * @throws \Google\Service\Exception
|
---|
281 | */
|
---|
282 | public function patch($projectId, $region, $clusterName, Cluster $postBody, $optParams = [])
|
---|
283 | {
|
---|
284 | $params = ['projectId' => $projectId, 'region' => $region, 'clusterName' => $clusterName, 'postBody' => $postBody];
|
---|
285 | $params = array_merge($params, $optParams);
|
---|
286 | return $this->call('patch', [$params], Operation::class);
|
---|
287 | }
|
---|
288 | /**
|
---|
289 | * Repairs a cluster. (clusters.repair)
|
---|
290 | *
|
---|
291 | * @param string $projectId Required. The ID of the Google Cloud Platform
|
---|
292 | * project the cluster belongs to.
|
---|
293 | * @param string $region Required. The Dataproc region in which to handle the
|
---|
294 | * request.
|
---|
295 | * @param string $clusterName Required. The cluster name.
|
---|
296 | * @param RepairClusterRequest $postBody
|
---|
297 | * @param array $optParams Optional parameters.
|
---|
298 | * @return Operation
|
---|
299 | * @throws \Google\Service\Exception
|
---|
300 | */
|
---|
301 | public function repair($projectId, $region, $clusterName, RepairClusterRequest $postBody, $optParams = [])
|
---|
302 | {
|
---|
303 | $params = ['projectId' => $projectId, 'region' => $region, 'clusterName' => $clusterName, 'postBody' => $postBody];
|
---|
304 | $params = array_merge($params, $optParams);
|
---|
305 | return $this->call('repair', [$params], Operation::class);
|
---|
306 | }
|
---|
307 | /**
|
---|
308 | * Sets the access control policy on the specified resource. Replaces any
|
---|
309 | * existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED
|
---|
310 | * errors. (clusters.setIamPolicy)
|
---|
311 | *
|
---|
312 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
313 | * specified. See Resource names
|
---|
314 | * (https://cloud.google.com/apis/design/resource_names) for the appropriate
|
---|
315 | * value for this field.
|
---|
316 | * @param SetIamPolicyRequest $postBody
|
---|
317 | * @param array $optParams Optional parameters.
|
---|
318 | * @return Policy
|
---|
319 | * @throws \Google\Service\Exception
|
---|
320 | */
|
---|
321 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
322 | {
|
---|
323 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
324 | $params = array_merge($params, $optParams);
|
---|
325 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
326 | }
|
---|
327 | /**
|
---|
328 | * Starts a cluster in a project. (clusters.start)
|
---|
329 | *
|
---|
330 | * @param string $projectId Required. The ID of the Google Cloud Platform
|
---|
331 | * project the cluster belongs to.
|
---|
332 | * @param string $region Required. The Dataproc region in which to handle the
|
---|
333 | * request.
|
---|
334 | * @param string $clusterName Required. The cluster name.
|
---|
335 | * @param StartClusterRequest $postBody
|
---|
336 | * @param array $optParams Optional parameters.
|
---|
337 | * @return Operation
|
---|
338 | * @throws \Google\Service\Exception
|
---|
339 | */
|
---|
340 | public function start($projectId, $region, $clusterName, StartClusterRequest $postBody, $optParams = [])
|
---|
341 | {
|
---|
342 | $params = ['projectId' => $projectId, 'region' => $region, 'clusterName' => $clusterName, 'postBody' => $postBody];
|
---|
343 | $params = array_merge($params, $optParams);
|
---|
344 | return $this->call('start', [$params], Operation::class);
|
---|
345 | }
|
---|
346 | /**
|
---|
347 | * Stops a cluster in a project. (clusters.stop)
|
---|
348 | *
|
---|
349 | * @param string $projectId Required. The ID of the Google Cloud Platform
|
---|
350 | * project the cluster belongs to.
|
---|
351 | * @param string $region Required. The Dataproc region in which to handle the
|
---|
352 | * request.
|
---|
353 | * @param string $clusterName Required. The cluster name.
|
---|
354 | * @param StopClusterRequest $postBody
|
---|
355 | * @param array $optParams Optional parameters.
|
---|
356 | * @return Operation
|
---|
357 | * @throws \Google\Service\Exception
|
---|
358 | */
|
---|
359 | public function stop($projectId, $region, $clusterName, StopClusterRequest $postBody, $optParams = [])
|
---|
360 | {
|
---|
361 | $params = ['projectId' => $projectId, 'region' => $region, 'clusterName' => $clusterName, 'postBody' => $postBody];
|
---|
362 | $params = array_merge($params, $optParams);
|
---|
363 | return $this->call('stop', [$params], Operation::class);
|
---|
364 | }
|
---|
365 | /**
|
---|
366 | * Returns permissions that a caller has on the specified resource. If the
|
---|
367 | * resource does not exist, this will return an empty set of permissions, not a
|
---|
368 | * NOT_FOUND error.Note: This operation is designed to be used for building
|
---|
369 | * permission-aware UIs and command-line tools, not for authorization checking.
|
---|
370 | * This operation may "fail open" without warning. (clusters.testIamPermissions)
|
---|
371 | *
|
---|
372 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
373 | * being requested. See Resource names
|
---|
374 | * (https://cloud.google.com/apis/design/resource_names) for the appropriate
|
---|
375 | * value for this field.
|
---|
376 | * @param TestIamPermissionsRequest $postBody
|
---|
377 | * @param array $optParams Optional parameters.
|
---|
378 | * @return TestIamPermissionsResponse
|
---|
379 | * @throws \Google\Service\Exception
|
---|
380 | */
|
---|
381 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
382 | {
|
---|
383 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
384 | $params = array_merge($params, $optParams);
|
---|
385 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
386 | }
|
---|
387 | }
|
---|
388 |
|
---|
389 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
390 | class_alias(ProjectsRegionsClusters::class, 'Google_Service_Dataproc_Resource_ProjectsRegionsClusters');
|
---|