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.

containerdeletelogic.go 1.6 kB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. Copyright (c) [2023] [pcm]
  3. [pcm-coordinator] is licensed under Mulan PSL v2.
  4. You can use this software according to the terms and conditions of the Mulan PSL v2.
  5. You may obtain a copy of Mulan PSL v2 at:
  6. http://license.coscl.org.cn/MulanPSL2
  7. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  8. EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  9. MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  10. See the Mulan PSL v2 for more details.
  11. */
  12. package cloud
  13. import (
  14. "context"
  15. "errors"
  16. "fmt"
  17. "github.com/zeromicro/go-zero/core/logx"
  18. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
  19. container "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types/cloud"
  20. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
  21. "net/http"
  22. "strconv"
  23. )
  24. type ContainerDeleteLogic struct {
  25. logx.Logger
  26. ctx context.Context
  27. svcCtx *svc.ServiceContext
  28. }
  29. func NewContainerDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ContainerDeleteLogic {
  30. return &ContainerDeleteLogic{
  31. Logger: logx.WithContext(ctx),
  32. ctx: ctx,
  33. svcCtx: svcCtx,
  34. }
  35. }
  36. func (l *ContainerDeleteLogic) ContainerDelete(req *container.DeleteParam) (resp interface{}, err error) {
  37. create, err := l.svcCtx.Cloud.ContainerDelete(req.ClusterId, req)
  38. if err != nil {
  39. return nil, err
  40. }
  41. if create.Code != http.StatusOK {
  42. return nil, errors.New(create.Message)
  43. }
  44. resp = create.Data
  45. id, err := strconv.ParseInt(req.Id, 10, 64)
  46. tx := l.svcCtx.DbEngin.Delete(&models.TaskCloud{}, id)
  47. if tx.Error != nil {
  48. fmt.Println()
  49. return nil, tx.Error
  50. }
  51. return
  52. }

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.