Init commit
This commit is contained in:
@@ -0,0 +1,350 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.12
|
||||
// protoc v7.35.1
|
||||
// source: homelab/v1/homelab.proto
|
||||
|
||||
package homelabv1
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type GetLuckyNumberRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetLuckyNumberRequest) Reset() {
|
||||
*x = GetLuckyNumberRequest{}
|
||||
mi := &file_homelab_v1_homelab_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetLuckyNumberRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetLuckyNumberRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetLuckyNumberRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_homelab_v1_homelab_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetLuckyNumberRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetLuckyNumberRequest) Descriptor() ([]byte, []int) {
|
||||
return file_homelab_v1_homelab_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
type GetLuckyNumberResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Number int64 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetLuckyNumberResponse) Reset() {
|
||||
*x = GetLuckyNumberResponse{}
|
||||
mi := &file_homelab_v1_homelab_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetLuckyNumberResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetLuckyNumberResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetLuckyNumberResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_homelab_v1_homelab_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetLuckyNumberResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetLuckyNumberResponse) Descriptor() ([]byte, []int) {
|
||||
return file_homelab_v1_homelab_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *GetLuckyNumberResponse) GetNumber() int64 {
|
||||
if x != nil {
|
||||
return x.Number
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type IncrementCounterRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *IncrementCounterRequest) Reset() {
|
||||
*x = IncrementCounterRequest{}
|
||||
mi := &file_homelab_v1_homelab_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *IncrementCounterRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*IncrementCounterRequest) ProtoMessage() {}
|
||||
|
||||
func (x *IncrementCounterRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_homelab_v1_homelab_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use IncrementCounterRequest.ProtoReflect.Descriptor instead.
|
||||
func (*IncrementCounterRequest) Descriptor() ([]byte, []int) {
|
||||
return file_homelab_v1_homelab_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
type IncrementCounterResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *IncrementCounterResponse) Reset() {
|
||||
*x = IncrementCounterResponse{}
|
||||
mi := &file_homelab_v1_homelab_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *IncrementCounterResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*IncrementCounterResponse) ProtoMessage() {}
|
||||
|
||||
func (x *IncrementCounterResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_homelab_v1_homelab_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use IncrementCounterResponse.ProtoReflect.Descriptor instead.
|
||||
func (*IncrementCounterResponse) Descriptor() ([]byte, []int) {
|
||||
return file_homelab_v1_homelab_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *IncrementCounterResponse) GetValue() int64 {
|
||||
if x != nil {
|
||||
return x.Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type SayHelloRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *SayHelloRequest) Reset() {
|
||||
*x = SayHelloRequest{}
|
||||
mi := &file_homelab_v1_homelab_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *SayHelloRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SayHelloRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SayHelloRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_homelab_v1_homelab_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SayHelloRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SayHelloRequest) Descriptor() ([]byte, []int) {
|
||||
return file_homelab_v1_homelab_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *SayHelloRequest) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SayHelloResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3" json:"greeting,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *SayHelloResponse) Reset() {
|
||||
*x = SayHelloResponse{}
|
||||
mi := &file_homelab_v1_homelab_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *SayHelloResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SayHelloResponse) ProtoMessage() {}
|
||||
|
||||
func (x *SayHelloResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_homelab_v1_homelab_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SayHelloResponse.ProtoReflect.Descriptor instead.
|
||||
func (*SayHelloResponse) Descriptor() ([]byte, []int) {
|
||||
return file_homelab_v1_homelab_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *SayHelloResponse) GetGreeting() string {
|
||||
if x != nil {
|
||||
return x.Greeting
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_homelab_v1_homelab_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_homelab_v1_homelab_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x18homelab/v1/homelab.proto\x12\n" +
|
||||
"homelab.v1\"\x17\n" +
|
||||
"\x15GetLuckyNumberRequest\"0\n" +
|
||||
"\x16GetLuckyNumberResponse\x12\x16\n" +
|
||||
"\x06number\x18\x01 \x01(\x03R\x06number\"\x19\n" +
|
||||
"\x17IncrementCounterRequest\"0\n" +
|
||||
"\x18IncrementCounterResponse\x12\x14\n" +
|
||||
"\x05value\x18\x01 \x01(\x03R\x05value\"%\n" +
|
||||
"\x0fSayHelloRequest\x12\x12\n" +
|
||||
"\x04name\x18\x01 \x01(\tR\x04name\".\n" +
|
||||
"\x10SayHelloResponse\x12\x1a\n" +
|
||||
"\bgreeting\x18\x01 \x01(\tR\bgreeting2\x8f\x02\n" +
|
||||
"\x0eHomelabService\x12W\n" +
|
||||
"\x0eGetLuckyNumber\x12!.homelab.v1.GetLuckyNumberRequest\x1a\".homelab.v1.GetLuckyNumberResponse\x12]\n" +
|
||||
"\x10IncrementCounter\x12#.homelab.v1.IncrementCounterRequest\x1a$.homelab.v1.IncrementCounterResponse\x12E\n" +
|
||||
"\bSayHello\x12\x1b.homelab.v1.SayHelloRequest\x1a\x1c.homelab.v1.SayHelloResponseB*Z(pwa-homelab-mon/gen/homelab/v1;homelabv1b\x06proto3"
|
||||
|
||||
var (
|
||||
file_homelab_v1_homelab_proto_rawDescOnce sync.Once
|
||||
file_homelab_v1_homelab_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_homelab_v1_homelab_proto_rawDescGZIP() []byte {
|
||||
file_homelab_v1_homelab_proto_rawDescOnce.Do(func() {
|
||||
file_homelab_v1_homelab_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_homelab_v1_homelab_proto_rawDesc), len(file_homelab_v1_homelab_proto_rawDesc)))
|
||||
})
|
||||
return file_homelab_v1_homelab_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_homelab_v1_homelab_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
var file_homelab_v1_homelab_proto_goTypes = []any{
|
||||
(*GetLuckyNumberRequest)(nil), // 0: homelab.v1.GetLuckyNumberRequest
|
||||
(*GetLuckyNumberResponse)(nil), // 1: homelab.v1.GetLuckyNumberResponse
|
||||
(*IncrementCounterRequest)(nil), // 2: homelab.v1.IncrementCounterRequest
|
||||
(*IncrementCounterResponse)(nil), // 3: homelab.v1.IncrementCounterResponse
|
||||
(*SayHelloRequest)(nil), // 4: homelab.v1.SayHelloRequest
|
||||
(*SayHelloResponse)(nil), // 5: homelab.v1.SayHelloResponse
|
||||
}
|
||||
var file_homelab_v1_homelab_proto_depIdxs = []int32{
|
||||
0, // 0: homelab.v1.HomelabService.GetLuckyNumber:input_type -> homelab.v1.GetLuckyNumberRequest
|
||||
2, // 1: homelab.v1.HomelabService.IncrementCounter:input_type -> homelab.v1.IncrementCounterRequest
|
||||
4, // 2: homelab.v1.HomelabService.SayHello:input_type -> homelab.v1.SayHelloRequest
|
||||
1, // 3: homelab.v1.HomelabService.GetLuckyNumber:output_type -> homelab.v1.GetLuckyNumberResponse
|
||||
3, // 4: homelab.v1.HomelabService.IncrementCounter:output_type -> homelab.v1.IncrementCounterResponse
|
||||
5, // 5: homelab.v1.HomelabService.SayHello:output_type -> homelab.v1.SayHelloResponse
|
||||
3, // [3:6] is the sub-list for method output_type
|
||||
0, // [0:3] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_homelab_v1_homelab_proto_init() }
|
||||
func file_homelab_v1_homelab_proto_init() {
|
||||
if File_homelab_v1_homelab_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_homelab_v1_homelab_proto_rawDesc), len(file_homelab_v1_homelab_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 6,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_homelab_v1_homelab_proto_goTypes,
|
||||
DependencyIndexes: file_homelab_v1_homelab_proto_depIdxs,
|
||||
MessageInfos: file_homelab_v1_homelab_proto_msgTypes,
|
||||
}.Build()
|
||||
File_homelab_v1_homelab_proto = out.File
|
||||
file_homelab_v1_homelab_proto_goTypes = nil
|
||||
file_homelab_v1_homelab_proto_depIdxs = nil
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
|
||||
//
|
||||
// Source: homelab/v1/homelab.proto
|
||||
|
||||
package homelabv1connect
|
||||
|
||||
import (
|
||||
connect "connectrpc.com/connect"
|
||||
context "context"
|
||||
errors "errors"
|
||||
http "net/http"
|
||||
v1 "pwa-homelab-mon/gen/homelab/v1"
|
||||
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 (
|
||||
// HomelabServiceName is the fully-qualified name of the HomelabService service.
|
||||
HomelabServiceName = "homelab.v1.HomelabService"
|
||||
)
|
||||
|
||||
// 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 (
|
||||
// HomelabServiceGetLuckyNumberProcedure is the fully-qualified name of the HomelabService's
|
||||
// GetLuckyNumber RPC.
|
||||
HomelabServiceGetLuckyNumberProcedure = "/homelab.v1.HomelabService/GetLuckyNumber"
|
||||
// HomelabServiceIncrementCounterProcedure is the fully-qualified name of the HomelabService's
|
||||
// IncrementCounter RPC.
|
||||
HomelabServiceIncrementCounterProcedure = "/homelab.v1.HomelabService/IncrementCounter"
|
||||
// HomelabServiceSayHelloProcedure is the fully-qualified name of the HomelabService's SayHello RPC.
|
||||
HomelabServiceSayHelloProcedure = "/homelab.v1.HomelabService/SayHello"
|
||||
)
|
||||
|
||||
// HomelabServiceClient is a client for the homelab.v1.HomelabService service.
|
||||
type HomelabServiceClient interface {
|
||||
GetLuckyNumber(context.Context, *connect.Request[v1.GetLuckyNumberRequest]) (*connect.Response[v1.GetLuckyNumberResponse], error)
|
||||
IncrementCounter(context.Context, *connect.Request[v1.IncrementCounterRequest]) (*connect.Response[v1.IncrementCounterResponse], error)
|
||||
SayHello(context.Context, *connect.Request[v1.SayHelloRequest]) (*connect.Response[v1.SayHelloResponse], error)
|
||||
}
|
||||
|
||||
// NewHomelabServiceClient constructs a client for the homelab.v1.HomelabService 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 NewHomelabServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) HomelabServiceClient {
|
||||
baseURL = strings.TrimRight(baseURL, "/")
|
||||
homelabServiceMethods := v1.File_homelab_v1_homelab_proto.Services().ByName("HomelabService").Methods()
|
||||
return &homelabServiceClient{
|
||||
getLuckyNumber: connect.NewClient[v1.GetLuckyNumberRequest, v1.GetLuckyNumberResponse](
|
||||
httpClient,
|
||||
baseURL+HomelabServiceGetLuckyNumberProcedure,
|
||||
connect.WithSchema(homelabServiceMethods.ByName("GetLuckyNumber")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
incrementCounter: connect.NewClient[v1.IncrementCounterRequest, v1.IncrementCounterResponse](
|
||||
httpClient,
|
||||
baseURL+HomelabServiceIncrementCounterProcedure,
|
||||
connect.WithSchema(homelabServiceMethods.ByName("IncrementCounter")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
sayHello: connect.NewClient[v1.SayHelloRequest, v1.SayHelloResponse](
|
||||
httpClient,
|
||||
baseURL+HomelabServiceSayHelloProcedure,
|
||||
connect.WithSchema(homelabServiceMethods.ByName("SayHello")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
// homelabServiceClient implements HomelabServiceClient.
|
||||
type homelabServiceClient struct {
|
||||
getLuckyNumber *connect.Client[v1.GetLuckyNumberRequest, v1.GetLuckyNumberResponse]
|
||||
incrementCounter *connect.Client[v1.IncrementCounterRequest, v1.IncrementCounterResponse]
|
||||
sayHello *connect.Client[v1.SayHelloRequest, v1.SayHelloResponse]
|
||||
}
|
||||
|
||||
// GetLuckyNumber calls homelab.v1.HomelabService.GetLuckyNumber.
|
||||
func (c *homelabServiceClient) GetLuckyNumber(ctx context.Context, req *connect.Request[v1.GetLuckyNumberRequest]) (*connect.Response[v1.GetLuckyNumberResponse], error) {
|
||||
return c.getLuckyNumber.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// IncrementCounter calls homelab.v1.HomelabService.IncrementCounter.
|
||||
func (c *homelabServiceClient) IncrementCounter(ctx context.Context, req *connect.Request[v1.IncrementCounterRequest]) (*connect.Response[v1.IncrementCounterResponse], error) {
|
||||
return c.incrementCounter.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// SayHello calls homelab.v1.HomelabService.SayHello.
|
||||
func (c *homelabServiceClient) SayHello(ctx context.Context, req *connect.Request[v1.SayHelloRequest]) (*connect.Response[v1.SayHelloResponse], error) {
|
||||
return c.sayHello.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// HomelabServiceHandler is an implementation of the homelab.v1.HomelabService service.
|
||||
type HomelabServiceHandler interface {
|
||||
GetLuckyNumber(context.Context, *connect.Request[v1.GetLuckyNumberRequest]) (*connect.Response[v1.GetLuckyNumberResponse], error)
|
||||
IncrementCounter(context.Context, *connect.Request[v1.IncrementCounterRequest]) (*connect.Response[v1.IncrementCounterResponse], error)
|
||||
SayHello(context.Context, *connect.Request[v1.SayHelloRequest]) (*connect.Response[v1.SayHelloResponse], error)
|
||||
}
|
||||
|
||||
// NewHomelabServiceHandler 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 NewHomelabServiceHandler(svc HomelabServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
|
||||
homelabServiceMethods := v1.File_homelab_v1_homelab_proto.Services().ByName("HomelabService").Methods()
|
||||
homelabServiceGetLuckyNumberHandler := connect.NewUnaryHandler(
|
||||
HomelabServiceGetLuckyNumberProcedure,
|
||||
svc.GetLuckyNumber,
|
||||
connect.WithSchema(homelabServiceMethods.ByName("GetLuckyNumber")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
homelabServiceIncrementCounterHandler := connect.NewUnaryHandler(
|
||||
HomelabServiceIncrementCounterProcedure,
|
||||
svc.IncrementCounter,
|
||||
connect.WithSchema(homelabServiceMethods.ByName("IncrementCounter")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
homelabServiceSayHelloHandler := connect.NewUnaryHandler(
|
||||
HomelabServiceSayHelloProcedure,
|
||||
svc.SayHello,
|
||||
connect.WithSchema(homelabServiceMethods.ByName("SayHello")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
return "/homelab.v1.HomelabService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case HomelabServiceGetLuckyNumberProcedure:
|
||||
homelabServiceGetLuckyNumberHandler.ServeHTTP(w, r)
|
||||
case HomelabServiceIncrementCounterProcedure:
|
||||
homelabServiceIncrementCounterHandler.ServeHTTP(w, r)
|
||||
case HomelabServiceSayHelloProcedure:
|
||||
homelabServiceSayHelloHandler.ServeHTTP(w, r)
|
||||
default:
|
||||
http.NotFound(w, r)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// UnimplementedHomelabServiceHandler returns CodeUnimplemented from all methods.
|
||||
type UnimplementedHomelabServiceHandler struct{}
|
||||
|
||||
func (UnimplementedHomelabServiceHandler) GetLuckyNumber(context.Context, *connect.Request[v1.GetLuckyNumberRequest]) (*connect.Response[v1.GetLuckyNumberResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("homelab.v1.HomelabService.GetLuckyNumber is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedHomelabServiceHandler) IncrementCounter(context.Context, *connect.Request[v1.IncrementCounterRequest]) (*connect.Response[v1.IncrementCounterResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("homelab.v1.HomelabService.IncrementCounter is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedHomelabServiceHandler) SayHello(context.Context, *connect.Request[v1.SayHelloRequest]) (*connect.Response[v1.SayHelloResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("homelab.v1.HomelabService.SayHello is not implemented"))
|
||||
}
|
||||
Reference in New Issue
Block a user