|
|
|
@@ -0,0 +1,87 @@ |
|
|
|
package storeLink |
|
|
|
|
|
|
|
import ( |
|
|
|
"context" |
|
|
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" |
|
|
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" |
|
|
|
"gitlink.org.cn/jcce-pcm/pcm-participant-octopus/octopus" |
|
|
|
) |
|
|
|
|
|
|
|
type OctopusLink struct { |
|
|
|
ctx context.Context |
|
|
|
svcCtx *svc.ServiceContext |
|
|
|
platform string |
|
|
|
pageIndex int32 |
|
|
|
pageSize int32 |
|
|
|
} |
|
|
|
|
|
|
|
func NewOctopusLink(ctx context.Context, svcCtx *svc.ServiceContext, platform string) *OctopusLink { |
|
|
|
return &OctopusLink{ctx: ctx, svcCtx: svcCtx, platform: platform, pageIndex: 1, pageSize: 100} |
|
|
|
} |
|
|
|
|
|
|
|
func (o *OctopusLink) UploadImage() (interface{}, error) { |
|
|
|
var uploadResp types.UploadLinkImageImageResp |
|
|
|
|
|
|
|
createReq := &octopus.CreateImageReq{ |
|
|
|
Platform: o.platform, |
|
|
|
CreateImage: &octopus.CreateImage{ |
|
|
|
SourceType: 1, |
|
|
|
}, |
|
|
|
} |
|
|
|
createResp, err := o.svcCtx.OctopusRpc.CreateImage(o.ctx, createReq) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
uploadReq := &octopus.UploadImageReq{ |
|
|
|
ImageId: createResp.Payload.ImageId, |
|
|
|
Params: &octopus.UploadImageParam{}, |
|
|
|
} |
|
|
|
octUpResp, err := o.svcCtx.OctopusRpc.UploadImage(o.ctx, uploadReq) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
octUpResp.String() |
|
|
|
return uploadResp, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (o *OctopusLink) DeleteImage() (interface{}, error) { |
|
|
|
//TODO implement me |
|
|
|
panic("implement me") |
|
|
|
} |
|
|
|
|
|
|
|
func (o *OctopusLink) QueryImageList() (interface{}, error) { |
|
|
|
var imgListResp types.GetLinkImageListResp |
|
|
|
|
|
|
|
req := &octopus.GetUserImageListReq{ |
|
|
|
Platform: o.platform, |
|
|
|
PageIndex: o.pageIndex, |
|
|
|
PageSize: o.pageSize, |
|
|
|
} |
|
|
|
resp, err := o.svcCtx.OctopusRpc.GetUserImageList(o.ctx, req) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
imgListResp.ImageIds = append(imgListResp.ImageIds, resp.Payload.Images[0].Image.CreatedAt) |
|
|
|
return imgListResp, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (o *OctopusLink) SubmitTask() (interface{}, error) { |
|
|
|
//req := &octopus.CreateTrainJobReq{} |
|
|
|
//TODO implement me |
|
|
|
panic("implement me") |
|
|
|
} |
|
|
|
|
|
|
|
func (o *OctopusLink) QueryTask() (interface{}, error) { |
|
|
|
//TODO implement me |
|
|
|
panic("implement me") |
|
|
|
} |
|
|
|
|
|
|
|
func (o *OctopusLink) DeleteTask() (interface{}, error) { |
|
|
|
//TODO implement me |
|
|
|
panic("implement me") |
|
|
|
} |
|
|
|
|
|
|
|
func (o *OctopusLink) name() { |
|
|
|
|
|
|
|
} |