|
|
|
@@ -18,15 +18,12 @@ import ( |
|
|
|
"context" |
|
|
|
"github.com/jinzhu/copier" |
|
|
|
"github.com/pkg/errors" |
|
|
|
"github.com/zeromicro/go-zero/core/logx" |
|
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" |
|
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" |
|
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr" |
|
|
|
error2 "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/error" |
|
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils" |
|
|
|
"gitlink.org.cn/JointCloud/pcm-openstack/openstack" |
|
|
|
"k8s.io/apimachinery/pkg/util/json" |
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/logx" |
|
|
|
) |
|
|
|
|
|
|
|
type ListServersDetailedLogic struct { |
|
|
|
@@ -44,18 +41,14 @@ func NewListServersDetailedLogic(ctx context.Context, svcCtx *svc.ServiceContext |
|
|
|
} |
|
|
|
|
|
|
|
func (l *ListServersDetailedLogic) ListServersDetailed(req *types.ListServersDetailedReq) (resp *types.ListServersDetailedResp, err error) { |
|
|
|
// todo: add your logic here and delete this line |
|
|
|
resp = &types.ListServersDetailedResp{} |
|
|
|
ListServersDetailedReq := &openstack.ListServersDetailedReq{} |
|
|
|
err = copier.CopyWithOption(ListServersDetailedReq, req, copier.Option{Converters: utils.Converters}) |
|
|
|
ListServersDetailedResp, err := l.svcCtx.OpenstackRpc.ListServersDetailed(l.ctx, ListServersDetailedReq) |
|
|
|
if err != nil { |
|
|
|
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get Servers list"), "Failed to get db Servers list err : %v ,req:%+v", err, req) |
|
|
|
} |
|
|
|
marshal, err := json.Marshal(&ListServersDetailedResp) |
|
|
|
if err != nil { |
|
|
|
return nil, error2.NewDefaultError(err.Error()) |
|
|
|
} |
|
|
|
json.Unmarshal(marshal, &resp) |
|
|
|
utils.Convert(&ListServersDetailedResp.Servers, &resp.ServersDetailed) |
|
|
|
err = copier.CopyWithOption(&resp, &ListServersDetailedResp, copier.Option{Converters: utils.Converters}) |
|
|
|
return resp, err |
|
|
|
|
|
|
|
|