Debian Codegraph @

go/svc/environment/v1/environmentv1connect/service.connect.go

raw symbols SCIP
1 // Code generated by protoc-gen-connect-go. DO NOT EDIT.
2 //
3 // Source: svc/environment/v1/service.proto
4
5 package environmentv1connect
6
7 import (
8 connect "connectrpc.com/connect"
9 context "context"
10 errors "errors"
11 v1 "github.com/humanlogio/api/go/svc/environment/v1"
12 http "net/http"
13 strings "strings"
14 )
15
16 // This is a compile-time assertion to ensure that this generated file and the connect package are
17 // compatible. If you get a compiler error that this constant is not defined, this code was
18 // generated with a version of connect newer than the one compiled into your binary. You can fix the
19 // problem by either regenerating this code with an older version of connect or updating the connect
20 // version compiled into your binary.
21 const _ = connect.IsAtLeastVersion1_13_0
22
23 const (
24 // EnvironmentServiceName is the fully-qualified name of the EnvironmentService service.
25 EnvironmentServiceName = "svc.environment.v1.EnvironmentService"
26 )
27
28 // These constants are the fully-qualified names of the RPCs defined in this package. They're
29 // exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
30 //
31 // Note that these are different from the fully-qualified method names used by
32 // google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
33 // reflection-formatted method names, remove the leading slash and convert the remaining slash to a
34 // period.
35 const (
36 // EnvironmentServiceListMachineProcedure is the fully-qualified name of the EnvironmentService's
37 // ListMachine RPC.
38 EnvironmentServiceListMachineProcedure = "/svc.environment.v1.EnvironmentService/ListMachine"
39 )
40
41 // EnvironmentServiceClient is a client for the svc.environment.v1.EnvironmentService service.
42 type EnvironmentServiceClient interface {
43 ListMachine(context.Context, *connect.Request[v1.ListMachineRequest]) (*connect.Response[v1.ListMachineResponse], error)
44 }
45
46 // NewEnvironmentServiceClient constructs a client for the svc.environment.v1.EnvironmentService
47 // service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for
48 // gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply
49 // the connect.WithGRPC() or connect.WithGRPCWeb() options.
50 //
51 // The URL supplied here should be the base URL for the Connect or gRPC server (for example,
52 // http://api.acme.com or https://acme.com/grpc).
53 func NewEnvironmentServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) EnvironmentServiceClient {
54 baseURL = strings.TrimRight(baseURL, "/")
55 environmentServiceMethods := v1.File_svc_environment_v1_service_proto.Services().ByName("EnvironmentService").Methods()
56 return &environmentServiceClient{
57 listMachine: connect.NewClient[v1.ListMachineRequest, v1.ListMachineResponse](
58 httpClient,
59 baseURL+EnvironmentServiceListMachineProcedure,
60 connect.WithSchema(environmentServiceMethods.ByName("ListMachine")),
61 connect.WithClientOptions(opts...),
62 ),
63 }
64 }
65
66 // environmentServiceClient implements EnvironmentServiceClient.
67 type environmentServiceClient struct {
68 listMachine *connect.Client[v1.ListMachineRequest, v1.ListMachineResponse]
69 }
70
71 // ListMachine calls svc.environment.v1.EnvironmentService.ListMachine.
72 func (c *environmentServiceClient) ListMachine(ctx context.Context, req *connect.Request[v1.ListMachineRequest]) (*connect.Response[v1.ListMachineResponse], error) {
73 return c.listMachine.CallUnary(ctx, req)
74 }
75
76 // EnvironmentServiceHandler is an implementation of the svc.environment.v1.EnvironmentService
77 // service.
78 type EnvironmentServiceHandler interface {
79 ListMachine(context.Context, *connect.Request[v1.ListMachineRequest]) (*connect.Response[v1.ListMachineResponse], error)
80 }
81
82 // NewEnvironmentServiceHandler builds an HTTP handler from the service implementation. It returns
83 // the path on which to mount the handler and the handler itself.
84 //
85 // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
86 // and JSON codecs. They also support gzip compression.
87 func NewEnvironmentServiceHandler(svc EnvironmentServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
88 environmentServiceMethods := v1.File_svc_environment_v1_service_proto.Services().ByName("EnvironmentService").Methods()
89 environmentServiceListMachineHandler := connect.NewUnaryHandler(
90 EnvironmentServiceListMachineProcedure,
91 svc.ListMachine,
92 connect.WithSchema(environmentServiceMethods.ByName("ListMachine")),
93 connect.WithHandlerOptions(opts...),
94 )
95 return "/svc.environment.v1.EnvironmentService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
96 switch r.URL.Path {
97 case EnvironmentServiceListMachineProcedure:
98 environmentServiceListMachineHandler.ServeHTTP(w, r)
99 default:
100 http.NotFound(w, r)
101 }
102 })
103 }
104
105 // UnimplementedEnvironmentServiceHandler returns CodeUnimplemented from all methods.
106 type UnimplementedEnvironmentServiceHandler struct{}
107
108 func (UnimplementedEnvironmentServiceHandler) ListMachine(context.Context, *connect.Request[v1.ListMachineRequest]) (*connect.Response[v1.ListMachineResponse], error) {
109 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.environment.v1.EnvironmentService.ListMachine is not implemented"))
110 }