All checks were successful
test / test (push) Successful in 1m56s
move to v4 micro Co-authored-by: Vasiliy Tolstov <v.tolstov@unistack.org> Reviewed-on: #199 Co-authored-by: Evstigneev Denis <danteevstigneev@yandex.ru> Co-committed-by: Evstigneev Denis <danteevstigneev@yandex.ru>
186 lines
4.7 KiB
Go
186 lines
4.7 KiB
Go
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
|
// protoc-gen-go-micro version: v4.1.0
|
|
// source: health/health.proto
|
|
|
|
package health_handler
|
|
|
|
import (
|
|
context "context"
|
|
v41 "go.unistack.org/micro-client-http/v4"
|
|
codec "go.unistack.org/micro-proto/v4/codec"
|
|
v4 "go.unistack.org/micro-server-http/v4"
|
|
client "go.unistack.org/micro/v4/client"
|
|
server "go.unistack.org/micro/v4/server"
|
|
http "net/http"
|
|
)
|
|
|
|
var (
|
|
HealthServiceServerEndpoints = []v4.EndpointMetadata{
|
|
{
|
|
Name: "HealthService.Healthy",
|
|
Path: "/health",
|
|
Method: "GET",
|
|
Body: "",
|
|
Stream: false,
|
|
},
|
|
{
|
|
Name: "HealthService.Healthy",
|
|
Path: "/healthz",
|
|
Method: "GET",
|
|
Body: "",
|
|
Stream: false,
|
|
},
|
|
{
|
|
Name: "HealthService.Live",
|
|
Path: "/live",
|
|
Method: "GET",
|
|
Body: "",
|
|
Stream: false,
|
|
},
|
|
{
|
|
Name: "HealthService.Live",
|
|
Path: "/livez",
|
|
Method: "GET",
|
|
Body: "",
|
|
Stream: false,
|
|
},
|
|
{
|
|
Name: "HealthService.Ready",
|
|
Path: "/ready",
|
|
Method: "GET",
|
|
Body: "",
|
|
Stream: false,
|
|
},
|
|
{
|
|
Name: "HealthService.Ready",
|
|
Path: "/readyz",
|
|
Method: "GET",
|
|
Body: "",
|
|
Stream: false,
|
|
},
|
|
{
|
|
Name: "HealthService.Version",
|
|
Path: "/version",
|
|
Method: "GET",
|
|
Body: "",
|
|
Stream: false,
|
|
},
|
|
}
|
|
)
|
|
|
|
type healthServiceClient struct {
|
|
c client.Client
|
|
name string
|
|
}
|
|
|
|
func NewHealthServiceClient(name string, c client.Client) HealthServiceClient {
|
|
return &healthServiceClient{c: c, name: name}
|
|
}
|
|
|
|
func (c *healthServiceClient) Healthy(ctx context.Context, req *codec.Frame, opts ...client.CallOption) (*codec.Frame, error) {
|
|
errmap := make(map[string]interface{}, 1)
|
|
errmap["default"] = &codec.Frame{}
|
|
opts = append(opts,
|
|
v41.ErrorMap(errmap),
|
|
)
|
|
opts = append(opts,
|
|
v41.Method(http.MethodGet),
|
|
v41.Path("/health"),
|
|
)
|
|
rsp := &codec.Frame{}
|
|
err := c.c.Call(ctx, c.c.NewRequest(c.name, "HealthService.Healthy", req), rsp, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return rsp, nil
|
|
}
|
|
|
|
func (c *healthServiceClient) Live(ctx context.Context, req *codec.Frame, opts ...client.CallOption) (*codec.Frame, error) {
|
|
errmap := make(map[string]interface{}, 1)
|
|
errmap["default"] = &codec.Frame{}
|
|
opts = append(opts,
|
|
v41.ErrorMap(errmap),
|
|
)
|
|
opts = append(opts,
|
|
v41.Method(http.MethodGet),
|
|
v41.Path("/live"),
|
|
)
|
|
rsp := &codec.Frame{}
|
|
err := c.c.Call(ctx, c.c.NewRequest(c.name, "HealthService.Live", req), rsp, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return rsp, nil
|
|
}
|
|
|
|
func (c *healthServiceClient) Ready(ctx context.Context, req *codec.Frame, opts ...client.CallOption) (*codec.Frame, error) {
|
|
errmap := make(map[string]interface{}, 1)
|
|
errmap["default"] = &codec.Frame{}
|
|
opts = append(opts,
|
|
v41.ErrorMap(errmap),
|
|
)
|
|
opts = append(opts,
|
|
v41.Method(http.MethodGet),
|
|
v41.Path("/ready"),
|
|
)
|
|
rsp := &codec.Frame{}
|
|
err := c.c.Call(ctx, c.c.NewRequest(c.name, "HealthService.Ready", req), rsp, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return rsp, nil
|
|
}
|
|
|
|
func (c *healthServiceClient) Version(ctx context.Context, req *codec.Frame, opts ...client.CallOption) (*codec.Frame, error) {
|
|
errmap := make(map[string]interface{}, 1)
|
|
errmap["default"] = &codec.Frame{}
|
|
opts = append(opts,
|
|
v41.ErrorMap(errmap),
|
|
)
|
|
opts = append(opts,
|
|
v41.Method(http.MethodGet),
|
|
v41.Path("/version"),
|
|
)
|
|
rsp := &codec.Frame{}
|
|
err := c.c.Call(ctx, c.c.NewRequest(c.name, "HealthService.Version", req), rsp, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return rsp, nil
|
|
}
|
|
|
|
type healthServiceServer struct {
|
|
HealthServiceServer
|
|
}
|
|
|
|
func (h *healthServiceServer) Healthy(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error {
|
|
return h.HealthServiceServer.Healthy(ctx, req, rsp)
|
|
}
|
|
|
|
func (h *healthServiceServer) Live(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error {
|
|
return h.HealthServiceServer.Live(ctx, req, rsp)
|
|
}
|
|
|
|
func (h *healthServiceServer) Ready(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error {
|
|
return h.HealthServiceServer.Ready(ctx, req, rsp)
|
|
}
|
|
|
|
func (h *healthServiceServer) Version(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error {
|
|
return h.HealthServiceServer.Version(ctx, req, rsp)
|
|
}
|
|
|
|
func RegisterHealthServiceServer(s server.Server, sh HealthServiceServer, opts ...server.HandlerOption) error {
|
|
type healthService interface {
|
|
Healthy(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error
|
|
Live(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error
|
|
Ready(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error
|
|
Version(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error
|
|
}
|
|
type HealthService struct {
|
|
healthService
|
|
}
|
|
h := &healthServiceServer{sh}
|
|
opts = append(opts, v4.HandlerEndpoints(HealthServiceServerEndpoints))
|
|
return s.Handle(s.NewHandler(&HealthService{h}, opts...))
|
|
}
|