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.

showfloatingipdetailslogic.go 1.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package vm
  2. import (
  3. "context"
  4. "github.com/jinzhu/copier"
  5. "github.com/pkg/errors"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
  7. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
  8. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
  9. "gitlink.org.cn/JointCloud/pcm-openstack/openstack"
  10. "k8s.io/apimachinery/pkg/util/json"
  11. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
  12. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
  13. "github.com/zeromicro/go-zero/core/logx"
  14. )
  15. type ShowFloatingIPDetailsLogic struct {
  16. logx.Logger
  17. ctx context.Context
  18. svcCtx *svc.ServiceContext
  19. }
  20. func NewShowFloatingIPDetailsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShowFloatingIPDetailsLogic {
  21. return &ShowFloatingIPDetailsLogic{
  22. Logger: logx.WithContext(ctx),
  23. ctx: ctx,
  24. svcCtx: svcCtx,
  25. }
  26. }
  27. func (l *ShowFloatingIPDetailsLogic) ShowFloatingIPDetails(req *types.ShowFloatingIPDetailsReq) (resp *types.ShowFloatingIPDetailsResp, err error) {
  28. // todo: add your logic here and delete this line
  29. ShowFloatingIPDetailsReq := &openstack.ShowFloatingIPDetailsReq{}
  30. err = copier.CopyWithOption(ShowFloatingIPDetailsReq, req, copier.Option{Converters: utils.Converters})
  31. ShowFloatingIPDetailsResp, err := l.svcCtx.OpenstackRpc.ShowFloatingIPDetails(l.ctx, ShowFloatingIPDetailsReq)
  32. if err != nil {
  33. return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
  34. }
  35. marshal, err := json.Marshal(&ShowFloatingIPDetailsResp)
  36. if err != nil {
  37. return nil, result.NewDefaultError(err.Error())
  38. }
  39. json.Unmarshal(marshal, &resp)
  40. err = copier.CopyWithOption(&resp, &ShowFloatingIPDetailsResp, copier.Option{Converters: utils.Converters})
  41. return resp, err
  42. }

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.