pcm-coordinator/api/internal/logic/apps/appdetaillogic.go

43 lines
1.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
}