-
Notifications
You must be signed in to change notification settings - Fork 4
/
actionResults.clj
112 lines (97 loc) · 3.95 KB
/
actionResults.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
(ns happygapi.remotebuildexecution.actionResults
"Remote Build Execution API: actionResults.
Supplies a Remote Execution API service for tools such as bazel.
See: https://cloud.google.com/remote-build-execution/docs/api/reference/rest/v2/actionResults"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn get$
"https://cloud.google.com/remote-build-execution/docs/api/reference/rest/v2/actionResults/get
Required parameters: sizeBytes, instanceName, hash
Optional parameters: inlineStdout, inlineStderr, inlineOutputFiles
Retrieve a cached execution result.
Implementations SHOULD ensure that any blobs referenced from the
ContentAddressableStorage
are available at the time of returning the
ActionResult and will be
for some period of time afterwards. The TTLs of the referenced blobs SHOULD be increased
if necessary and applicable.
Errors:
* `NOT_FOUND`: The requested `ActionResult` is not in the cache."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"]}
[auth args]
{:pre [(util/has-keys? args #{:hash :instanceName :sizeBytes})]}
(util/get-response
(http/get
(util/get-url
"https://remotebuildexecution.googleapis.com/"
"v2/{+instanceName}/actionResults/{hash}/{sizeBytes}"
#{:hash :instanceName :sizeBytes}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn update$
"https://cloud.google.com/remote-build-execution/docs/api/reference/rest/v2/actionResults/update
Required parameters: sizeBytes, instanceName, hash
Optional parameters: resultsCachePolicy.priority
Body:
{:stderrDigest {:hash string, :sizeBytes string},
:exitCode integer,
:stdoutRaw string,
:executionMetadata {:executionCompletedTimestamp string,
:workerStartTimestamp string,
:inputFetchCompletedTimestamp string,
:outputUploadCompletedTimestamp string,
:executionStartTimestamp string,
:workerCompletedTimestamp string,
:inputFetchStartTimestamp string,
:queuedTimestamp string,
:outputUploadStartTimestamp string,
:worker string},
:outputFiles [{:digest BuildBazelRemoteExecutionV2Digest,
:isExecutable boolean,
:path string,
:contents string}],
:stdoutDigest {:hash string, :sizeBytes string},
:outputDirectories [{:path string,
:treeDigest BuildBazelRemoteExecutionV2Digest}],
:outputDirectorySymlinks [{:target string, :path string}],
:stderrRaw string,
:outputFileSymlinks [{:target string, :path string}]}
Upload a new execution result.
In order to allow the server to perform access control based on the type of
action, and to assist with client debugging, the client MUST first upload
the Action that produced the
result, along with its
Command, into the
`ContentAddressableStorage`.
Errors:
* `INVALID_ARGUMENT`: One or more arguments are invalid.
* `FAILED_PRECONDITION`: One or more errors occurred in updating the
action result, such as a missing command or action.
* `RESOURCE_EXHAUSTED`: There is insufficient storage space to add the
entry to the cache."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"]}
[auth args body]
{:pre [(util/has-keys? args #{:hash :instanceName :sizeBytes})]}
(util/get-response
(http/put
(util/get-url
"https://remotebuildexecution.googleapis.com/"
"v2/{+instanceName}/actionResults/{hash}/{sizeBytes}"
#{:hash :instanceName :sizeBytes}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))