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\CloudScheduler\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudScheduler\CloudschedulerEmpty;
|
---|
21 | use Google\Service\CloudScheduler\Job;
|
---|
22 | use Google\Service\CloudScheduler\ListJobsResponse;
|
---|
23 | use Google\Service\CloudScheduler\PauseJobRequest;
|
---|
24 | use Google\Service\CloudScheduler\ResumeJobRequest;
|
---|
25 | use Google\Service\CloudScheduler\RunJobRequest;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * The "jobs" collection of methods.
|
---|
29 | * Typical usage is:
|
---|
30 | * <code>
|
---|
31 | * $cloudschedulerService = new Google\Service\CloudScheduler(...);
|
---|
32 | * $jobs = $cloudschedulerService->projects_locations_jobs;
|
---|
33 | * </code>
|
---|
34 | */
|
---|
35 | class ProjectsLocationsJobs extends \Google\Service\Resource
|
---|
36 | {
|
---|
37 | /**
|
---|
38 | * Creates a job. (jobs.create)
|
---|
39 | *
|
---|
40 | * @param string $parent Required. The location name. For example:
|
---|
41 | * `projects/PROJECT_ID/locations/LOCATION_ID`.
|
---|
42 | * @param Job $postBody
|
---|
43 | * @param array $optParams Optional parameters.
|
---|
44 | * @return Job
|
---|
45 | * @throws \Google\Service\Exception
|
---|
46 | */
|
---|
47 | public function create($parent, Job $postBody, $optParams = [])
|
---|
48 | {
|
---|
49 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
50 | $params = array_merge($params, $optParams);
|
---|
51 | return $this->call('create', [$params], Job::class);
|
---|
52 | }
|
---|
53 | /**
|
---|
54 | * Deletes a job. (jobs.delete)
|
---|
55 | *
|
---|
56 | * @param string $name Required. The job name. For example:
|
---|
57 | * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
|
---|
58 | * @param array $optParams Optional parameters.
|
---|
59 | * @return CloudschedulerEmpty
|
---|
60 | * @throws \Google\Service\Exception
|
---|
61 | */
|
---|
62 | public function delete($name, $optParams = [])
|
---|
63 | {
|
---|
64 | $params = ['name' => $name];
|
---|
65 | $params = array_merge($params, $optParams);
|
---|
66 | return $this->call('delete', [$params], CloudschedulerEmpty::class);
|
---|
67 | }
|
---|
68 | /**
|
---|
69 | * Gets a job. (jobs.get)
|
---|
70 | *
|
---|
71 | * @param string $name Required. The job name. For example:
|
---|
72 | * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
|
---|
73 | * @param array $optParams Optional parameters.
|
---|
74 | * @return Job
|
---|
75 | * @throws \Google\Service\Exception
|
---|
76 | */
|
---|
77 | public function get($name, $optParams = [])
|
---|
78 | {
|
---|
79 | $params = ['name' => $name];
|
---|
80 | $params = array_merge($params, $optParams);
|
---|
81 | return $this->call('get', [$params], Job::class);
|
---|
82 | }
|
---|
83 | /**
|
---|
84 | * Lists jobs. (jobs.listProjectsLocationsJobs)
|
---|
85 | *
|
---|
86 | * @param string $parent Required. The location name. For example:
|
---|
87 | * `projects/PROJECT_ID/locations/LOCATION_ID`.
|
---|
88 | * @param array $optParams Optional parameters.
|
---|
89 | *
|
---|
90 | * @opt_param int pageSize Requested page size. The maximum page size is 500. If
|
---|
91 | * unspecified, the page size will be the maximum. Fewer jobs than requested
|
---|
92 | * might be returned, even if more jobs exist; use next_page_token to determine
|
---|
93 | * if more jobs exist.
|
---|
94 | * @opt_param string pageToken A token identifying a page of results the server
|
---|
95 | * will return. To request the first page results, page_token must be empty. To
|
---|
96 | * request the next page of results, page_token must be the value of
|
---|
97 | * next_page_token returned from the previous call to ListJobs.
|
---|
98 | * @return ListJobsResponse
|
---|
99 | * @throws \Google\Service\Exception
|
---|
100 | */
|
---|
101 | public function listProjectsLocationsJobs($parent, $optParams = [])
|
---|
102 | {
|
---|
103 | $params = ['parent' => $parent];
|
---|
104 | $params = array_merge($params, $optParams);
|
---|
105 | return $this->call('list', [$params], ListJobsResponse::class);
|
---|
106 | }
|
---|
107 | /**
|
---|
108 | * Updates a job. If successful, the updated Job is returned. If the job does
|
---|
109 | * not exist, `NOT_FOUND` is returned. If UpdateJob does not successfully
|
---|
110 | * return, it is possible for the job to be in an Job.State.UPDATE_FAILED state.
|
---|
111 | * A job in this state may not be executed. If this happens, retry the UpdateJob
|
---|
112 | * request until a successful response is received. (jobs.patch)
|
---|
113 | *
|
---|
114 | * @param string $name Optionally caller-specified in CreateJob, after which it
|
---|
115 | * becomes output only. The job name. For example:
|
---|
116 | * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. * `PROJECT_ID` can
|
---|
117 | * contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), or
|
---|
118 | * periods (.). For more information, see [Identifying
|
---|
119 | * projects](https://cloud.google.com/resource-manager/docs/creating-managing-
|
---|
120 | * projects#identifying_projects) * `LOCATION_ID` is the canonical ID for the
|
---|
121 | * job's location. The list of available locations can be obtained by calling
|
---|
122 | * ListLocations. For more information, see
|
---|
123 | * https://cloud.google.com/about/locations/. * `JOB_ID` can contain only
|
---|
124 | * letters ([A-Za-z]), numbers ([0-9]), hyphens (-), or underscores (_). The
|
---|
125 | * maximum length is 500 characters.
|
---|
126 | * @param Job $postBody
|
---|
127 | * @param array $optParams Optional parameters.
|
---|
128 | *
|
---|
129 | * @opt_param string updateMask A mask used to specify which fields of the job
|
---|
130 | * are being updated.
|
---|
131 | * @return Job
|
---|
132 | * @throws \Google\Service\Exception
|
---|
133 | */
|
---|
134 | public function patch($name, Job $postBody, $optParams = [])
|
---|
135 | {
|
---|
136 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
137 | $params = array_merge($params, $optParams);
|
---|
138 | return $this->call('patch', [$params], Job::class);
|
---|
139 | }
|
---|
140 | /**
|
---|
141 | * Pauses a job. If a job is paused then the system will stop executing the job
|
---|
142 | * until it is re-enabled via ResumeJob. The state of the job is stored in
|
---|
143 | * state; if paused it will be set to Job.State.PAUSED. A job must be in
|
---|
144 | * Job.State.ENABLED to be paused. (jobs.pause)
|
---|
145 | *
|
---|
146 | * @param string $name Required. The job name. For example:
|
---|
147 | * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
|
---|
148 | * @param PauseJobRequest $postBody
|
---|
149 | * @param array $optParams Optional parameters.
|
---|
150 | * @return Job
|
---|
151 | * @throws \Google\Service\Exception
|
---|
152 | */
|
---|
153 | public function pause($name, PauseJobRequest $postBody, $optParams = [])
|
---|
154 | {
|
---|
155 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
156 | $params = array_merge($params, $optParams);
|
---|
157 | return $this->call('pause', [$params], Job::class);
|
---|
158 | }
|
---|
159 | /**
|
---|
160 | * Resume a job. This method reenables a job after it has been Job.State.PAUSED.
|
---|
161 | * The state of a job is stored in Job.state; after calling this method it will
|
---|
162 | * be set to Job.State.ENABLED. A job must be in Job.State.PAUSED to be resumed.
|
---|
163 | * (jobs.resume)
|
---|
164 | *
|
---|
165 | * @param string $name Required. The job name. For example:
|
---|
166 | * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
|
---|
167 | * @param ResumeJobRequest $postBody
|
---|
168 | * @param array $optParams Optional parameters.
|
---|
169 | * @return Job
|
---|
170 | * @throws \Google\Service\Exception
|
---|
171 | */
|
---|
172 | public function resume($name, ResumeJobRequest $postBody, $optParams = [])
|
---|
173 | {
|
---|
174 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
175 | $params = array_merge($params, $optParams);
|
---|
176 | return $this->call('resume', [$params], Job::class);
|
---|
177 | }
|
---|
178 | /**
|
---|
179 | * Forces a job to run now. When this method is called, Cloud Scheduler will
|
---|
180 | * dispatch the job, even if the job is already running. (jobs.run)
|
---|
181 | *
|
---|
182 | * @param string $name Required. The job name. For example:
|
---|
183 | * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
|
---|
184 | * @param RunJobRequest $postBody
|
---|
185 | * @param array $optParams Optional parameters.
|
---|
186 | * @return Job
|
---|
187 | * @throws \Google\Service\Exception
|
---|
188 | */
|
---|
189 | public function run($name, RunJobRequest $postBody, $optParams = [])
|
---|
190 | {
|
---|
191 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
192 | $params = array_merge($params, $optParams);
|
---|
193 | return $this->call('run', [$params], Job::class);
|
---|
194 | }
|
---|
195 | }
|
---|
196 |
|
---|
197 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
198 | class_alias(ProjectsLocationsJobs::class, 'Google_Service_CloudScheduler_Resource_ProjectsLocationsJobs');
|
---|