48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
package server
|
|
|
|
import (
|
|
"context"
|
|
"gitlink.org.cn/JCCE/PCM/adaptor/pod_adaptor/server/pod"
|
|
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
|
|
|
|
"github.com/golang/glog"
|
|
"google.golang.org/grpc/codes"
|
|
"google.golang.org/grpc/status"
|
|
)
|
|
|
|
func (s *Server) CreatePod(ctx context.Context, req *pbpod.CreatePodReq) (*pbpod.CreatePodResp, error) {
|
|
resp, err := pod.CreatePod(ctx, req)
|
|
if err != nil {
|
|
glog.Errorf("CreatePod error %+v", err)
|
|
return nil, status.Errorf(codes.Internal, err.Error())
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
func (s *Server) ListPodDetail(ctx context.Context, req *pbpod.ListPodDetailReq) (*pbpod.ListPodDetailResp, error) {
|
|
resp, err := pod.ListPodDetail(ctx, req)
|
|
if err != nil {
|
|
glog.Errorf("ListPodDetail error %+v", err)
|
|
return nil, status.Errorf(codes.Internal, err.Error())
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
func (s *Server) ListPod(ctx context.Context, req *pbpod.ListPodReq) (*pbpod.ListPodResp, error) {
|
|
resp, err := pod.ListPod(ctx, req)
|
|
if err != nil {
|
|
glog.Errorf("ListPod error %+v", err)
|
|
return nil, status.Errorf(codes.Internal, err.Error())
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
func (s *Server) ListPodAll(ctx context.Context, req *pbpod.ListPodAllReq) (*pbpod.ListPodResp, error) {
|
|
resp, err := pod.ListPodAll(ctx)
|
|
if err != nil {
|
|
glog.Errorf("ListPodAll error %+v", err)
|
|
return nil, status.Errorf(codes.Internal, err.Error())
|
|
}
|
|
return resp, nil
|
|
}
|