// SPDX-License-Identifier: MIT // Code generated by protoc-gen-connect-go. DO NOT EDIT. // // Source: ermite/artifact.proto package ermiteconnect import ( ermite "bnema.dev/ermite-api/gen/ermite" connect "connectrpc.com/connect" context "context" errors "errors" http "net/http" strings "strings" ) // This is a compile-time assertion to ensure that this generated file and the connect package are // compatible. If you get a compiler error that this constant is not defined, this code was // generated with a version of connect newer than the one compiled into your binary. You can fix the // problem by either regenerating this code with an older version of connect or updating the connect // version compiled into your binary. const _ = connect.IsAtLeastVersion1_13_0 const ( // JobArtifactServiceName is the fully-qualified name of the JobArtifactService service. JobArtifactServiceName = "ermite.JobArtifactService" // ArtifactServiceName is the fully-qualified name of the ArtifactService service. ArtifactServiceName = "ermite.ArtifactService" ) // These constants are the fully-qualified names of the RPCs defined in this package. They're // exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. // // Note that these are different from the fully-qualified method names used by // google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to // reflection-formatted method names, remove the leading slash and convert the remaining slash to a // period. const ( // JobArtifactServiceCreateJobArtifactProcedure is the fully-qualified name of the // JobArtifactService's CreateJobArtifact RPC. JobArtifactServiceCreateJobArtifactProcedure = "/ermite.JobArtifactService/CreateJobArtifact" // JobArtifactServiceUploadJobArtifactBlockProcedure is the fully-qualified name of the // JobArtifactService's UploadJobArtifactBlock RPC. JobArtifactServiceUploadJobArtifactBlockProcedure = "/ermite.JobArtifactService/UploadJobArtifactBlock" // JobArtifactServiceCommitJobArtifactProcedure is the fully-qualified name of the // JobArtifactService's CommitJobArtifact RPC. JobArtifactServiceCommitJobArtifactProcedure = "/ermite.JobArtifactService/CommitJobArtifact" // JobArtifactServiceFinalizeJobArtifactProcedure is the fully-qualified name of the // JobArtifactService's FinalizeJobArtifact RPC. JobArtifactServiceFinalizeJobArtifactProcedure = "/ermite.JobArtifactService/FinalizeJobArtifact" // JobArtifactServiceListJobArtifactsProcedure is the fully-qualified name of the // JobArtifactService's ListJobArtifacts RPC. JobArtifactServiceListJobArtifactsProcedure = "/ermite.JobArtifactService/ListJobArtifacts" // JobArtifactServiceDownloadJobArtifactProcedure is the fully-qualified name of the // JobArtifactService's DownloadJobArtifact RPC. JobArtifactServiceDownloadJobArtifactProcedure = "/ermite.JobArtifactService/DownloadJobArtifact" // JobArtifactServiceDeleteJobArtifactProcedure is the fully-qualified name of the // JobArtifactService's DeleteJobArtifact RPC. JobArtifactServiceDeleteJobArtifactProcedure = "/ermite.JobArtifactService/DeleteJobArtifact" // ArtifactServiceListArtifactsProcedure is the fully-qualified name of the ArtifactService's // ListArtifacts RPC. ArtifactServiceListArtifactsProcedure = "/ermite.ArtifactService/ListArtifacts" // ArtifactServiceDownloadArtifactProcedure is the fully-qualified name of the ArtifactService's // DownloadArtifact RPC. ArtifactServiceDownloadArtifactProcedure = "/ermite.ArtifactService/DownloadArtifact" // ArtifactServiceDeleteArtifactProcedure is the fully-qualified name of the ArtifactService's // DeleteArtifact RPC. ArtifactServiceDeleteArtifactProcedure = "/ermite.ArtifactService/DeleteArtifact" ) // JobArtifactServiceClient is a client for the ermite.JobArtifactService service. type JobArtifactServiceClient interface { // CreateJobArtifact begins the upload of an artifact of the job's run and // returns its id. Fails with invalid_argument if the name or expires_at break // a rule, already_exists if an artifact of that name was finalized by a job // of the same attempt of the run (the uploader deletes it first to replace // it: DeleteJobArtifact), and resource_exhausted if the artifacts of the // repository already use all their space. A pending artifact of the same // job and name is discarded: a new create is a new upload. CreateJobArtifact(context.Context, *connect.Request[ermite.CreateJobArtifactRequest]) (*connect.Response[ermite.CreateJobArtifactResponse], error) // UploadJobArtifactBlock stores one block of a pending artifact. It is a // client stream: the first message names the job, the artifact and the // block, every message may carry data, and the block is the data of all the // messages in order. The block is stored when the client closes the stream // and the server answers; a stream that breaks or fails stores nothing. // Storing a block id again replaces the block, so a retry is safe. Blocks // that the commit does not name are dropped. // // Fails with not_found if the artifact is not a pending artifact of this job, // failed_precondition if it is already committed, invalid_argument if a rule // of the messages is broken, and resource_exhausted if the blocks of the // artifact would exceed the size of one artifact or the space of the // repository. UploadJobArtifactBlock(context.Context) *connect.ClientStreamForClient[ermite.UploadJobArtifactBlockRequest, ermite.UploadJobArtifactBlockResponse] // CommitJobArtifact sets the content of a pending artifact: the blocks named, // in that order (Azure's Put Block List). An empty list is an empty content // (a 0-byte upload). The server then knows the size and the digest, and // drops the blocks. A repeat of the same call after a success returns the // same result; a different list on a committed artifact is // failed_precondition. Fails with not_found if the artifact is not a pending // artifact of this job, and invalid_argument if a block id was never // uploaded or the list has more than 50,000 ids. CommitJobArtifact(context.Context, *connect.Request[ermite.CommitJobArtifactRequest]) (*connect.Response[ermite.CommitJobArtifactResponse], error) // FinalizeJobArtifact makes the latest committed artifact of the job with // that name visible to the run, and returns it. An artifact of the same name // from an earlier attempt of the run is deleted at the same moment (a re-run // replaces what the first attempt uploaded). A repeat after a success // returns the same artifact. Fails with not_found if the job has no pending // artifact of that name, failed_precondition if it is not committed, // invalid_argument if digest is set and differs from the content, and // already_exists if a job of the same attempt finalized an artifact of that // name in the meantime. FinalizeJobArtifact(context.Context, *connect.Request[ermite.FinalizeJobArtifactRequest]) (*connect.Response[ermite.FinalizeJobArtifactResponse], error) // ListJobArtifacts lists the finalized, unexpired artifacts of the job's run, // all attempts, by id. An empty list is not an error. ListJobArtifacts(context.Context, *connect.Request[ermite.ListJobArtifactsRequest]) (*connect.Response[ermite.ListJobArtifactsResponse], error) // DownloadJobArtifact streams the content of an artifact of the job's run. // The first message carries the artifact, then the chunks follow in order // from offset. A client that loses the stream calls again with the offset // after the last byte it received. Fails with not_found if the artifact is // not a finalized artifact of the run (or has expired), and out_of_range if // offset is beyond its size. DownloadJobArtifact(context.Context, *connect.Request[ermite.DownloadJobArtifactRequest]) (*connect.ServerStreamForClient[ermite.DownloadJobArtifactResponse], error) // DeleteJobArtifact deletes the finalized artifact of that name of the job's // run (upload-artifact's "overwrite", and its merge action's // "delete-merged"). Fails with not_found if there is none. DeleteJobArtifact(context.Context, *connect.Request[ermite.DeleteJobArtifactRequest]) (*connect.Response[ermite.DeleteJobArtifactResponse], error) } // NewJobArtifactServiceClient constructs a client for the ermite.JobArtifactService service. By // default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, // and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the // connect.WithGRPC() or connect.WithGRPCWeb() options. // // The URL supplied here should be the base URL for the Connect or gRPC server (for example, // http://api.acme.com or https://acme.com/grpc). func NewJobArtifactServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) JobArtifactServiceClient { baseURL = strings.TrimRight(baseURL, "/") jobArtifactServiceMethods := ermite.File_ermite_artifact_proto.Services().ByName("JobArtifactService").Methods() return &jobArtifactServiceClient{ createJobArtifact: connect.NewClient[ermite.CreateJobArtifactRequest, ermite.CreateJobArtifactResponse]( httpClient, baseURL+JobArtifactServiceCreateJobArtifactProcedure, connect.WithSchema(jobArtifactServiceMethods.ByName("CreateJobArtifact")), connect.WithClientOptions(opts...), ), uploadJobArtifactBlock: connect.NewClient[ermite.UploadJobArtifactBlockRequest, ermite.UploadJobArtifactBlockResponse]( httpClient, baseURL+JobArtifactServiceUploadJobArtifactBlockProcedure, connect.WithSchema(jobArtifactServiceMethods.ByName("UploadJobArtifactBlock")), connect.WithClientOptions(opts...), ), commitJobArtifact: connect.NewClient[ermite.CommitJobArtifactRequest, ermite.CommitJobArtifactResponse]( httpClient, baseURL+JobArtifactServiceCommitJobArtifactProcedure, connect.WithSchema(jobArtifactServiceMethods.ByName("CommitJobArtifact")), connect.WithClientOptions(opts...), ), finalizeJobArtifact: connect.NewClient[ermite.FinalizeJobArtifactRequest, ermite.FinalizeJobArtifactResponse]( httpClient, baseURL+JobArtifactServiceFinalizeJobArtifactProcedure, connect.WithSchema(jobArtifactServiceMethods.ByName("FinalizeJobArtifact")), connect.WithClientOptions(opts...), ), listJobArtifacts: connect.NewClient[ermite.ListJobArtifactsRequest, ermite.ListJobArtifactsResponse]( httpClient, baseURL+JobArtifactServiceListJobArtifactsProcedure, connect.WithSchema(jobArtifactServiceMethods.ByName("ListJobArtifacts")), connect.WithClientOptions(opts...), ), downloadJobArtifact: connect.NewClient[ermite.DownloadJobArtifactRequest, ermite.DownloadJobArtifactResponse]( httpClient, baseURL+JobArtifactServiceDownloadJobArtifactProcedure, connect.WithSchema(jobArtifactServiceMethods.ByName("DownloadJobArtifact")), connect.WithClientOptions(opts...), ), deleteJobArtifact: connect.NewClient[ermite.DeleteJobArtifactRequest, ermite.DeleteJobArtifactResponse]( httpClient, baseURL+JobArtifactServiceDeleteJobArtifactProcedure, connect.WithSchema(jobArtifactServiceMethods.ByName("DeleteJobArtifact")), connect.WithClientOptions(opts...), ), } } // jobArtifactServiceClient implements JobArtifactServiceClient. type jobArtifactServiceClient struct { createJobArtifact *connect.Client[ermite.CreateJobArtifactRequest, ermite.CreateJobArtifactResponse] uploadJobArtifactBlock *connect.Client[ermite.UploadJobArtifactBlockRequest, ermite.UploadJobArtifactBlockResponse] commitJobArtifact *connect.Client[ermite.CommitJobArtifactRequest, ermite.CommitJobArtifactResponse] finalizeJobArtifact *connect.Client[ermite.FinalizeJobArtifactRequest, ermite.FinalizeJobArtifactResponse] listJobArtifacts *connect.Client[ermite.ListJobArtifactsRequest, ermite.ListJobArtifactsResponse] downloadJobArtifact *connect.Client[ermite.DownloadJobArtifactRequest, ermite.DownloadJobArtifactResponse] deleteJobArtifact *connect.Client[ermite.DeleteJobArtifactRequest, ermite.DeleteJobArtifactResponse] } // CreateJobArtifact calls ermite.JobArtifactService.CreateJobArtifact. func (c *jobArtifactServiceClient) CreateJobArtifact(ctx context.Context, req *connect.Request[ermite.CreateJobArtifactRequest]) (*connect.Response[ermite.CreateJobArtifactResponse], error) { return c.createJobArtifact.CallUnary(ctx, req) } // UploadJobArtifactBlock calls ermite.JobArtifactService.UploadJobArtifactBlock. func (c *jobArtifactServiceClient) UploadJobArtifactBlock(ctx context.Context) *connect.ClientStreamForClient[ermite.UploadJobArtifactBlockRequest, ermite.UploadJobArtifactBlockResponse] { return c.uploadJobArtifactBlock.CallClientStream(ctx) } // CommitJobArtifact calls ermite.JobArtifactService.CommitJobArtifact. func (c *jobArtifactServiceClient) CommitJobArtifact(ctx context.Context, req *connect.Request[ermite.CommitJobArtifactRequest]) (*connect.Response[ermite.CommitJobArtifactResponse], error) { return c.commitJobArtifact.CallUnary(ctx, req) } // FinalizeJobArtifact calls ermite.JobArtifactService.FinalizeJobArtifact. func (c *jobArtifactServiceClient) FinalizeJobArtifact(ctx context.Context, req *connect.Request[ermite.FinalizeJobArtifactRequest]) (*connect.Response[ermite.FinalizeJobArtifactResponse], error) { return c.finalizeJobArtifact.CallUnary(ctx, req) } // ListJobArtifacts calls ermite.JobArtifactService.ListJobArtifacts. func (c *jobArtifactServiceClient) ListJobArtifacts(ctx context.Context, req *connect.Request[ermite.ListJobArtifactsRequest]) (*connect.Response[ermite.ListJobArtifactsResponse], error) { return c.listJobArtifacts.CallUnary(ctx, req) } // DownloadJobArtifact calls ermite.JobArtifactService.DownloadJobArtifact. func (c *jobArtifactServiceClient) DownloadJobArtifact(ctx context.Context, req *connect.Request[ermite.DownloadJobArtifactRequest]) (*connect.ServerStreamForClient[ermite.DownloadJobArtifactResponse], error) { return c.downloadJobArtifact.CallServerStream(ctx, req) } // DeleteJobArtifact calls ermite.JobArtifactService.DeleteJobArtifact. func (c *jobArtifactServiceClient) DeleteJobArtifact(ctx context.Context, req *connect.Request[ermite.DeleteJobArtifactRequest]) (*connect.Response[ermite.DeleteJobArtifactResponse], error) { return c.deleteJobArtifact.CallUnary(ctx, req) } // JobArtifactServiceHandler is an implementation of the ermite.JobArtifactService service. type JobArtifactServiceHandler interface { // CreateJobArtifact begins the upload of an artifact of the job's run and // returns its id. Fails with invalid_argument if the name or expires_at break // a rule, already_exists if an artifact of that name was finalized by a job // of the same attempt of the run (the uploader deletes it first to replace // it: DeleteJobArtifact), and resource_exhausted if the artifacts of the // repository already use all their space. A pending artifact of the same // job and name is discarded: a new create is a new upload. CreateJobArtifact(context.Context, *connect.Request[ermite.CreateJobArtifactRequest]) (*connect.Response[ermite.CreateJobArtifactResponse], error) // UploadJobArtifactBlock stores one block of a pending artifact. It is a // client stream: the first message names the job, the artifact and the // block, every message may carry data, and the block is the data of all the // messages in order. The block is stored when the client closes the stream // and the server answers; a stream that breaks or fails stores nothing. // Storing a block id again replaces the block, so a retry is safe. Blocks // that the commit does not name are dropped. // // Fails with not_found if the artifact is not a pending artifact of this job, // failed_precondition if it is already committed, invalid_argument if a rule // of the messages is broken, and resource_exhausted if the blocks of the // artifact would exceed the size of one artifact or the space of the // repository. UploadJobArtifactBlock(context.Context, *connect.ClientStream[ermite.UploadJobArtifactBlockRequest]) (*connect.Response[ermite.UploadJobArtifactBlockResponse], error) // CommitJobArtifact sets the content of a pending artifact: the blocks named, // in that order (Azure's Put Block List). An empty list is an empty content // (a 0-byte upload). The server then knows the size and the digest, and // drops the blocks. A repeat of the same call after a success returns the // same result; a different list on a committed artifact is // failed_precondition. Fails with not_found if the artifact is not a pending // artifact of this job, and invalid_argument if a block id was never // uploaded or the list has more than 50,000 ids. CommitJobArtifact(context.Context, *connect.Request[ermite.CommitJobArtifactRequest]) (*connect.Response[ermite.CommitJobArtifactResponse], error) // FinalizeJobArtifact makes the latest committed artifact of the job with // that name visible to the run, and returns it. An artifact of the same name // from an earlier attempt of the run is deleted at the same moment (a re-run // replaces what the first attempt uploaded). A repeat after a success // returns the same artifact. Fails with not_found if the job has no pending // artifact of that name, failed_precondition if it is not committed, // invalid_argument if digest is set and differs from the content, and // already_exists if a job of the same attempt finalized an artifact of that // name in the meantime. FinalizeJobArtifact(context.Context, *connect.Request[ermite.FinalizeJobArtifactRequest]) (*connect.Response[ermite.FinalizeJobArtifactResponse], error) // ListJobArtifacts lists the finalized, unexpired artifacts of the job's run, // all attempts, by id. An empty list is not an error. ListJobArtifacts(context.Context, *connect.Request[ermite.ListJobArtifactsRequest]) (*connect.Response[ermite.ListJobArtifactsResponse], error) // DownloadJobArtifact streams the content of an artifact of the job's run. // The first message carries the artifact, then the chunks follow in order // from offset. A client that loses the stream calls again with the offset // after the last byte it received. Fails with not_found if the artifact is // not a finalized artifact of the run (or has expired), and out_of_range if // offset is beyond its size. DownloadJobArtifact(context.Context, *connect.Request[ermite.DownloadJobArtifactRequest], *connect.ServerStream[ermite.DownloadJobArtifactResponse]) error // DeleteJobArtifact deletes the finalized artifact of that name of the job's // run (upload-artifact's "overwrite", and its merge action's // "delete-merged"). Fails with not_found if there is none. DeleteJobArtifact(context.Context, *connect.Request[ermite.DeleteJobArtifactRequest]) (*connect.Response[ermite.DeleteJobArtifactResponse], error) } // NewJobArtifactServiceHandler builds an HTTP handler from the service implementation. It returns // the path on which to mount the handler and the handler itself. // // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf // and JSON codecs. They also support gzip compression. func NewJobArtifactServiceHandler(svc JobArtifactServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { jobArtifactServiceMethods := ermite.File_ermite_artifact_proto.Services().ByName("JobArtifactService").Methods() jobArtifactServiceCreateJobArtifactHandler := connect.NewUnaryHandler( JobArtifactServiceCreateJobArtifactProcedure, svc.CreateJobArtifact, connect.WithSchema(jobArtifactServiceMethods.ByName("CreateJobArtifact")), connect.WithHandlerOptions(opts...), ) jobArtifactServiceUploadJobArtifactBlockHandler := connect.NewClientStreamHandler( JobArtifactServiceUploadJobArtifactBlockProcedure, svc.UploadJobArtifactBlock, connect.WithSchema(jobArtifactServiceMethods.ByName("UploadJobArtifactBlock")), connect.WithHandlerOptions(opts...), ) jobArtifactServiceCommitJobArtifactHandler := connect.NewUnaryHandler( JobArtifactServiceCommitJobArtifactProcedure, svc.CommitJobArtifact, connect.WithSchema(jobArtifactServiceMethods.ByName("CommitJobArtifact")), connect.WithHandlerOptions(opts...), ) jobArtifactServiceFinalizeJobArtifactHandler := connect.NewUnaryHandler( JobArtifactServiceFinalizeJobArtifactProcedure, svc.FinalizeJobArtifact, connect.WithSchema(jobArtifactServiceMethods.ByName("FinalizeJobArtifact")), connect.WithHandlerOptions(opts...), ) jobArtifactServiceListJobArtifactsHandler := connect.NewUnaryHandler( JobArtifactServiceListJobArtifactsProcedure, svc.ListJobArtifacts, connect.WithSchema(jobArtifactServiceMethods.ByName("ListJobArtifacts")), connect.WithHandlerOptions(opts...), ) jobArtifactServiceDownloadJobArtifactHandler := connect.NewServerStreamHandler( JobArtifactServiceDownloadJobArtifactProcedure, svc.DownloadJobArtifact, connect.WithSchema(jobArtifactServiceMethods.ByName("DownloadJobArtifact")), connect.WithHandlerOptions(opts...), ) jobArtifactServiceDeleteJobArtifactHandler := connect.NewUnaryHandler( JobArtifactServiceDeleteJobArtifactProcedure, svc.DeleteJobArtifact, connect.WithSchema(jobArtifactServiceMethods.ByName("DeleteJobArtifact")), connect.WithHandlerOptions(opts...), ) return "/ermite.JobArtifactService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case JobArtifactServiceCreateJobArtifactProcedure: jobArtifactServiceCreateJobArtifactHandler.ServeHTTP(w, r) case JobArtifactServiceUploadJobArtifactBlockProcedure: jobArtifactServiceUploadJobArtifactBlockHandler.ServeHTTP(w, r) case JobArtifactServiceCommitJobArtifactProcedure: jobArtifactServiceCommitJobArtifactHandler.ServeHTTP(w, r) case JobArtifactServiceFinalizeJobArtifactProcedure: jobArtifactServiceFinalizeJobArtifactHandler.ServeHTTP(w, r) case JobArtifactServiceListJobArtifactsProcedure: jobArtifactServiceListJobArtifactsHandler.ServeHTTP(w, r) case JobArtifactServiceDownloadJobArtifactProcedure: jobArtifactServiceDownloadJobArtifactHandler.ServeHTTP(w, r) case JobArtifactServiceDeleteJobArtifactProcedure: jobArtifactServiceDeleteJobArtifactHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } }) } // UnimplementedJobArtifactServiceHandler returns CodeUnimplemented from all methods. type UnimplementedJobArtifactServiceHandler struct{} func (UnimplementedJobArtifactServiceHandler) CreateJobArtifact(context.Context, *connect.Request[ermite.CreateJobArtifactRequest]) (*connect.Response[ermite.CreateJobArtifactResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.JobArtifactService.CreateJobArtifact is not implemented")) } func (UnimplementedJobArtifactServiceHandler) UploadJobArtifactBlock(context.Context, *connect.ClientStream[ermite.UploadJobArtifactBlockRequest]) (*connect.Response[ermite.UploadJobArtifactBlockResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.JobArtifactService.UploadJobArtifactBlock is not implemented")) } func (UnimplementedJobArtifactServiceHandler) CommitJobArtifact(context.Context, *connect.Request[ermite.CommitJobArtifactRequest]) (*connect.Response[ermite.CommitJobArtifactResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.JobArtifactService.CommitJobArtifact is not implemented")) } func (UnimplementedJobArtifactServiceHandler) FinalizeJobArtifact(context.Context, *connect.Request[ermite.FinalizeJobArtifactRequest]) (*connect.Response[ermite.FinalizeJobArtifactResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.JobArtifactService.FinalizeJobArtifact is not implemented")) } func (UnimplementedJobArtifactServiceHandler) ListJobArtifacts(context.Context, *connect.Request[ermite.ListJobArtifactsRequest]) (*connect.Response[ermite.ListJobArtifactsResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.JobArtifactService.ListJobArtifacts is not implemented")) } func (UnimplementedJobArtifactServiceHandler) DownloadJobArtifact(context.Context, *connect.Request[ermite.DownloadJobArtifactRequest], *connect.ServerStream[ermite.DownloadJobArtifactResponse]) error { return connect.NewError(connect.CodeUnimplemented, errors.New("ermite.JobArtifactService.DownloadJobArtifact is not implemented")) } func (UnimplementedJobArtifactServiceHandler) DeleteJobArtifact(context.Context, *connect.Request[ermite.DeleteJobArtifactRequest]) (*connect.Response[ermite.DeleteJobArtifactResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.JobArtifactService.DeleteJobArtifact is not implemented")) } // ArtifactServiceClient is a client for the ermite.ArtifactService service. type ArtifactServiceClient interface { // ListArtifacts lists the artifacts of a run, by id, with the space that the // artifacts of the repository use. ListArtifacts(context.Context, *connect.Request[ermite.ListArtifactsRequest]) (*connect.Response[ermite.ListArtifactsResponse], error) // DownloadArtifact streams the content of an artifact, as // JobArtifactService.DownloadJobArtifact does. Fails with not_found if the // artifact is not an artifact of the repository, and out_of_range if offset // is beyond its size. DownloadArtifact(context.Context, *connect.Request[ermite.DownloadArtifactRequest]) (*connect.ServerStreamForClient[ermite.DownloadArtifactResponse], error) // DeleteArtifact deletes an artifact. Fails with not_found if it is not an // artifact of the repository. DeleteArtifact(context.Context, *connect.Request[ermite.DeleteArtifactRequest]) (*connect.Response[ermite.DeleteArtifactResponse], error) } // NewArtifactServiceClient constructs a client for the ermite.ArtifactService service. By default, // it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and // sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() // or connect.WithGRPCWeb() options. // // The URL supplied here should be the base URL for the Connect or gRPC server (for example, // http://api.acme.com or https://acme.com/grpc). func NewArtifactServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ArtifactServiceClient { baseURL = strings.TrimRight(baseURL, "/") artifactServiceMethods := ermite.File_ermite_artifact_proto.Services().ByName("ArtifactService").Methods() return &artifactServiceClient{ listArtifacts: connect.NewClient[ermite.ListArtifactsRequest, ermite.ListArtifactsResponse]( httpClient, baseURL+ArtifactServiceListArtifactsProcedure, connect.WithSchema(artifactServiceMethods.ByName("ListArtifacts")), connect.WithClientOptions(opts...), ), downloadArtifact: connect.NewClient[ermite.DownloadArtifactRequest, ermite.DownloadArtifactResponse]( httpClient, baseURL+ArtifactServiceDownloadArtifactProcedure, connect.WithSchema(artifactServiceMethods.ByName("DownloadArtifact")), connect.WithClientOptions(opts...), ), deleteArtifact: connect.NewClient[ermite.DeleteArtifactRequest, ermite.DeleteArtifactResponse]( httpClient, baseURL+ArtifactServiceDeleteArtifactProcedure, connect.WithSchema(artifactServiceMethods.ByName("DeleteArtifact")), connect.WithClientOptions(opts...), ), } } // artifactServiceClient implements ArtifactServiceClient. type artifactServiceClient struct { listArtifacts *connect.Client[ermite.ListArtifactsRequest, ermite.ListArtifactsResponse] downloadArtifact *connect.Client[ermite.DownloadArtifactRequest, ermite.DownloadArtifactResponse] deleteArtifact *connect.Client[ermite.DeleteArtifactRequest, ermite.DeleteArtifactResponse] } // ListArtifacts calls ermite.ArtifactService.ListArtifacts. func (c *artifactServiceClient) ListArtifacts(ctx context.Context, req *connect.Request[ermite.ListArtifactsRequest]) (*connect.Response[ermite.ListArtifactsResponse], error) { return c.listArtifacts.CallUnary(ctx, req) } // DownloadArtifact calls ermite.ArtifactService.DownloadArtifact. func (c *artifactServiceClient) DownloadArtifact(ctx context.Context, req *connect.Request[ermite.DownloadArtifactRequest]) (*connect.ServerStreamForClient[ermite.DownloadArtifactResponse], error) { return c.downloadArtifact.CallServerStream(ctx, req) } // DeleteArtifact calls ermite.ArtifactService.DeleteArtifact. func (c *artifactServiceClient) DeleteArtifact(ctx context.Context, req *connect.Request[ermite.DeleteArtifactRequest]) (*connect.Response[ermite.DeleteArtifactResponse], error) { return c.deleteArtifact.CallUnary(ctx, req) } // ArtifactServiceHandler is an implementation of the ermite.ArtifactService service. type ArtifactServiceHandler interface { // ListArtifacts lists the artifacts of a run, by id, with the space that the // artifacts of the repository use. ListArtifacts(context.Context, *connect.Request[ermite.ListArtifactsRequest]) (*connect.Response[ermite.ListArtifactsResponse], error) // DownloadArtifact streams the content of an artifact, as // JobArtifactService.DownloadJobArtifact does. Fails with not_found if the // artifact is not an artifact of the repository, and out_of_range if offset // is beyond its size. DownloadArtifact(context.Context, *connect.Request[ermite.DownloadArtifactRequest], *connect.ServerStream[ermite.DownloadArtifactResponse]) error // DeleteArtifact deletes an artifact. Fails with not_found if it is not an // artifact of the repository. DeleteArtifact(context.Context, *connect.Request[ermite.DeleteArtifactRequest]) (*connect.Response[ermite.DeleteArtifactResponse], error) } // NewArtifactServiceHandler builds an HTTP handler from the service implementation. It returns the // path on which to mount the handler and the handler itself. // // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf // and JSON codecs. They also support gzip compression. func NewArtifactServiceHandler(svc ArtifactServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { artifactServiceMethods := ermite.File_ermite_artifact_proto.Services().ByName("ArtifactService").Methods() artifactServiceListArtifactsHandler := connect.NewUnaryHandler( ArtifactServiceListArtifactsProcedure, svc.ListArtifacts, connect.WithSchema(artifactServiceMethods.ByName("ListArtifacts")), connect.WithHandlerOptions(opts...), ) artifactServiceDownloadArtifactHandler := connect.NewServerStreamHandler( ArtifactServiceDownloadArtifactProcedure, svc.DownloadArtifact, connect.WithSchema(artifactServiceMethods.ByName("DownloadArtifact")), connect.WithHandlerOptions(opts...), ) artifactServiceDeleteArtifactHandler := connect.NewUnaryHandler( ArtifactServiceDeleteArtifactProcedure, svc.DeleteArtifact, connect.WithSchema(artifactServiceMethods.ByName("DeleteArtifact")), connect.WithHandlerOptions(opts...), ) return "/ermite.ArtifactService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case ArtifactServiceListArtifactsProcedure: artifactServiceListArtifactsHandler.ServeHTTP(w, r) case ArtifactServiceDownloadArtifactProcedure: artifactServiceDownloadArtifactHandler.ServeHTTP(w, r) case ArtifactServiceDeleteArtifactProcedure: artifactServiceDeleteArtifactHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } }) } // UnimplementedArtifactServiceHandler returns CodeUnimplemented from all methods. type UnimplementedArtifactServiceHandler struct{} func (UnimplementedArtifactServiceHandler) ListArtifacts(context.Context, *connect.Request[ermite.ListArtifactsRequest]) (*connect.Response[ermite.ListArtifactsResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.ArtifactService.ListArtifacts is not implemented")) } func (UnimplementedArtifactServiceHandler) DownloadArtifact(context.Context, *connect.Request[ermite.DownloadArtifactRequest], *connect.ServerStream[ermite.DownloadArtifactResponse]) error { return connect.NewError(connect.CodeUnimplemented, errors.New("ermite.ArtifactService.DownloadArtifact is not implemented")) } func (UnimplementedArtifactServiceHandler) DeleteArtifact(context.Context, *connect.Request[ermite.DeleteArtifactRequest]) (*connect.Response[ermite.DeleteArtifactResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.ArtifactService.DeleteArtifact is not implemented")) }