api/generated/remote/v1/rpcv1connect/executor.connect.go

177 lines
8.4 KiB
Go

// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: remote/v1/executor.proto
package rpcv1connect
import (
v1 "code.icb4dc0.de/buildr/api/generated/remote/v1"
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.IsAtLeastVersion0_1_0
const (
// ExecutorServiceName is the fully-qualified name of the ExecutorService service.
ExecutorServiceName = "buildr.rpc.v1.ExecutorService"
// PluginManagerServiceName is the fully-qualified name of the PluginManagerService service.
PluginManagerServiceName = "buildr.rpc.v1.PluginManagerService"
)
// 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 (
// ExecutorServiceExecuteStreamProcedure is the fully-qualified name of the ExecutorService's
// ExecuteStream RPC.
ExecutorServiceExecuteStreamProcedure = "/buildr.rpc.v1.ExecutorService/ExecuteStream"
// PluginManagerServiceRegisterPluginModuleProcedure is the fully-qualified name of the
// PluginManagerService's RegisterPluginModule RPC.
PluginManagerServiceRegisterPluginModuleProcedure = "/buildr.rpc.v1.PluginManagerService/RegisterPluginModule"
)
// ExecutorServiceClient is a client for the buildr.rpc.v1.ExecutorService service.
type ExecutorServiceClient interface {
ExecuteStream(context.Context) *connect.BidiStreamForClient[v1.ExecutionClientMessage, v1.ExecutionServerMessage]
}
// NewExecutorServiceClient constructs a client for the buildr.rpc.v1.ExecutorService 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 NewExecutorServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ExecutorServiceClient {
baseURL = strings.TrimRight(baseURL, "/")
return &executorServiceClient{
executeStream: connect.NewClient[v1.ExecutionClientMessage, v1.ExecutionServerMessage](
httpClient,
baseURL+ExecutorServiceExecuteStreamProcedure,
opts...,
),
}
}
// executorServiceClient implements ExecutorServiceClient.
type executorServiceClient struct {
executeStream *connect.Client[v1.ExecutionClientMessage, v1.ExecutionServerMessage]
}
// ExecuteStream calls buildr.rpc.v1.ExecutorService.ExecuteStream.
func (c *executorServiceClient) ExecuteStream(ctx context.Context) *connect.BidiStreamForClient[v1.ExecutionClientMessage, v1.ExecutionServerMessage] {
return c.executeStream.CallBidiStream(ctx)
}
// ExecutorServiceHandler is an implementation of the buildr.rpc.v1.ExecutorService service.
type ExecutorServiceHandler interface {
ExecuteStream(context.Context, *connect.BidiStream[v1.ExecutionClientMessage, v1.ExecutionServerMessage]) error
}
// NewExecutorServiceHandler 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 NewExecutorServiceHandler(svc ExecutorServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
executorServiceExecuteStreamHandler := connect.NewBidiStreamHandler(
ExecutorServiceExecuteStreamProcedure,
svc.ExecuteStream,
opts...,
)
return "/buildr.rpc.v1.ExecutorService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case ExecutorServiceExecuteStreamProcedure:
executorServiceExecuteStreamHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
})
}
// UnimplementedExecutorServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedExecutorServiceHandler struct{}
func (UnimplementedExecutorServiceHandler) ExecuteStream(context.Context, *connect.BidiStream[v1.ExecutionClientMessage, v1.ExecutionServerMessage]) error {
return connect.NewError(connect.CodeUnimplemented, errors.New("buildr.rpc.v1.ExecutorService.ExecuteStream is not implemented"))
}
// PluginManagerServiceClient is a client for the buildr.rpc.v1.PluginManagerService service.
type PluginManagerServiceClient interface {
RegisterPluginModule(context.Context, *connect.Request[v1.RegisterPluginModuleRequest]) (*connect.Response[v1.RegisterPluginModuleResponse], error)
}
// NewPluginManagerServiceClient constructs a client for the buildr.rpc.v1.PluginManagerService
// 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 NewPluginManagerServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) PluginManagerServiceClient {
baseURL = strings.TrimRight(baseURL, "/")
return &pluginManagerServiceClient{
registerPluginModule: connect.NewClient[v1.RegisterPluginModuleRequest, v1.RegisterPluginModuleResponse](
httpClient,
baseURL+PluginManagerServiceRegisterPluginModuleProcedure,
opts...,
),
}
}
// pluginManagerServiceClient implements PluginManagerServiceClient.
type pluginManagerServiceClient struct {
registerPluginModule *connect.Client[v1.RegisterPluginModuleRequest, v1.RegisterPluginModuleResponse]
}
// RegisterPluginModule calls buildr.rpc.v1.PluginManagerService.RegisterPluginModule.
func (c *pluginManagerServiceClient) RegisterPluginModule(ctx context.Context, req *connect.Request[v1.RegisterPluginModuleRequest]) (*connect.Response[v1.RegisterPluginModuleResponse], error) {
return c.registerPluginModule.CallUnary(ctx, req)
}
// PluginManagerServiceHandler is an implementation of the buildr.rpc.v1.PluginManagerService
// service.
type PluginManagerServiceHandler interface {
RegisterPluginModule(context.Context, *connect.Request[v1.RegisterPluginModuleRequest]) (*connect.Response[v1.RegisterPluginModuleResponse], error)
}
// NewPluginManagerServiceHandler 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 NewPluginManagerServiceHandler(svc PluginManagerServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
pluginManagerServiceRegisterPluginModuleHandler := connect.NewUnaryHandler(
PluginManagerServiceRegisterPluginModuleProcedure,
svc.RegisterPluginModule,
opts...,
)
return "/buildr.rpc.v1.PluginManagerService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case PluginManagerServiceRegisterPluginModuleProcedure:
pluginManagerServiceRegisterPluginModuleHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
})
}
// UnimplementedPluginManagerServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedPluginManagerServiceHandler struct{}
func (UnimplementedPluginManagerServiceHandler) RegisterPluginModule(context.Context, *connect.Request[v1.RegisterPluginModuleRequest]) (*connect.Response[v1.RegisterPluginModuleResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("buildr.rpc.v1.PluginManagerService.RegisterPluginModule is not implemented"))
}