mirror of
https://github.com/hanzoai/ca.git
synced 2026-11-03 18:08:27 +00:00
122 lines
3.5 KiB
Go
122 lines
3.5 KiB
Go
// Code generated by protoc-gen-go-proxy. DO NOT EDIT.
|
|
// source: status.proto
|
|
|
|
package proxypb
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/effective-security/porto/pkg/retriable"
|
|
"github.com/effective-security/porto/xhttp/correlation"
|
|
"github.com/effective-security/porto/xhttp/httperror"
|
|
"github.com/effective-security/trustyca/api/pb"
|
|
"google.golang.org/grpc"
|
|
"google.golang.org/protobuf/types/known/emptypb"
|
|
)
|
|
|
|
type proxyStatusServer struct {
|
|
srv pb.StatusServer
|
|
}
|
|
|
|
type proxyStatusClient struct {
|
|
remote pb.StatusClient
|
|
callOpts []grpc.CallOption
|
|
}
|
|
|
|
type postproxyStatusClient struct {
|
|
client retriable.PostRequester
|
|
}
|
|
|
|
// StatusServerToClient returns pb.StatusClient
|
|
func StatusServerToClient(srv pb.StatusServer) pb.StatusClient {
|
|
return &proxyStatusServer{srv}
|
|
}
|
|
|
|
// NewStatusClient returns instance of the StatusClient
|
|
func NewStatusClient(conn *grpc.ClientConn, callOpts []grpc.CallOption) pb.StatusServer {
|
|
return &proxyStatusClient{
|
|
remote: pb.NewStatusClient(conn),
|
|
callOpts: callOpts,
|
|
}
|
|
}
|
|
|
|
// NewStatusClientFromProxy returns instance of StatusClient
|
|
func NewStatusClientFromProxy(proxy pb.StatusClient) pb.StatusServer {
|
|
return &proxyStatusClient{
|
|
remote: proxy,
|
|
}
|
|
}
|
|
|
|
// NewStatusClientFromProxy returns instance of StatusClient
|
|
func NewHTTPStatusClient(client retriable.PostRequester) pb.StatusServer {
|
|
return &postproxyStatusClient{
|
|
client: client,
|
|
}
|
|
}
|
|
|
|
// Version returns the server version.
|
|
func (s *proxyStatusServer) Version(ctx context.Context, req *emptypb.Empty, opts ...grpc.CallOption) (*pb.ServerVersion, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.Version(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// Version returns the server version.
|
|
func (s *proxyStatusClient) Version(ctx context.Context, req *emptypb.Empty) (*pb.ServerVersion, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.Version(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// Version returns the server version.
|
|
func (s *postproxyStatusClient) Version(ctx context.Context, req *emptypb.Empty) (*pb.ServerVersion, error) {
|
|
var res pb.ServerVersion
|
|
path := pb.Status_Version_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// Server returns the server status.
|
|
func (s *proxyStatusServer) Server(ctx context.Context, req *emptypb.Empty, opts ...grpc.CallOption) (*pb.ServerStatusResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.Server(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// Server returns the server status.
|
|
func (s *proxyStatusClient) Server(ctx context.Context, req *emptypb.Empty) (*pb.ServerStatusResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.Server(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// Server returns the server status.
|
|
func (s *postproxyStatusClient) Server(ctx context.Context, req *emptypb.Empty) (*pb.ServerStatusResponse, error) {
|
|
var res pb.ServerStatusResponse
|
|
path := pb.Status_Server_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|