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\Datapipelines\Resource;
19
20use Google\Service\Datapipelines\GoogleCloudDatapipelinesV1Pipeline;
21use Google\Service\Datapipelines\GoogleCloudDatapipelinesV1RunPipelineRequest;
22use Google\Service\Datapipelines\GoogleCloudDatapipelinesV1RunPipelineResponse;
23use Google\Service\Datapipelines\GoogleCloudDatapipelinesV1StopPipelineRequest;
24use Google\Service\Datapipelines\GoogleProtobufEmpty;
25
26/**
27 * The "pipelines" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $datapipelinesService = new Google\Service\Datapipelines(...);
31 *   $pipelines = $datapipelinesService->pipelines;
32 *  </code>
33 */
34class ProjectsLocationsPipelines extends \Google\Service\Resource
35{
36  /**
37   * Creates a pipeline. For a batch pipeline, you can pass scheduler information.
38   * Data Pipelines uses the scheduler information to create an internal scheduler
39   * that runs jobs periodically. If the internal scheduler is not configured, you
40   * can use RunPipeline to run jobs. (pipelines.create)
41   *
42   * @param string $parent Required. The location name. For example:
43   * `projects/PROJECT_ID/locations/LOCATION_ID`.
44   * @param GoogleCloudDatapipelinesV1Pipeline $postBody
45   * @param array $optParams Optional parameters.
46   * @return GoogleCloudDatapipelinesV1Pipeline
47   */
48  public function create($parent, GoogleCloudDatapipelinesV1Pipeline $postBody, $optParams = [])
49  {
50    $params = ['parent' => $parent, 'postBody' => $postBody];
51    $params = array_merge($params, $optParams);
52    return $this->call('create', [$params], GoogleCloudDatapipelinesV1Pipeline::class);
53  }
54  /**
55   * Deletes a pipeline. If a scheduler job is attached to the pipeline, it will
56   * be deleted. (pipelines.delete)
57   *
58   * @param string $name Required. The pipeline name. For example:
59   * `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`.
60   * @param array $optParams Optional parameters.
61   * @return GoogleProtobufEmpty
62   */
63  public function delete($name, $optParams = [])
64  {
65    $params = ['name' => $name];
66    $params = array_merge($params, $optParams);
67    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
68  }
69  /**
70   * Looks up a single pipeline. Returns a "NOT_FOUND" error if no such pipeline
71   * exists. Returns a "FORBIDDEN" error if the caller doesn't have permission to
72   * access it. (pipelines.get)
73   *
74   * @param string $name Required. The pipeline name. For example:
75   * `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`.
76   * @param array $optParams Optional parameters.
77   * @return GoogleCloudDatapipelinesV1Pipeline
78   */
79  public function get($name, $optParams = [])
80  {
81    $params = ['name' => $name];
82    $params = array_merge($params, $optParams);
83    return $this->call('get', [$params], GoogleCloudDatapipelinesV1Pipeline::class);
84  }
85  /**
86   * Updates a pipeline. If successful, the updated Pipeline is returned. Returns
87   * `NOT_FOUND` if the pipeline doesn't exist. If UpdatePipeline does not return
88   * successfully, you can retry the UpdatePipeline request until you receive a
89   * successful response. (pipelines.patch)
90   *
91   * @param string $name The pipeline name. For example:
92   * `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`. *
93   * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-),
94   * colons (:), and periods (.). For more information, see [Identifying
95   * projects](https://cloud.google.com/resource-manager/docs/creating-managing-
96   * projects#identifying_projects). * `LOCATION_ID` is the canonical ID for the
97   * pipeline's location. The list of available locations can be obtained by
98   * calling `google.cloud.location.Locations.ListLocations`. Note that the Data
99   * Pipelines service is not available in all regions. It depends on Cloud
100   * Scheduler, an App Engine application, so it's only available in [App Engine
101   * regions](https://cloud.google.com/about/locations#region). * `PIPELINE_ID` is
102   * the ID of the pipeline. Must be unique for the selected project and location.
103   * @param GoogleCloudDatapipelinesV1Pipeline $postBody
104   * @param array $optParams Optional parameters.
105   *
106   * @opt_param string updateMask The list of fields to be updated.
107   * @return GoogleCloudDatapipelinesV1Pipeline
108   */
109  public function patch($name, GoogleCloudDatapipelinesV1Pipeline $postBody, $optParams = [])
110  {
111    $params = ['name' => $name, 'postBody' => $postBody];
112    $params = array_merge($params, $optParams);
113    return $this->call('patch', [$params], GoogleCloudDatapipelinesV1Pipeline::class);
114  }
115  /**
116   * Creates a job for the specified pipeline directly. You can use this method
117   * when the internal scheduler is not configured and you want to trigger the job
118   * directly or through an external system. Returns a "NOT_FOUND" error if the
119   * pipeline doesn't exist. Returns a "FORBIDDEN" error if the user doesn't have
120   * permission to access the pipeline or run jobs for the pipeline.
121   * (pipelines.run)
122   *
123   * @param string $name Required. The pipeline name. For example:
124   * `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`.
125   * @param GoogleCloudDatapipelinesV1RunPipelineRequest $postBody
126   * @param array $optParams Optional parameters.
127   * @return GoogleCloudDatapipelinesV1RunPipelineResponse
128   */
129  public function run($name, GoogleCloudDatapipelinesV1RunPipelineRequest $postBody, $optParams = [])
130  {
131    $params = ['name' => $name, 'postBody' => $postBody];
132    $params = array_merge($params, $optParams);
133    return $this->call('run', [$params], GoogleCloudDatapipelinesV1RunPipelineResponse::class);
134  }
135  /**
136   * Freezes pipeline execution permanently. If there's a corresponding scheduler
137   * entry, it's deleted, and the pipeline state is changed to "ARCHIVED".
138   * However, pipeline metadata is retained. (pipelines.stop)
139   *
140   * @param string $name Required. The pipeline name. For example:
141   * `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`.
142   * @param GoogleCloudDatapipelinesV1StopPipelineRequest $postBody
143   * @param array $optParams Optional parameters.
144   * @return GoogleCloudDatapipelinesV1Pipeline
145   */
146  public function stop($name, GoogleCloudDatapipelinesV1StopPipelineRequest $postBody, $optParams = [])
147  {
148    $params = ['name' => $name, 'postBody' => $postBody];
149    $params = array_merge($params, $optParams);
150    return $this->call('stop', [$params], GoogleCloudDatapipelinesV1Pipeline::class);
151  }
152}
153
154// Adding a class alias for backwards compatibility with the previous class name.
155class_alias(ProjectsLocationsPipelines::class, 'Google_Service_Datapipelines_Resource_ProjectsLocationsPipelines');
156