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\WorkflowExecutions\Resource;
19
20use Google\Service\WorkflowExecutions\CancelExecutionRequest;
21use Google\Service\WorkflowExecutions\Execution;
22use Google\Service\WorkflowExecutions\ListExecutionsResponse;
23
24/**
25 * The "executions" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $workflowexecutionsService = new Google\Service\WorkflowExecutions(...);
29 *   $executions = $workflowexecutionsService->executions;
30 *  </code>
31 */
32class ProjectsLocationsWorkflowsExecutions extends \Google\Service\Resource
33{
34  /**
35   * Cancels an execution of the given name. (executions.cancel)
36   *
37   * @param string $name Required. Name of the execution to be cancelled. Format:
38   * projects/{project}/locations/{location}/workflows/{workflow}/executions/{exec
39   * ution}
40   * @param CancelExecutionRequest $postBody
41   * @param array $optParams Optional parameters.
42   * @return Execution
43   */
44  public function cancel($name, CancelExecutionRequest $postBody, $optParams = [])
45  {
46    $params = ['name' => $name, 'postBody' => $postBody];
47    $params = array_merge($params, $optParams);
48    return $this->call('cancel', [$params], Execution::class);
49  }
50  /**
51   * Creates a new execution using the latest revision of the given workflow.
52   * (executions.create)
53   *
54   * @param string $parent Required. Name of the workflow for which an execution
55   * should be created. Format:
56   * projects/{project}/locations/{location}/workflows/{workflow} The latest
57   * revision of the workflow will be used.
58   * @param Execution $postBody
59   * @param array $optParams Optional parameters.
60   * @return Execution
61   */
62  public function create($parent, Execution $postBody, $optParams = [])
63  {
64    $params = ['parent' => $parent, 'postBody' => $postBody];
65    $params = array_merge($params, $optParams);
66    return $this->call('create', [$params], Execution::class);
67  }
68  /**
69   * Returns an execution of the given name. (executions.get)
70   *
71   * @param string $name Required. Name of the execution to be retrieved. Format:
72   * projects/{project}/locations/{location}/workflows/{workflow}/executions/{exec
73   * ution}
74   * @param array $optParams Optional parameters.
75   *
76   * @opt_param string view Optional. A view defining which fields should be
77   * filled in the returned execution. The API will default to the FULL view.
78   * @return Execution
79   */
80  public function get($name, $optParams = [])
81  {
82    $params = ['name' => $name];
83    $params = array_merge($params, $optParams);
84    return $this->call('get', [$params], Execution::class);
85  }
86  /**
87   * Returns a list of executions which belong to the workflow with the given
88   * name. The method returns executions of all workflow revisions. Returned
89   * executions are ordered by their start time (newest first).
90   * (executions.listProjectsLocationsWorkflowsExecutions)
91   *
92   * @param string $parent Required. Name of the workflow for which the executions
93   * should be listed. Format:
94   * projects/{project}/locations/{location}/workflows/{workflow}
95   * @param array $optParams Optional parameters.
96   *
97   * @opt_param int pageSize Maximum number of executions to return per call. Max
98   * supported value depends on the selected Execution view: it's 10000 for BASIC
99   * and 100 for FULL. The default value used if the field is not specified is
100   * 100, regardless of the selected view. Values greater than the max value will
101   * be coerced down to it.
102   * @opt_param string pageToken A page token, received from a previous
103   * `ListExecutions` call. Provide this to retrieve the subsequent page. When
104   * paginating, all other parameters provided to `ListExecutions` must match the
105   * call that provided the page token.
106   * @opt_param string view Optional. A view defining which fields should be
107   * filled in the returned executions. The API will default to the BASIC view.
108   * @return ListExecutionsResponse
109   */
110  public function listProjectsLocationsWorkflowsExecutions($parent, $optParams = [])
111  {
112    $params = ['parent' => $parent];
113    $params = array_merge($params, $optParams);
114    return $this->call('list', [$params], ListExecutionsResponse::class);
115  }
116}
117
118// Adding a class alias for backwards compatibility with the previous class name.
119class_alias(ProjectsLocationsWorkflowsExecutions::class, 'Google_Service_WorkflowExecutions_Resource_ProjectsLocationsWorkflowsExecutions');
120