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