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