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

259 lines
13 KiB
Go
Raw Normal View History

// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: wasi/v1/wasi.proto
package rpcv1connect
import (
2023-09-05 19:54:58 +00:00
v11 "code.icb4dc0.de/buildr/api/generated/remote/v1"
v1 "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 (
2023-09-05 19:54:58 +00:00
// WasiExecutorServicePluginInventoryProcedure is the fully-qualified name of the
// WasiExecutorService's PluginInventory RPC.
WasiExecutorServicePluginInventoryProcedure = "/buildr.rpc.v1.WasiExecutorService/PluginInventory"
// 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 {
2023-09-05 19:54:58 +00:00
PluginInventory(context.Context, *connect.Request[v1.PluginInventoryRequest]) (*connect.Response[v1.PluginInventoryResponse], error)
StartTask(context.Context, *connect.Request[v11.StartTaskRequest]) (*connect.Response[v1.StartTaskResponse], error)
Help(context.Context, *connect.Request[v1.HelpRequest]) (*connect.Response[v1.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{
2023-09-05 19:54:58 +00:00
pluginInventory: connect.NewClient[v1.PluginInventoryRequest, v1.PluginInventoryResponse](
httpClient,
baseURL+WasiExecutorServicePluginInventoryProcedure,
opts...,
),
startTask: connect.NewClient[v11.StartTaskRequest, v1.StartTaskResponse](
httpClient,
baseURL+WasiExecutorServiceStartTaskProcedure,
opts...,
),
2023-09-05 19:54:58 +00:00
help: connect.NewClient[v1.HelpRequest, v1.HelpResponse](
httpClient,
baseURL+WasiExecutorServiceHelpProcedure,
opts...,
),
}
}
// wasiExecutorServiceClient implements WasiExecutorServiceClient.
type wasiExecutorServiceClient struct {
2023-09-05 19:54:58 +00:00
pluginInventory *connect.Client[v1.PluginInventoryRequest, v1.PluginInventoryResponse]
startTask *connect.Client[v11.StartTaskRequest, v1.StartTaskResponse]
help *connect.Client[v1.HelpRequest, v1.HelpResponse]
}
// PluginInventory calls buildr.rpc.v1.WasiExecutorService.PluginInventory.
func (c *wasiExecutorServiceClient) PluginInventory(ctx context.Context, req *connect.Request[v1.PluginInventoryRequest]) (*connect.Response[v1.PluginInventoryResponse], error) {
return c.pluginInventory.CallUnary(ctx, req)
}
// StartTask calls buildr.rpc.v1.WasiExecutorService.StartTask.
2023-09-05 19:54:58 +00:00
func (c *wasiExecutorServiceClient) StartTask(ctx context.Context, req *connect.Request[v11.StartTaskRequest]) (*connect.Response[v1.StartTaskResponse], error) {
return c.startTask.CallUnary(ctx, req)
}
// Help calls buildr.rpc.v1.WasiExecutorService.Help.
2023-09-05 19:54:58 +00:00
func (c *wasiExecutorServiceClient) Help(ctx context.Context, req *connect.Request[v1.HelpRequest]) (*connect.Response[v1.HelpResponse], error) {
return c.help.CallUnary(ctx, req)
}
// WasiExecutorServiceHandler is an implementation of the buildr.rpc.v1.WasiExecutorService service.
type WasiExecutorServiceHandler interface {
2023-09-05 19:54:58 +00:00
PluginInventory(context.Context, *connect.Request[v1.PluginInventoryRequest]) (*connect.Response[v1.PluginInventoryResponse], error)
StartTask(context.Context, *connect.Request[v11.StartTaskRequest]) (*connect.Response[v1.StartTaskResponse], error)
Help(context.Context, *connect.Request[v1.HelpRequest]) (*connect.Response[v1.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) {
2023-09-05 19:54:58 +00:00
wasiExecutorServicePluginInventoryHandler := connect.NewUnaryHandler(
WasiExecutorServicePluginInventoryProcedure,
svc.PluginInventory,
opts...,
)
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 {
2023-09-05 19:54:58 +00:00
case WasiExecutorServicePluginInventoryProcedure:
wasiExecutorServicePluginInventoryHandler.ServeHTTP(w, r)
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{}
2023-09-05 19:54:58 +00:00
func (UnimplementedWasiExecutorServiceHandler) PluginInventory(context.Context, *connect.Request[v1.PluginInventoryRequest]) (*connect.Response[v1.PluginInventoryResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("buildr.rpc.v1.WasiExecutorService.PluginInventory is not implemented"))
}
func (UnimplementedWasiExecutorServiceHandler) StartTask(context.Context, *connect.Request[v11.StartTaskRequest]) (*connect.Response[v1.StartTaskResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("buildr.rpc.v1.WasiExecutorService.StartTask is not implemented"))
}
2023-09-05 19:54:58 +00:00
func (UnimplementedWasiExecutorServiceHandler) Help(context.Context, *connect.Request[v1.HelpRequest]) (*connect.Response[v1.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 {
2023-09-05 19:54:58 +00:00
ProcessStart(context.Context, *connect.Request[v1.ProcessStartRequest]) (*connect.Response[v1.ProcessStartResponse], error)
LookupPath(context.Context, *connect.Request[v1.LookupPathRequest]) (*connect.Response[v1.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{
2023-09-05 19:54:58 +00:00
processStart: connect.NewClient[v1.ProcessStartRequest, v1.ProcessStartResponse](
httpClient,
baseURL+ExecutorHostServiceProcessStartProcedure,
opts...,
),
2023-09-05 19:54:58 +00:00
lookupPath: connect.NewClient[v1.LookupPathRequest, v1.LookupPathResponse](
httpClient,
baseURL+ExecutorHostServiceLookupPathProcedure,
opts...,
),
}
}
// executorHostServiceClient implements ExecutorHostServiceClient.
type executorHostServiceClient struct {
2023-09-05 19:54:58 +00:00
processStart *connect.Client[v1.ProcessStartRequest, v1.ProcessStartResponse]
lookupPath *connect.Client[v1.LookupPathRequest, v1.LookupPathResponse]
}
// ProcessStart calls buildr.rpc.v1.ExecutorHostService.ProcessStart.
2023-09-05 19:54:58 +00:00
func (c *executorHostServiceClient) ProcessStart(ctx context.Context, req *connect.Request[v1.ProcessStartRequest]) (*connect.Response[v1.ProcessStartResponse], error) {
return c.processStart.CallUnary(ctx, req)
}
// LookupPath calls buildr.rpc.v1.ExecutorHostService.LookupPath.
2023-09-05 19:54:58 +00:00
func (c *executorHostServiceClient) LookupPath(ctx context.Context, req *connect.Request[v1.LookupPathRequest]) (*connect.Response[v1.LookupPathResponse], error) {
return c.lookupPath.CallUnary(ctx, req)
}
// ExecutorHostServiceHandler is an implementation of the buildr.rpc.v1.ExecutorHostService service.
type ExecutorHostServiceHandler interface {
2023-09-05 19:54:58 +00:00
ProcessStart(context.Context, *connect.Request[v1.ProcessStartRequest]) (*connect.Response[v1.ProcessStartResponse], error)
LookupPath(context.Context, *connect.Request[v1.LookupPathRequest]) (*connect.Response[v1.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{}
2023-09-05 19:54:58 +00:00
func (UnimplementedExecutorHostServiceHandler) ProcessStart(context.Context, *connect.Request[v1.ProcessStartRequest]) (*connect.Response[v1.ProcessStartResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("buildr.rpc.v1.ExecutorHostService.ProcessStart is not implemented"))
}
2023-09-05 19:54:58 +00:00
func (UnimplementedExecutorHostServiceHandler) LookupPath(context.Context, *connect.Request[v1.LookupPathRequest]) (*connect.Response[v1.LookupPathResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("buildr.rpc.v1.ExecutorHostService.LookupPath is not implemented"))
}