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\RemoteBuildExecution\Resource;
19
20use Google\Service\RemoteBuildExecution\BuildBazelRemoteExecutionV2ActionResult;
21
22/**
23 * The "actionResults" collection of methods.
24 * Typical usage is:
25 *  <code>
26 *   $remotebuildexecutionService = new Google\Service\RemoteBuildExecution(...);
27 *   $actionResults = $remotebuildexecutionService->actionResults;
28 *  </code>
29 */
30class ActionResults extends \Google\Service\Resource
31{
32  /**
33   * Retrieve a cached execution result. Implementations SHOULD ensure that any
34   * blobs referenced from the ContentAddressableStorage are available at the time
35   * of returning the ActionResult and will be for some period of time afterwards.
36   * The lifetimes of the referenced blobs SHOULD be increased if necessary and
37   * applicable. Errors: * `NOT_FOUND`: The requested `ActionResult` is not in the
38   * cache. (actionResults.get)
39   *
40   * @param string $instanceName The instance of the execution system to operate
41   * against. A server may support multiple instances of the execution system
42   * (with their own workers, storage, caches, etc.). The server MAY require use
43   * of this field to select between them in an implementation-defined fashion,
44   * otherwise it can be omitted.
45   * @param string $hash The hash. In the case of SHA-256, it will always be a
46   * lowercase hex string exactly 64 characters long.
47   * @param string $sizeBytes The size of the blob, in bytes.
48   * @param array $optParams Optional parameters.
49   *
50   * @opt_param string inlineOutputFiles A hint to the server to inline the
51   * contents of the listed output files. Each path needs to exactly match one
52   * file path in either `output_paths` or `output_files` (DEPRECATED since v2.1)
53   * in the Command message.
54   * @opt_param bool inlineStderr A hint to the server to request inlining stderr
55   * in the ActionResult message.
56   * @opt_param bool inlineStdout A hint to the server to request inlining stdout
57   * in the ActionResult message.
58   * @return BuildBazelRemoteExecutionV2ActionResult
59   */
60  public function get($instanceName, $hash, $sizeBytes, $optParams = [])
61  {
62    $params = ['instanceName' => $instanceName, 'hash' => $hash, 'sizeBytes' => $sizeBytes];
63    $params = array_merge($params, $optParams);
64    return $this->call('get', [$params], BuildBazelRemoteExecutionV2ActionResult::class);
65  }
66  /**
67   * Upload a new execution result. In order to allow the server to perform access
68   * control based on the type of action, and to assist with client debugging, the
69   * client MUST first upload the Action that produced the result, along with its
70   * Command, into the `ContentAddressableStorage`. Server implementations MAY
71   * modify the `UpdateActionResultRequest.action_result` and return an equivalent
72   * value. Errors: * `INVALID_ARGUMENT`: One or more arguments are invalid. *
73   * `FAILED_PRECONDITION`: One or more errors occurred in updating the action
74   * result, such as a missing command or action. * `RESOURCE_EXHAUSTED`: There is
75   * insufficient storage space to add the entry to the cache.
76   * (actionResults.update)
77   *
78   * @param string $instanceName The instance of the execution system to operate
79   * against. A server may support multiple instances of the execution system
80   * (with their own workers, storage, caches, etc.). The server MAY require use
81   * of this field to select between them in an implementation-defined fashion,
82   * otherwise it can be omitted.
83   * @param string $hash The hash. In the case of SHA-256, it will always be a
84   * lowercase hex string exactly 64 characters long.
85   * @param string $sizeBytes The size of the blob, in bytes.
86   * @param BuildBazelRemoteExecutionV2ActionResult $postBody
87   * @param array $optParams Optional parameters.
88   *
89   * @opt_param int resultsCachePolicy.priority The priority (relative importance)
90   * of this content in the overall cache. Generally, a lower value means a longer
91   * retention time or other advantage, but the interpretation of a given value is
92   * server-dependent. A priority of 0 means a *default* value, decided by the
93   * server. The particular semantics of this field is up to the server. In
94   * particular, every server will have their own supported range of priorities,
95   * and will decide how these map into retention/eviction policy.
96   * @return BuildBazelRemoteExecutionV2ActionResult
97   */
98  public function update($instanceName, $hash, $sizeBytes, BuildBazelRemoteExecutionV2ActionResult $postBody, $optParams = [])
99  {
100    $params = ['instanceName' => $instanceName, 'hash' => $hash, 'sizeBytes' => $sizeBytes, 'postBody' => $postBody];
101    $params = array_merge($params, $optParams);
102    return $this->call('update', [$params], BuildBazelRemoteExecutionV2ActionResult::class);
103  }
104}
105
106// Adding a class alias for backwards compatibility with the previous class name.
107class_alias(ActionResults::class, 'Google_Service_RemoteBuildExecution_Resource_ActionResults');
108