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\CloudRun\Resource;
19
20use Google\Service\CloudRun\GoogleCloudRunV2Job;
21use Google\Service\CloudRun\GoogleCloudRunV2ListJobsResponse;
22use Google\Service\CloudRun\GoogleCloudRunV2RunJobRequest;
23use Google\Service\CloudRun\GoogleIamV1Policy;
24use Google\Service\CloudRun\GoogleIamV1SetIamPolicyRequest;
25use Google\Service\CloudRun\GoogleIamV1TestIamPermissionsRequest;
26use Google\Service\CloudRun\GoogleIamV1TestIamPermissionsResponse;
27use Google\Service\CloudRun\GoogleLongrunningOperation;
28
29/**
30 * The "jobs" collection of methods.
31 * Typical usage is:
32 *  <code>
33 *   $runService = new Google\Service\CloudRun(...);
34 *   $jobs = $runService->jobs;
35 *  </code>
36 */
37class ProjectsLocationsJobs extends \Google\Service\Resource
38{
39  /**
40   * Create a Job. (jobs.create)
41   *
42   * @param string $parent Required. The location and project in which this Job
43   * should be created. Format: projects/{projectnumber}/locations/{location}
44   * @param GoogleCloudRunV2Job $postBody
45   * @param array $optParams Optional parameters.
46   *
47   * @opt_param string jobId Required. The unique identifier for the Job. The name
48   * of the job becomes {parent}/jobs/{job_id}.
49   * @opt_param bool validateOnly Indicates that the request should be validated
50   * and default values populated, without persisting the request or creating any
51   * resources.
52   * @return GoogleLongrunningOperation
53   */
54  public function create($parent, GoogleCloudRunV2Job $postBody, $optParams = [])
55  {
56    $params = ['parent' => $parent, 'postBody' => $postBody];
57    $params = array_merge($params, $optParams);
58    return $this->call('create', [$params], GoogleLongrunningOperation::class);
59  }
60  /**
61   * Deletes a Job. (jobs.delete)
62   *
63   * @param string $name Required. The full name of the Job. Format:
64   * projects/{projectnumber}/locations/{location}/jobs/{job}
65   * @param array $optParams Optional parameters.
66   *
67   * @opt_param string etag A system-generated fingerprint for this version of the
68   * resource. May be used to detect modification conflict during updates.
69   * @opt_param bool force If set to true, the Job and its Executions will be
70   * deleted no matter whether any Executions are still running or not. If set to
71   * false or unset, the Job and its Executions can only be deleted if there are
72   * no running Executions. Any running Execution will fail the deletion.
73   * @opt_param bool validateOnly Indicates that the request should be validated
74   * without actually deleting any resources.
75   * @return GoogleLongrunningOperation
76   */
77  public function delete($name, $optParams = [])
78  {
79    $params = ['name' => $name];
80    $params = array_merge($params, $optParams);
81    return $this->call('delete', [$params], GoogleLongrunningOperation::class);
82  }
83  /**
84   * Gets information about a Job. (jobs.get)
85   *
86   * @param string $name Required. The full name of the Job. Format:
87   * projects/{projectnumber}/locations/{location}/jobs/{job}
88   * @param array $optParams Optional parameters.
89   * @return GoogleCloudRunV2Job
90   */
91  public function get($name, $optParams = [])
92  {
93    $params = ['name' => $name];
94    $params = array_merge($params, $optParams);
95    return $this->call('get', [$params], GoogleCloudRunV2Job::class);
96  }
97  /**
98   * Get the IAM Access Control policy currently in effect for the given Job. This
99   * result does not include any inherited policies. (jobs.getIamPolicy)
100   *
101   * @param string $resource REQUIRED: The resource for which the policy is being
102   * requested. See the operation documentation for the appropriate value for this
103   * field.
104   * @param array $optParams Optional parameters.
105   *
106   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
107   * version that will be used to format the policy. Valid values are 0, 1, and 3.
108   * Requests specifying an invalid value will be rejected. Requests for policies
109   * with any conditional role bindings must specify version 3. Policies with no
110   * conditional role bindings may specify any valid value or leave the field
111   * unset. The policy in the response might use the policy version that you
112   * specified, or it might use a lower policy version. For example, if you
113   * specify version 3, but the policy has no conditional role bindings, the
114   * response uses version 1. To learn which resources support conditions in their
115   * IAM policies, see the [IAM
116   * documentation](https://cloud.google.com/iam/help/conditions/resource-
117   * policies).
118   * @return GoogleIamV1Policy
119   */
120  public function getIamPolicy($resource, $optParams = [])
121  {
122    $params = ['resource' => $resource];
123    $params = array_merge($params, $optParams);
124    return $this->call('getIamPolicy', [$params], GoogleIamV1Policy::class);
125  }
126  /**
127   * List Jobs. (jobs.listProjectsLocationsJobs)
128   *
129   * @param string $parent Required. The location and project to list resources
130   * on. Format: projects/{projectnumber}/locations/{location}
131   * @param array $optParams Optional parameters.
132   *
133   * @opt_param int pageSize Maximum number of Jobs to return in this call.
134   * @opt_param string pageToken A page token received from a previous call to
135   * ListJobs. All other parameters must match.
136   * @opt_param bool showDeleted If true, returns deleted (but unexpired)
137   * resources along with active ones.
138   * @return GoogleCloudRunV2ListJobsResponse
139   */
140  public function listProjectsLocationsJobs($parent, $optParams = [])
141  {
142    $params = ['parent' => $parent];
143    $params = array_merge($params, $optParams);
144    return $this->call('list', [$params], GoogleCloudRunV2ListJobsResponse::class);
145  }
146  /**
147   * Updates a Job. (jobs.patch)
148   *
149   * @param string $name The fully qualified name of this Job. Format:
150   * projects/{project}/locations/{location}/jobs/{job}
151   * @param GoogleCloudRunV2Job $postBody
152   * @param array $optParams Optional parameters.
153   *
154   * @opt_param bool allowMissing If set to true, and if the Job does not exist,
155   * it will create a new one. Caller must have both create and update permissions
156   * for this call if this is set to true.
157   * @opt_param string updateMask The list of fields to be updated.
158   * @opt_param bool validateOnly Indicates that the request should be validated
159   * and default values populated, without persisting the request or updating any
160   * resources.
161   * @return GoogleLongrunningOperation
162   */
163  public function patch($name, GoogleCloudRunV2Job $postBody, $optParams = [])
164  {
165    $params = ['name' => $name, 'postBody' => $postBody];
166    $params = array_merge($params, $optParams);
167    return $this->call('patch', [$params], GoogleLongrunningOperation::class);
168  }
169  /**
170   * Triggers creation of a new Execution of this Job. (jobs.run)
171   *
172   * @param string $name Required. The full name of the Job. Format:
173   * projects/{projectnumber}/locations/{location}/jobs/{job}
174   * @param GoogleCloudRunV2RunJobRequest $postBody
175   * @param array $optParams Optional parameters.
176   * @return GoogleLongrunningOperation
177   */
178  public function run($name, GoogleCloudRunV2RunJobRequest $postBody, $optParams = [])
179  {
180    $params = ['name' => $name, 'postBody' => $postBody];
181    $params = array_merge($params, $optParams);
182    return $this->call('run', [$params], GoogleLongrunningOperation::class);
183  }
184  /**
185   * Sets the IAM Access control policy for the specified Job. Overwrites any
186   * existing policy. (jobs.setIamPolicy)
187   *
188   * @param string $resource REQUIRED: The resource for which the policy is being
189   * specified. See the operation documentation for the appropriate value for this
190   * field.
191   * @param GoogleIamV1SetIamPolicyRequest $postBody
192   * @param array $optParams Optional parameters.
193   * @return GoogleIamV1Policy
194   */
195  public function setIamPolicy($resource, GoogleIamV1SetIamPolicyRequest $postBody, $optParams = [])
196  {
197    $params = ['resource' => $resource, 'postBody' => $postBody];
198    $params = array_merge($params, $optParams);
199    return $this->call('setIamPolicy', [$params], GoogleIamV1Policy::class);
200  }
201  /**
202   * Returns permissions that a caller has on the specified Project. There are no
203   * permissions required for making this API call. (jobs.testIamPermissions)
204   *
205   * @param string $resource REQUIRED: The resource for which the policy detail is
206   * being requested. See the operation documentation for the appropriate value
207   * for this field.
208   * @param GoogleIamV1TestIamPermissionsRequest $postBody
209   * @param array $optParams Optional parameters.
210   * @return GoogleIamV1TestIamPermissionsResponse
211   */
212  public function testIamPermissions($resource, GoogleIamV1TestIamPermissionsRequest $postBody, $optParams = [])
213  {
214    $params = ['resource' => $resource, 'postBody' => $postBody];
215    $params = array_merge($params, $optParams);
216    return $this->call('testIamPermissions', [$params], GoogleIamV1TestIamPermissionsResponse::class);
217  }
218}
219
220// Adding a class alias for backwards compatibility with the previous class name.
221class_alias(ProjectsLocationsJobs::class, 'Google_Service_CloudRun_Resource_ProjectsLocationsJobs');
222