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