[e3d4e0a] | 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 |
|
---|
| 18 | namespace Google\Service\Storagetransfer\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Storagetransfer\CancelOperationRequest;
|
---|
| 21 | use Google\Service\Storagetransfer\ListOperationsResponse;
|
---|
| 22 | use Google\Service\Storagetransfer\Operation;
|
---|
| 23 | use Google\Service\Storagetransfer\PauseTransferOperationRequest;
|
---|
| 24 | use Google\Service\Storagetransfer\ResumeTransferOperationRequest;
|
---|
| 25 | use Google\Service\Storagetransfer\StoragetransferEmpty;
|
---|
| 26 |
|
---|
| 27 | /**
|
---|
| 28 | * The "transferOperations" collection of methods.
|
---|
| 29 | * Typical usage is:
|
---|
| 30 | * <code>
|
---|
| 31 | * $storagetransferService = new Google\Service\Storagetransfer(...);
|
---|
| 32 | * $transferOperations = $storagetransferService->transferOperations;
|
---|
| 33 | * </code>
|
---|
| 34 | */
|
---|
| 35 | class TransferOperations extends \Google\Service\Resource
|
---|
| 36 | {
|
---|
| 37 | /**
|
---|
| 38 | * Cancels a transfer. Use the transferOperations.get method to check if the
|
---|
| 39 | * cancellation succeeded or if the operation completed despite the `cancel`
|
---|
| 40 | * request. When you cancel an operation, the currently running transfer is
|
---|
| 41 | * interrupted. For recurring transfer jobs, the next instance of the transfer
|
---|
| 42 | * job will still run. For example, if your job is configured to run every day
|
---|
| 43 | * at 1pm and you cancel Monday's operation at 1:05pm, Monday's transfer will
|
---|
| 44 | * stop. However, a transfer job will still be attempted on Tuesday. This
|
---|
| 45 | * applies only to currently running operations. If an operation is not
|
---|
| 46 | * currently running, `cancel` does nothing. *Caution:* Canceling a transfer job
|
---|
| 47 | * can leave your data in an unknown state. We recommend that you restore the
|
---|
| 48 | * state at both the destination and the source after the `cancel` request
|
---|
| 49 | * completes so that your data is in a consistent state. When you cancel a job,
|
---|
| 50 | * the next job computes a delta of files and may repair any inconsistent state.
|
---|
| 51 | * For instance, if you run a job every day, and today's job found 10 new files
|
---|
| 52 | * and transferred five files before you canceled the job, tomorrow's transfer
|
---|
| 53 | * operation will compute a new delta with the five files that were not copied
|
---|
| 54 | * today plus any new files discovered tomorrow. (transferOperations.cancel)
|
---|
| 55 | *
|
---|
| 56 | * @param string $name The name of the operation resource to be cancelled.
|
---|
| 57 | * @param CancelOperationRequest $postBody
|
---|
| 58 | * @param array $optParams Optional parameters.
|
---|
| 59 | * @return StoragetransferEmpty
|
---|
| 60 | * @throws \Google\Service\Exception
|
---|
| 61 | */
|
---|
| 62 | public function cancel($name, CancelOperationRequest $postBody, $optParams = [])
|
---|
| 63 | {
|
---|
| 64 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 65 | $params = array_merge($params, $optParams);
|
---|
| 66 | return $this->call('cancel', [$params], StoragetransferEmpty::class);
|
---|
| 67 | }
|
---|
| 68 | /**
|
---|
| 69 | * Gets the latest state of a long-running operation. Clients can use this
|
---|
| 70 | * method to poll the operation result at intervals as recommended by the API
|
---|
| 71 | * service. (transferOperations.get)
|
---|
| 72 | *
|
---|
| 73 | * @param string $name The name of the operation resource.
|
---|
| 74 | * @param array $optParams Optional parameters.
|
---|
| 75 | * @return Operation
|
---|
| 76 | * @throws \Google\Service\Exception
|
---|
| 77 | */
|
---|
| 78 | public function get($name, $optParams = [])
|
---|
| 79 | {
|
---|
| 80 | $params = ['name' => $name];
|
---|
| 81 | $params = array_merge($params, $optParams);
|
---|
| 82 | return $this->call('get', [$params], Operation::class);
|
---|
| 83 | }
|
---|
| 84 | /**
|
---|
| 85 | * Lists transfer operations. Operations are ordered by their creation time in
|
---|
| 86 | * reverse chronological order. (transferOperations.listTransferOperations)
|
---|
| 87 | *
|
---|
| 88 | * @param string $name Required. The name of the type being listed; must be
|
---|
| 89 | * `transferOperations`.
|
---|
| 90 | * @param string $filter Required. A list of query parameters specified as JSON
|
---|
| 91 | * text in the form of: `{"projectId":"my_project_id",
|
---|
| 92 | * "jobNames":["jobid1","jobid2",...], "jobNamePattern": "job_name_pattern",
|
---|
| 93 | * "operationNames":["opid1","opid2",...], "operationNamePattern":
|
---|
| 94 | * "operation_name_pattern", "minCreationTime": "min_creation_time",
|
---|
| 95 | * "maxCreationTime": "max_creation_time",
|
---|
| 96 | * "transferStatuses":["status1","status2",...]}` Since `jobNames`,
|
---|
| 97 | * `operationNames`, and `transferStatuses` support multiple values, they must
|
---|
| 98 | * be specified with array notation. `projectId` is the only argument that is
|
---|
| 99 | * required. If specified, `jobNamePattern` and `operationNamePattern` must
|
---|
| 100 | * match the full job or operation name respectively. '*' is a wildcard matching
|
---|
| 101 | * 0 or more characters. `minCreationTime` and `maxCreationTime` should be
|
---|
| 102 | * timestamps encoded as a string in the [RFC
|
---|
| 103 | * 3339](https://www.ietf.org/rfc/rfc3339.txt) format. The valid values for
|
---|
| 104 | * `transferStatuses` are case-insensitive: IN_PROGRESS, PAUSED, SUCCESS,
|
---|
| 105 | * FAILED, and ABORTED.
|
---|
| 106 | * @param array $optParams Optional parameters.
|
---|
| 107 | *
|
---|
| 108 | * @opt_param int pageSize The list page size. The max allowed value is 256.
|
---|
| 109 | * @opt_param string pageToken The list page token.
|
---|
| 110 | * @return ListOperationsResponse
|
---|
| 111 | * @throws \Google\Service\Exception
|
---|
| 112 | */
|
---|
| 113 | public function listTransferOperations($name, $filter, $optParams = [])
|
---|
| 114 | {
|
---|
| 115 | $params = ['name' => $name, 'filter' => $filter];
|
---|
| 116 | $params = array_merge($params, $optParams);
|
---|
| 117 | return $this->call('list', [$params], ListOperationsResponse::class);
|
---|
| 118 | }
|
---|
| 119 | /**
|
---|
| 120 | * Pauses a transfer operation. (transferOperations.pause)
|
---|
| 121 | *
|
---|
| 122 | * @param string $name Required. The name of the transfer operation.
|
---|
| 123 | * @param PauseTransferOperationRequest $postBody
|
---|
| 124 | * @param array $optParams Optional parameters.
|
---|
| 125 | * @return StoragetransferEmpty
|
---|
| 126 | * @throws \Google\Service\Exception
|
---|
| 127 | */
|
---|
| 128 | public function pause($name, PauseTransferOperationRequest $postBody, $optParams = [])
|
---|
| 129 | {
|
---|
| 130 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 131 | $params = array_merge($params, $optParams);
|
---|
| 132 | return $this->call('pause', [$params], StoragetransferEmpty::class);
|
---|
| 133 | }
|
---|
| 134 | /**
|
---|
| 135 | * Resumes a transfer operation that is paused. (transferOperations.resume)
|
---|
| 136 | *
|
---|
| 137 | * @param string $name Required. The name of the transfer operation.
|
---|
| 138 | * @param ResumeTransferOperationRequest $postBody
|
---|
| 139 | * @param array $optParams Optional parameters.
|
---|
| 140 | * @return StoragetransferEmpty
|
---|
| 141 | * @throws \Google\Service\Exception
|
---|
| 142 | */
|
---|
| 143 | public function resume($name, ResumeTransferOperationRequest $postBody, $optParams = [])
|
---|
| 144 | {
|
---|
| 145 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 146 | $params = array_merge($params, $optParams);
|
---|
| 147 | return $this->call('resume', [$params], StoragetransferEmpty::class);
|
---|
| 148 | }
|
---|
| 149 | }
|
---|
| 150 |
|
---|
| 151 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 152 | class_alias(TransferOperations::class, 'Google_Service_Storagetransfer_Resource_TransferOperations');
|
---|