api/generated/wasi/v1/rpcv1connect/wasi.connect.go
2023-09-12 18:05:19 +02:00

286 lines
14 KiB
Go

// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: wasi/v1/wasi.proto
package rpcv1connect
import (
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 (
// 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"
// WasiExecutorServiceBinaryNameProcedure is the fully-qualified name of the WasiExecutorService's
// BinaryName RPC.
WasiExecutorServiceBinaryNameProcedure = "/buildr.rpc.v1.WasiExecutorService/BinaryName"
// 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 {
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)
BinaryName(context.Context, *connect.Request[v1.BinaryNameRequest]) (*connect.Response[v1.BinaryNameResponse], 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{
pluginInventory: connect.NewClient[v1.PluginInventoryRequest, v1.PluginInventoryResponse](
httpClient,
baseURL+WasiExecutorServicePluginInventoryProcedure,
opts...,
),
startTask: connect.NewClient[v11.StartTaskRequest, v1.StartTaskResponse](
httpClient,
baseURL+WasiExecutorServiceStartTaskProcedure,
opts...,
),
help: connect.NewClient[v1.HelpRequest, v1.HelpResponse](
httpClient,
baseURL+WasiExecutorServiceHelpProcedure,
opts...,
),
binaryName: connect.NewClient[v1.BinaryNameRequest, v1.BinaryNameResponse](
httpClient,
baseURL+WasiExecutorServiceBinaryNameProcedure,
opts...,
),
}
}
// wasiExecutorServiceClient implements WasiExecutorServiceClient.
type wasiExecutorServiceClient struct {
pluginInventory *connect.Client[v1.PluginInventoryRequest, v1.PluginInventoryResponse]
startTask *connect.Client[v11.StartTaskRequest, v1.StartTaskResponse]
help *connect.Client[v1.HelpRequest, v1.HelpResponse]
binaryName *connect.Client[v1.BinaryNameRequest, v1.BinaryNameResponse]
}
// 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.
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.
func (c *wasiExecutorServiceClient) Help(ctx context.Context, req *connect.Request[v1.HelpRequest]) (*connect.Response[v1.HelpResponse], error) {
return c.help.CallUnary(ctx, req)
}
// BinaryName calls buildr.rpc.v1.WasiExecutorService.BinaryName.
func (c *wasiExecutorServiceClient) BinaryName(ctx context.Context, req *connect.Request[v1.BinaryNameRequest]) (*connect.Response[v1.BinaryNameResponse], error) {
return c.binaryName.CallUnary(ctx, req)
}
// WasiExecutorServiceHandler is an implementation of the buildr.rpc.v1.WasiExecutorService service.
type WasiExecutorServiceHandler interface {
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)
BinaryName(context.Context, *connect.Request[v1.BinaryNameRequest]) (*connect.Response[v1.BinaryNameResponse], 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) {
wasiExecutorServicePluginInventoryHandler := connect.NewUnaryHandler(
WasiExecutorServicePluginInventoryProcedure,
svc.PluginInventory,
opts...,
)
wasiExecutorServiceStartTaskHandler := connect.NewUnaryHandler(
WasiExecutorServiceStartTaskProcedure,
svc.StartTask,
opts...,
)
wasiExecutorServiceHelpHandler := connect.NewUnaryHandler(
WasiExecutorServiceHelpProcedure,
svc.Help,
opts...,
)
wasiExecutorServiceBinaryNameHandler := connect.NewUnaryHandler(
WasiExecutorServiceBinaryNameProcedure,
svc.BinaryName,
opts...,
)
return "/buildr.rpc.v1.WasiExecutorService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case WasiExecutorServicePluginInventoryProcedure:
wasiExecutorServicePluginInventoryHandler.ServeHTTP(w, r)
case WasiExecutorServiceStartTaskProcedure:
wasiExecutorServiceStartTaskHandler.ServeHTTP(w, r)
case WasiExecutorServiceHelpProcedure:
wasiExecutorServiceHelpHandler.ServeHTTP(w, r)
case WasiExecutorServiceBinaryNameProcedure:
wasiExecutorServiceBinaryNameHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
})
}
// UnimplementedWasiExecutorServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedWasiExecutorServiceHandler struct{}
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"))
}
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"))
}
func (UnimplementedWasiExecutorServiceHandler) BinaryName(context.Context, *connect.Request[v1.BinaryNameRequest]) (*connect.Response[v1.BinaryNameResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("buildr.rpc.v1.WasiExecutorService.BinaryName is not implemented"))
}
// ExecutorHostServiceClient is a client for the buildr.rpc.v1.ExecutorHostService service.
type ExecutorHostServiceClient interface {
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{
processStart: connect.NewClient[v1.ProcessStartRequest, v1.ProcessStartResponse](
httpClient,
baseURL+ExecutorHostServiceProcessStartProcedure,
opts...,
),
lookupPath: connect.NewClient[v1.LookupPathRequest, v1.LookupPathResponse](
httpClient,
baseURL+ExecutorHostServiceLookupPathProcedure,
opts...,
),
}
}
// executorHostServiceClient implements ExecutorHostServiceClient.
type executorHostServiceClient struct {
processStart *connect.Client[v1.ProcessStartRequest, v1.ProcessStartResponse]
lookupPath *connect.Client[v1.LookupPathRequest, v1.LookupPathResponse]
}
// ProcessStart calls buildr.rpc.v1.ExecutorHostService.ProcessStart.
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.
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 {
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{}
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"))
}
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"))
}