* $storagetransferService = new Google\Service\Storagetransfer(...); * $transferJobs = $storagetransferService->transferJobs; * */ class TransferJobs extends \Google\Service\Resource { /** * Creates a transfer job that runs periodically. (transferJobs.create) * * @param TransferJob $postBody * @param array $optParams Optional parameters. * @return TransferJob * @throws \Google\Service\Exception */ public function create(TransferJob $postBody, $optParams = []) { $params = ['postBody' => $postBody]; $params = array_merge($params, $optParams); return $this->call('create', [$params], TransferJob::class); } /** * Deletes a transfer job. Deleting a transfer job sets its status to DELETED. * (transferJobs.delete) * * @param string $jobName Required. The job to delete. * @param string $projectId Required. The ID of the Google Cloud project that * owns the job. * @param array $optParams Optional parameters. * @return StoragetransferEmpty * @throws \Google\Service\Exception */ public function delete($jobName, $projectId, $optParams = []) { $params = ['jobName' => $jobName, 'projectId' => $projectId]; $params = array_merge($params, $optParams); return $this->call('delete', [$params], StoragetransferEmpty::class); } /** * Gets a transfer job. (transferJobs.get) * * @param string $jobName Required. The job to get. * @param string $projectId Required. The ID of the Google Cloud project that * owns the job. * @param array $optParams Optional parameters. * @return TransferJob * @throws \Google\Service\Exception */ public function get($jobName, $projectId, $optParams = []) { $params = ['jobName' => $jobName, 'projectId' => $projectId]; $params = array_merge($params, $optParams); return $this->call('get', [$params], TransferJob::class); } /** * Lists transfer jobs. (transferJobs.listTransferJobs) * * @param string $filter Required. A list of query parameters specified as JSON * text in the form of: ``` { "projectId":"my_project_id", * "jobNames":["jobid1","jobid2",...], "jobStatuses":["status1","status2",...], * "dataBackend":"QUERY_REPLICATION_CONFIGS", "sourceBucket":"source-bucket- * name", "sinkBucket":"sink-bucket-name", } ``` The JSON formatting in the * example is for display only; provide the query parameters without spaces or * line breaks. * `projectId` is required. * Since `jobNames` and `jobStatuses` * support multiple values, their values must be specified with array notation. * `jobNames` and `jobStatuses` are optional. Valid values are case-insensitive: * * ENABLED * DISABLED * DELETED * Specify * `"dataBackend":"QUERY_REPLICATION_CONFIGS"` to return a list of cross-bucket * replication jobs. * Limit the results to jobs from a particular bucket with * `sourceBucket` and/or to a particular bucket with `sinkBucket`. * @param array $optParams Optional parameters. * * @opt_param int pageSize The list page size. The max allowed value is 256. * @opt_param string pageToken The list page token. * @return ListTransferJobsResponse * @throws \Google\Service\Exception */ public function listTransferJobs($filter, $optParams = []) { $params = ['filter' => $filter]; $params = array_merge($params, $optParams); return $this->call('list', [$params], ListTransferJobsResponse::class); } /** * Updates a transfer job. Updating a job's transfer spec does not affect * transfer operations that are running already. **Note:** The job's status * field can be modified using this RPC (for example, to set a job's status to * DELETED, DISABLED, or ENABLED). (transferJobs.patch) * * @param string $jobName Required. The name of job to update. * @param UpdateTransferJobRequest $postBody * @param array $optParams Optional parameters. * @return TransferJob * @throws \Google\Service\Exception */ public function patch($jobName, UpdateTransferJobRequest $postBody, $optParams = []) { $params = ['jobName' => $jobName, 'postBody' => $postBody]; $params = array_merge($params, $optParams); return $this->call('patch', [$params], TransferJob::class); } /** * Starts a new operation for the specified transfer job. A `TransferJob` has a * maximum of one active `TransferOperation`. If this method is called while a * `TransferOperation` is active, an error is returned. (transferJobs.run) * * @param string $jobName Required. The name of the transfer job. * @param RunTransferJobRequest $postBody * @param array $optParams Optional parameters. * @return Operation * @throws \Google\Service\Exception */ public function run($jobName, RunTransferJobRequest $postBody, $optParams = []) { $params = ['jobName' => $jobName, 'postBody' => $postBody]; $params = array_merge($params, $optParams); return $this->call('run', [$params], Operation::class); } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(TransferJobs::class, 'Google_Service_Storagetransfer_Resource_TransferJobs');