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\ToolResults\Resource;
19
20use Google\Service\ToolResults\Execution;
21use Google\Service\ToolResults\ListExecutionsResponse;
22
23/**
24 * The "executions" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $toolresultsService = new Google\Service\ToolResults(...);
28 *   $executions = $toolresultsService->executions;
29 *  </code>
30 */
31class ProjectsHistoriesExecutions extends \Google\Service\Resource
32{
33  /**
34   * Creates an Execution. The returned Execution will have the id set. May return
35   * any of the following canonical error codes: - PERMISSION_DENIED - if the user
36   * is not authorized to write to project - INVALID_ARGUMENT - if the request is
37   * malformed - NOT_FOUND - if the containing History does not exist
38   * (executions.create)
39   *
40   * @param string $projectId A Project id. Required.
41   * @param string $historyId A History id. Required.
42   * @param Execution $postBody
43   * @param array $optParams Optional parameters.
44   *
45   * @opt_param string requestId A unique request ID for server to detect
46   * duplicated requests. For example, a UUID. Optional, but strongly recommended.
47   * @return Execution
48   */
49  public function create($projectId, $historyId, Execution $postBody, $optParams = [])
50  {
51    $params = ['projectId' => $projectId, 'historyId' => $historyId, 'postBody' => $postBody];
52    $params = array_merge($params, $optParams);
53    return $this->call('create', [$params], Execution::class);
54  }
55  /**
56   * Gets an Execution. May return any of the following canonical error codes: -
57   * PERMISSION_DENIED - if the user is not authorized to write to project -
58   * INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the Execution
59   * does not exist (executions.get)
60   *
61   * @param string $projectId A Project id. Required.
62   * @param string $historyId A History id. Required.
63   * @param string $executionId An Execution id. Required.
64   * @param array $optParams Optional parameters.
65   * @return Execution
66   */
67  public function get($projectId, $historyId, $executionId, $optParams = [])
68  {
69    $params = ['projectId' => $projectId, 'historyId' => $historyId, 'executionId' => $executionId];
70    $params = array_merge($params, $optParams);
71    return $this->call('get', [$params], Execution::class);
72  }
73  /**
74   * Lists Executions for a given History. The executions are sorted by
75   * creation_time in descending order. The execution_id key will be used to order
76   * the executions with the same creation_time. May return any of the following
77   * canonical error codes: - PERMISSION_DENIED - if the user is not authorized to
78   * read project - INVALID_ARGUMENT - if the request is malformed - NOT_FOUND -
79   * if the containing History does not exist
80   * (executions.listProjectsHistoriesExecutions)
81   *
82   * @param string $projectId A Project id. Required.
83   * @param string $historyId A History id. Required.
84   * @param array $optParams Optional parameters.
85   *
86   * @opt_param int pageSize The maximum number of Executions to fetch. Default
87   * value: 25. The server will use this default if the field is not set or has a
88   * value of 0. Optional.
89   * @opt_param string pageToken A continuation token to resume the query at the
90   * next item. Optional.
91   * @return ListExecutionsResponse
92   */
93  public function listProjectsHistoriesExecutions($projectId, $historyId, $optParams = [])
94  {
95    $params = ['projectId' => $projectId, 'historyId' => $historyId];
96    $params = array_merge($params, $optParams);
97    return $this->call('list', [$params], ListExecutionsResponse::class);
98  }
99  /**
100   * Updates an existing Execution with the supplied partial entity. May return
101   * any of the following canonical error codes: - PERMISSION_DENIED - if the user
102   * is not authorized to write to project - INVALID_ARGUMENT - if the request is
103   * malformed - FAILED_PRECONDITION - if the requested state transition is
104   * illegal - NOT_FOUND - if the containing History does not exist
105   * (executions.patch)
106   *
107   * @param string $projectId A Project id. Required.
108   * @param string $historyId Required.
109   * @param string $executionId Required.
110   * @param Execution $postBody
111   * @param array $optParams Optional parameters.
112   *
113   * @opt_param string requestId A unique request ID for server to detect
114   * duplicated requests. For example, a UUID. Optional, but strongly recommended.
115   * @return Execution
116   */
117  public function patch($projectId, $historyId, $executionId, Execution $postBody, $optParams = [])
118  {
119    $params = ['projectId' => $projectId, 'historyId' => $historyId, 'executionId' => $executionId, 'postBody' => $postBody];
120    $params = array_merge($params, $optParams);
121    return $this->call('patch', [$params], Execution::class);
122  }
123}
124
125// Adding a class alias for backwards compatibility with the previous class name.
126class_alias(ProjectsHistoriesExecutions::class, 'Google_Service_ToolResults_Resource_ProjectsHistoriesExecutions');
127