You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

scheduletaskbyyamlhandler.go 1.0 kB

123456789101112131415161718192021222324252627282930313233343536
  1. package core
  2. import (
  3. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
  4. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
  5. "net/http"
  6. "github.com/zeromicro/go-zero/rest/httpx"
  7. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/core"
  8. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
  9. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
  10. )
  11. func ScheduleTaskByYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  12. return func(w http.ResponseWriter, r *http.Request) {
  13. var req types.ScheduleTaskByYamlReq
  14. if err := httpx.Parse(r, &req); err != nil {
  15. result.HttpResult(r, w, nil, err)
  16. return
  17. }
  18. // 解析yaml文件
  19. _, fileHeader, err := r.FormFile("file")
  20. if err != nil {
  21. result.HttpResult(r, w, nil, err)
  22. return
  23. }
  24. err = utils.Yaml2struct(fileHeader, &req)
  25. if err != nil {
  26. result.HttpResult(r, w, nil, err)
  27. return
  28. }
  29. l := core.NewScheduleTaskByYamlLogic(r.Context(), svcCtx)
  30. resp, err := l.ScheduleTaskByYaml(&req)
  31. result.HttpResult(r, w, resp, err)
  32. }
  33. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.