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\Dataflow\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Dataflow\Job;
|
---|
21 | use Google\Service\Dataflow\JobExecutionDetails;
|
---|
22 | use Google\Service\Dataflow\JobMetrics;
|
---|
23 | use Google\Service\Dataflow\ListJobsResponse;
|
---|
24 | use Google\Service\Dataflow\Snapshot;
|
---|
25 | use Google\Service\Dataflow\SnapshotJobRequest;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * The "jobs" collection of methods.
|
---|
29 | * Typical usage is:
|
---|
30 | * <code>
|
---|
31 | * $dataflowService = new Google\Service\Dataflow(...);
|
---|
32 | * $jobs = $dataflowService->projects_locations_jobs;
|
---|
33 | * </code>
|
---|
34 | */
|
---|
35 | class ProjectsLocationsJobs extends \Google\Service\Resource
|
---|
36 | {
|
---|
37 | /**
|
---|
38 | * Creates a Cloud Dataflow job. To create a job, we recommend using
|
---|
39 | * `projects.locations.jobs.create` with a [regional endpoint]
|
---|
40 | * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using
|
---|
41 | * `projects.jobs.create` is not recommended, as your job will always start in
|
---|
42 | * `us-central1`. Do not enter confidential information when you supply string
|
---|
43 | * values using the API. (jobs.create)
|
---|
44 | *
|
---|
45 | * @param string $projectId The ID of the Cloud Platform project that the job
|
---|
46 | * belongs to.
|
---|
47 | * @param string $location The [regional endpoint]
|
---|
48 | * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that
|
---|
49 | * contains this job.
|
---|
50 | * @param Job $postBody
|
---|
51 | * @param array $optParams Optional parameters.
|
---|
52 | *
|
---|
53 | * @opt_param string replaceJobId Deprecated. This field is now in the Job
|
---|
54 | * message.
|
---|
55 | * @opt_param string view The level of information requested in response.
|
---|
56 | * @return Job
|
---|
57 | * @throws \Google\Service\Exception
|
---|
58 | */
|
---|
59 | public function create($projectId, $location, Job $postBody, $optParams = [])
|
---|
60 | {
|
---|
61 | $params = ['projectId' => $projectId, 'location' => $location, 'postBody' => $postBody];
|
---|
62 | $params = array_merge($params, $optParams);
|
---|
63 | return $this->call('create', [$params], Job::class);
|
---|
64 | }
|
---|
65 | /**
|
---|
66 | * Gets the state of the specified Cloud Dataflow job. To get the state of a
|
---|
67 | * job, we recommend using `projects.locations.jobs.get` with a [regional
|
---|
68 | * endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-
|
---|
69 | * endpoints). Using `projects.jobs.get` is not recommended, as you can only get
|
---|
70 | * the state of jobs that are running in `us-central1`. (jobs.get)
|
---|
71 | *
|
---|
72 | * @param string $projectId The ID of the Cloud Platform project that the job
|
---|
73 | * belongs to.
|
---|
74 | * @param string $location The [regional endpoint]
|
---|
75 | * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that
|
---|
76 | * contains this job.
|
---|
77 | * @param string $jobId The job ID.
|
---|
78 | * @param array $optParams Optional parameters.
|
---|
79 | *
|
---|
80 | * @opt_param string view The level of information requested in response.
|
---|
81 | * @return Job
|
---|
82 | * @throws \Google\Service\Exception
|
---|
83 | */
|
---|
84 | public function get($projectId, $location, $jobId, $optParams = [])
|
---|
85 | {
|
---|
86 | $params = ['projectId' => $projectId, 'location' => $location, 'jobId' => $jobId];
|
---|
87 | $params = array_merge($params, $optParams);
|
---|
88 | return $this->call('get', [$params], Job::class);
|
---|
89 | }
|
---|
90 | /**
|
---|
91 | * Request detailed information about the execution status of the job.
|
---|
92 | * EXPERIMENTAL. This API is subject to change or removal without notice.
|
---|
93 | * (jobs.getExecutionDetails)
|
---|
94 | *
|
---|
95 | * @param string $projectId A project id.
|
---|
96 | * @param string $location The [regional endpoint]
|
---|
97 | * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that
|
---|
98 | * contains the job specified by job_id.
|
---|
99 | * @param string $jobId The job to get execution details for.
|
---|
100 | * @param array $optParams Optional parameters.
|
---|
101 | *
|
---|
102 | * @opt_param int pageSize If specified, determines the maximum number of stages
|
---|
103 | * to return. If unspecified, the service may choose an appropriate default, or
|
---|
104 | * may return an arbitrarily large number of results.
|
---|
105 | * @opt_param string pageToken If supplied, this should be the value of
|
---|
106 | * next_page_token returned by an earlier call. This will cause the next page of
|
---|
107 | * results to be returned.
|
---|
108 | * @return JobExecutionDetails
|
---|
109 | * @throws \Google\Service\Exception
|
---|
110 | */
|
---|
111 | public function getExecutionDetails($projectId, $location, $jobId, $optParams = [])
|
---|
112 | {
|
---|
113 | $params = ['projectId' => $projectId, 'location' => $location, 'jobId' => $jobId];
|
---|
114 | $params = array_merge($params, $optParams);
|
---|
115 | return $this->call('getExecutionDetails', [$params], JobExecutionDetails::class);
|
---|
116 | }
|
---|
117 | /**
|
---|
118 | * Request the job status. To request the status of a job, we recommend using
|
---|
119 | * `projects.locations.jobs.getMetrics` with a [regional endpoint]
|
---|
120 | * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using
|
---|
121 | * `projects.jobs.getMetrics` is not recommended, as you can only request the
|
---|
122 | * status of jobs that are running in `us-central1`. (jobs.getMetrics)
|
---|
123 | *
|
---|
124 | * @param string $projectId A project id.
|
---|
125 | * @param string $location The [regional endpoint]
|
---|
126 | * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that
|
---|
127 | * contains the job specified by job_id.
|
---|
128 | * @param string $jobId The job to get metrics for.
|
---|
129 | * @param array $optParams Optional parameters.
|
---|
130 | *
|
---|
131 | * @opt_param string startTime Return only metric data that has changed since
|
---|
132 | * this time. Default is to return all information about all metrics for the
|
---|
133 | * job.
|
---|
134 | * @return JobMetrics
|
---|
135 | * @throws \Google\Service\Exception
|
---|
136 | */
|
---|
137 | public function getMetrics($projectId, $location, $jobId, $optParams = [])
|
---|
138 | {
|
---|
139 | $params = ['projectId' => $projectId, 'location' => $location, 'jobId' => $jobId];
|
---|
140 | $params = array_merge($params, $optParams);
|
---|
141 | return $this->call('getMetrics', [$params], JobMetrics::class);
|
---|
142 | }
|
---|
143 | /**
|
---|
144 | * List the jobs of a project. To list the jobs of a project in a region, we
|
---|
145 | * recommend using `projects.locations.jobs.list` with a [regional endpoint]
|
---|
146 | * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). To list
|
---|
147 | * the all jobs across all regions, use `projects.jobs.aggregated`. Using
|
---|
148 | * `projects.jobs.list` is not recommended, because you can only get the list of
|
---|
149 | * jobs that are running in `us-central1`. `projects.locations.jobs.list` and
|
---|
150 | * `projects.jobs.list` support filtering the list of jobs by name. Filtering by
|
---|
151 | * name isn't supported by `projects.jobs.aggregated`.
|
---|
152 | * (jobs.listProjectsLocationsJobs)
|
---|
153 | *
|
---|
154 | * @param string $projectId The project which owns the jobs.
|
---|
155 | * @param string $location The [regional endpoint]
|
---|
156 | * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that
|
---|
157 | * contains this job.
|
---|
158 | * @param array $optParams Optional parameters.
|
---|
159 | *
|
---|
160 | * @opt_param string filter The kind of filter to use.
|
---|
161 | * @opt_param string name Optional. The job name.
|
---|
162 | * @opt_param int pageSize If there are many jobs, limit response to at most
|
---|
163 | * this many. The actual number of jobs returned will be the lesser of
|
---|
164 | * max_responses and an unspecified server-defined limit.
|
---|
165 | * @opt_param string pageToken Set this to the 'next_page_token' field of a
|
---|
166 | * previous response to request additional results in a long list.
|
---|
167 | * @opt_param string view Deprecated. ListJobs always returns summaries now. Use
|
---|
168 | * GetJob for other JobViews.
|
---|
169 | * @return ListJobsResponse
|
---|
170 | * @throws \Google\Service\Exception
|
---|
171 | */
|
---|
172 | public function listProjectsLocationsJobs($projectId, $location, $optParams = [])
|
---|
173 | {
|
---|
174 | $params = ['projectId' => $projectId, 'location' => $location];
|
---|
175 | $params = array_merge($params, $optParams);
|
---|
176 | return $this->call('list', [$params], ListJobsResponse::class);
|
---|
177 | }
|
---|
178 | /**
|
---|
179 | * Snapshot the state of a streaming job. (jobs.snapshot)
|
---|
180 | *
|
---|
181 | * @param string $projectId The project which owns the job to be snapshotted.
|
---|
182 | * @param string $location The location that contains this job.
|
---|
183 | * @param string $jobId The job to be snapshotted.
|
---|
184 | * @param SnapshotJobRequest $postBody
|
---|
185 | * @param array $optParams Optional parameters.
|
---|
186 | * @return Snapshot
|
---|
187 | * @throws \Google\Service\Exception
|
---|
188 | */
|
---|
189 | public function snapshot($projectId, $location, $jobId, SnapshotJobRequest $postBody, $optParams = [])
|
---|
190 | {
|
---|
191 | $params = ['projectId' => $projectId, 'location' => $location, 'jobId' => $jobId, 'postBody' => $postBody];
|
---|
192 | $params = array_merge($params, $optParams);
|
---|
193 | return $this->call('snapshot', [$params], Snapshot::class);
|
---|
194 | }
|
---|
195 | /**
|
---|
196 | * Updates the state of an existing Cloud Dataflow job. To update the state of
|
---|
197 | * an existing job, we recommend using `projects.locations.jobs.update` with a
|
---|
198 | * [regional endpoint]
|
---|
199 | * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using
|
---|
200 | * `projects.jobs.update` is not recommended, as you can only update the state
|
---|
201 | * of jobs that are running in `us-central1`. (jobs.update)
|
---|
202 | *
|
---|
203 | * @param string $projectId The ID of the Cloud Platform project that the job
|
---|
204 | * belongs to.
|
---|
205 | * @param string $location The [regional endpoint]
|
---|
206 | * (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that
|
---|
207 | * contains this job.
|
---|
208 | * @param string $jobId The job ID.
|
---|
209 | * @param Job $postBody
|
---|
210 | * @param array $optParams Optional parameters.
|
---|
211 | *
|
---|
212 | * @opt_param string updateMask The list of fields to update relative to Job. If
|
---|
213 | * empty, only RequestedJobState will be considered for update. If the FieldMask
|
---|
214 | * is not empty and RequestedJobState is none/empty, The fields specified in the
|
---|
215 | * update mask will be the only ones considered for update. If both
|
---|
216 | * RequestedJobState and update_mask are specified, an error will be returned as
|
---|
217 | * we cannot update both state and mask.
|
---|
218 | * @return Job
|
---|
219 | * @throws \Google\Service\Exception
|
---|
220 | */
|
---|
221 | public function update($projectId, $location, $jobId, Job $postBody, $optParams = [])
|
---|
222 | {
|
---|
223 | $params = ['projectId' => $projectId, 'location' => $location, 'jobId' => $jobId, 'postBody' => $postBody];
|
---|
224 | $params = array_merge($params, $optParams);
|
---|
225 | return $this->call('update', [$params], Job::class);
|
---|
226 | }
|
---|
227 | }
|
---|
228 |
|
---|
229 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
230 | class_alias(ProjectsLocationsJobs::class, 'Google_Service_Dataflow_Resource_ProjectsLocationsJobs');
|
---|