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\DataLabeling\Resource;
19
20use Google\Service\DataLabeling\GoogleCloudDatalabelingV1beta1CreateEvaluationJobRequest;
21use Google\Service\DataLabeling\GoogleCloudDatalabelingV1beta1EvaluationJob;
22use Google\Service\DataLabeling\GoogleCloudDatalabelingV1beta1ListEvaluationJobsResponse;
23use Google\Service\DataLabeling\GoogleCloudDatalabelingV1beta1PauseEvaluationJobRequest;
24use Google\Service\DataLabeling\GoogleCloudDatalabelingV1beta1ResumeEvaluationJobRequest;
25use Google\Service\DataLabeling\GoogleProtobufEmpty;
26
27/**
28 * The "evaluationJobs" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $datalabelingService = new Google\Service\DataLabeling(...);
32 *   $evaluationJobs = $datalabelingService->evaluationJobs;
33 *  </code>
34 */
35class ProjectsEvaluationJobs extends \Google\Service\Resource
36{
37  /**
38   * Creates an evaluation job. (evaluationJobs.create)
39   *
40   * @param string $parent Required. Evaluation job resource parent. Format:
41   * "projects/{project_id}"
42   * @param GoogleCloudDatalabelingV1beta1CreateEvaluationJobRequest $postBody
43   * @param array $optParams Optional parameters.
44   * @return GoogleCloudDatalabelingV1beta1EvaluationJob
45   */
46  public function create($parent, GoogleCloudDatalabelingV1beta1CreateEvaluationJobRequest $postBody, $optParams = [])
47  {
48    $params = ['parent' => $parent, 'postBody' => $postBody];
49    $params = array_merge($params, $optParams);
50    return $this->call('create', [$params], GoogleCloudDatalabelingV1beta1EvaluationJob::class);
51  }
52  /**
53   * Stops and deletes an evaluation job. (evaluationJobs.delete)
54   *
55   * @param string $name Required. Name of the evaluation job that is going to be
56   * deleted. Format: "projects/{project_id}/evaluationJobs/{evaluation_job_id}"
57   * @param array $optParams Optional parameters.
58   * @return GoogleProtobufEmpty
59   */
60  public function delete($name, $optParams = [])
61  {
62    $params = ['name' => $name];
63    $params = array_merge($params, $optParams);
64    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
65  }
66  /**
67   * Gets an evaluation job by resource name. (evaluationJobs.get)
68   *
69   * @param string $name Required. Name of the evaluation job. Format:
70   * "projects/{project_id} /evaluationJobs/{evaluation_job_id}"
71   * @param array $optParams Optional parameters.
72   * @return GoogleCloudDatalabelingV1beta1EvaluationJob
73   */
74  public function get($name, $optParams = [])
75  {
76    $params = ['name' => $name];
77    $params = array_merge($params, $optParams);
78    return $this->call('get', [$params], GoogleCloudDatalabelingV1beta1EvaluationJob::class);
79  }
80  /**
81   * Lists all evaluation jobs within a project with possible filters. Pagination
82   * is supported. (evaluationJobs.listProjectsEvaluationJobs)
83   *
84   * @param string $parent Required. Evaluation job resource parent. Format:
85   * "projects/{project_id}"
86   * @param array $optParams Optional parameters.
87   *
88   * @opt_param string filter Optional. You can filter the jobs to list by
89   * model_id (also known as model_name, as described in
90   * EvaluationJob.modelVersion) or by evaluation job state (as described in
91   * EvaluationJob.state). To filter by both criteria, use the `AND` operator or
92   * the `OR` operator. For example, you can use the following string for your
93   * filter: "evaluation_job.model_id = {model_name} AND evaluation_job.state =
94   * {evaluation_job_state}"
95   * @opt_param int pageSize Optional. Requested page size. Server may return
96   * fewer results than requested. Default value is 100.
97   * @opt_param string pageToken Optional. A token identifying a page of results
98   * for the server to return. Typically obtained by the nextPageToken in the
99   * response to the previous request. The request returns the first page if this
100   * is empty.
101   * @return GoogleCloudDatalabelingV1beta1ListEvaluationJobsResponse
102   */
103  public function listProjectsEvaluationJobs($parent, $optParams = [])
104  {
105    $params = ['parent' => $parent];
106    $params = array_merge($params, $optParams);
107    return $this->call('list', [$params], GoogleCloudDatalabelingV1beta1ListEvaluationJobsResponse::class);
108  }
109  /**
110   * Updates an evaluation job. You can only update certain fields of the job's
111   * EvaluationJobConfig: `humanAnnotationConfig.instruction`, `exampleCount`, and
112   * `exampleSamplePercentage`. If you want to change any other aspect of the
113   * evaluation job, you must delete the job and create a new one.
114   * (evaluationJobs.patch)
115   *
116   * @param string $name Output only. After you create a job, Data Labeling
117   * Service assigns a name to the job with the following format:
118   * "projects/{project_id}/evaluationJobs/ {evaluation_job_id}"
119   * @param GoogleCloudDatalabelingV1beta1EvaluationJob $postBody
120   * @param array $optParams Optional parameters.
121   *
122   * @opt_param string updateMask Optional. Mask for which fields to update. You
123   * can only provide the following fields: *
124   * `evaluationJobConfig.humanAnnotationConfig.instruction` *
125   * `evaluationJobConfig.exampleCount` *
126   * `evaluationJobConfig.exampleSamplePercentage` You can provide more than one
127   * of these fields by separating them with commas.
128   * @return GoogleCloudDatalabelingV1beta1EvaluationJob
129   */
130  public function patch($name, GoogleCloudDatalabelingV1beta1EvaluationJob $postBody, $optParams = [])
131  {
132    $params = ['name' => $name, 'postBody' => $postBody];
133    $params = array_merge($params, $optParams);
134    return $this->call('patch', [$params], GoogleCloudDatalabelingV1beta1EvaluationJob::class);
135  }
136  /**
137   * Pauses an evaluation job. Pausing an evaluation job that is already in a
138   * `PAUSED` state is a no-op. (evaluationJobs.pause)
139   *
140   * @param string $name Required. Name of the evaluation job that is going to be
141   * paused. Format: "projects/{project_id}/evaluationJobs/{evaluation_job_id}"
142   * @param GoogleCloudDatalabelingV1beta1PauseEvaluationJobRequest $postBody
143   * @param array $optParams Optional parameters.
144   * @return GoogleProtobufEmpty
145   */
146  public function pause($name, GoogleCloudDatalabelingV1beta1PauseEvaluationJobRequest $postBody, $optParams = [])
147  {
148    $params = ['name' => $name, 'postBody' => $postBody];
149    $params = array_merge($params, $optParams);
150    return $this->call('pause', [$params], GoogleProtobufEmpty::class);
151  }
152  /**
153   * Resumes a paused evaluation job. A deleted evaluation job can't be resumed.
154   * Resuming a running or scheduled evaluation job is a no-op.
155   * (evaluationJobs.resume)
156   *
157   * @param string $name Required. Name of the evaluation job that is going to be
158   * resumed. Format: "projects/{project_id}/evaluationJobs/{evaluation_job_id}"
159   * @param GoogleCloudDatalabelingV1beta1ResumeEvaluationJobRequest $postBody
160   * @param array $optParams Optional parameters.
161   * @return GoogleProtobufEmpty
162   */
163  public function resume($name, GoogleCloudDatalabelingV1beta1ResumeEvaluationJobRequest $postBody, $optParams = [])
164  {
165    $params = ['name' => $name, 'postBody' => $postBody];
166    $params = array_merge($params, $optParams);
167    return $this->call('resume', [$params], GoogleProtobufEmpty::class);
168  }
169}
170
171// Adding a class alias for backwards compatibility with the previous class name.
172class_alias(ProjectsEvaluationJobs::class, 'Google_Service_DataLabeling_Resource_ProjectsEvaluationJobs');
173