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 AppDetailLogic struct {
|
||
logx.Logger
|
||
ctx context.Context
|
||
svcCtx *svc.ServiceContext
|
||
}
|
||
|
||
func NewAppDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AppDetailLogic {
|
||
return &AppDetailLogic{
|
||
Logger: logx.WithContext(ctx),
|
||
ctx: ctx,
|
||
svcCtx: svcCtx,
|
||
}
|
||
}
|
||
|
||
func (l *AppDetailLogic) AppDetail(req *types.AppDetailReq) (resp *kubernetes.AppDetailResp, err error) {
|
||
resp = &kubernetes.AppDetailResp{}
|
||
//调用p端接口查询应用详情
|
||
appDetail, err := l.svcCtx.K8sRpc.GetAppDetail(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 appDetail, err
|
||
}
|