updated types
Former-commit-id: 898388856c31253f46aca54df8b6d72b5d15333a
This commit is contained in:
parent
130b116b52
commit
ff117751b0
|
@ -1225,6 +1225,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||
Path: "/schedule/getComputeCardsByCluster/:adapterId/:clusterId",
|
||||
Handler: schedule.GetComputeCardsByClusterHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/schedule/getClusterBalanceById/:adapterId/:clusterId",
|
||||
Handler: schedule.GetClusterBalanceByIdHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/pcm/v1"),
|
||||
)
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package schedule
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func GetClusterBalanceByIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.GetClusterBalanceByIdReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := schedule.NewGetClusterBalanceByIdLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetClusterBalanceById(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package schedule
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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 GetClusterBalanceByIdLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewGetClusterBalanceByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetClusterBalanceByIdLogic {
|
||||
return &GetClusterBalanceByIdLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetClusterBalanceByIdLogic) GetClusterBalanceById(req *types.GetClusterBalanceByIdReq) (resp *types.GetClusterBalanceByIdResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
|
@ -5746,6 +5746,15 @@ type GetComputeCardsByClusterResp struct {
|
|||
Cards []string `json:"cards"`
|
||||
}
|
||||
|
||||
type GetClusterBalanceByIdReq struct {
|
||||
AdapterId string `path:"adapterId"`
|
||||
ClusterId string `path:"clusterId"`
|
||||
}
|
||||
|
||||
type GetClusterBalanceByIdResp struct {
|
||||
Balance float64 `json:"balance"`
|
||||
}
|
||||
|
||||
type CreateAlertRuleReq struct {
|
||||
CLusterId string `json:"clusterId"`
|
||||
ClusterName string `json:"clusterName"`
|
||||
|
|
Loading…
Reference in New Issue