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
18namespace Google\Service\Dataproc\Resource;
19
20use Google\Service\Dataproc\CancelJobRequest;
21use Google\Service\Dataproc\DataprocEmpty;
22use Google\Service\Dataproc\GetIamPolicyRequest;
23use Google\Service\Dataproc\Job;
24use Google\Service\Dataproc\ListJobsResponse;
25use Google\Service\Dataproc\Operation;
26use Google\Service\Dataproc\Policy;
27use Google\Service\Dataproc\SetIamPolicyRequest;
28use Google\Service\Dataproc\SubmitJobRequest;
29use Google\Service\Dataproc\TestIamPermissionsRequest;
30use Google\Service\Dataproc\TestIamPermissionsResponse;
31
32/**
33 * The "jobs" collection of methods.
34 * Typical usage is:
35 *  <code>
36 *   $dataprocService = new Google\Service\Dataproc(...);
37 *   $jobs = $dataprocService->jobs;
38 *  </code>
39 */
40class ProjectsRegionsJobs extends \Google\Service\Resource
41{
42  /**
43   * Starts a job cancellation request. To access the job resource after
44   * cancellation, call regions/{region}/jobs.list (https://cloud.google.com/datap
45   * roc/docs/reference/rest/v1/projects.regions.jobs/list) or
46   * regions/{region}/jobs.get (https://cloud.google.com/dataproc/docs/reference/r
47   * est/v1/projects.regions.jobs/get). (jobs.cancel)
48   *
49   * @param string $projectId Required. The ID of the Google Cloud Platform
50   * project that the job belongs to.
51   * @param string $region Required. The Dataproc region in which to handle the
52   * request.
53   * @param string $jobId Required. The job ID.
54   * @param CancelJobRequest $postBody
55   * @param array $optParams Optional parameters.
56   * @return Job
57   */
58  public function cancel($projectId, $region, $jobId, CancelJobRequest $postBody, $optParams = [])
59  {
60    $params = ['projectId' => $projectId, 'region' => $region, 'jobId' => $jobId, 'postBody' => $postBody];
61    $params = array_merge($params, $optParams);
62    return $this->call('cancel', [$params], Job::class);
63  }
64  /**
65   * Deletes the job from the project. If the job is active, the delete fails, and
66   * the response returns FAILED_PRECONDITION. (jobs.delete)
67   *
68   * @param string $projectId Required. The ID of the Google Cloud Platform
69   * project that the job belongs to.
70   * @param string $region Required. The Dataproc region in which to handle the
71   * request.
72   * @param string $jobId Required. The job ID.
73   * @param array $optParams Optional parameters.
74   * @return DataprocEmpty
75   */
76  public function delete($projectId, $region, $jobId, $optParams = [])
77  {
78    $params = ['projectId' => $projectId, 'region' => $region, 'jobId' => $jobId];
79    $params = array_merge($params, $optParams);
80    return $this->call('delete', [$params], DataprocEmpty::class);
81  }
82  /**
83   * Gets the resource representation for a job in a project. (jobs.get)
84   *
85   * @param string $projectId Required. The ID of the Google Cloud Platform
86   * project that the job belongs to.
87   * @param string $region Required. The Dataproc region in which to handle the
88   * request.
89   * @param string $jobId Required. The job ID.
90   * @param array $optParams Optional parameters.
91   * @return Job
92   */
93  public function get($projectId, $region, $jobId, $optParams = [])
94  {
95    $params = ['projectId' => $projectId, 'region' => $region, 'jobId' => $jobId];
96    $params = array_merge($params, $optParams);
97    return $this->call('get', [$params], Job::class);
98  }
99  /**
100   * Gets the access control policy for a resource. Returns an empty policy if the
101   * resource exists and does not have a policy set. (jobs.getIamPolicy)
102   *
103   * @param string $resource REQUIRED: The resource for which the policy is being
104   * requested. See the operation documentation for the appropriate value for this
105   * field.
106   * @param GetIamPolicyRequest $postBody
107   * @param array $optParams Optional parameters.
108   * @return Policy
109   */
110  public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
111  {
112    $params = ['resource' => $resource, 'postBody' => $postBody];
113    $params = array_merge($params, $optParams);
114    return $this->call('getIamPolicy', [$params], Policy::class);
115  }
116  /**
117   * Lists regions/{region}/jobs in a project. (jobs.listProjectsRegionsJobs)
118   *
119   * @param string $projectId Required. The ID of the Google Cloud Platform
120   * project that the job belongs to.
121   * @param string $region Required. The Dataproc region in which to handle the
122   * request.
123   * @param array $optParams Optional parameters.
124   *
125   * @opt_param string clusterName Optional. If set, the returned jobs list
126   * includes only jobs that were submitted to the named cluster.
127   * @opt_param string filter Optional. A filter constraining the jobs to list.
128   * Filters are case-sensitive and have the following syntax:field = value AND
129   * field = value ...where field is status.state or labels.[KEY], and [KEY] is a
130   * label key. value can be * to match all values. status.state can be either
131   * ACTIVE or NON_ACTIVE. Only the logical AND operator is supported; space-
132   * separated items are treated as having an implicit AND operator.Example
133   * filter:status.state = ACTIVE AND labels.env = staging AND labels.starred = *
134   * @opt_param string jobStateMatcher Optional. Specifies enumerated categories
135   * of jobs to list. (default = match ALL jobs).If filter is provided,
136   * jobStateMatcher will be ignored.
137   * @opt_param int pageSize Optional. The number of results to return in each
138   * response.
139   * @opt_param string pageToken Optional. The page token, returned by a previous
140   * call, to request the next page of results.
141   * @return ListJobsResponse
142   */
143  public function listProjectsRegionsJobs($projectId, $region, $optParams = [])
144  {
145    $params = ['projectId' => $projectId, 'region' => $region];
146    $params = array_merge($params, $optParams);
147    return $this->call('list', [$params], ListJobsResponse::class);
148  }
149  /**
150   * Updates a job in a project. (jobs.patch)
151   *
152   * @param string $projectId Required. The ID of the Google Cloud Platform
153   * project that the job belongs to.
154   * @param string $region Required. The Dataproc region in which to handle the
155   * request.
156   * @param string $jobId Required. The job ID.
157   * @param Job $postBody
158   * @param array $optParams Optional parameters.
159   *
160   * @opt_param string updateMask Required. Specifies the path, relative to Job,
161   * of the field to update. For example, to update the labels of a Job the
162   * update_mask parameter would be specified as labels, and the PATCH request
163   * body would specify the new value. *Note:* Currently, labels is the only field
164   * that can be updated.
165   * @return Job
166   */
167  public function patch($projectId, $region, $jobId, Job $postBody, $optParams = [])
168  {
169    $params = ['projectId' => $projectId, 'region' => $region, 'jobId' => $jobId, 'postBody' => $postBody];
170    $params = array_merge($params, $optParams);
171    return $this->call('patch', [$params], Job::class);
172  }
173  /**
174   * Sets the access control policy on the specified resource. Replaces any
175   * existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED
176   * errors. (jobs.setIamPolicy)
177   *
178   * @param string $resource REQUIRED: The resource for which the policy is being
179   * specified. See the operation documentation for the appropriate value for this
180   * field.
181   * @param SetIamPolicyRequest $postBody
182   * @param array $optParams Optional parameters.
183   * @return Policy
184   */
185  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
186  {
187    $params = ['resource' => $resource, 'postBody' => $postBody];
188    $params = array_merge($params, $optParams);
189    return $this->call('setIamPolicy', [$params], Policy::class);
190  }
191  /**
192   * Submits a job to a cluster. (jobs.submit)
193   *
194   * @param string $projectId Required. The ID of the Google Cloud Platform
195   * project that the job belongs to.
196   * @param string $region Required. The Dataproc region in which to handle the
197   * request.
198   * @param SubmitJobRequest $postBody
199   * @param array $optParams Optional parameters.
200   * @return Job
201   */
202  public function submit($projectId, $region, SubmitJobRequest $postBody, $optParams = [])
203  {
204    $params = ['projectId' => $projectId, 'region' => $region, 'postBody' => $postBody];
205    $params = array_merge($params, $optParams);
206    return $this->call('submit', [$params], Job::class);
207  }
208  /**
209   * Submits job to a cluster. (jobs.submitAsOperation)
210   *
211   * @param string $projectId Required. The ID of the Google Cloud Platform
212   * project that the job belongs to.
213   * @param string $region Required. The Dataproc region in which to handle the
214   * request.
215   * @param SubmitJobRequest $postBody
216   * @param array $optParams Optional parameters.
217   * @return Operation
218   */
219  public function submitAsOperation($projectId, $region, SubmitJobRequest $postBody, $optParams = [])
220  {
221    $params = ['projectId' => $projectId, 'region' => $region, 'postBody' => $postBody];
222    $params = array_merge($params, $optParams);
223    return $this->call('submitAsOperation', [$params], Operation::class);
224  }
225  /**
226   * Returns permissions that a caller has on the specified resource. If the
227   * resource does not exist, this will return an empty set of permissions, not a
228   * NOT_FOUND error.Note: This operation is designed to be used for building
229   * permission-aware UIs and command-line tools, not for authorization checking.
230   * This operation may "fail open" without warning. (jobs.testIamPermissions)
231   *
232   * @param string $resource REQUIRED: The resource for which the policy detail is
233   * being requested. See the operation documentation for the appropriate value
234   * for this field.
235   * @param TestIamPermissionsRequest $postBody
236   * @param array $optParams Optional parameters.
237   * @return TestIamPermissionsResponse
238   */
239  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
240  {
241    $params = ['resource' => $resource, 'postBody' => $postBody];
242    $params = array_merge($params, $optParams);
243    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
244  }
245}
246
247// Adding a class alias for backwards compatibility with the previous class name.
248class_alias(ProjectsRegionsJobs::class, 'Google_Service_Dataproc_Resource_ProjectsRegionsJobs');
249