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