From 622b366f92c651241c9d5327a559d39b479611b1 Mon Sep 17 00:00:00 2001 From: zhangwei <894646498@qq.com> Date: Fri, 8 Sep 2023 17:32:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=98=E7=AE=97=E8=81=94=E5=8A=A8api?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 1cc0303d2ddf28ff386779caf3f3fd9775367ec9 --- api/desc/pcm.api | 2 +- api/internal/handler/routes.go | 17 +++++++++++++++++ api/internal/pkg/scheduler/cloudScheduler.go | 4 ++++ api/internal/types/types.go | 14 ++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/api/desc/pcm.api b/api/desc/pcm.api index 89a40878..f4262a2a 100644 --- a/api/desc/pcm.api +++ b/api/desc/pcm.api @@ -300,4 +300,4 @@ service pcm { @handler GetLinkImageListHandler get /storelink/getImageList (GetLinkImageListReq) returns (GetLinkImageListResp) -} +} \ No newline at end of file diff --git a/api/internal/handler/routes.go b/api/internal/handler/routes.go index 6e95c52b..15b3ed4e 100644 --- a/api/internal/handler/routes.go +++ b/api/internal/handler/routes.go @@ -10,6 +10,7 @@ import ( hpc "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/handler/hpc" image "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/handler/image" storage "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/handler/storage" + storelink "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/handler/storelink" vm "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/handler/vm" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" @@ -458,4 +459,20 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { }, rest.WithPrefix("/pcm/v1"), ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodPost, + Path: "/storelink/uploadImage", + Handler: storelink.UploadLinkImageHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/storelink/getImageList", + Handler: storelink.GetLinkImageListHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) } diff --git a/api/internal/pkg/scheduler/cloudScheduler.go b/api/internal/pkg/scheduler/cloudScheduler.go index b17fd854..2d9190ef 100644 --- a/api/internal/pkg/scheduler/cloudScheduler.go +++ b/api/internal/pkg/scheduler/cloudScheduler.go @@ -79,6 +79,10 @@ func (cs *cloudScheduler) UnMarshalK8sStruct(yamlString string, taskId int64) mo Namespace: unstructureObj.GetNamespace(), Status: "Saved", } + // 命名空间为空 设置默认值 + if len(unstructureObj.GetNamespace()) == 0 { + cloud.Namespace = "default" + } } return cloud } diff --git a/api/internal/types/types.go b/api/internal/types/types.go index 7190e7a7..a467d806 100644 --- a/api/internal/types/types.go +++ b/api/internal/types/types.go @@ -2719,3 +2719,17 @@ type Cloud struct { CreatedTime string `json:"createdTime"` // 创建时间 Result string `json:"result"` } + +type UploadLinkImageReq struct { +} + +type UploadLinkImageImageResp struct { +} + +type GetLinkImageListReq struct { + PartId int64 `json:"partId"` +} + +type GetLinkImageListResp struct { + ImageIds []int64 `json:"imageIds"` +}