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\LeaseWorkItemRequest;
21use Google\Service\Dataflow\LeaseWorkItemResponse;
22use Google\Service\Dataflow\ReportWorkItemStatusRequest;
23use Google\Service\Dataflow\ReportWorkItemStatusResponse;
24
25/**
26 * The "workItems" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $dataflowService = new Google\Service\Dataflow(...);
30 *   $workItems = $dataflowService->workItems;
31 *  </code>
32 */
33class ProjectsJobsWorkItems extends \Google\Service\Resource
34{
35  /**
36   * Leases a dataflow WorkItem to run. (workItems.lease)
37   *
38   * @param string $projectId Identifies the project this worker belongs to.
39   * @param string $jobId Identifies the workflow job this worker belongs to.
40   * @param LeaseWorkItemRequest $postBody
41   * @param array $optParams Optional parameters.
42   * @return LeaseWorkItemResponse
43   */
44  public function lease($projectId, $jobId, LeaseWorkItemRequest $postBody, $optParams = [])
45  {
46    $params = ['projectId' => $projectId, 'jobId' => $jobId, 'postBody' => $postBody];
47    $params = array_merge($params, $optParams);
48    return $this->call('lease', [$params], LeaseWorkItemResponse::class);
49  }
50  /**
51   * Reports the status of dataflow WorkItems leased by a worker.
52   * (workItems.reportStatus)
53   *
54   * @param string $projectId The project which owns the WorkItem's job.
55   * @param string $jobId The job which the WorkItem is part of.
56   * @param ReportWorkItemStatusRequest $postBody
57   * @param array $optParams Optional parameters.
58   * @return ReportWorkItemStatusResponse
59   */
60  public function reportStatus($projectId, $jobId, ReportWorkItemStatusRequest $postBody, $optParams = [])
61  {
62    $params = ['projectId' => $projectId, 'jobId' => $jobId, 'postBody' => $postBody];
63    $params = array_merge($params, $optParams);
64    return $this->call('reportStatus', [$params], ReportWorkItemStatusResponse::class);
65  }
66}
67
68// Adding a class alias for backwards compatibility with the previous class name.
69class_alias(ProjectsJobsWorkItems::class, 'Google_Service_Dataflow_Resource_ProjectsJobsWorkItems');
70