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.

containercreatehandler.go 1.2 kB

3 months ago
2 months ago
3 months ago
3 months ago
2 months ago
3 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package cloud
  2. import (
  3. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
  4. "io"
  5. "net/http"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/cloud"
  7. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
  8. "k8s.io/apimachinery/pkg/util/json"
  9. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
  10. container "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/cloud"
  11. )
  12. func ContainerCreateHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13. return func(w http.ResponseWriter, r *http.Request) {
  14. var req container.CreateParam
  15. body, err := io.ReadAll(r.Body)
  16. if err != nil {
  17. result.ParamErrorResult(r, w, err)
  18. return
  19. }
  20. if err = json.Unmarshal(body, &req); err != nil {
  21. result.ParamErrorResult(r, w, err)
  22. return
  23. }
  24. // 获取token信息
  25. token := r.Header.Get("Authorization")
  26. jccUserInfo, err := utils.ParseTokenWithoutVerify(token)
  27. if err != nil {
  28. result.ParamErrorResult(r, w, err)
  29. return
  30. }
  31. req.UserId = jccUserInfo.Id
  32. req.UserName = jccUserInfo.UserName
  33. l := cloud.NewContainerCreateLogic(r.Context(), svcCtx)
  34. resp, err := l.ContainerCreate(&req)
  35. result.HttpResult(r, w, resp, err)
  36. }
  37. }

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.