Browse Source

updated protobuf

Former-commit-id: 6e3382beb8
pull/148/head
tzwang 1 year ago
parent
commit
6bc14cfabd
5 changed files with 98 additions and 0 deletions
  1. +5
    -0
      api/internal/handler/routes.go
  2. +28
    -0
      api/internal/handler/schedule/downloadalgothmcodehandler.go
  3. +28
    -0
      api/internal/handler/schedule/getcomputecardsbyclusterhandler.go
  4. +28
    -0
      api/internal/handler/schedule/uploadalgothmcodehandler.go
  5. +9
    -0
      api/internal/types/types.go

+ 5
- 0
api/internal/handler/routes.go View File

@@ -1215,6 +1215,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/schedule/getDownloadAlgothmCode",
Handler: schedule.UploadAlgothmCodeHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/schedule/getComputeCardsByCluster/:adapterId/:clusterId",
Handler: schedule.GetComputeCardsByClusterHandler(serverCtx),
},
},
rest.WithPrefix("/pcm/v1"),
)


+ 28
- 0
api/internal/handler/schedule/downloadalgothmcodehandler.go View File

@@ -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 DownloadAlgothmCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DownloadAlgorithmCodeReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}

l := schedule.NewDownloadAlgothmCodeLogic(r.Context(), svcCtx)
resp, err := l.DownloadAlgothmCode(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

+ 28
- 0
api/internal/handler/schedule/getcomputecardsbyclusterhandler.go View File

@@ -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 GetComputeCardsByClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetComputeCardsByClusterReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}

l := schedule.NewGetComputeCardsByClusterLogic(r.Context(), svcCtx)
resp, err := l.GetComputeCardsByCluster(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

+ 28
- 0
api/internal/handler/schedule/uploadalgothmcodehandler.go View File

@@ -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 UploadAlgothmCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UploadAlgorithmCodeReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}

l := schedule.NewUploadAlgothmCodeLogic(r.Context(), svcCtx)
resp, err := l.UploadAlgothmCode(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

+ 9
- 0
api/internal/types/types.go View File

@@ -5705,6 +5705,15 @@ type UploadAlgorithmCodeReq struct {
type UploadAlgorithmCodeResp struct {
}

type GetComputeCardsByClusterReq struct {
AdapterId string `path:"adapterId"`
ClusterId string `path:"clusterId"`
}

type GetComputeCardsByClusterResp struct {
Cards []string `json:"cards"`
}

type CreateAlertRuleReq struct {
CLusterId string `json:"clusterId"`
ClusterName string `json:"clusterName"`


Loading…
Cancel
Save