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.

middleware.go 1.0 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package jcs
  2. import (
  3. "github.com/zeromicro/go-zero/core/logx"
  4. "gitlink.org.cn/JointCloud/pcm-openi/common"
  5. )
  6. type JobStatusReportReq struct {
  7. TaskName string `json:"taskName"`
  8. TaskID string `json:"taskID"`
  9. Messages []*ReportMessage `json:"messages"`
  10. }
  11. type ReportMessage struct {
  12. Status bool `json:"status"`
  13. Message string `json:"message"`
  14. ClusterID string `json:"clusterID"`
  15. Output string `json:"output"`
  16. }
  17. func StatusReport(url string, report *JobStatusReportReq) error {
  18. resp := struct {
  19. Code string `json:"code"`
  20. Msg string `json:"msg"`
  21. Data string `json:"data"`
  22. }{}
  23. req := common.GetRestyRequest(common.TIMEOUT)
  24. rp, err := req.
  25. SetHeader("Content-Type", "application/json").
  26. SetBody(report).
  27. SetResult(&resp).
  28. Post(url)
  29. if err != nil {
  30. logx.Errorf("############ Report Status Message Error %s", err.Error())
  31. return err
  32. }
  33. logx.Errorf("############ Report Status Message After Sending %s", string(rp.Body()))
  34. return nil
  35. }

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.