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\Workflows\Resource;
19
20use Google\Service\Workflows\ListWorkflowsResponse;
21use Google\Service\Workflows\Operation;
22use Google\Service\Workflows\Workflow;
23
24/**
25 * The "workflows" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $workflowsService = new Google\Service\Workflows(...);
29 *   $workflows = $workflowsService->workflows;
30 *  </code>
31 */
32class ProjectsLocationsWorkflows extends \Google\Service\Resource
33{
34  /**
35   * Creates a new workflow. If a workflow with the specified name already exists
36   * in the specified project and location, the long running operation will return
37   * ALREADY_EXISTS error. (workflows.create)
38   *
39   * @param string $parent Required. Project and location in which the workflow
40   * should be created. Format: projects/{project}/locations/{location}
41   * @param Workflow $postBody
42   * @param array $optParams Optional parameters.
43   *
44   * @opt_param string workflowId Required. The ID of the workflow to be created.
45   * It has to fulfill the following requirements: * Must contain only letters,
46   * numbers, underscores and hyphens. * Must start with a letter. * Must be
47   * between 1-64 characters. * Must end with a number or a letter. * Must be
48   * unique within the customer project and location.
49   * @return Operation
50   */
51  public function create($parent, Workflow $postBody, $optParams = [])
52  {
53    $params = ['parent' => $parent, 'postBody' => $postBody];
54    $params = array_merge($params, $optParams);
55    return $this->call('create', [$params], Operation::class);
56  }
57  /**
58   * Deletes a workflow with the specified name. This method also cancels and
59   * deletes all running executions of the workflow. (workflows.delete)
60   *
61   * @param string $name Required. Name of the workflow to be deleted. Format:
62   * projects/{project}/locations/{location}/workflows/{workflow}
63   * @param array $optParams Optional parameters.
64   * @return Operation
65   */
66  public function delete($name, $optParams = [])
67  {
68    $params = ['name' => $name];
69    $params = array_merge($params, $optParams);
70    return $this->call('delete', [$params], Operation::class);
71  }
72  /**
73   * Gets details of a single Workflow. (workflows.get)
74   *
75   * @param string $name Required. Name of the workflow which information should
76   * be retrieved. Format:
77   * projects/{project}/locations/{location}/workflows/{workflow}
78   * @param array $optParams Optional parameters.
79   * @return Workflow
80   */
81  public function get($name, $optParams = [])
82  {
83    $params = ['name' => $name];
84    $params = array_merge($params, $optParams);
85    return $this->call('get', [$params], Workflow::class);
86  }
87  /**
88   * Lists Workflows in a given project and location. The default order is not
89   * specified. (workflows.listProjectsLocationsWorkflows)
90   *
91   * @param string $parent Required. Project and location from which the workflows
92   * should be listed. Format: projects/{project}/locations/{location}
93   * @param array $optParams Optional parameters.
94   *
95   * @opt_param string filter Filter to restrict results to specific workflows.
96   * @opt_param string orderBy Comma-separated list of fields that that specify
97   * the order of the results. Default sorting order for a field is ascending. To
98   * specify descending order for a field, append a " desc" suffix. If not
99   * specified, the results will be returned in an unspecified order.
100   * @opt_param int pageSize Maximum number of workflows to return per call. The
101   * service may return fewer than this value. If the value is not specified, a
102   * default value of 500 will be used. The maximum permitted value is 1000 and
103   * values greater than 1000 will be coerced down to 1000.
104   * @opt_param string pageToken A page token, received from a previous
105   * `ListWorkflows` call. Provide this to retrieve the subsequent page. When
106   * paginating, all other parameters provided to `ListWorkflows` must match the
107   * call that provided the page token.
108   * @return ListWorkflowsResponse
109   */
110  public function listProjectsLocationsWorkflows($parent, $optParams = [])
111  {
112    $params = ['parent' => $parent];
113    $params = array_merge($params, $optParams);
114    return $this->call('list', [$params], ListWorkflowsResponse::class);
115  }
116  /**
117   * Updates an existing workflow. Running this method has no impact on already
118   * running executions of the workflow. A new revision of the workflow may be
119   * created as a result of a successful update operation. In that case, such
120   * revision will be used in new workflow executions. (workflows.patch)
121   *
122   * @param string $name The resource name of the workflow. Format:
123   * projects/{project}/locations/{location}/workflows/{workflow}
124   * @param Workflow $postBody
125   * @param array $optParams Optional parameters.
126   *
127   * @opt_param string updateMask List of fields to be updated. If not present,
128   * the entire workflow will be updated.
129   * @return Operation
130   */
131  public function patch($name, Workflow $postBody, $optParams = [])
132  {
133    $params = ['name' => $name, 'postBody' => $postBody];
134    $params = array_merge($params, $optParams);
135    return $this->call('patch', [$params], Operation::class);
136  }
137}
138
139// Adding a class alias for backwards compatibility with the previous class name.
140class_alias(ProjectsLocationsWorkflows::class, 'Google_Service_Workflows_Resource_ProjectsLocationsWorkflows');
141