forked from JointCloud/pcm-coordinator
43 lines
1.0 KiB
Go
43 lines
1.0 KiB
Go
package apps
|
||
|
||
import (
|
||
"context"
|
||
"gitlink.org.cn/JointCloud/pcm-kubernetes/kubernetes"
|
||
|
||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||
|
||
"github.com/zeromicro/go-zero/core/logx"
|
||
)
|
||
|
||
type AppPodsLogic struct {
|
||
logx.Logger
|
||
ctx context.Context
|
||
svcCtx *svc.ServiceContext
|
||
}
|
||
|
||
func NewAppPodsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AppPodsLogic {
|
||
return &AppPodsLogic{
|
||
Logger: logx.WithContext(ctx),
|
||
ctx: ctx,
|
||
svcCtx: svcCtx,
|
||
}
|
||
}
|
||
|
||
func (l *AppPodsLogic) AppPods(req *types.AppDetailReq) (resp *kubernetes.PodDetailResp, err error) {
|
||
resp = &kubernetes.PodDetailResp{}
|
||
//调用p端接口查询应用详情
|
||
podList, err := l.svcCtx.K8sRpc.GetAppPodsByAppName(context.Background(), &kubernetes.AppDetailReq{
|
||
Namespace: req.NsID,
|
||
Name: req.Name,
|
||
})
|
||
if err != nil {
|
||
logx.Errorf("调用p端接口查询应用详情失败,err:%v", err)
|
||
resp.Code = "500"
|
||
resp.Msg = err.Error()
|
||
return resp, err
|
||
}
|
||
resp.Code = "200"
|
||
return podList, err
|
||
}
|