api/generated/wasi/v1/rpcv1connect/wasi.connect.go

232 lines
11 KiB
Go
Raw Normal View History

// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: wasi/v1/wasi.proto
package rpcv1connect
import (
v1 "code.icb4dc0.de/buildr/api/generated/remote/v1"
v11 "code.icb4dc0.de/buildr/api/generated/wasi/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 (
// WasiExecutorServiceName is the fully-qualified name of the WasiExecutorService service.
WasiExecutorServiceName = "buildr.rpc.v1.WasiExecutorService"
// ExecutorHostServiceName is the fully-qualified name of the ExecutorHostService service.
ExecutorHostServiceName = "buildr.rpc.v1.ExecutorHostService"
)
// 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 (
// WasiExecutorServiceStartTaskProcedure is the fully-qualified name of the WasiExecutorService's
// StartTask RPC.
WasiExecutorServiceStartTaskProcedure = "/buildr.rpc.v1.WasiExecutorService/StartTask"
// WasiExecutorServiceHelpProcedure is the fully-qualified name of the WasiExecutorService's Help
// RPC.
WasiExecutorServiceHelpProcedure = "/buildr.rpc.v1.WasiExecutorService/Help"
// ExecutorHostServiceProcessStartProcedure is the fully-qualified name of the ExecutorHostService's
// ProcessStart RPC.
ExecutorHostServiceProcessStartProcedure = "/buildr.rpc.v1.ExecutorHostService/ProcessStart"
// ExecutorHostServiceLookupPathProcedure is the fully-qualified name of the ExecutorHostService's
// LookupPath RPC.
ExecutorHostServiceLookupPathProcedure = "/buildr.rpc.v1.ExecutorHostService/LookupPath"
)
// WasiExecutorServiceClient is a client for the buildr.rpc.v1.WasiExecutorService service.
type WasiExecutorServiceClient interface {
StartTask(context.Context, *connect.Request[v1.StartTaskRequest]) (*connect.Response[v11.StartTaskResponse], error)
Help(context.Context, *connect.Request[v11.HelpRequest]) (*connect.Response[v11.HelpResponse], error)
}
// NewWasiExecutorServiceClient constructs a client for the buildr.rpc.v1.WasiExecutorService
// 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 NewWasiExecutorServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) WasiExecutorServiceClient {
baseURL = strings.TrimRight(baseURL, "/")
return &wasiExecutorServiceClient{
startTask: connect.NewClient[v1.StartTaskRequest, v11.StartTaskResponse](
httpClient,
baseURL+WasiExecutorServiceStartTaskProcedure,
opts...,
),
help: connect.NewClient[v11.HelpRequest, v11.HelpResponse](
httpClient,
baseURL+WasiExecutorServiceHelpProcedure,
opts...,
),
}
}
// wasiExecutorServiceClient implements WasiExecutorServiceClient.
type wasiExecutorServiceClient struct {
startTask *connect.Client[v1.StartTaskRequest, v11.StartTaskResponse]
help *connect.Client[v11.HelpRequest, v11.HelpResponse]
}
// StartTask calls buildr.rpc.v1.WasiExecutorService.StartTask.
func (c *wasiExecutorServiceClient) StartTask(ctx context.Context, req *connect.Request[v1.StartTaskRequest]) (*connect.Response[v11.StartTaskResponse], error) {
return c.startTask.CallUnary(ctx, req)
}
// Help calls buildr.rpc.v1.WasiExecutorService.Help.
func (c *wasiExecutorServiceClient) Help(ctx context.Context, req *connect.Request[v11.HelpRequest]) (*connect.Response[v11.HelpResponse], error) {
return c.help.CallUnary(ctx, req)
}
// WasiExecutorServiceHandler is an implementation of the buildr.rpc.v1.WasiExecutorService service.
type WasiExecutorServiceHandler interface {
StartTask(context.Context, *connect.Request[v1.StartTaskRequest]) (*connect.Response[v11.StartTaskResponse], error)
Help(context.Context, *connect.Request[v11.HelpRequest]) (*connect.Response[v11.HelpResponse], error)
}
// NewWasiExecutorServiceHandler 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 NewWasiExecutorServiceHandler(svc WasiExecutorServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
wasiExecutorServiceStartTaskHandler := connect.NewUnaryHandler(
WasiExecutorServiceStartTaskProcedure,
svc.StartTask,
opts...,
)
wasiExecutorServiceHelpHandler := connect.NewUnaryHandler(
WasiExecutorServiceHelpProcedure,
svc.Help,
opts...,
)
return "/buildr.rpc.v1.WasiExecutorService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case WasiExecutorServiceStartTaskProcedure:
wasiExecutorServiceStartTaskHandler.ServeHTTP(w, r)
case WasiExecutorServiceHelpProcedure:
wasiExecutorServiceHelpHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
})
}
// UnimplementedWasiExecutorServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedWasiExecutorServiceHandler struct{}
func (UnimplementedWasiExecutorServiceHandler) StartTask(context.Context, *connect.Request[v1.StartTaskRequest]) (*connect.Response[v11.StartTaskResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("buildr.rpc.v1.WasiExecutorService.StartTask is not implemented"))
}
func (UnimplementedWasiExecutorServiceHandler) Help(context.Context, *connect.Request[v11.HelpRequest]) (*connect.Response[v11.HelpResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("buildr.rpc.v1.WasiExecutorService.Help is not implemented"))
}
// ExecutorHostServiceClient is a client for the buildr.rpc.v1.ExecutorHostService service.
type ExecutorHostServiceClient interface {
ProcessStart(context.Context, *connect.Request[v11.ProcessStartRequest]) (*connect.Response[v11.ProcessStartResponse], error)
LookupPath(context.Context, *connect.Request[v11.LookupPathRequest]) (*connect.Response[v11.LookupPathResponse], error)
}
// NewExecutorHostServiceClient constructs a client for the buildr.rpc.v1.ExecutorHostService
// 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 NewExecutorHostServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ExecutorHostServiceClient {
baseURL = strings.TrimRight(baseURL, "/")
return &executorHostServiceClient{
processStart: connect.NewClient[v11.ProcessStartRequest, v11.ProcessStartResponse](
httpClient,
baseURL+ExecutorHostServiceProcessStartProcedure,
opts...,
),
lookupPath: connect.NewClient[v11.LookupPathRequest, v11.LookupPathResponse](
httpClient,
baseURL+ExecutorHostServiceLookupPathProcedure,
opts...,
),
}
}
// executorHostServiceClient implements ExecutorHostServiceClient.
type executorHostServiceClient struct {
processStart *connect.Client[v11.ProcessStartRequest, v11.ProcessStartResponse]
lookupPath *connect.Client[v11.LookupPathRequest, v11.LookupPathResponse]
}
// ProcessStart calls buildr.rpc.v1.ExecutorHostService.ProcessStart.
func (c *executorHostServiceClient) ProcessStart(ctx context.Context, req *connect.Request[v11.ProcessStartRequest]) (*connect.Response[v11.ProcessStartResponse], error) {
return c.processStart.CallUnary(ctx, req)
}
// LookupPath calls buildr.rpc.v1.ExecutorHostService.LookupPath.
func (c *executorHostServiceClient) LookupPath(ctx context.Context, req *connect.Request[v11.LookupPathRequest]) (*connect.Response[v11.LookupPathResponse], error) {
return c.lookupPath.CallUnary(ctx, req)
}
// ExecutorHostServiceHandler is an implementation of the buildr.rpc.v1.ExecutorHostService service.
type ExecutorHostServiceHandler interface {
ProcessStart(context.Context, *connect.Request[v11.ProcessStartRequest]) (*connect.Response[v11.ProcessStartResponse], error)
LookupPath(context.Context, *connect.Request[v11.LookupPathRequest]) (*connect.Response[v11.LookupPathResponse], error)
}
// NewExecutorHostServiceHandler 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 NewExecutorHostServiceHandler(svc ExecutorHostServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
executorHostServiceProcessStartHandler := connect.NewUnaryHandler(
ExecutorHostServiceProcessStartProcedure,
svc.ProcessStart,
opts...,
)
executorHostServiceLookupPathHandler := connect.NewUnaryHandler(
ExecutorHostServiceLookupPathProcedure,
svc.LookupPath,
opts...,
)
return "/buildr.rpc.v1.ExecutorHostService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case ExecutorHostServiceProcessStartProcedure:
executorHostServiceProcessStartHandler.ServeHTTP(w, r)
case ExecutorHostServiceLookupPathProcedure:
executorHostServiceLookupPathHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
})
}
// UnimplementedExecutorHostServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedExecutorHostServiceHandler struct{}
func (UnimplementedExecutorHostServiceHandler) ProcessStart(context.Context, *connect.Request[v11.ProcessStartRequest]) (*connect.Response[v11.ProcessStartResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("buildr.rpc.v1.ExecutorHostService.ProcessStart is not implemented"))
}
func (UnimplementedExecutorHostServiceHandler) LookupPath(context.Context, *connect.Request[v11.LookupPathRequest]) (*connect.Response[v11.LookupPathResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("buildr.rpc.v1.ExecutorHostService.LookupPath is not implemented"))
}