| 1 |
|
| 2 |
|
| 3 |
|
| 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 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
const _ = connect.IsAtLeastVersion1_13_0 |
| 22 |
|
| 23 |
const ( |
| 24 |
|
| 25 |
EnvironmentServiceName = "svc.environment.v1.EnvironmentService" |
| 26 |
) |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
const ( |
| 36 |
|
| 37 |
|
| 38 |
EnvironmentServiceListMachineProcedure = "/svc.environment.v1.EnvironmentService/ListMachine" |
| 39 |
) |
| 40 |
|
| 41 |
|
| 42 |
type EnvironmentServiceClient interface { |
| 43 |
ListMachine(context.Context, *connect.Request[v1.ListMachineRequest]) (*connect.Response[v1.ListMachineResponse], error) |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 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 |
|
| 67 |
type environmentServiceClient struct { |
| 68 |
listMachine *connect.Client[v1.ListMachineRequest, v1.ListMachineResponse] |
| 69 |
} |
| 70 |
|
| 71 |
|
| 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 |
|
| 77 |
|
| 78 |
type EnvironmentServiceHandler interface { |
| 79 |
ListMachine(context.Context, *connect.Request[v1.ListMachineRequest]) (*connect.Response[v1.ListMachineResponse], error) |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 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 |
|
| 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 |
} |