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.1 kB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
123456789101112131415161718192021222324252627282930313233343536373839
  1. package cloud
  2. import (
  3. "io"
  4. "net/http"
  5. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/cloud"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
  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. // 获取用户信息
  25. userStr := r.Header.Get("User")
  26. user := &models.JccUserInfo{}
  27. json.Unmarshal([]byte(userStr), user)
  28. req.UserId = user.Id
  29. req.UserName = user.UserName
  30. l := cloud.NewContainerCreateLogic(r.Context(), svcCtx)
  31. resp, err := l.ContainerCreate(&req)
  32. result.HttpResult(r, w, resp, err)
  33. }
  34. }

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.