1// SPDX-License-Identifier: MIT
2
3// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4//
5// Source: ermite/artifact.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 // JobArtifactServiceName is the fully-qualified name of the JobArtifactService service.
27 JobArtifactServiceName = "ermite.JobArtifactService"
28 // ArtifactServiceName is the fully-qualified name of the ArtifactService service.
29 ArtifactServiceName = "ermite.ArtifactService"
30)
31
32// These constants are the fully-qualified names of the RPCs defined in this package. They're
33// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
34//
35// Note that these are different from the fully-qualified method names used by
36// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
37// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
38// period.
39const (
40 // JobArtifactServiceCreateJobArtifactProcedure is the fully-qualified name of the
41 // JobArtifactService's CreateJobArtifact RPC.
42 JobArtifactServiceCreateJobArtifactProcedure = "/ermite.JobArtifactService/CreateJobArtifact"
43 // JobArtifactServiceUploadJobArtifactBlockProcedure is the fully-qualified name of the
44 // JobArtifactService's UploadJobArtifactBlock RPC.
45 JobArtifactServiceUploadJobArtifactBlockProcedure = "/ermite.JobArtifactService/UploadJobArtifactBlock"
46 // JobArtifactServiceCommitJobArtifactProcedure is the fully-qualified name of the
47 // JobArtifactService's CommitJobArtifact RPC.
48 JobArtifactServiceCommitJobArtifactProcedure = "/ermite.JobArtifactService/CommitJobArtifact"
49 // JobArtifactServiceFinalizeJobArtifactProcedure is the fully-qualified name of the
50 // JobArtifactService's FinalizeJobArtifact RPC.
51 JobArtifactServiceFinalizeJobArtifactProcedure = "/ermite.JobArtifactService/FinalizeJobArtifact"
52 // JobArtifactServiceListJobArtifactsProcedure is the fully-qualified name of the
53 // JobArtifactService's ListJobArtifacts RPC.
54 JobArtifactServiceListJobArtifactsProcedure = "/ermite.JobArtifactService/ListJobArtifacts"
55 // JobArtifactServiceDownloadJobArtifactProcedure is the fully-qualified name of the
56 // JobArtifactService's DownloadJobArtifact RPC.
57 JobArtifactServiceDownloadJobArtifactProcedure = "/ermite.JobArtifactService/DownloadJobArtifact"
58 // JobArtifactServiceDeleteJobArtifactProcedure is the fully-qualified name of the
59 // JobArtifactService's DeleteJobArtifact RPC.
60 JobArtifactServiceDeleteJobArtifactProcedure = "/ermite.JobArtifactService/DeleteJobArtifact"
61 // ArtifactServiceListArtifactsProcedure is the fully-qualified name of the ArtifactService's
62 // ListArtifacts RPC.
63 ArtifactServiceListArtifactsProcedure = "/ermite.ArtifactService/ListArtifacts"
64 // ArtifactServiceDownloadArtifactProcedure is the fully-qualified name of the ArtifactService's
65 // DownloadArtifact RPC.
66 ArtifactServiceDownloadArtifactProcedure = "/ermite.ArtifactService/DownloadArtifact"
67 // ArtifactServiceDeleteArtifactProcedure is the fully-qualified name of the ArtifactService's
68 // DeleteArtifact RPC.
69 ArtifactServiceDeleteArtifactProcedure = "/ermite.ArtifactService/DeleteArtifact"
70)
71
72// JobArtifactServiceClient is a client for the ermite.JobArtifactService service.
73type JobArtifactServiceClient interface {
74 // CreateJobArtifact begins the upload of an artifact of the job's run and
75 // returns its id. Fails with invalid_argument if the name or expires_at break
76 // a rule, already_exists if an artifact of that name was finalized by a job
77 // of the same attempt of the run (the uploader deletes it first to replace
78 // it: DeleteJobArtifact), and resource_exhausted if the artifacts of the
79 // repository already use all their space. A pending artifact of the same
80 // job and name is discarded: a new create is a new upload.
81 CreateJobArtifact(context.Context, *connect.Request[ermite.CreateJobArtifactRequest]) (*connect.Response[ermite.CreateJobArtifactResponse], error)
82 // UploadJobArtifactBlock stores one block of a pending artifact. It is a
83 // client stream: the first message names the job, the artifact and the
84 // block, every message may carry data, and the block is the data of all the
85 // messages in order. The block is stored when the client closes the stream
86 // and the server answers; a stream that breaks or fails stores nothing.
87 // Storing a block id again replaces the block, so a retry is safe. Blocks
88 // that the commit does not name are dropped.
89 //
90 // Fails with not_found if the artifact is not a pending artifact of this job,
91 // failed_precondition if it is already committed, invalid_argument if a rule
92 // of the messages is broken, and resource_exhausted if the blocks of the
93 // artifact would exceed the size of one artifact or the space of the
94 // repository.
95 UploadJobArtifactBlock(context.Context) *connect.ClientStreamForClient[ermite.UploadJobArtifactBlockRequest, ermite.UploadJobArtifactBlockResponse]
96 // CommitJobArtifact sets the content of a pending artifact: the blocks named,
97 // in that order (Azure's Put Block List). An empty list is an empty content
98 // (a 0-byte upload). The server then knows the size and the digest, and
99 // drops the blocks. A repeat of the same call after a success returns the
100 // same result; a different list on a committed artifact is
101 // failed_precondition. Fails with not_found if the artifact is not a pending
102 // artifact of this job, and invalid_argument if a block id was never
103 // uploaded or the list has more than 50,000 ids.
104 CommitJobArtifact(context.Context, *connect.Request[ermite.CommitJobArtifactRequest]) (*connect.Response[ermite.CommitJobArtifactResponse], error)
105 // FinalizeJobArtifact makes the latest committed artifact of the job with
106 // that name visible to the run, and returns it. An artifact of the same name
107 // from an earlier attempt of the run is deleted at the same moment (a re-run
108 // replaces what the first attempt uploaded). A repeat after a success
109 // returns the same artifact. Fails with not_found if the job has no pending
110 // artifact of that name, failed_precondition if it is not committed,
111 // invalid_argument if digest is set and differs from the content, and
112 // already_exists if a job of the same attempt finalized an artifact of that
113 // name in the meantime.
114 FinalizeJobArtifact(context.Context, *connect.Request[ermite.FinalizeJobArtifactRequest]) (*connect.Response[ermite.FinalizeJobArtifactResponse], error)
115 // ListJobArtifacts lists the finalized, unexpired artifacts of the job's run,
116 // all attempts, by id. An empty list is not an error.
117 ListJobArtifacts(context.Context, *connect.Request[ermite.ListJobArtifactsRequest]) (*connect.Response[ermite.ListJobArtifactsResponse], error)
118 // DownloadJobArtifact streams the content of an artifact of the job's run.
119 // The first message carries the artifact, then the chunks follow in order
120 // from offset. A client that loses the stream calls again with the offset
121 // after the last byte it received. Fails with not_found if the artifact is
122 // not a finalized artifact of the run (or has expired), and out_of_range if
123 // offset is beyond its size.
124 DownloadJobArtifact(context.Context, *connect.Request[ermite.DownloadJobArtifactRequest]) (*connect.ServerStreamForClient[ermite.DownloadJobArtifactResponse], error)
125 // DeleteJobArtifact deletes the finalized artifact of that name of the job's
126 // run (upload-artifact's "overwrite", and its merge action's
127 // "delete-merged"). Fails with not_found if there is none.
128 DeleteJobArtifact(context.Context, *connect.Request[ermite.DeleteJobArtifactRequest]) (*connect.Response[ermite.DeleteJobArtifactResponse], error)
129}
130
131// NewJobArtifactServiceClient constructs a client for the ermite.JobArtifactService service. By
132// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses,
133// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the
134// connect.WithGRPC() or connect.WithGRPCWeb() options.
135//
136// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
137// http://api.acme.com or https://acme.com/grpc).
138func NewJobArtifactServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) JobArtifactServiceClient {
139 baseURL = strings.TrimRight(baseURL, "/")
140 jobArtifactServiceMethods := ermite.File_ermite_artifact_proto.Services().ByName("JobArtifactService").Methods()
141 return &jobArtifactServiceClient{
142 createJobArtifact: connect.NewClient[ermite.CreateJobArtifactRequest, ermite.CreateJobArtifactResponse](
143 httpClient,
144 baseURL+JobArtifactServiceCreateJobArtifactProcedure,
145 connect.WithSchema(jobArtifactServiceMethods.ByName("CreateJobArtifact")),
146 connect.WithClientOptions(opts...),
147 ),
148 uploadJobArtifactBlock: connect.NewClient[ermite.UploadJobArtifactBlockRequest, ermite.UploadJobArtifactBlockResponse](
149 httpClient,
150 baseURL+JobArtifactServiceUploadJobArtifactBlockProcedure,
151 connect.WithSchema(jobArtifactServiceMethods.ByName("UploadJobArtifactBlock")),
152 connect.WithClientOptions(opts...),
153 ),
154 commitJobArtifact: connect.NewClient[ermite.CommitJobArtifactRequest, ermite.CommitJobArtifactResponse](
155 httpClient,
156 baseURL+JobArtifactServiceCommitJobArtifactProcedure,
157 connect.WithSchema(jobArtifactServiceMethods.ByName("CommitJobArtifact")),
158 connect.WithClientOptions(opts...),
159 ),
160 finalizeJobArtifact: connect.NewClient[ermite.FinalizeJobArtifactRequest, ermite.FinalizeJobArtifactResponse](
161 httpClient,
162 baseURL+JobArtifactServiceFinalizeJobArtifactProcedure,
163 connect.WithSchema(jobArtifactServiceMethods.ByName("FinalizeJobArtifact")),
164 connect.WithClientOptions(opts...),
165 ),
166 listJobArtifacts: connect.NewClient[ermite.ListJobArtifactsRequest, ermite.ListJobArtifactsResponse](
167 httpClient,
168 baseURL+JobArtifactServiceListJobArtifactsProcedure,
169 connect.WithSchema(jobArtifactServiceMethods.ByName("ListJobArtifacts")),
170 connect.WithClientOptions(opts...),
171 ),
172 downloadJobArtifact: connect.NewClient[ermite.DownloadJobArtifactRequest, ermite.DownloadJobArtifactResponse](
173 httpClient,
174 baseURL+JobArtifactServiceDownloadJobArtifactProcedure,
175 connect.WithSchema(jobArtifactServiceMethods.ByName("DownloadJobArtifact")),
176 connect.WithClientOptions(opts...),
177 ),
178 deleteJobArtifact: connect.NewClient[ermite.DeleteJobArtifactRequest, ermite.DeleteJobArtifactResponse](
179 httpClient,
180 baseURL+JobArtifactServiceDeleteJobArtifactProcedure,
181 connect.WithSchema(jobArtifactServiceMethods.ByName("DeleteJobArtifact")),
182 connect.WithClientOptions(opts...),
183 ),
184 }
185}
186
187// jobArtifactServiceClient implements JobArtifactServiceClient.
188type jobArtifactServiceClient struct {
189 createJobArtifact *connect.Client[ermite.CreateJobArtifactRequest, ermite.CreateJobArtifactResponse]
190 uploadJobArtifactBlock *connect.Client[ermite.UploadJobArtifactBlockRequest, ermite.UploadJobArtifactBlockResponse]
191 commitJobArtifact *connect.Client[ermite.CommitJobArtifactRequest, ermite.CommitJobArtifactResponse]
192 finalizeJobArtifact *connect.Client[ermite.FinalizeJobArtifactRequest, ermite.FinalizeJobArtifactResponse]
193 listJobArtifacts *connect.Client[ermite.ListJobArtifactsRequest, ermite.ListJobArtifactsResponse]
194 downloadJobArtifact *connect.Client[ermite.DownloadJobArtifactRequest, ermite.DownloadJobArtifactResponse]
195 deleteJobArtifact *connect.Client[ermite.DeleteJobArtifactRequest, ermite.DeleteJobArtifactResponse]
196}
197
198// CreateJobArtifact calls ermite.JobArtifactService.CreateJobArtifact.
199func (c *jobArtifactServiceClient) CreateJobArtifact(ctx context.Context, req *connect.Request[ermite.CreateJobArtifactRequest]) (*connect.Response[ermite.CreateJobArtifactResponse], error) {
200 return c.createJobArtifact.CallUnary(ctx, req)
201}
202
203// UploadJobArtifactBlock calls ermite.JobArtifactService.UploadJobArtifactBlock.
204func (c *jobArtifactServiceClient) UploadJobArtifactBlock(ctx context.Context) *connect.ClientStreamForClient[ermite.UploadJobArtifactBlockRequest, ermite.UploadJobArtifactBlockResponse] {
205 return c.uploadJobArtifactBlock.CallClientStream(ctx)
206}
207
208// CommitJobArtifact calls ermite.JobArtifactService.CommitJobArtifact.
209func (c *jobArtifactServiceClient) CommitJobArtifact(ctx context.Context, req *connect.Request[ermite.CommitJobArtifactRequest]) (*connect.Response[ermite.CommitJobArtifactResponse], error) {
210 return c.commitJobArtifact.CallUnary(ctx, req)
211}
212
213// FinalizeJobArtifact calls ermite.JobArtifactService.FinalizeJobArtifact.
214func (c *jobArtifactServiceClient) FinalizeJobArtifact(ctx context.Context, req *connect.Request[ermite.FinalizeJobArtifactRequest]) (*connect.Response[ermite.FinalizeJobArtifactResponse], error) {
215 return c.finalizeJobArtifact.CallUnary(ctx, req)
216}
217
218// ListJobArtifacts calls ermite.JobArtifactService.ListJobArtifacts.
219func (c *jobArtifactServiceClient) ListJobArtifacts(ctx context.Context, req *connect.Request[ermite.ListJobArtifactsRequest]) (*connect.Response[ermite.ListJobArtifactsResponse], error) {
220 return c.listJobArtifacts.CallUnary(ctx, req)
221}
222
223// DownloadJobArtifact calls ermite.JobArtifactService.DownloadJobArtifact.
224func (c *jobArtifactServiceClient) DownloadJobArtifact(ctx context.Context, req *connect.Request[ermite.DownloadJobArtifactRequest]) (*connect.ServerStreamForClient[ermite.DownloadJobArtifactResponse], error) {
225 return c.downloadJobArtifact.CallServerStream(ctx, req)
226}
227
228// DeleteJobArtifact calls ermite.JobArtifactService.DeleteJobArtifact.
229func (c *jobArtifactServiceClient) DeleteJobArtifact(ctx context.Context, req *connect.Request[ermite.DeleteJobArtifactRequest]) (*connect.Response[ermite.DeleteJobArtifactResponse], error) {
230 return c.deleteJobArtifact.CallUnary(ctx, req)
231}
232
233// JobArtifactServiceHandler is an implementation of the ermite.JobArtifactService service.
234type JobArtifactServiceHandler interface {
235 // CreateJobArtifact begins the upload of an artifact of the job's run and
236 // returns its id. Fails with invalid_argument if the name or expires_at break
237 // a rule, already_exists if an artifact of that name was finalized by a job
238 // of the same attempt of the run (the uploader deletes it first to replace
239 // it: DeleteJobArtifact), and resource_exhausted if the artifacts of the
240 // repository already use all their space. A pending artifact of the same
241 // job and name is discarded: a new create is a new upload.
242 CreateJobArtifact(context.Context, *connect.Request[ermite.CreateJobArtifactRequest]) (*connect.Response[ermite.CreateJobArtifactResponse], error)
243 // UploadJobArtifactBlock stores one block of a pending artifact. It is a
244 // client stream: the first message names the job, the artifact and the
245 // block, every message may carry data, and the block is the data of all the
246 // messages in order. The block is stored when the client closes the stream
247 // and the server answers; a stream that breaks or fails stores nothing.
248 // Storing a block id again replaces the block, so a retry is safe. Blocks
249 // that the commit does not name are dropped.
250 //
251 // Fails with not_found if the artifact is not a pending artifact of this job,
252 // failed_precondition if it is already committed, invalid_argument if a rule
253 // of the messages is broken, and resource_exhausted if the blocks of the
254 // artifact would exceed the size of one artifact or the space of the
255 // repository.
256 UploadJobArtifactBlock(context.Context, *connect.ClientStream[ermite.UploadJobArtifactBlockRequest]) (*connect.Response[ermite.UploadJobArtifactBlockResponse], error)
257 // CommitJobArtifact sets the content of a pending artifact: the blocks named,
258 // in that order (Azure's Put Block List). An empty list is an empty content
259 // (a 0-byte upload). The server then knows the size and the digest, and
260 // drops the blocks. A repeat of the same call after a success returns the
261 // same result; a different list on a committed artifact is
262 // failed_precondition. Fails with not_found if the artifact is not a pending
263 // artifact of this job, and invalid_argument if a block id was never
264 // uploaded or the list has more than 50,000 ids.
265 CommitJobArtifact(context.Context, *connect.Request[ermite.CommitJobArtifactRequest]) (*connect.Response[ermite.CommitJobArtifactResponse], error)
266 // FinalizeJobArtifact makes the latest committed artifact of the job with
267 // that name visible to the run, and returns it. An artifact of the same name
268 // from an earlier attempt of the run is deleted at the same moment (a re-run
269 // replaces what the first attempt uploaded). A repeat after a success
270 // returns the same artifact. Fails with not_found if the job has no pending
271 // artifact of that name, failed_precondition if it is not committed,
272 // invalid_argument if digest is set and differs from the content, and
273 // already_exists if a job of the same attempt finalized an artifact of that
274 // name in the meantime.
275 FinalizeJobArtifact(context.Context, *connect.Request[ermite.FinalizeJobArtifactRequest]) (*connect.Response[ermite.FinalizeJobArtifactResponse], error)
276 // ListJobArtifacts lists the finalized, unexpired artifacts of the job's run,
277 // all attempts, by id. An empty list is not an error.
278 ListJobArtifacts(context.Context, *connect.Request[ermite.ListJobArtifactsRequest]) (*connect.Response[ermite.ListJobArtifactsResponse], error)
279 // DownloadJobArtifact streams the content of an artifact of the job's run.
280 // The first message carries the artifact, then the chunks follow in order
281 // from offset. A client that loses the stream calls again with the offset
282 // after the last byte it received. Fails with not_found if the artifact is
283 // not a finalized artifact of the run (or has expired), and out_of_range if
284 // offset is beyond its size.
285 DownloadJobArtifact(context.Context, *connect.Request[ermite.DownloadJobArtifactRequest], *connect.ServerStream[ermite.DownloadJobArtifactResponse]) error
286 // DeleteJobArtifact deletes the finalized artifact of that name of the job's
287 // run (upload-artifact's "overwrite", and its merge action's
288 // "delete-merged"). Fails with not_found if there is none.
289 DeleteJobArtifact(context.Context, *connect.Request[ermite.DeleteJobArtifactRequest]) (*connect.Response[ermite.DeleteJobArtifactResponse], error)
290}
291
292// NewJobArtifactServiceHandler builds an HTTP handler from the service implementation. It returns
293// the path on which to mount the handler and the handler itself.
294//
295// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
296// and JSON codecs. They also support gzip compression.
297func NewJobArtifactServiceHandler(svc JobArtifactServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
298 jobArtifactServiceMethods := ermite.File_ermite_artifact_proto.Services().ByName("JobArtifactService").Methods()
299 jobArtifactServiceCreateJobArtifactHandler := connect.NewUnaryHandler(
300 JobArtifactServiceCreateJobArtifactProcedure,
301 svc.CreateJobArtifact,
302 connect.WithSchema(jobArtifactServiceMethods.ByName("CreateJobArtifact")),
303 connect.WithHandlerOptions(opts...),
304 )
305 jobArtifactServiceUploadJobArtifactBlockHandler := connect.NewClientStreamHandler(
306 JobArtifactServiceUploadJobArtifactBlockProcedure,
307 svc.UploadJobArtifactBlock,
308 connect.WithSchema(jobArtifactServiceMethods.ByName("UploadJobArtifactBlock")),
309 connect.WithHandlerOptions(opts...),
310 )
311 jobArtifactServiceCommitJobArtifactHandler := connect.NewUnaryHandler(
312 JobArtifactServiceCommitJobArtifactProcedure,
313 svc.CommitJobArtifact,
314 connect.WithSchema(jobArtifactServiceMethods.ByName("CommitJobArtifact")),
315 connect.WithHandlerOptions(opts...),
316 )
317 jobArtifactServiceFinalizeJobArtifactHandler := connect.NewUnaryHandler(
318 JobArtifactServiceFinalizeJobArtifactProcedure,
319 svc.FinalizeJobArtifact,
320 connect.WithSchema(jobArtifactServiceMethods.ByName("FinalizeJobArtifact")),
321 connect.WithHandlerOptions(opts...),
322 )
323 jobArtifactServiceListJobArtifactsHandler := connect.NewUnaryHandler(
324 JobArtifactServiceListJobArtifactsProcedure,
325 svc.ListJobArtifacts,
326 connect.WithSchema(jobArtifactServiceMethods.ByName("ListJobArtifacts")),
327 connect.WithHandlerOptions(opts...),
328 )
329 jobArtifactServiceDownloadJobArtifactHandler := connect.NewServerStreamHandler(
330 JobArtifactServiceDownloadJobArtifactProcedure,
331 svc.DownloadJobArtifact,
332 connect.WithSchema(jobArtifactServiceMethods.ByName("DownloadJobArtifact")),
333 connect.WithHandlerOptions(opts...),
334 )
335 jobArtifactServiceDeleteJobArtifactHandler := connect.NewUnaryHandler(
336 JobArtifactServiceDeleteJobArtifactProcedure,
337 svc.DeleteJobArtifact,
338 connect.WithSchema(jobArtifactServiceMethods.ByName("DeleteJobArtifact")),
339 connect.WithHandlerOptions(opts...),
340 )
341 return "/ermite.JobArtifactService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
342 switch r.URL.Path {
343 case JobArtifactServiceCreateJobArtifactProcedure:
344 jobArtifactServiceCreateJobArtifactHandler.ServeHTTP(w, r)
345 case JobArtifactServiceUploadJobArtifactBlockProcedure:
346 jobArtifactServiceUploadJobArtifactBlockHandler.ServeHTTP(w, r)
347 case JobArtifactServiceCommitJobArtifactProcedure:
348 jobArtifactServiceCommitJobArtifactHandler.ServeHTTP(w, r)
349 case JobArtifactServiceFinalizeJobArtifactProcedure:
350 jobArtifactServiceFinalizeJobArtifactHandler.ServeHTTP(w, r)
351 case JobArtifactServiceListJobArtifactsProcedure:
352 jobArtifactServiceListJobArtifactsHandler.ServeHTTP(w, r)
353 case JobArtifactServiceDownloadJobArtifactProcedure:
354 jobArtifactServiceDownloadJobArtifactHandler.ServeHTTP(w, r)
355 case JobArtifactServiceDeleteJobArtifactProcedure:
356 jobArtifactServiceDeleteJobArtifactHandler.ServeHTTP(w, r)
357 default:
358 http.NotFound(w, r)
359 }
360 })
361}
362
363// UnimplementedJobArtifactServiceHandler returns CodeUnimplemented from all methods.
364type UnimplementedJobArtifactServiceHandler struct{}
365
366func (UnimplementedJobArtifactServiceHandler) CreateJobArtifact(context.Context, *connect.Request[ermite.CreateJobArtifactRequest]) (*connect.Response[ermite.CreateJobArtifactResponse], error) {
367 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.JobArtifactService.CreateJobArtifact is not implemented"))
368}
369
370func (UnimplementedJobArtifactServiceHandler) UploadJobArtifactBlock(context.Context, *connect.ClientStream[ermite.UploadJobArtifactBlockRequest]) (*connect.Response[ermite.UploadJobArtifactBlockResponse], error) {
371 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.JobArtifactService.UploadJobArtifactBlock is not implemented"))
372}
373
374func (UnimplementedJobArtifactServiceHandler) CommitJobArtifact(context.Context, *connect.Request[ermite.CommitJobArtifactRequest]) (*connect.Response[ermite.CommitJobArtifactResponse], error) {
375 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.JobArtifactService.CommitJobArtifact is not implemented"))
376}
377
378func (UnimplementedJobArtifactServiceHandler) FinalizeJobArtifact(context.Context, *connect.Request[ermite.FinalizeJobArtifactRequest]) (*connect.Response[ermite.FinalizeJobArtifactResponse], error) {
379 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.JobArtifactService.FinalizeJobArtifact is not implemented"))
380}
381
382func (UnimplementedJobArtifactServiceHandler) ListJobArtifacts(context.Context, *connect.Request[ermite.ListJobArtifactsRequest]) (*connect.Response[ermite.ListJobArtifactsResponse], error) {
383 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.JobArtifactService.ListJobArtifacts is not implemented"))
384}
385
386func (UnimplementedJobArtifactServiceHandler) DownloadJobArtifact(context.Context, *connect.Request[ermite.DownloadJobArtifactRequest], *connect.ServerStream[ermite.DownloadJobArtifactResponse]) error {
387 return connect.NewError(connect.CodeUnimplemented, errors.New("ermite.JobArtifactService.DownloadJobArtifact is not implemented"))
388}
389
390func (UnimplementedJobArtifactServiceHandler) DeleteJobArtifact(context.Context, *connect.Request[ermite.DeleteJobArtifactRequest]) (*connect.Response[ermite.DeleteJobArtifactResponse], error) {
391 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.JobArtifactService.DeleteJobArtifact is not implemented"))
392}
393
394// ArtifactServiceClient is a client for the ermite.ArtifactService service.
395type ArtifactServiceClient interface {
396 // ListArtifacts lists the artifacts of a run, by id, with the space that the
397 // artifacts of the repository use.
398 ListArtifacts(context.Context, *connect.Request[ermite.ListArtifactsRequest]) (*connect.Response[ermite.ListArtifactsResponse], error)
399 // DownloadArtifact streams the content of an artifact, as
400 // JobArtifactService.DownloadJobArtifact does. Fails with not_found if the
401 // artifact is not an artifact of the repository, and out_of_range if offset
402 // is beyond its size.
403 DownloadArtifact(context.Context, *connect.Request[ermite.DownloadArtifactRequest]) (*connect.ServerStreamForClient[ermite.DownloadArtifactResponse], error)
404 // DeleteArtifact deletes an artifact. Fails with not_found if it is not an
405 // artifact of the repository.
406 DeleteArtifact(context.Context, *connect.Request[ermite.DeleteArtifactRequest]) (*connect.Response[ermite.DeleteArtifactResponse], error)
407}
408
409// NewArtifactServiceClient constructs a client for the ermite.ArtifactService service. By default,
410// it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and
411// sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC()
412// or connect.WithGRPCWeb() options.
413//
414// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
415// http://api.acme.com or https://acme.com/grpc).
416func NewArtifactServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ArtifactServiceClient {
417 baseURL = strings.TrimRight(baseURL, "/")
418 artifactServiceMethods := ermite.File_ermite_artifact_proto.Services().ByName("ArtifactService").Methods()
419 return &artifactServiceClient{
420 listArtifacts: connect.NewClient[ermite.ListArtifactsRequest, ermite.ListArtifactsResponse](
421 httpClient,
422 baseURL+ArtifactServiceListArtifactsProcedure,
423 connect.WithSchema(artifactServiceMethods.ByName("ListArtifacts")),
424 connect.WithClientOptions(opts...),
425 ),
426 downloadArtifact: connect.NewClient[ermite.DownloadArtifactRequest, ermite.DownloadArtifactResponse](
427 httpClient,
428 baseURL+ArtifactServiceDownloadArtifactProcedure,
429 connect.WithSchema(artifactServiceMethods.ByName("DownloadArtifact")),
430 connect.WithClientOptions(opts...),
431 ),
432 deleteArtifact: connect.NewClient[ermite.DeleteArtifactRequest, ermite.DeleteArtifactResponse](
433 httpClient,
434 baseURL+ArtifactServiceDeleteArtifactProcedure,
435 connect.WithSchema(artifactServiceMethods.ByName("DeleteArtifact")),
436 connect.WithClientOptions(opts...),
437 ),
438 }
439}
440
441// artifactServiceClient implements ArtifactServiceClient.
442type artifactServiceClient struct {
443 listArtifacts *connect.Client[ermite.ListArtifactsRequest, ermite.ListArtifactsResponse]
444 downloadArtifact *connect.Client[ermite.DownloadArtifactRequest, ermite.DownloadArtifactResponse]
445 deleteArtifact *connect.Client[ermite.DeleteArtifactRequest, ermite.DeleteArtifactResponse]
446}
447
448// ListArtifacts calls ermite.ArtifactService.ListArtifacts.
449func (c *artifactServiceClient) ListArtifacts(ctx context.Context, req *connect.Request[ermite.ListArtifactsRequest]) (*connect.Response[ermite.ListArtifactsResponse], error) {
450 return c.listArtifacts.CallUnary(ctx, req)
451}
452
453// DownloadArtifact calls ermite.ArtifactService.DownloadArtifact.
454func (c *artifactServiceClient) DownloadArtifact(ctx context.Context, req *connect.Request[ermite.DownloadArtifactRequest]) (*connect.ServerStreamForClient[ermite.DownloadArtifactResponse], error) {
455 return c.downloadArtifact.CallServerStream(ctx, req)
456}
457
458// DeleteArtifact calls ermite.ArtifactService.DeleteArtifact.
459func (c *artifactServiceClient) DeleteArtifact(ctx context.Context, req *connect.Request[ermite.DeleteArtifactRequest]) (*connect.Response[ermite.DeleteArtifactResponse], error) {
460 return c.deleteArtifact.CallUnary(ctx, req)
461}
462
463// ArtifactServiceHandler is an implementation of the ermite.ArtifactService service.
464type ArtifactServiceHandler interface {
465 // ListArtifacts lists the artifacts of a run, by id, with the space that the
466 // artifacts of the repository use.
467 ListArtifacts(context.Context, *connect.Request[ermite.ListArtifactsRequest]) (*connect.Response[ermite.ListArtifactsResponse], error)
468 // DownloadArtifact streams the content of an artifact, as
469 // JobArtifactService.DownloadJobArtifact does. Fails with not_found if the
470 // artifact is not an artifact of the repository, and out_of_range if offset
471 // is beyond its size.
472 DownloadArtifact(context.Context, *connect.Request[ermite.DownloadArtifactRequest], *connect.ServerStream[ermite.DownloadArtifactResponse]) error
473 // DeleteArtifact deletes an artifact. Fails with not_found if it is not an
474 // artifact of the repository.
475 DeleteArtifact(context.Context, *connect.Request[ermite.DeleteArtifactRequest]) (*connect.Response[ermite.DeleteArtifactResponse], error)
476}
477
478// NewArtifactServiceHandler builds an HTTP handler from the service implementation. It returns the
479// path on which to mount the handler and the handler itself.
480//
481// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
482// and JSON codecs. They also support gzip compression.
483func NewArtifactServiceHandler(svc ArtifactServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
484 artifactServiceMethods := ermite.File_ermite_artifact_proto.Services().ByName("ArtifactService").Methods()
485 artifactServiceListArtifactsHandler := connect.NewUnaryHandler(
486 ArtifactServiceListArtifactsProcedure,
487 svc.ListArtifacts,
488 connect.WithSchema(artifactServiceMethods.ByName("ListArtifacts")),
489 connect.WithHandlerOptions(opts...),
490 )
491 artifactServiceDownloadArtifactHandler := connect.NewServerStreamHandler(
492 ArtifactServiceDownloadArtifactProcedure,
493 svc.DownloadArtifact,
494 connect.WithSchema(artifactServiceMethods.ByName("DownloadArtifact")),
495 connect.WithHandlerOptions(opts...),
496 )
497 artifactServiceDeleteArtifactHandler := connect.NewUnaryHandler(
498 ArtifactServiceDeleteArtifactProcedure,
499 svc.DeleteArtifact,
500 connect.WithSchema(artifactServiceMethods.ByName("DeleteArtifact")),
501 connect.WithHandlerOptions(opts...),
502 )
503 return "/ermite.ArtifactService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
504 switch r.URL.Path {
505 case ArtifactServiceListArtifactsProcedure:
506 artifactServiceListArtifactsHandler.ServeHTTP(w, r)
507 case ArtifactServiceDownloadArtifactProcedure:
508 artifactServiceDownloadArtifactHandler.ServeHTTP(w, r)
509 case ArtifactServiceDeleteArtifactProcedure:
510 artifactServiceDeleteArtifactHandler.ServeHTTP(w, r)
511 default:
512 http.NotFound(w, r)
513 }
514 })
515}
516
517// UnimplementedArtifactServiceHandler returns CodeUnimplemented from all methods.
518type UnimplementedArtifactServiceHandler struct{}
519
520func (UnimplementedArtifactServiceHandler) ListArtifacts(context.Context, *connect.Request[ermite.ListArtifactsRequest]) (*connect.Response[ermite.ListArtifactsResponse], error) {
521 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.ArtifactService.ListArtifacts is not implemented"))
522}
523
524func (UnimplementedArtifactServiceHandler) DownloadArtifact(context.Context, *connect.Request[ermite.DownloadArtifactRequest], *connect.ServerStream[ermite.DownloadArtifactResponse]) error {
525 return connect.NewError(connect.CodeUnimplemented, errors.New("ermite.ArtifactService.DownloadArtifact is not implemented"))
526}
527
528func (UnimplementedArtifactServiceHandler) DeleteArtifact(context.Context, *connect.Request[ermite.DeleteArtifactRequest]) (*connect.Response[ermite.DeleteArtifactResponse], error) {
529 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.ArtifactService.DeleteArtifact is not implemented"))
530}