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\Storagetransfer\Resource;
19
20use Google\Service\Storagetransfer\ListTransferJobsResponse;
21use Google\Service\Storagetransfer\Operation;
22use Google\Service\Storagetransfer\RunTransferJobRequest;
23use Google\Service\Storagetransfer\TransferJob;
24use Google\Service\Storagetransfer\UpdateTransferJobRequest;
25
26/**
27 * The "transferJobs" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $storagetransferService = new Google\Service\Storagetransfer(...);
31 *   $transferJobs = $storagetransferService->transferJobs;
32 *  </code>
33 */
34class TransferJobs extends \Google\Service\Resource
35{
36  /**
37   * Creates a transfer job that runs periodically. (transferJobs.create)
38   *
39   * @param TransferJob $postBody
40   * @param array $optParams Optional parameters.
41   * @return TransferJob
42   */
43  public function create(TransferJob $postBody, $optParams = [])
44  {
45    $params = ['postBody' => $postBody];
46    $params = array_merge($params, $optParams);
47    return $this->call('create', [$params], TransferJob::class);
48  }
49  /**
50   * Gets a transfer job. (transferJobs.get)
51   *
52   * @param string $jobName Required. The job to get.
53   * @param string $projectId Required. The ID of the Google Cloud project that
54   * owns the job.
55   * @param array $optParams Optional parameters.
56   * @return TransferJob
57   */
58  public function get($jobName, $projectId, $optParams = [])
59  {
60    $params = ['jobName' => $jobName, 'projectId' => $projectId];
61    $params = array_merge($params, $optParams);
62    return $this->call('get', [$params], TransferJob::class);
63  }
64  /**
65   * Lists transfer jobs. (transferJobs.listTransferJobs)
66   *
67   * @param string $filter Required. A list of query parameters specified as JSON
68   * text in the form of: `{"projectId":"my_project_id",
69   * "jobNames":["jobid1","jobid2",...], "jobStatuses":["status1","status2",...]}`
70   * Since `jobNames` and `jobStatuses` support multiple values, their values must
71   * be specified with array notation. `projectId` is required. `jobNames` and
72   * `jobStatuses` are optional. The valid values for `jobStatuses` are case-
73   * insensitive: ENABLED, DISABLED, and DELETED.
74   * @param array $optParams Optional parameters.
75   *
76   * @opt_param int pageSize The list page size. The max allowed value is 256.
77   * @opt_param string pageToken The list page token.
78   * @return ListTransferJobsResponse
79   */
80  public function listTransferJobs($filter, $optParams = [])
81  {
82    $params = ['filter' => $filter];
83    $params = array_merge($params, $optParams);
84    return $this->call('list', [$params], ListTransferJobsResponse::class);
85  }
86  /**
87   * Updates a transfer job. Updating a job's transfer spec does not affect
88   * transfer operations that are running already. **Note:** The job's status
89   * field can be modified using this RPC (for example, to set a job's status to
90   * DELETED, DISABLED, or ENABLED). (transferJobs.patch)
91   *
92   * @param string $jobName Required. The name of job to update.
93   * @param UpdateTransferJobRequest $postBody
94   * @param array $optParams Optional parameters.
95   * @return TransferJob
96   */
97  public function patch($jobName, UpdateTransferJobRequest $postBody, $optParams = [])
98  {
99    $params = ['jobName' => $jobName, 'postBody' => $postBody];
100    $params = array_merge($params, $optParams);
101    return $this->call('patch', [$params], TransferJob::class);
102  }
103  /**
104   * Attempts to start a new TransferOperation for the current TransferJob. A
105   * TransferJob has a maximum of one active TransferOperation. If this method is
106   * called while a TransferOperation is active, an error will be returned.
107   * (transferJobs.run)
108   *
109   * @param string $jobName Required. The name of the transfer job.
110   * @param RunTransferJobRequest $postBody
111   * @param array $optParams Optional parameters.
112   * @return Operation
113   */
114  public function run($jobName, RunTransferJobRequest $postBody, $optParams = [])
115  {
116    $params = ['jobName' => $jobName, 'postBody' => $postBody];
117    $params = array_merge($params, $optParams);
118    return $this->call('run', [$params], Operation::class);
119  }
120}
121
122// Adding a class alias for backwards compatibility with the previous class name.
123class_alias(TransferJobs::class, 'Google_Service_Storagetransfer_Resource_TransferJobs');
124