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.

deleteservicelogic.go 1.4 kB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package ai
  2. import (
  3. "context"
  4. "github.com/jinzhu/copier"
  5. error2 "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/error"
  6. "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/utils"
  7. "gitlink.org.cn/jcce-pcm/pcm-participant-modelarts/modelarts"
  8. "k8s.io/apimachinery/pkg/util/json"
  9. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
  10. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
  11. "github.com/zeromicro/go-zero/core/logx"
  12. )
  13. type DeleteServiceLogic struct {
  14. logx.Logger
  15. ctx context.Context
  16. svcCtx *svc.ServiceContext
  17. }
  18. func NewDeleteServiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteServiceLogic {
  19. return &DeleteServiceLogic{
  20. Logger: logx.WithContext(ctx),
  21. ctx: ctx,
  22. svcCtx: svcCtx,
  23. }
  24. }
  25. func (l *DeleteServiceLogic) DeleteService(req *types.DeleteServiceReq) (resp *types.DeleteServiceResp, err error) {
  26. modelartsReq := &modelarts.DeleteServiceReq{}
  27. err = copier.CopyWithOption(modelartsReq, req, copier.Option{Converters: utils.Converters})
  28. deleteServiceResp, err := l.svcCtx.ModelArtsRpc.DeleteService(l.ctx, modelartsReq)
  29. if err != nil {
  30. return nil, error2.NewDefaultError(err.Error())
  31. }
  32. marshal, err := json.Marshal(&deleteServiceResp)
  33. if err != nil {
  34. return nil, error2.NewDefaultError(err.Error())
  35. }
  36. json.Unmarshal(marshal, &resp)
  37. err = copier.CopyWithOption(&resp, &deleteServiceResp, copier.Option{Converters: utils.Converters})
  38. return resp, nil
  39. }

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.