1// SPDX-License-Identifier: MIT
2
3// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4//
5// Source: ermite/run.proto
6
7package ermiteconnect
8
9import (
10 ermite "bnema.dev/ermite-api/gen/ermite"
11 connect "connectrpc.com/connect"
12 context "context"
13 errors "errors"
14 http "net/http"
15 strings "strings"
16)
17
18// This is a compile-time assertion to ensure that this generated file and the connect package are
19// compatible. If you get a compiler error that this constant is not defined, this code was
20// generated with a version of connect newer than the one compiled into your binary. You can fix the
21// problem by either regenerating this code with an older version of connect or updating the connect
22// version compiled into your binary.
23const _ = connect.IsAtLeastVersion1_13_0
24
25const (
26 // RunServiceName is the fully-qualified name of the RunService service.
27 RunServiceName = "ermite.RunService"
28)
29
30// These constants are the fully-qualified names of the RPCs defined in this package. They're
31// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
32//
33// Note that these are different from the fully-qualified method names used by
34// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
35// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
36// period.
37const (
38 // RunServiceListRunsProcedure is the fully-qualified name of the RunService's ListRuns RPC.
39 RunServiceListRunsProcedure = "/ermite.RunService/ListRuns"
40 // RunServiceGetRunProcedure is the fully-qualified name of the RunService's GetRun RPC.
41 RunServiceGetRunProcedure = "/ermite.RunService/GetRun"
42 // RunServiceGetJobProcedure is the fully-qualified name of the RunService's GetJob RPC.
43 RunServiceGetJobProcedure = "/ermite.RunService/GetJob"
44 // RunServiceListAnnotationsProcedure is the fully-qualified name of the RunService's
45 // ListAnnotations RPC.
46 RunServiceListAnnotationsProcedure = "/ermite.RunService/ListAnnotations"
47 // RunServiceGetStepSummariesProcedure is the fully-qualified name of the RunService's
48 // GetStepSummaries RPC.
49 RunServiceGetStepSummariesProcedure = "/ermite.RunService/GetStepSummaries"
50 // RunServiceGetJobLogProcedure is the fully-qualified name of the RunService's GetJobLog RPC.
51 RunServiceGetJobLogProcedure = "/ermite.RunService/GetJobLog"
52 // RunServiceCancelRunProcedure is the fully-qualified name of the RunService's CancelRun RPC.
53 RunServiceCancelRunProcedure = "/ermite.RunService/CancelRun"
54 // RunServiceRerunRunProcedure is the fully-qualified name of the RunService's RerunRun RPC.
55 RunServiceRerunRunProcedure = "/ermite.RunService/RerunRun"
56 // RunServiceDispatchWorkflowProcedure is the fully-qualified name of the RunService's
57 // DispatchWorkflow RPC.
58 RunServiceDispatchWorkflowProcedure = "/ermite.RunService/DispatchWorkflow"
59 // RunServiceListChecksProcedure is the fully-qualified name of the RunService's ListChecks RPC.
60 RunServiceListChecksProcedure = "/ermite.RunService/ListChecks"
61 // RunServiceListRunnersProcedure is the fully-qualified name of the RunService's ListRunners RPC.
62 RunServiceListRunnersProcedure = "/ermite.RunService/ListRunners"
63 // RunServiceRemoveRunnerProcedure is the fully-qualified name of the RunService's RemoveRunner RPC.
64 RunServiceRemoveRunnerProcedure = "/ermite.RunService/RemoveRunner"
65)
66
67// RunServiceClient is a client for the ermite.RunService service.
68type RunServiceClient interface {
69 // ListRuns lists the runs of a repository, highest id (newest) first. Each
70 // run is described by its latest attempt. The filters narrow the result; a
71 // server without the feature "ci.runs.filters" ignores them and returns
72 // every run, so a client that needs them checks the feature. Fails with
73 // invalid_argument if a filter is malformed.
74 ListRuns(context.Context, *connect.Request[ermite.ListRunsRequest]) (*connect.Response[ermite.ListRunsResponse], error)
75 // GetRun returns a run with its jobs and their steps, for the latest attempt
76 // or for the one asked. Fails with not_found if the run or the attempt does
77 // not exist.
78 GetRun(context.Context, *connect.Request[ermite.GetRunRequest]) (*connect.Response[ermite.GetRunResponse], error)
79 // GetJob returns one job with its steps. Fails with not_found if the job
80 // or the attempt does not exist.
81 GetJob(context.Context, *connect.Request[ermite.GetJobRequest]) (*connect.Response[ermite.GetJobResponse], error)
82 // ListAnnotations lists the annotations of a run attempt, optionally of one
83 // job, ordered by job (as in GetRun), step number, then the order in which
84 // the step produced them. For each job it gives the annotations of the
85 // attempt in which that job executed (RunJob.attempt), which is lower than
86 // the attempt of the run for a job kept by a re-run of failed jobs only. Needs the same access as GetRun. Returns at most
87 // 1,000 annotations (truncated tells). A run without annotations gives an
88 // empty list. Only servers with the feature "ci.annotations" implement it
89 // (unimplemented otherwise). Fails with not_found if the run, the attempt or
90 // the job does not exist, or if the job is not a job of the run.
91 ListAnnotations(context.Context, *connect.Request[ermite.ListAnnotationsRequest]) (*connect.Response[ermite.ListAnnotationsResponse], error)
92 // GetStepSummaries returns the job summaries (the Markdown written to
93 // GITHUB_STEP_SUMMARY) of the steps of a job that have one, ordered by step
94 // number. Like GitHub, it returns at most 20 summaries per job: the first 20
95 // steps that have one, in step order; truncated says there are more. Needs
96 // the same access as GetJob. Only servers with the feature
97 // "ci.summaries" implement it (unimplemented otherwise). A job without
98 // summaries gives an empty list. Fails with not_found if the job or the
99 // attempt does not exist.
100 GetStepSummaries(context.Context, *connect.Request[ermite.GetStepSummariesRequest]) (*connect.Response[ermite.GetStepSummariesResponse], error)
101 // GetJobLog streams the lines of the log of a job, from a line number. The
102 // server sends them in order in messages of at most 1,000 lines and 64 KiB of
103 // text each.
104 //
105 // Without follow, the stream ends after the last line stored when the call
106 // was made. With follow, it goes on as lines arrive, with at most 1 second of
107 // delay after the runner's AppendLog, and ends without error once the job has
108 // completed and all its lines were sent; on a completed job follow changes
109 // nothing. A client that loses the stream calls again with the offset after
110 // the last line it received. The client may cancel at any time.
111 //
112 // Fails with not_found if the job, the attempt or its log does not exist (the
113 // log is removed by the retention sweep, and a queued job has none: with
114 // follow, the call waits for the first line instead), with out_of_range if
115 // offset is beyond the end of the log of a job without follow, and with
116 // resource_exhausted when there are too many concurrent log streams, in
117 // total or from one client. Like Watch, a stream ends with unauthenticated
118 // when the token was revoked or expired.
119 GetJobLog(context.Context, *connect.Request[ermite.GetJobLogRequest]) (*connect.ServerStreamForClient[ermite.GetJobLogResponse], error)
120 // CancelRun asks to cancel the latest attempt of a run. Needs the ci:write
121 // scope. Jobs that have not started are cancelled at once; jobs in progress
122 // get a CANCEL_REASON_USER request through WatchJob, and the run completes
123 // when they have ended, so the returned run may still be IN_PROGRESS.
124 // Cancelling a run that already has a cancellation requested succeeds and
125 // changes nothing. Fails with failed_precondition if the run has completed.
126 CancelRun(context.Context, *connect.Request[ermite.CancelRunRequest]) (*connect.Response[ermite.CancelRunResponse], error)
127 // RerunRun starts a new attempt of a completed run: same run id and number,
128 // attempt + 1, same commit and same workflow file as at the original run (the
129 // file of the repository is not read again). Needs the ci:write scope. Fails
130 // with failed_precondition if the latest attempt has not completed, or if
131 // failed_only is set and no job failed. The new attempt is returned QUEUED.
132 RerunRun(context.Context, *connect.Request[ermite.RerunRunRequest]) (*connect.Response[ermite.RerunRunResponse], error)
133 // DispatchWorkflow starts a run of a workflow file by hand, like `gh
134 // workflow run` and GitHub's "workflow_dispatch" event. Needs the ci:write
135 // scope on the repository. The workflow is read at ref and must have
136 // "workflow_dispatch" among its events. The run has event
137 // "workflow_dispatch", ref and the commit ref points to, and the caller as
138 // actor; it is trusted when the caller is the owner and not trusted when the
139 // caller is a token limited to branches. The run is returned QUEUED, before
140 // any job has been given to a runner. Only servers with the feature
141 // "ci.dispatch" implement it (unimplemented otherwise). Fails with
142 // not_found if the repository, the workflow file or ref does not exist,
143 // with failed_precondition if the workflow does not declare
144 // "workflow_dispatch", and with invalid_argument if an input is unknown, is
145 // missing while required without default, or has a value of the wrong type
146 // or outside its choices, or if the workflow file is not valid.
147 DispatchWorkflow(context.Context, *connect.Request[ermite.DispatchWorkflowRequest]) (*connect.Response[ermite.DispatchWorkflowResponse], error)
148 // ListChecks lists the checks of a commit: for each job of each run on that
149 // sha, the one of the latest attempt, ordered by creation time then name.
150 // A commit without a run has no check: the list is empty, which is not an
151 // error, and the server does not verify that the commit exists. Returns at
152 // most 1,000 checks (truncated tells).
153 ListChecks(context.Context, *connect.Request[ermite.ListChecksRequest]) (*connect.Response[ermite.ListChecksResponse], error)
154 // ListRunners lists the registered runners, ordered by name. Needs the
155 // runner:register scope.
156 ListRunners(context.Context, *connect.Request[ermite.ListRunnersRequest]) (*connect.Response[ermite.ListRunnersResponse], error)
157 // RemoveRunner removes a runner: its runner token stops working at once (a
158 // FetchJob in progress ends with unauthenticated) and it no longer gets
159 // jobs. A job it is running is not affected: it ends normally, or fails as
160 // a lost runner without heartbeats. Needs the runner:register scope. Fails
161 // with not_found if the id is unknown.
162 RemoveRunner(context.Context, *connect.Request[ermite.RemoveRunnerRequest]) (*connect.Response[ermite.RemoveRunnerResponse], error)
163}
164
165// NewRunServiceClient constructs a client for the ermite.RunService service. By default, it uses
166// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
167// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
168// connect.WithGRPCWeb() options.
169//
170// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
171// http://api.acme.com or https://acme.com/grpc).
172func NewRunServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) RunServiceClient {
173 baseURL = strings.TrimRight(baseURL, "/")
174 runServiceMethods := ermite.File_ermite_run_proto.Services().ByName("RunService").Methods()
175 return &runServiceClient{
176 listRuns: connect.NewClient[ermite.ListRunsRequest, ermite.ListRunsResponse](
177 httpClient,
178 baseURL+RunServiceListRunsProcedure,
179 connect.WithSchema(runServiceMethods.ByName("ListRuns")),
180 connect.WithClientOptions(opts...),
181 ),
182 getRun: connect.NewClient[ermite.GetRunRequest, ermite.GetRunResponse](
183 httpClient,
184 baseURL+RunServiceGetRunProcedure,
185 connect.WithSchema(runServiceMethods.ByName("GetRun")),
186 connect.WithClientOptions(opts...),
187 ),
188 getJob: connect.NewClient[ermite.GetJobRequest, ermite.GetJobResponse](
189 httpClient,
190 baseURL+RunServiceGetJobProcedure,
191 connect.WithSchema(runServiceMethods.ByName("GetJob")),
192 connect.WithClientOptions(opts...),
193 ),
194 listAnnotations: connect.NewClient[ermite.ListAnnotationsRequest, ermite.ListAnnotationsResponse](
195 httpClient,
196 baseURL+RunServiceListAnnotationsProcedure,
197 connect.WithSchema(runServiceMethods.ByName("ListAnnotations")),
198 connect.WithClientOptions(opts...),
199 ),
200 getStepSummaries: connect.NewClient[ermite.GetStepSummariesRequest, ermite.GetStepSummariesResponse](
201 httpClient,
202 baseURL+RunServiceGetStepSummariesProcedure,
203 connect.WithSchema(runServiceMethods.ByName("GetStepSummaries")),
204 connect.WithClientOptions(opts...),
205 ),
206 getJobLog: connect.NewClient[ermite.GetJobLogRequest, ermite.GetJobLogResponse](
207 httpClient,
208 baseURL+RunServiceGetJobLogProcedure,
209 connect.WithSchema(runServiceMethods.ByName("GetJobLog")),
210 connect.WithClientOptions(opts...),
211 ),
212 cancelRun: connect.NewClient[ermite.CancelRunRequest, ermite.CancelRunResponse](
213 httpClient,
214 baseURL+RunServiceCancelRunProcedure,
215 connect.WithSchema(runServiceMethods.ByName("CancelRun")),
216 connect.WithClientOptions(opts...),
217 ),
218 rerunRun: connect.NewClient[ermite.RerunRunRequest, ermite.RerunRunResponse](
219 httpClient,
220 baseURL+RunServiceRerunRunProcedure,
221 connect.WithSchema(runServiceMethods.ByName("RerunRun")),
222 connect.WithClientOptions(opts...),
223 ),
224 dispatchWorkflow: connect.NewClient[ermite.DispatchWorkflowRequest, ermite.DispatchWorkflowResponse](
225 httpClient,
226 baseURL+RunServiceDispatchWorkflowProcedure,
227 connect.WithSchema(runServiceMethods.ByName("DispatchWorkflow")),
228 connect.WithClientOptions(opts...),
229 ),
230 listChecks: connect.NewClient[ermite.ListChecksRequest, ermite.ListChecksResponse](
231 httpClient,
232 baseURL+RunServiceListChecksProcedure,
233 connect.WithSchema(runServiceMethods.ByName("ListChecks")),
234 connect.WithClientOptions(opts...),
235 ),
236 listRunners: connect.NewClient[ermite.ListRunnersRequest, ermite.ListRunnersResponse](
237 httpClient,
238 baseURL+RunServiceListRunnersProcedure,
239 connect.WithSchema(runServiceMethods.ByName("ListRunners")),
240 connect.WithClientOptions(opts...),
241 ),
242 removeRunner: connect.NewClient[ermite.RemoveRunnerRequest, ermite.RemoveRunnerResponse](
243 httpClient,
244 baseURL+RunServiceRemoveRunnerProcedure,
245 connect.WithSchema(runServiceMethods.ByName("RemoveRunner")),
246 connect.WithClientOptions(opts...),
247 ),
248 }
249}
250
251// runServiceClient implements RunServiceClient.
252type runServiceClient struct {
253 listRuns *connect.Client[ermite.ListRunsRequest, ermite.ListRunsResponse]
254 getRun *connect.Client[ermite.GetRunRequest, ermite.GetRunResponse]
255 getJob *connect.Client[ermite.GetJobRequest, ermite.GetJobResponse]
256 listAnnotations *connect.Client[ermite.ListAnnotationsRequest, ermite.ListAnnotationsResponse]
257 getStepSummaries *connect.Client[ermite.GetStepSummariesRequest, ermite.GetStepSummariesResponse]
258 getJobLog *connect.Client[ermite.GetJobLogRequest, ermite.GetJobLogResponse]
259 cancelRun *connect.Client[ermite.CancelRunRequest, ermite.CancelRunResponse]
260 rerunRun *connect.Client[ermite.RerunRunRequest, ermite.RerunRunResponse]
261 dispatchWorkflow *connect.Client[ermite.DispatchWorkflowRequest, ermite.DispatchWorkflowResponse]
262 listChecks *connect.Client[ermite.ListChecksRequest, ermite.ListChecksResponse]
263 listRunners *connect.Client[ermite.ListRunnersRequest, ermite.ListRunnersResponse]
264 removeRunner *connect.Client[ermite.RemoveRunnerRequest, ermite.RemoveRunnerResponse]
265}
266
267// ListRuns calls ermite.RunService.ListRuns.
268func (c *runServiceClient) ListRuns(ctx context.Context, req *connect.Request[ermite.ListRunsRequest]) (*connect.Response[ermite.ListRunsResponse], error) {
269 return c.listRuns.CallUnary(ctx, req)
270}
271
272// GetRun calls ermite.RunService.GetRun.
273func (c *runServiceClient) GetRun(ctx context.Context, req *connect.Request[ermite.GetRunRequest]) (*connect.Response[ermite.GetRunResponse], error) {
274 return c.getRun.CallUnary(ctx, req)
275}
276
277// GetJob calls ermite.RunService.GetJob.
278func (c *runServiceClient) GetJob(ctx context.Context, req *connect.Request[ermite.GetJobRequest]) (*connect.Response[ermite.GetJobResponse], error) {
279 return c.getJob.CallUnary(ctx, req)
280}
281
282// ListAnnotations calls ermite.RunService.ListAnnotations.
283func (c *runServiceClient) ListAnnotations(ctx context.Context, req *connect.Request[ermite.ListAnnotationsRequest]) (*connect.Response[ermite.ListAnnotationsResponse], error) {
284 return c.listAnnotations.CallUnary(ctx, req)
285}
286
287// GetStepSummaries calls ermite.RunService.GetStepSummaries.
288func (c *runServiceClient) GetStepSummaries(ctx context.Context, req *connect.Request[ermite.GetStepSummariesRequest]) (*connect.Response[ermite.GetStepSummariesResponse], error) {
289 return c.getStepSummaries.CallUnary(ctx, req)
290}
291
292// GetJobLog calls ermite.RunService.GetJobLog.
293func (c *runServiceClient) GetJobLog(ctx context.Context, req *connect.Request[ermite.GetJobLogRequest]) (*connect.ServerStreamForClient[ermite.GetJobLogResponse], error) {
294 return c.getJobLog.CallServerStream(ctx, req)
295}
296
297// CancelRun calls ermite.RunService.CancelRun.
298func (c *runServiceClient) CancelRun(ctx context.Context, req *connect.Request[ermite.CancelRunRequest]) (*connect.Response[ermite.CancelRunResponse], error) {
299 return c.cancelRun.CallUnary(ctx, req)
300}
301
302// RerunRun calls ermite.RunService.RerunRun.
303func (c *runServiceClient) RerunRun(ctx context.Context, req *connect.Request[ermite.RerunRunRequest]) (*connect.Response[ermite.RerunRunResponse], error) {
304 return c.rerunRun.CallUnary(ctx, req)
305}
306
307// DispatchWorkflow calls ermite.RunService.DispatchWorkflow.
308func (c *runServiceClient) DispatchWorkflow(ctx context.Context, req *connect.Request[ermite.DispatchWorkflowRequest]) (*connect.Response[ermite.DispatchWorkflowResponse], error) {
309 return c.dispatchWorkflow.CallUnary(ctx, req)
310}
311
312// ListChecks calls ermite.RunService.ListChecks.
313func (c *runServiceClient) ListChecks(ctx context.Context, req *connect.Request[ermite.ListChecksRequest]) (*connect.Response[ermite.ListChecksResponse], error) {
314 return c.listChecks.CallUnary(ctx, req)
315}
316
317// ListRunners calls ermite.RunService.ListRunners.
318func (c *runServiceClient) ListRunners(ctx context.Context, req *connect.Request[ermite.ListRunnersRequest]) (*connect.Response[ermite.ListRunnersResponse], error) {
319 return c.listRunners.CallUnary(ctx, req)
320}
321
322// RemoveRunner calls ermite.RunService.RemoveRunner.
323func (c *runServiceClient) RemoveRunner(ctx context.Context, req *connect.Request[ermite.RemoveRunnerRequest]) (*connect.Response[ermite.RemoveRunnerResponse], error) {
324 return c.removeRunner.CallUnary(ctx, req)
325}
326
327// RunServiceHandler is an implementation of the ermite.RunService service.
328type RunServiceHandler interface {
329 // ListRuns lists the runs of a repository, highest id (newest) first. Each
330 // run is described by its latest attempt. The filters narrow the result; a
331 // server without the feature "ci.runs.filters" ignores them and returns
332 // every run, so a client that needs them checks the feature. Fails with
333 // invalid_argument if a filter is malformed.
334 ListRuns(context.Context, *connect.Request[ermite.ListRunsRequest]) (*connect.Response[ermite.ListRunsResponse], error)
335 // GetRun returns a run with its jobs and their steps, for the latest attempt
336 // or for the one asked. Fails with not_found if the run or the attempt does
337 // not exist.
338 GetRun(context.Context, *connect.Request[ermite.GetRunRequest]) (*connect.Response[ermite.GetRunResponse], error)
339 // GetJob returns one job with its steps. Fails with not_found if the job
340 // or the attempt does not exist.
341 GetJob(context.Context, *connect.Request[ermite.GetJobRequest]) (*connect.Response[ermite.GetJobResponse], error)
342 // ListAnnotations lists the annotations of a run attempt, optionally of one
343 // job, ordered by job (as in GetRun), step number, then the order in which
344 // the step produced them. For each job it gives the annotations of the
345 // attempt in which that job executed (RunJob.attempt), which is lower than
346 // the attempt of the run for a job kept by a re-run of failed jobs only. Needs the same access as GetRun. Returns at most
347 // 1,000 annotations (truncated tells). A run without annotations gives an
348 // empty list. Only servers with the feature "ci.annotations" implement it
349 // (unimplemented otherwise). Fails with not_found if the run, the attempt or
350 // the job does not exist, or if the job is not a job of the run.
351 ListAnnotations(context.Context, *connect.Request[ermite.ListAnnotationsRequest]) (*connect.Response[ermite.ListAnnotationsResponse], error)
352 // GetStepSummaries returns the job summaries (the Markdown written to
353 // GITHUB_STEP_SUMMARY) of the steps of a job that have one, ordered by step
354 // number. Like GitHub, it returns at most 20 summaries per job: the first 20
355 // steps that have one, in step order; truncated says there are more. Needs
356 // the same access as GetJob. Only servers with the feature
357 // "ci.summaries" implement it (unimplemented otherwise). A job without
358 // summaries gives an empty list. Fails with not_found if the job or the
359 // attempt does not exist.
360 GetStepSummaries(context.Context, *connect.Request[ermite.GetStepSummariesRequest]) (*connect.Response[ermite.GetStepSummariesResponse], error)
361 // GetJobLog streams the lines of the log of a job, from a line number. The
362 // server sends them in order in messages of at most 1,000 lines and 64 KiB of
363 // text each.
364 //
365 // Without follow, the stream ends after the last line stored when the call
366 // was made. With follow, it goes on as lines arrive, with at most 1 second of
367 // delay after the runner's AppendLog, and ends without error once the job has
368 // completed and all its lines were sent; on a completed job follow changes
369 // nothing. A client that loses the stream calls again with the offset after
370 // the last line it received. The client may cancel at any time.
371 //
372 // Fails with not_found if the job, the attempt or its log does not exist (the
373 // log is removed by the retention sweep, and a queued job has none: with
374 // follow, the call waits for the first line instead), with out_of_range if
375 // offset is beyond the end of the log of a job without follow, and with
376 // resource_exhausted when there are too many concurrent log streams, in
377 // total or from one client. Like Watch, a stream ends with unauthenticated
378 // when the token was revoked or expired.
379 GetJobLog(context.Context, *connect.Request[ermite.GetJobLogRequest], *connect.ServerStream[ermite.GetJobLogResponse]) error
380 // CancelRun asks to cancel the latest attempt of a run. Needs the ci:write
381 // scope. Jobs that have not started are cancelled at once; jobs in progress
382 // get a CANCEL_REASON_USER request through WatchJob, and the run completes
383 // when they have ended, so the returned run may still be IN_PROGRESS.
384 // Cancelling a run that already has a cancellation requested succeeds and
385 // changes nothing. Fails with failed_precondition if the run has completed.
386 CancelRun(context.Context, *connect.Request[ermite.CancelRunRequest]) (*connect.Response[ermite.CancelRunResponse], error)
387 // RerunRun starts a new attempt of a completed run: same run id and number,
388 // attempt + 1, same commit and same workflow file as at the original run (the
389 // file of the repository is not read again). Needs the ci:write scope. Fails
390 // with failed_precondition if the latest attempt has not completed, or if
391 // failed_only is set and no job failed. The new attempt is returned QUEUED.
392 RerunRun(context.Context, *connect.Request[ermite.RerunRunRequest]) (*connect.Response[ermite.RerunRunResponse], error)
393 // DispatchWorkflow starts a run of a workflow file by hand, like `gh
394 // workflow run` and GitHub's "workflow_dispatch" event. Needs the ci:write
395 // scope on the repository. The workflow is read at ref and must have
396 // "workflow_dispatch" among its events. The run has event
397 // "workflow_dispatch", ref and the commit ref points to, and the caller as
398 // actor; it is trusted when the caller is the owner and not trusted when the
399 // caller is a token limited to branches. The run is returned QUEUED, before
400 // any job has been given to a runner. Only servers with the feature
401 // "ci.dispatch" implement it (unimplemented otherwise). Fails with
402 // not_found if the repository, the workflow file or ref does not exist,
403 // with failed_precondition if the workflow does not declare
404 // "workflow_dispatch", and with invalid_argument if an input is unknown, is
405 // missing while required without default, or has a value of the wrong type
406 // or outside its choices, or if the workflow file is not valid.
407 DispatchWorkflow(context.Context, *connect.Request[ermite.DispatchWorkflowRequest]) (*connect.Response[ermite.DispatchWorkflowResponse], error)
408 // ListChecks lists the checks of a commit: for each job of each run on that
409 // sha, the one of the latest attempt, ordered by creation time then name.
410 // A commit without a run has no check: the list is empty, which is not an
411 // error, and the server does not verify that the commit exists. Returns at
412 // most 1,000 checks (truncated tells).
413 ListChecks(context.Context, *connect.Request[ermite.ListChecksRequest]) (*connect.Response[ermite.ListChecksResponse], error)
414 // ListRunners lists the registered runners, ordered by name. Needs the
415 // runner:register scope.
416 ListRunners(context.Context, *connect.Request[ermite.ListRunnersRequest]) (*connect.Response[ermite.ListRunnersResponse], error)
417 // RemoveRunner removes a runner: its runner token stops working at once (a
418 // FetchJob in progress ends with unauthenticated) and it no longer gets
419 // jobs. A job it is running is not affected: it ends normally, or fails as
420 // a lost runner without heartbeats. Needs the runner:register scope. Fails
421 // with not_found if the id is unknown.
422 RemoveRunner(context.Context, *connect.Request[ermite.RemoveRunnerRequest]) (*connect.Response[ermite.RemoveRunnerResponse], error)
423}
424
425// NewRunServiceHandler builds an HTTP handler from the service implementation. It returns the path
426// on which to mount the handler and the handler itself.
427//
428// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
429// and JSON codecs. They also support gzip compression.
430func NewRunServiceHandler(svc RunServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
431 runServiceMethods := ermite.File_ermite_run_proto.Services().ByName("RunService").Methods()
432 runServiceListRunsHandler := connect.NewUnaryHandler(
433 RunServiceListRunsProcedure,
434 svc.ListRuns,
435 connect.WithSchema(runServiceMethods.ByName("ListRuns")),
436 connect.WithHandlerOptions(opts...),
437 )
438 runServiceGetRunHandler := connect.NewUnaryHandler(
439 RunServiceGetRunProcedure,
440 svc.GetRun,
441 connect.WithSchema(runServiceMethods.ByName("GetRun")),
442 connect.WithHandlerOptions(opts...),
443 )
444 runServiceGetJobHandler := connect.NewUnaryHandler(
445 RunServiceGetJobProcedure,
446 svc.GetJob,
447 connect.WithSchema(runServiceMethods.ByName("GetJob")),
448 connect.WithHandlerOptions(opts...),
449 )
450 runServiceListAnnotationsHandler := connect.NewUnaryHandler(
451 RunServiceListAnnotationsProcedure,
452 svc.ListAnnotations,
453 connect.WithSchema(runServiceMethods.ByName("ListAnnotations")),
454 connect.WithHandlerOptions(opts...),
455 )
456 runServiceGetStepSummariesHandler := connect.NewUnaryHandler(
457 RunServiceGetStepSummariesProcedure,
458 svc.GetStepSummaries,
459 connect.WithSchema(runServiceMethods.ByName("GetStepSummaries")),
460 connect.WithHandlerOptions(opts...),
461 )
462 runServiceGetJobLogHandler := connect.NewServerStreamHandler(
463 RunServiceGetJobLogProcedure,
464 svc.GetJobLog,
465 connect.WithSchema(runServiceMethods.ByName("GetJobLog")),
466 connect.WithHandlerOptions(opts...),
467 )
468 runServiceCancelRunHandler := connect.NewUnaryHandler(
469 RunServiceCancelRunProcedure,
470 svc.CancelRun,
471 connect.WithSchema(runServiceMethods.ByName("CancelRun")),
472 connect.WithHandlerOptions(opts...),
473 )
474 runServiceRerunRunHandler := connect.NewUnaryHandler(
475 RunServiceRerunRunProcedure,
476 svc.RerunRun,
477 connect.WithSchema(runServiceMethods.ByName("RerunRun")),
478 connect.WithHandlerOptions(opts...),
479 )
480 runServiceDispatchWorkflowHandler := connect.NewUnaryHandler(
481 RunServiceDispatchWorkflowProcedure,
482 svc.DispatchWorkflow,
483 connect.WithSchema(runServiceMethods.ByName("DispatchWorkflow")),
484 connect.WithHandlerOptions(opts...),
485 )
486 runServiceListChecksHandler := connect.NewUnaryHandler(
487 RunServiceListChecksProcedure,
488 svc.ListChecks,
489 connect.WithSchema(runServiceMethods.ByName("ListChecks")),
490 connect.WithHandlerOptions(opts...),
491 )
492 runServiceListRunnersHandler := connect.NewUnaryHandler(
493 RunServiceListRunnersProcedure,
494 svc.ListRunners,
495 connect.WithSchema(runServiceMethods.ByName("ListRunners")),
496 connect.WithHandlerOptions(opts...),
497 )
498 runServiceRemoveRunnerHandler := connect.NewUnaryHandler(
499 RunServiceRemoveRunnerProcedure,
500 svc.RemoveRunner,
501 connect.WithSchema(runServiceMethods.ByName("RemoveRunner")),
502 connect.WithHandlerOptions(opts...),
503 )
504 return "/ermite.RunService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
505 switch r.URL.Path {
506 case RunServiceListRunsProcedure:
507 runServiceListRunsHandler.ServeHTTP(w, r)
508 case RunServiceGetRunProcedure:
509 runServiceGetRunHandler.ServeHTTP(w, r)
510 case RunServiceGetJobProcedure:
511 runServiceGetJobHandler.ServeHTTP(w, r)
512 case RunServiceListAnnotationsProcedure:
513 runServiceListAnnotationsHandler.ServeHTTP(w, r)
514 case RunServiceGetStepSummariesProcedure:
515 runServiceGetStepSummariesHandler.ServeHTTP(w, r)
516 case RunServiceGetJobLogProcedure:
517 runServiceGetJobLogHandler.ServeHTTP(w, r)
518 case RunServiceCancelRunProcedure:
519 runServiceCancelRunHandler.ServeHTTP(w, r)
520 case RunServiceRerunRunProcedure:
521 runServiceRerunRunHandler.ServeHTTP(w, r)
522 case RunServiceDispatchWorkflowProcedure:
523 runServiceDispatchWorkflowHandler.ServeHTTP(w, r)
524 case RunServiceListChecksProcedure:
525 runServiceListChecksHandler.ServeHTTP(w, r)
526 case RunServiceListRunnersProcedure:
527 runServiceListRunnersHandler.ServeHTTP(w, r)
528 case RunServiceRemoveRunnerProcedure:
529 runServiceRemoveRunnerHandler.ServeHTTP(w, r)
530 default:
531 http.NotFound(w, r)
532 }
533 })
534}
535
536// UnimplementedRunServiceHandler returns CodeUnimplemented from all methods.
537type UnimplementedRunServiceHandler struct{}
538
539func (UnimplementedRunServiceHandler) ListRuns(context.Context, *connect.Request[ermite.ListRunsRequest]) (*connect.Response[ermite.ListRunsResponse], error) {
540 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.ListRuns is not implemented"))
541}
542
543func (UnimplementedRunServiceHandler) GetRun(context.Context, *connect.Request[ermite.GetRunRequest]) (*connect.Response[ermite.GetRunResponse], error) {
544 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.GetRun is not implemented"))
545}
546
547func (UnimplementedRunServiceHandler) GetJob(context.Context, *connect.Request[ermite.GetJobRequest]) (*connect.Response[ermite.GetJobResponse], error) {
548 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.GetJob is not implemented"))
549}
550
551func (UnimplementedRunServiceHandler) ListAnnotations(context.Context, *connect.Request[ermite.ListAnnotationsRequest]) (*connect.Response[ermite.ListAnnotationsResponse], error) {
552 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.ListAnnotations is not implemented"))
553}
554
555func (UnimplementedRunServiceHandler) GetStepSummaries(context.Context, *connect.Request[ermite.GetStepSummariesRequest]) (*connect.Response[ermite.GetStepSummariesResponse], error) {
556 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.GetStepSummaries is not implemented"))
557}
558
559func (UnimplementedRunServiceHandler) GetJobLog(context.Context, *connect.Request[ermite.GetJobLogRequest], *connect.ServerStream[ermite.GetJobLogResponse]) error {
560 return connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.GetJobLog is not implemented"))
561}
562
563func (UnimplementedRunServiceHandler) CancelRun(context.Context, *connect.Request[ermite.CancelRunRequest]) (*connect.Response[ermite.CancelRunResponse], error) {
564 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.CancelRun is not implemented"))
565}
566
567func (UnimplementedRunServiceHandler) RerunRun(context.Context, *connect.Request[ermite.RerunRunRequest]) (*connect.Response[ermite.RerunRunResponse], error) {
568 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.RerunRun is not implemented"))
569}
570
571func (UnimplementedRunServiceHandler) DispatchWorkflow(context.Context, *connect.Request[ermite.DispatchWorkflowRequest]) (*connect.Response[ermite.DispatchWorkflowResponse], error) {
572 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.DispatchWorkflow is not implemented"))
573}
574
575func (UnimplementedRunServiceHandler) ListChecks(context.Context, *connect.Request[ermite.ListChecksRequest]) (*connect.Response[ermite.ListChecksResponse], error) {
576 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.ListChecks is not implemented"))
577}
578
579func (UnimplementedRunServiceHandler) ListRunners(context.Context, *connect.Request[ermite.ListRunnersRequest]) (*connect.Response[ermite.ListRunnersResponse], error) {
580 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.ListRunners is not implemented"))
581}
582
583func (UnimplementedRunServiceHandler) RemoveRunner(context.Context, *connect.Request[ermite.RemoveRunnerRequest]) (*connect.Response[ermite.RemoveRunnerResponse], error) {
584 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.RemoveRunner is not implemented"))
585}